6 #include <boost/regex.hpp>
8 inline char* char_type (u_char* v) {return (char*)v;}
9 inline char* char_type (char* v) {return v;}
10 inline const char* char_type (const u_char* v) {return (const char*)v;}
11 //inline u_char* uchar_type (char* v) {return (u_char*)v;}
12 inline const u_char* uchar_type (const char* v) {return (const u_char*)v;}
13 inline char* noconst_char (const char* v) {return (char*)v;}
14 #define UCharConst(s) (uchar_type(s)), (sizeof (s) - 1)
15 #define CharConst(s) (s), (sizeof (s) - 1)
16 #define comapreHead(s) compare(0, sizeof(s) - 1, (s), sizeof(s) - 1)
18 typedef std::basic_string<char> ustring;
19 typedef ustring::const_iterator uiterator;
20 typedef std::pair<ustring::const_iterator, ustring::const_iterator> upair;
21 typedef boost::match_results<ustring::const_iterator> umatch;
22 typedef boost::basic_regex<char, boost::regex_traits<char> > uregex;
24 inline bool usearch (ustring::const_iterator first, ustring::const_iterator last, umatch& m, const uregex& re, boost::match_flag_type flags = boost::regex_constants::match_single_line) {
25 return regex_search (first, last, m, re, flags);
27 inline bool usearch (const ustring& s, umatch& m, const uregex& re, boost::match_flag_type flags = boost::regex_constants::match_single_line) {
28 return regex_search (s.begin (), s.end (), m, re, flags);
31 inline int match (upair& p, const u_char* s, ustring::size_type len) {
32 ustring::size_type n = p.second - p.first;
33 return (n == len && memcmp (p.first.base (), s, n) == 0);
36 inline uiterator find (uiterator b, uiterator e, ustring::value_type ch) {
37 for (; b != e; b ++) {
44 #endif /* USTRING_H */