00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __EDELIB_REGEX_H__
00022 #define __EDELIB_REGEX_H__
00023
00024 #include "List.h"
00025 #include "String.h"
00026
00027 EDELIB_NS_BEGIN
00028
00034 enum RegexMode {
00035 RX_EXTENDED = (1 << 1),
00036 RX_CASELESS = (1 << 2),
00037 RX_DOLLAR_ENDONLY = (1 << 3),
00038 RX_DOTALL = (1 << 4),
00039 RX_MULTILINE = (1 << 5),
00040 RX_UNGREEDY = (1 << 6)
00041 };
00042
00048 enum RegexMatchMode {
00049 RX_MATCH_ANCHORED = (1 << 1),
00050 RX_MATCH_NOTBOL = (1 << 2),
00051 RX_MATCH_NOTEOL = (1 << 3),
00052 RX_MATCH_NOTEMPTY = (1 << 4)
00053 };
00054
00055 #ifndef SKIP_DOCS
00056 struct RegexData;
00057 #endif
00058
00065 struct RegexMatch {
00067 int offset;
00069 int length;
00070 };
00071
00098 class EDELIB_API Regex {
00099 private:
00100 RegexData* data;
00101
00102 void clear(void);
00103 E_DISABLE_CLASS_COPY(Regex)
00104 public:
00106 typedef list<RegexMatch> MatchVec;
00107
00111 Regex();
00112
00116 ~Regex();
00117
00125 bool compile(const char* pattern, int m = 0);
00126
00136 operator bool(void) const;
00137
00150 int match(const char* str, int match_mode, int start, int len, MatchVec* matches);
00151
00156 int match(const char* str, int match_mode = 0, MatchVec* matches = 0)
00157 { return match(str, match_mode, 0, -1, matches); }
00158
00167 int split(const char* str, list<String>& ls, int match_mode = 0);
00168
00172 const char* strerror(void) const;
00173 };
00174
00175 EDELIB_NS_END
00176 #endif