|
Rapicorn - Experimental UI Toolkit - Source Code 10.08.1
|
00001 /* Rapicorn 00002 * Copyright (C) 2009 Tim Janik 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * A copy of the GNU Lesser General Public License should ship along 00015 * with this library; if not, see http://www.gnu.org/copyleft/. 00016 */ 00017 #ifndef __RAPICORN_REGEX_HH__ 00018 #define __RAPICORN_REGEX_HH__ 00019 00020 #include <rcore/utilities.hh> 00021 00022 namespace Rapicorn { 00023 00024 namespace Regex { 00025 00026 typedef enum { // copied from gregex.h 00027 CASELESS = 1 << 0, 00028 MULTILINE = 1 << 1, 00029 DOTALL = 1 << 2, 00030 EXTENDED = 1 << 3, 00031 ANCHORED = 1 << 4, 00032 DOLLAR_ENDONLY = 1 << 5, 00033 UNGREEDY = 1 << 9, 00034 RAW = 1 << 11, 00035 NO_AUTO_CAPTURE = 1 << 12, 00036 OPTIMIZE = 1 << 13, 00037 DUPNAMES = 1 << 19, 00038 NEWLINE_CR = 1 << 20, 00039 NEWLINE_LF = 1 << 21, 00040 NEWLINE_CRLF = NEWLINE_CR | NEWLINE_LF 00041 } CompileFlags; 00042 static const CompileFlags COMPILE_NORMAL = CompileFlags (0); 00043 inline CompileFlags operator& (CompileFlags s1, CompileFlags s2) { return CompileFlags (s1 & (uint64) s2); } 00044 inline CompileFlags& operator&= (CompileFlags &s1, CompileFlags s2) { s1 = s1 & s2; return s1; } 00045 inline CompileFlags operator| (CompileFlags s1, CompileFlags s2) { return CompileFlags (s1 | (uint64) s2); } 00046 inline CompileFlags& operator|= (CompileFlags &s1, CompileFlags s2) { s1 = s1 | s2; return s1; } 00047 00048 typedef enum { // copied from gregex.h 00049 MATCH_ANCHORED = 1 << 4, 00050 MATCH_NOTBOL = 1 << 7, 00051 MATCH_NOTEOL = 1 << 8, 00052 MATCH_NOTEMPTY = 1 << 10, 00053 MATCH_PARTIAL = 1 << 15, 00054 MATCH_NEWLINE_CR = 1 << 20, 00055 MATCH_NEWLINE_LF = 1 << 21, 00056 MATCH_NEWLINE_CRLF = MATCH_NEWLINE_CR | MATCH_NEWLINE_LF, 00057 MATCH_NEWLINE_ANY = 1 << 22 00058 } MatchFlags; 00059 static const MatchFlags MATCH_NORMAL = MatchFlags (0); 00060 inline MatchFlags operator& (MatchFlags s1, MatchFlags s2) { return MatchFlags (s1 & (uint64) s2); } 00061 inline MatchFlags& operator&= (MatchFlags &s1, MatchFlags s2) { s1 = s1 & s2; return s1; } 00062 inline MatchFlags operator| (MatchFlags s1, MatchFlags s2) { return MatchFlags (s1 | (uint64) s2); } 00063 inline MatchFlags& operator|= (MatchFlags &s1, MatchFlags s2) { s1 = s1 | s2; return s1; } 00064 00065 bool match_simple (const String &pattern, 00066 const String &utf8string, 00067 CompileFlags compile_flags, 00068 MatchFlags match_flags); 00069 } // Regex 00070 00071 } // Rapicorn 00072 00073 #endif /* __RAPICORN_REGEX_HH__ */
1.7.4