Rapicorn - Experimental UI Toolkit - Source Code  13.07.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
regex.hh
Go to the documentation of this file.
00001  // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html
00002 #ifndef __RAPICORN_REGEX_HH__
00003 #define __RAPICORN_REGEX_HH__
00004 
00005 #include <rcore/utilities.hh>
00006 
00007 namespace Rapicorn {
00008 
00009 namespace Regex {
00010 
00011 typedef enum { // copied from gregex.h
00012   CASELESS          = 1 << 0,
00013   MULTILINE         = 1 << 1,
00014   DOTALL            = 1 << 2,
00015   EXTENDED          = 1 << 3,
00016   ANCHORED          = 1 << 4,
00017   DOLLAR_ENDONLY    = 1 << 5,
00018   UNGREEDY          = 1 << 9,
00019   RAW               = 1 << 11,
00020   NO_AUTO_CAPTURE   = 1 << 12,
00021   OPTIMIZE          = 1 << 13,
00022   DUPNAMES          = 1 << 19,
00023   NEWLINE_CR        = 1 << 20,
00024   NEWLINE_LF        = 1 << 21,
00025   NEWLINE_CRLF      = NEWLINE_CR | NEWLINE_LF
00026 } CompileFlags;
00027 static const CompileFlags COMPILE_NORMAL = CompileFlags (0);
00028 inline CompileFlags  operator&  (CompileFlags  s1, CompileFlags s2) { return CompileFlags (s1 & (uint64) s2); }
00029 inline CompileFlags& operator&= (CompileFlags &s1, CompileFlags s2) { s1 = s1 & s2; return s1; }
00030 inline CompileFlags  operator|  (CompileFlags  s1, CompileFlags s2) { return CompileFlags (s1 | (uint64) s2); }
00031 inline CompileFlags& operator|= (CompileFlags &s1, CompileFlags s2) { s1 = s1 | s2; return s1; }
00032 
00033 typedef enum { // copied from gregex.h
00034   MATCH_ANCHORED      = 1 << 4,
00035   MATCH_NOTBOL        = 1 << 7,
00036   MATCH_NOTEOL        = 1 << 8,
00037   MATCH_NOTEMPTY      = 1 << 10,
00038   MATCH_PARTIAL       = 1 << 15,
00039   MATCH_NEWLINE_CR    = 1 << 20,
00040   MATCH_NEWLINE_LF    = 1 << 21,
00041   MATCH_NEWLINE_CRLF  = MATCH_NEWLINE_CR | MATCH_NEWLINE_LF,
00042   MATCH_NEWLINE_ANY   = 1 << 22
00043 } MatchFlags;
00044 static const MatchFlags MATCH_NORMAL = MatchFlags (0);
00045 inline MatchFlags  operator&  (MatchFlags  s1, MatchFlags s2) { return MatchFlags (s1 & (uint64) s2); }
00046 inline MatchFlags& operator&= (MatchFlags &s1, MatchFlags s2) { s1 = s1 & s2; return s1; }
00047 inline MatchFlags  operator|  (MatchFlags  s1, MatchFlags s2) { return MatchFlags (s1 | (uint64) s2); }
00048 inline MatchFlags& operator|= (MatchFlags &s1, MatchFlags s2) { s1 = s1 | s2; return s1; }
00049 
00050 bool    match_simple    (const String   &pattern,
00051                          const String   &utf8string,
00052                          CompileFlags    compile_flags,
00053                          MatchFlags      match_flags);
00054 } // Regex
00055 
00056 } // Rapicorn
00057 
00058 #endif /* __RAPICORN_REGEX_HH__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines