cgv
scan.h
Go to the documentation of this file.
1 #pragma once
2 
7 #include <string>
8 
9 #include "date_time.h"
10 
11 #include "lib_begin.h"
12 
13 namespace cgv {
14  namespace utils {
15 
17 extern CGV_API const char* skip_spaces(const char* begin, const char* end);
19 extern CGV_API const char* cutoff_spaces(const char* begin, const char* end);
21 extern CGV_API bool is_space(char c);
23 extern CGV_API bool is_url_special(char c);
25 extern CGV_API bool is_digit(char c);
27 extern CGV_API bool is_letter(char c);
29 extern CGV_API char to_lower(char c);
31 extern CGV_API std::string to_hex(uint8_t v, bool use_upper_case = true);
33 extern CGV_API std::string to_lower(const std::string& _s);
35 extern CGV_API char to_upper(char c);
37 extern CGV_API std::string to_upper(const std::string& _s);
39 extern CGV_API std::string replace_special(const std::string& _s);
41 extern CGV_API unsigned int replace(std::string& _s, char c1, char c2);
43 extern CGV_API unsigned int replace(std::string& _s, const std::string& s1, const std::string& s2);
45 extern CGV_API std::string interpret_special(const std::string& s);
47 extern CGV_API std::string escape_special(const std::string& s);
49 extern CGV_API bool find_name(const std::string& s, const char* names[], int& idx);
51 extern CGV_API bool is_element(char c, const std::string& s);
53 extern CGV_API bool is_element(const std::string& e, const std::string& s, char sep = ';');
56 extern CGV_API int get_element_index(const std::string& e, const std::string& s, char sep = ';');
58 extern CGV_API std::string get_element(const std::string& s, int element_index, char sep = ';');
60 extern CGV_API bool is_integer(const char* begin, const char* end, int& value);
62 extern CGV_API bool is_integer(const std::string& s, int& value);
64 extern CGV_API bool is_double(const char* begin, const char* end, double& value);
66 extern CGV_API bool is_double(const std::string& s, double& value);
68 extern CGV_API bool is_year(const char* begin, const char* end, unsigned short& year, bool short_allowed = true);
70 extern CGV_API bool is_year(const std::string& s, unsigned short& year, bool short_allowed = true);
72 extern CGV_API bool is_day(const char* begin, const char* end, unsigned char& day);
74 extern CGV_API bool is_day(const std::string& s, unsigned char& day);
76 extern CGV_API bool is_month(const char* begin, const char* end, unsigned char& month);
78 extern CGV_API bool is_month(const std::string& s, unsigned char& month);
80 extern CGV_API bool is_time(const std::string& s, cgv::utils::time& t, const char **new_end = 0);
82 extern CGV_API bool is_time(const char* begin, const char* end, cgv::utils::time& t, const char **new_end = 0);
84 extern CGV_API bool is_date(const std::string& s, cgv::utils::date& d, const char **new_end = 0);
86 extern CGV_API bool is_date(const char* begin, const char* end, cgv::utils::date& d, const char **new_end = 0);
88 extern CGV_API bool is_url(const std::string& s, const char** end = 0);
90 extern CGV_API bool is_url(const char* begin, const char* end, const char** new_end = 0);
91 
92  }
93 }
94 
95 #include <cgv/config/lib_end.h>
cgv::utils::is_letter
bool is_letter(char c)
check if char is a letter
Definition: scan.cxx:21
cgv::utils::skip_spaces
const char * skip_spaces(const char *begin, const char *end)
return new start pointer by skipping spaces at begin
Definition: scan.cxx:606
cgv::utils::is_day
CGV_API bool is_day(const char *begin, const char *end, unsigned char &day)
check and extract day from string token [begin, end]
cgv::utils::is_integer
bool is_integer(const char *begin, const char *end, int &value)
check if the text range (begin,end( defines an integer value. If yes, store the value in the passed r...
Definition: scan.cxx:300
cgv::utils::is_space
bool is_space(char c)
check if char is a whitespace
Definition: scan.cxx:9
cgv::utils::is_year
bool is_year(const char *begin, const char *end, unsigned short &year, bool short_allowed)
check and extract year from string token [begin, end]
Definition: scan.cxx:413
cgv::utils::to_upper
char to_upper(char c)
convert char to upper case
Definition: scan.cxx:65
cgv::utils::get_element_index
int get_element_index(const std::string &e, const std::string &s, char sep)
Definition: scan.cxx:267
cgv::utils::cutoff_spaces
const char * cutoff_spaces(const char *begin, const char *end)
return new end pointer by cutting off spaces at the end
Definition: scan.cxx:613
cgv::utils::find_name
bool find_name(const std::string &s, const char *names[], int &idx)
check if string s is contained in the given array of names and in case of success store name index in...
Definition: scan.cxx:430
cgv::utils::is_time
bool is_time(const std::string &s, cgv::utils::time &t, const char **new_end)
check and extract time from string token [begin, end]
Definition: scan.cxx:474
cgv::utils::is_month
bool is_month(const char *begin, const char *end, unsigned char &month)
check and extract month from string token [begin, end]
Definition: scan.cxx:443
cgv::utils::replace
unsigned int replace(std::string &s, char c1, char c2)
replace char c1 with c2 in the given string _s and return number of replacements
Definition: scan.cxx:103
cgv::utils::to_lower
char to_lower(char c)
convert char to lower case
Definition: scan.cxx:36
cgv::utils::to_hex
std::string to_hex(uint8_t v, bool use_upper_case)
convert to hex
Definition: scan.cxx:48
cgv::utils::is_url
bool is_url(const std::string &s, const char **end)
check and extract end of valid url from string s
Definition: scan.cxx:576
cgv::utils::is_element
bool is_element(char c, const std::string &s)
check if char c arises in string s
Definition: scan.cxx:235
cgv::utils::is_digit
bool is_digit(char c)
check if char is a digit
Definition: scan.cxx:17
cgv::utils::get_element
std::string get_element(const std::string &s, int element_index, char sep)
Definition: scan.cxx:245
cgv::utils::replace_special
std::string replace_special(const std::string &_s)
replaces the german special characters ä,ö,ü,ß,Ä,Ö,Ü
Definition: scan.cxx:85
cgv::utils::interpret_special
std::string interpret_special(const std::string &s)
interprets the C++ special characters \a, \b, \f, \n, \r, \t, \v, \\', \", \\, \?,...
Definition: scan.cxx:171
cgv::utils::escape_special
std::string escape_special(const std::string &s)
escapes the C++ special characters \a, \b, \f, \n, \r, \t, \v, \\', \", \\, \?
Definition: scan.cxx:149
cgv::utils::is_url_special
bool is_url_special(char c)
check if char is a special character from an url
Definition: scan.cxx:13
cgv
the cgv namespace
Definition: vr_calib.cxx:9
cgv::utils::is_double
bool is_double(const char *begin, const char *end, double &value)
check if the text range (begin,end( defines a double value. If yes, store the value in the passed ref...
Definition: scan.cxx:354
cgv::utils::is_date
bool is_date(const std::string &s, cgv::utils::date &d, const char **new_end)
check and extract date from string token [begin, end]
Definition: scan.cxx:514