diff options
Diffstat (limited to 'plugins/SmileyAdd/src/regexp')
-rw-r--r-- | plugins/SmileyAdd/src/regexp/WCMatcher.cpp | 20 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/regexp/WCMatcher.h | 32 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/regexp/WCPattern.cpp | 178 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/regexp/WCPattern.h | 158 |
4 files changed, 194 insertions, 194 deletions
diff --git a/plugins/SmileyAdd/src/regexp/WCMatcher.cpp b/plugins/SmileyAdd/src/regexp/WCMatcher.cpp index 939e347afd..12c1c0d4bd 100644 --- a/plugins/SmileyAdd/src/regexp/WCMatcher.cpp +++ b/plugins/SmileyAdd/src/regexp/WCMatcher.cpp @@ -10,7 +10,7 @@ const int WCMatcher::MATCH_ENTIRE_STRING = 0x01; @version 1.07.00
*/
-WCMatcher::WCMatcher(WCPattern *pattern, const CMString &text)
+WCMatcher::WCMatcher(WCPattern *pattern, const CMStringW &text)
{
pat = pattern;
str = &text;
@@ -48,11 +48,11 @@ void WCMatcher::clearGroups() for (i = 1; i <= ncgc; ++i) groups[0 - i] = starts[0 - i] = ends[0 - i] = -1;
}
-CMString WCMatcher::replaceWithGroups(const CMString &pStr)
+CMStringW WCMatcher::replaceWithGroups(const CMStringW &pStr)
{
- CMString ret;
+ CMStringW ret;
- CMString t = pStr;
+ CMStringW t = pStr;
while (t.GetLength() > 0) {
if (t[0] == '\\') {
t.Delete(0);
@@ -86,7 +86,7 @@ unsigned long WCMatcher::getFlags() const return flags;
}
-const CMString& WCMatcher::getText() const
+const CMStringW& WCMatcher::getText() const
{
return *str;
}
@@ -132,9 +132,9 @@ bool WCMatcher::findNextMatch() return ends[0] >= 0;
}
-std::vector<CMString> WCMatcher::findAll()
+std::vector<CMStringW> WCMatcher::findAll()
{
- std::vector<CMString> ret;
+ std::vector<CMStringW> ret;
reset();
while (findNextMatch())
ret.push_back(getGroup());
@@ -163,16 +163,16 @@ int WCMatcher::getEndingIndex(const int groupNum) const return ends[groupNum];
}
-CMString WCMatcher::getGroup(const int groupNum) const
+CMStringW WCMatcher::getGroup(const int groupNum) const
{
if (groupNum < 0 || groupNum >= gc) return L"";
if (starts[groupNum] < 0 || ends[groupNum] < 0) return L"";
return str->Mid(starts[groupNum], ends[groupNum] - starts[groupNum]);
}
-std::vector<CMString> WCMatcher::getGroups(const bool includeGroupZero) const
+std::vector<CMStringW> WCMatcher::getGroups(const bool includeGroupZero) const
{
- std::vector<CMString> ret;
+ std::vector<CMStringW> ret;
for (int i = (includeGroupZero ? 0 : 1); i < gc; ++i)
ret.push_back(getGroup(i));
diff --git a/plugins/SmileyAdd/src/regexp/WCMatcher.h b/plugins/SmileyAdd/src/regexp/WCMatcher.h index 3c5df018d7..285a49c349 100644 --- a/plugins/SmileyAdd/src/regexp/WCMatcher.h +++ b/plugins/SmileyAdd/src/regexp/WCMatcher.h @@ -23,7 +23,7 @@ invocation looks like:
<pre>
wchar_t buf[10000];
- CMString str = "\\5 (user name \\1) uses \\7 for his/her shell and \\6 is their home directory";
+ CMStringW str = "\\5 (user name \\1) uses \\7 for his/her shell and \\6 is their home directory";
FILE * fp = fopen("/etc/passwd", "r");
WCPattern::registerWCPattern("entry", "[^:]+");
WCPattern * p = WCPattern::compile("^({entry}):({entry}):({entry}):({entry}):({entry}):({entry}):({entry})$",
@@ -92,24 +92,24 @@ class WCMatcher @param pattern The pattern with which to search
@param text The text in which to search
*/
- WCMatcher(WCPattern * pattern, const CMString & text);
+ WCMatcher(WCPattern *pattern, const CMStringW & ext);
protected:
/// The pattern we use to match
- WCPattern * pat;
+ WCPattern *pat;
/// The string in which we are matching
- const CMString * str;
+ const CMStringW *str;
/// The starting point of our match
int start;
/// An array of the starting positions for each group
- int * starts;
+ int *starts;
/// An array of the ending positions for each group
- int * ends;
+ int *ends;
/// An array of private data used by NFAUNodes during matching
- int * groups;
+ int *groups;
/// An array of private data used by NFAUNodes during matching
- int * groupIndeces;
+ int *groupIndeces;
/// An array of private data used by NFAUNodes during matching
- int * groupPos;
+ int *groupPos;
/// The ending index of the last match
int lm;
/// The number of capturing groups we have
@@ -135,7 +135,7 @@ class WCMatcher @param str The string in which to replace text
@return A string with all backreferences appropriately replaced
*/
- CMString replaceWithGroups(const CMString & str);
+ CMStringW replaceWithGroups(const CMStringW & str);
/**
The flags currently being used by the matcher.
@return Zero
@@ -145,7 +145,7 @@ class WCMatcher The text being searched by the matcher.
@return the text being searched by the matcher.
*/
- const CMString& getText() const;
+ const CMStringW& getText() const;
/**
Scans the string from start to finish for a match. The entire string must
@@ -179,7 +179,7 @@ class WCMatcher @return Every substring in order which matches the given pattern
*/
- std::vector<CMString> findAll();
+ std::vector<CMStringW> findAll();
/**
Resets the internal state of the matcher
*/
@@ -188,12 +188,12 @@ class WCMatcher Same as getText. Left n for backwards compatibilty with old source code
@return Returns the string that is currently being used for matching
*/
- inline const CMString& getString() const { return *str; }
+ inline const CMStringW& getString() const { return *str; }
/**
Sets the string to scan
@param newStr The string to scan for subsequent matches
*/
- inline void setString(const CMString & newStr) { str = &newStr; reset(); }
+ inline void setString(const CMStringW & newStr) { str = &newStr; reset(); }
/**
Returns the starting index of the specified group.
@@ -217,14 +217,14 @@ class WCMatcher @param groupNum The group to query
@return The text of the group
*/
- CMString getGroup(const int groupNum = 0) const;
+ CMStringW getGroup(const int groupNum = 0) const;
/**
Returns every capture group in a vector
@param includeGroupZero Whether or not include capture group zero
@return Every capture group
*/
- std::vector<CMString> getGroups(const bool includeGroupZero = 0) const;
+ std::vector<CMStringW> getGroups(const bool includeGroupZero = 0) const;
};
#endif
diff --git a/plugins/SmileyAdd/src/regexp/WCPattern.cpp b/plugins/SmileyAdd/src/regexp/WCPattern.cpp index 22a7b78847..2ce1a1b301 100644 --- a/plugins/SmileyAdd/src/regexp/WCPattern.cpp +++ b/plugins/SmileyAdd/src/regexp/WCPattern.cpp @@ -25,8 +25,8 @@ #include "../stdafx.h"
-std::map<CMString, WCPattern *> WCPattern::compiledWCPatterns;
-std::map<CMString, std::pair<CMString, unsigned long> > WCPattern::registeredWCPatterns;
+std::map<CMStringW, WCPattern *> WCPattern::compiledWCPatterns;
+std::map<CMStringW, std::pair<CMStringW, unsigned long> > WCPattern::registeredWCPatterns;
const int WCPattern::MIN_QMATCH = 0x00000000;
const int WCPattern::MAX_QMATCH = 0x7FFFFFFF;
@@ -62,7 +62,7 @@ static inline int str_icmp(const wchar_t *a, const wchar_t *b) #define str_icmp wcscasecmp
#endif
-WCPattern::WCPattern(const CMString &rhs)
+WCPattern::WCPattern(const CMStringW &rhs)
{
matcher = NULL;
pattern = rhs;
@@ -85,29 +85,29 @@ NFAUNode *WCPattern::registerNode(NFAUNode *node) return node;
}
-CMString WCPattern::classUnion(CMString s1, CMString s2) const
+CMStringW WCPattern::classUnion(CMStringW s1, CMStringW s2) const
{
wchar_t *out = new wchar_t[66000];
std::sort((LPTSTR)s1.GetString(), (LPTSTR)s1.GetTail());
std::sort((LPTSTR)s2.GetString(), (LPTSTR)s2.GetTail());
wchar_t *p = std::set_union(s1.GetString(), s1.GetTail(), s2.GetString(), s2.GetTail(), out); *p = 0;
- CMString ret = out;
+ CMStringW ret = out;
delete[] out;
return ret;
}
-CMString WCPattern::classIntersect(CMString s1, CMString s2) const
+CMStringW WCPattern::classIntersect(CMStringW s1, CMStringW s2) const
{
wchar_t *out = new wchar_t[66000];
std::sort((LPTSTR)s1.GetString(), (LPTSTR)s1.GetTail());
std::sort((LPTSTR)s2.GetString(), (LPTSTR)s2.GetTail());
*std::set_intersection(s1.GetString(), s1.GetTail(), s2.GetString(), s2.GetTail(), out) = 0;
- CMString ret = out;
+ CMStringW ret = out;
delete[] out;
return ret;
}
-CMString WCPattern::classNegate(CMString s1) const
+CMStringW WCPattern::classNegate(CMStringW s1) const
{
wchar_t *out = new wchar_t[66000];
int i, ind = 0;
@@ -116,18 +116,18 @@ CMString WCPattern::classNegate(CMString s1) const for (i = 0; i < s1.GetLength(); ++i) m[s1[i]] = 1;
for (i = 0xFF; i >= 0; --i) if (m.find((wchar_t)i) == m.end()) out[ind++] = (wchar_t)i;
out[ind] = 0;
- CMString ret(out, ind);
+ CMStringW ret(out, ind);
delete[] out;
return ret;
}
-CMString WCPattern::classCreateRange(wchar_t low, wchar_t hi) const
+CMStringW WCPattern::classCreateRange(wchar_t low, wchar_t hi) const
{
wchar_t out[300];
int ind = 0;
while (low != hi) out[ind++] = low++;
out[ind++] = low;
- return CMString(out, ind);
+ return CMStringW(out, ind);
}
int WCPattern::getInt(int start, int end)
@@ -266,9 +266,9 @@ NFAUNode* WCPattern::quantify(NFAUNode *newNode) return newNode;
}
-CMString WCPattern::parseClass()
+CMStringW WCPattern::parseClass()
{
- CMString t, ret;
+ CMStringW t, ret;
wchar_t ch, c1, c2;
bool inv = 0, neg = 0, quo = 0;
@@ -364,9 +364,9 @@ CMString WCPattern::parseClass() return ret;
}
-CMString WCPattern::parsePosix()
+CMStringW WCPattern::parsePosix()
{
- CMString s7 = pattern.Mid(curInd, 7);
+ CMStringW s7 = pattern.Mid(curInd, 7);
if (s7 == L"{Lower}") { curInd += 7; return L"abcdefghijklmnopqrstuvwxyz"; }
if (s7 == L"{Upper}") { curInd += 7; return L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"; }
if (s7 == L"{Alpha}") { curInd += 7; return L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; }
@@ -378,7 +378,7 @@ CMString WCPattern::parsePosix() if (s7 == L"{Blank}") { curInd += 7; return L" \t"; }
if (s7 == L"{Space}") { curInd += 7; return L" \t\n\x0B\f\r"; }
if (s7 == L"{Cntrl}") {
- CMString s(' ', 32 + 1);
+ CMStringW s(' ', 32 + 1);
for (int i = 0; i <= 0x1F; ++i)
s.SetAt(i, i);
s.SetAt(0x20, 0x7F);
@@ -386,7 +386,7 @@ CMString WCPattern::parsePosix() return s;
}
if (s7 == L"{ASCII}") {
- CMString s(' ', 0x80);
+ CMStringW s(' ', 0x80);
for (int i = 0; i <= 0x7f; ++i) s.SetAt(i, i);
curInd += 7;
return s;
@@ -422,7 +422,7 @@ NFAUNode* WCPattern::parseBackref() #undef to_int
}
-CMString WCPattern::parseOctal()
+CMStringW WCPattern::parseOctal()
{
#define islowoc(x) ((x) >= '0' && (x) <= '3')
#define isoc(x) ((x) >= '0' && (x) <= '7')
@@ -431,7 +431,7 @@ CMString WCPattern::parseOctal() wchar_t ch1 = (ci + 0 < pattern.GetLength()) ? pattern[ci + 0] : USHRT_MAX;
wchar_t ch2 = (ci + 1 < pattern.GetLength()) ? pattern[ci + 1] : USHRT_MAX;
wchar_t ch3 = (ci + 2 < pattern.GetLength()) ? pattern[ci + 2] : USHRT_MAX;
- CMString s = L" ";
+ CMStringW s = L" ";
if (islowoc(ch1) && isoc(ch2)) {
curInd += 2;
@@ -453,7 +453,7 @@ CMString WCPattern::parseOctal() #undef fromoc
}
-CMString WCPattern::parseHex()
+CMStringW WCPattern::parseHex()
{
#define to_low(x) (((x) >= 'A' && (x) <= 'Z') ? ((x) - 'A' + 'a') : (x))
#define is_dig(x) ((x) >= '0' && (x) <= '9')
@@ -465,7 +465,7 @@ CMString WCPattern::parseHex() wchar_t ch2 = (ci + 1 < pattern.GetLength()) ? pattern[ci + 1] : USHRT_MAX;
wchar_t ch3 = (ci + 2 < pattern.GetLength()) ? pattern[ci + 2] : USHRT_MAX;
wchar_t ch4 = (ci + 3 < pattern.GetLength()) ? pattern[ci + 3] : USHRT_MAX;
- CMString s = L" ";
+ CMStringW s = L" ";
if (is_hex(ch1) && is_hex(ch2) && is_hex(ch3) && is_hex(ch4)) {
curInd += 2;
@@ -484,10 +484,10 @@ CMString WCPattern::parseHex() #undef to_int
}
-CMString WCPattern::parseEscape(bool &inv, bool &quo)
+CMStringW WCPattern::parseEscape(bool &inv, bool &quo)
{
wchar_t ch = pattern[curInd++];
- CMString classes;
+ CMStringW classes;
if (curInd > pattern.GetLength()) {
raiseError();
@@ -530,7 +530,7 @@ CMString WCPattern::parseEscape(bool &inv, bool &quo) NFAUNode* WCPattern::parseRegisteredWCPattern(NFAUNode **end)
{
int i, j;
- CMString s;
+ CMStringW s;
NFAUNode *ret = NULL;
for (i = curInd; i < pattern.GetLength() && pattern[i] != '}'; ++i) {}
if (pattern[i] != '}') { raiseError(); return NULL; }
@@ -555,7 +555,7 @@ NFAUNode* WCPattern::parseRegisteredWCPattern(NFAUNode **end) if (registeredWCPatterns.find(s) == registeredWCPatterns.end()) raiseError();
else {
unsigned long oflags = flags;
- CMString op = pattern;
+ CMStringW op = pattern;
int ci = i + 1;
pattern = registeredWCPatterns[s].first;
@@ -577,7 +577,7 @@ NFAUNode* WCPattern::parseRegisteredWCPattern(NFAUNode **end) // pattern must have a concrete length
NFAUNode* WCPattern::parseBehind(const bool pos, NFAUNode **end)
{
- CMString t;
+ CMStringW t;
while (curInd < pattern.GetLength() && pattern[curInd] != ')') {
wchar_t ch = pattern[curInd++];
if (ch == '\\') {
@@ -597,7 +597,7 @@ NFAUNode* WCPattern::parseBehind(const bool pos, NFAUNode **end) NFAUNode* WCPattern::parseQuote()
{
bool done = 0;
- CMString s;
+ CMStringW s;
while (!done) {
if (curInd >= pattern.GetLength()) {
@@ -621,7 +621,7 @@ NFAUNode* WCPattern::parseQuote() NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end)
{
NFAUNode *start, *cur, *next = NULL;
- CMString t;
+ CMStringW t;
int grc = groupCount++;
bool inv, quo;
bool ahead = 0, pos = 0, noncap = 0, indep = 0;
@@ -747,13 +747,13 @@ NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end) case '[':
if ((flags & WCPattern::CASE_INSENSITIVE) == 0) {
NFAClassUNode *clazz = new NFAClassUNode();
- CMString s = parseClass();
+ CMStringW s = parseClass();
for (int i = 0; i < (int)s.GetLength(); ++i) clazz->vals[s[i]] = 1;
next = registerNode(clazz);
}
else {
NFACIClassUNode *clazz = new NFACIClassUNode();
- CMString s = parseClass();
+ CMStringW s = parseClass();
for (int i = 0; i < s.GetLength(); ++i) clazz->vals[to_lower(s[i])] = 1;
next = registerNode(clazz);
}
@@ -845,7 +845,7 @@ NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end) return start;
}
-WCPattern* WCPattern::compile(const CMString &pattern, const unsigned long mode)
+WCPattern* WCPattern::compile(const CMStringW &pattern, const unsigned long mode)
{
WCPattern *p = new WCPattern(pattern);
NFAUNode *end;
@@ -879,10 +879,10 @@ WCPattern* WCPattern::compile(const CMString &pattern, const unsigned long mode) return p;
}
-WCPattern* WCPattern::compileAndKeep(const CMString &pattern, const unsigned long mode)
+WCPattern* WCPattern::compileAndKeep(const CMStringW &pattern, const unsigned long mode)
{
WCPattern *ret = NULL;
- std::map<CMString, WCPattern*>::iterator it = compiledWCPatterns.find(pattern);
+ std::map<CMStringW, WCPattern*>::iterator it = compiledWCPatterns.find(pattern);
if (it != compiledWCPatterns.end())
ret = it->second;
else {
@@ -893,9 +893,9 @@ WCPattern* WCPattern::compileAndKeep(const CMString &pattern, const unsigned lon return ret;
}
-CMString WCPattern::replace(const CMString &pattern, const CMString &str, const CMString &replacementText, const unsigned long mode)
+CMStringW WCPattern::replace(const CMStringW &pattern, const CMStringW &str, const CMStringW &replacementText, const unsigned long mode)
{
- CMString ret;
+ CMStringW ret;
WCPattern *p = WCPattern::compile(pattern, mode);
if (p) {
ret = p->replace(str, replacementText);
@@ -904,9 +904,9 @@ CMString WCPattern::replace(const CMString &pattern, const CMString &str, const return ret;
}
-std::vector<CMString> WCPattern::split(const CMString &pattern, const CMString &str, const bool keepEmptys, const unsigned long limit, const unsigned long mode)
+std::vector<CMStringW> WCPattern::split(const CMStringW &pattern, const CMStringW &str, const bool keepEmptys, const unsigned long limit, const unsigned long mode)
{
- std::vector<CMString> ret;
+ std::vector<CMStringW> ret;
WCPattern *p = WCPattern::compile(pattern, mode);
if (p) {
ret = p->split(str, keepEmptys, limit);
@@ -915,9 +915,9 @@ std::vector<CMString> WCPattern::split(const CMString &pattern, const CMString & return ret;
}
-std::vector<CMString> WCPattern::findAll(const CMString &pattern, const CMString &str, const unsigned long mode)
+std::vector<CMStringW> WCPattern::findAll(const CMStringW &pattern, const CMStringW &str, const unsigned long mode)
{
- std::vector<CMString> ret;
+ std::vector<CMStringW> ret;
WCPattern *p = WCPattern::compile(pattern, mode);
if (p) {
ret = p->findAll(str);
@@ -926,7 +926,7 @@ std::vector<CMString> WCPattern::findAll(const CMString &pattern, const CMString return ret;
}
-bool WCPattern::matches(const CMString &pattern, const CMString &str, const unsigned long mode)
+bool WCPattern::matches(const CMStringW &pattern, const CMStringW &str, const unsigned long mode)
{
bool ret = 0;
WCPattern *p = compile(pattern, mode);
@@ -938,7 +938,7 @@ bool WCPattern::matches(const CMString &pattern, const CMString &str, const unsi return ret;
}
-bool WCPattern::registerWCPattern(const CMString &name, const CMString &pattern, const unsigned long mode)
+bool WCPattern::registerWCPattern(const CMStringW &name, const CMStringW &pattern, const unsigned long mode)
{
WCPattern *p = WCPattern::compile(pattern, mode);
if (!p)
@@ -956,17 +956,17 @@ void WCPattern::unregisterWCPatterns() void WCPattern::clearWCPatternCache()
{
- std::map<CMString, WCPattern*>::iterator it;
+ std::map<CMStringW, WCPattern*>::iterator it;
for (it = compiledWCPatterns.begin(); it != compiledWCPatterns.end(); ++it)
delete it->second;
compiledWCPatterns.clear();
}
-std::pair<CMString, int> WCPattern::findNthMatch(const CMString &pattern, const CMString &str,
+std::pair<CMStringW, int> WCPattern::findNthMatch(const CMStringW &pattern, const CMStringW &str,
const int matchNum, const unsigned long mode)
{
- std::pair<CMString, int> ret;
+ std::pair<CMStringW, int> ret;
WCPattern *p = WCPattern::compile(pattern, mode);
ret.second = -1;
@@ -991,10 +991,10 @@ WCPattern::~WCPattern() delete it->first;
}
-CMString WCPattern::replace(const CMString &str, const CMString &replacementText)
+CMStringW WCPattern::replace(const CMStringW &str, const CMStringW &replacementText)
{
int li = 0;
- CMString ret;
+ CMStringW ret;
matcher->setString(str);
while (matcher->findNextMatch()) {
@@ -1007,11 +1007,11 @@ CMString WCPattern::replace(const CMString &str, const CMString &replacementText return ret;
}
-std::vector<CMString> WCPattern::split(const CMString &str, const bool keepEmptys, const unsigned long limit)
+std::vector<CMStringW> WCPattern::split(const CMStringW &str, const bool keepEmptys, const unsigned long limit)
{
unsigned long lim = (limit == 0 ? MAX_QMATCH : limit);
int li = 0;
- std::vector<CMString> ret;
+ std::vector<CMStringW> ret;
matcher->setString(str);
@@ -1031,13 +1031,13 @@ std::vector<CMString> WCPattern::split(const CMString &str, const bool keepEmpty return ret;
}
-std::vector<CMString> WCPattern::findAll(const CMString &str)
+std::vector<CMStringW> WCPattern::findAll(const CMStringW &str)
{
matcher->setString(str);
return matcher->findAll();
}
-bool WCPattern::matches(const CMString &str)
+bool WCPattern::matches(const CMStringW &str)
{
matcher->setString(str);
return matcher->matches();
@@ -1048,12 +1048,12 @@ unsigned long WCPattern::getFlags() const return flags;
}
-CMString WCPattern::getWCPattern() const
+CMStringW WCPattern::getWCPattern() const
{
return pattern;
}
-WCMatcher *WCPattern::createWCMatcher(const CMString &str)
+WCMatcher *WCPattern::createWCMatcher(const CMStringW &str)
{
return new WCMatcher(this, str);
}
@@ -1072,7 +1072,7 @@ void NFAUNode::findAllNodes(std::map<NFAUNode*, bool> &soFar) // NFACharUNode
NFACharUNode::NFACharUNode(const wchar_t c) { ch = c; }
-int NFACharUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFACharUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
if (curInd < str.GetLength() && str[curInd] == ch)
return next->match(str, matcher, curInd + 1);
@@ -1082,7 +1082,7 @@ int NFACharUNode::match(const CMString &str, WCMatcher *matcher, const int curIn // NFACICharUNode
NFACICharUNode::NFACICharUNode(const wchar_t c) { ch = to_lower(c); }
-int NFACICharUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFACICharUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
if (curInd < str.GetLength() && to_lower(str[curInd]) == ch)
return next->match(str, matcher, curInd + 1);
@@ -1092,7 +1092,7 @@ int NFACICharUNode::match(const CMString &str, WCMatcher *matcher, const int cur // NFAStartUNode
NFAStartUNode::NFAStartUNode() {}
-int NFAStartUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAStartUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int ret = -1, ci = curInd;
@@ -1118,7 +1118,7 @@ int NFAStartUNode::match(const CMString &str, WCMatcher *matcher, const int curI // NFAEndUNode
NFAEndUNode::NFAEndUNode() {}
-int NFAEndUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAEndUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
matcher->ends[0] = curInd;
if ((matcher->getFlags() & WCMatcher::MATCH_ENTIRE_STRING) != 0) {
@@ -1147,7 +1147,7 @@ NFAQuantifierUNode::NFAQuantifierUNode(WCPattern *pat, NFAUNode *internal, const max = (maxMatch > WCPattern::MAX_QMATCH) ? WCPattern::MAX_QMATCH : maxMatch;
}
-int NFAQuantifierUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAQuantifierUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int i0, i1, i2 = 0;
@@ -1168,14 +1168,14 @@ NFAGreedyQuantifierUNode::NFAGreedyQuantifierUNode(WCPattern *pat, NFAUNode *int {
}
-int NFAGreedyQuantifierUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGreedyQuantifierUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int t = NFAQuantifierUNode::match(str, matcher, curInd);
if (t != -1) return matchInternal(str, matcher, t, min);
return t;
}
-int NFAGreedyQuantifierUNode::matchInternal(const CMString &str, WCMatcher *matcher, const int curInd, const int soFar) const
+int NFAGreedyQuantifierUNode::matchInternal(const CMStringW &str, WCMatcher *matcher, const int curInd, const int soFar) const
{
if (soFar >= max)
return next->match(str, matcher, curInd);
@@ -1196,7 +1196,7 @@ NFALazyQuantifierUNode::NFALazyQuantifierUNode(WCPattern *pat, NFAUNode *interna {
}
-int NFALazyQuantifierUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFALazyQuantifierUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int m = NFAQuantifierUNode::match(str, matcher, curInd);
if (m == -1)
@@ -1225,7 +1225,7 @@ NFAPossessiveQuantifierUNode::NFAPossessiveQuantifierUNode(WCPattern *pat, NFAUN {
}
-int NFAPossessiveQuantifierUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAPossessiveQuantifierUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int m = NFAQuantifierUNode::match(str, matcher, curInd);
if (m == -1)
@@ -1246,7 +1246,7 @@ NFAAcceptUNode::NFAAcceptUNode() {
}
-int NFAAcceptUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAAcceptUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
if (!next) return curInd;
else return next->match(str, matcher, curInd);
@@ -1259,14 +1259,14 @@ NFAClassUNode::NFAClassUNode(const bool invert) inv = invert;
}
-NFAClassUNode::NFAClassUNode(const CMString &clazz, const bool invert)
+NFAClassUNode::NFAClassUNode(const CMStringW &clazz, const bool invert)
{
inv = invert;
for (int i = 0; i < clazz.GetLength(); ++i)
vals[clazz[i]] = 1;
}
-int NFAClassUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAClassUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
if (curInd < str.GetLength() && ((vals.find(str[curInd]) != vals.end()) ^ inv)) {
return next->match(str, matcher, curInd + 1);
@@ -1281,14 +1281,14 @@ NFACIClassUNode::NFACIClassUNode(const bool invert) inv = invert;
}
-NFACIClassUNode::NFACIClassUNode(const CMString &clazz, const bool invert)
+NFACIClassUNode::NFACIClassUNode(const CMStringW &clazz, const bool invert)
{
inv = invert;
for (int i = 0; i < (int)clazz.GetLength(); ++i)
vals[to_lower(clazz[i])] = 1;
}
-int NFACIClassUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFACIClassUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
if (curInd < str.GetLength() && ((vals.find(to_lower(str[curInd])) != vals.end()) ^ inv))
return next->match(str, matcher, curInd + 1);
@@ -1302,7 +1302,7 @@ NFASubStartUNode::NFASubStartUNode() {
}
-int NFASubStartUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFASubStartUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
return next->match(str, matcher, curInd);
}
@@ -1320,7 +1320,7 @@ void NFAOrUNode::findAllNodes(std::map<NFAUNode*, bool> &soFar) if (two) two->findAllNodes(soFar);
NFAUNode::findAllNodes(soFar);
}
-int NFAOrUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAOrUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int ci = one->match(str, matcher, curInd);
@@ -1333,12 +1333,12 @@ int NFAOrUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) // NFAQuoteUNode
-NFAQuoteUNode::NFAQuoteUNode(const CMString "ed) :
+NFAQuoteUNode::NFAQuoteUNode(const CMStringW "ed) :
qStr(quoted)
{
}
-int NFAQuoteUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAQuoteUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
if (curInd + qStr.GetLength() > str.GetLength()) return -1;
if (str.Mid(curInd, qStr.GetLength()) != qStr) return -1;
@@ -1347,12 +1347,12 @@ int NFAQuoteUNode::match(const CMString &str, WCMatcher *matcher, const int curI // NFACIQuoteUNode
-NFACIQuoteUNode::NFACIQuoteUNode(const CMString "ed) :
+NFACIQuoteUNode::NFACIQuoteUNode(const CMStringW "ed) :
qStr(quoted)
{
}
-int NFACIQuoteUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFACIQuoteUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
if (curInd + qStr.GetLength() > str.GetLength()) return -1;
if (str_icmp(str.Mid(curInd, qStr.GetLength()).c_str(), qStr.c_str())) return -1;
@@ -1372,19 +1372,19 @@ void NFALookAheadUNode::findAllNodes(std::map<NFAUNode*, bool> &soFar) NFAUNode::findAllNodes(soFar);
}
-int NFALookAheadUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFALookAheadUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
return ((inner->match(str, matcher, curInd) == -1) ^ pos) ? next->match(str, matcher, curInd) : -1;
}
// NFALookBehindUNode
-NFALookBehindUNode::NFALookBehindUNode(const CMString &str, const bool positive) :
+NFALookBehindUNode::NFALookBehindUNode(const CMStringW &str, const bool positive) :
pos(positive), mStr(str)
{
}
-int NFALookBehindUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFALookBehindUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
if (pos) {
if (curInd < mStr.GetLength())
@@ -1408,7 +1408,7 @@ NFAStartOfLineUNode::NFAStartOfLineUNode() {
}
-int NFAStartOfLineUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAStartOfLineUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
if (curInd == 0 || str[curInd - 1] == '\n' || str[curInd - 1] == '\r')
return next->match(str, matcher, curInd);
@@ -1422,7 +1422,7 @@ NFAEndOfLineUNode::NFAEndOfLineUNode() {
}
-int NFAEndOfLineUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAEndOfLineUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
if (curInd >= str.GetLength() || str[curInd] == '\n' || str[curInd] == '\r')
return next->match(str, matcher, curInd);
@@ -1437,7 +1437,7 @@ NFAReferenceUNode::NFAReferenceUNode(const int groupIndex) : {
}
-int NFAReferenceUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAReferenceUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int len = matcher->ends[gi] - matcher->starts[gi];
int ni = -1;
@@ -1455,7 +1455,7 @@ NFAStartOfInputUNode::NFAStartOfInputUNode() {
}
-int NFAStartOfInputUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAStartOfInputUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
if (curInd == 0) return next->match(str, matcher, curInd);
return -1;
@@ -1468,7 +1468,7 @@ NFAEndOfInputUNode::NFAEndOfInputUNode(const bool lookForTerm) : {
}
-int NFAEndOfInputUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAEndOfInputUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int len = str.GetLength();
if (curInd == len) return next->match(str, matcher, curInd);
@@ -1490,7 +1490,7 @@ NFAWordBoundaryUNode::NFAWordBoundaryUNode(const bool positive) : {
}
-int NFAWordBoundaryUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAWordBoundaryUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int len = str.GetLength();
@@ -1509,7 +1509,7 @@ NFAEndOfMatchUNode::NFAEndOfMatchUNode() {
}
-int NFAEndOfMatchUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAEndOfMatchUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
if (curInd == matcher->lm) return next->match(str, matcher, curInd);
return -1;
@@ -1522,7 +1522,7 @@ NFAGroupHeadUNode::NFAGroupHeadUNode(const int groupIndex) : {
}
-int NFAGroupHeadUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupHeadUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int ret, o = matcher->starts[gi];
@@ -1540,7 +1540,7 @@ NFAGroupTailUNode::NFAGroupTailUNode(const int groupIndex) : {
}
-int NFAGroupTailUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupTailUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int ret, o = matcher->ends[gi];
@@ -1558,7 +1558,7 @@ NFAGroupLoopPrologueUNode::NFAGroupLoopPrologueUNode(const int groupIndex) : {
}
-int NFAGroupLoopPrologueUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupLoopPrologueUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int ret, o1 = matcher->groups[gi], o2 = matcher->groupPos[gi], o3 = matcher->groupIndeces[gi];
@@ -1593,7 +1593,7 @@ void NFAGroupLoopUNode::findAllNodes(std::map<NFAUNode*, bool> &soFar) NFAUNode::findAllNodes(soFar);
}
-int NFAGroupLoopUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupLoopUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
bool b = (curInd > matcher->groupIndeces[gi]);
@@ -1621,7 +1621,7 @@ int NFAGroupLoopUNode::match(const CMString &str, WCMatcher *matcher, const int return -1;
}
-int NFAGroupLoopUNode::matchGreedy(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupLoopUNode::matchGreedy(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int o = matcher->groupIndeces[gi]; // save our info for backtracking
matcher->groupIndeces[gi] = curInd; // move along
@@ -1635,7 +1635,7 @@ int NFAGroupLoopUNode::matchGreedy(const CMString &str, WCMatcher *matcher, cons return ret;
}
-int NFAGroupLoopUNode::matchLazy(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupLoopUNode::matchLazy(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int ret = next->match(str, matcher, curInd); // be lazy, just go on
if (ret < 0) {
@@ -1652,7 +1652,7 @@ int NFAGroupLoopUNode::matchLazy(const CMString &str, WCMatcher *matcher, const return ret;
}
-int NFAGroupLoopUNode::matchPossessive(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupLoopUNode::matchPossessive(const CMStringW &str, WCMatcher *matcher, const int curInd) const
{
int o = matcher->groupIndeces[gi]; // save info for backtracking
matcher->groupPos[gi] = matcher->groups[gi]; // set a flag stating we have matcher at least this much
diff --git a/plugins/SmileyAdd/src/regexp/WCPattern.h b/plugins/SmileyAdd/src/regexp/WCPattern.h index e3455e8b31..d45f734645 100644 --- a/plugins/SmileyAdd/src/regexp/WCPattern.h +++ b/plugins/SmileyAdd/src/regexp/WCPattern.h @@ -974,19 +974,19 @@ private: @param rhs The pattern to compile
@memo Creates a new pattern from the regular expression in <code>rhs</code>.
*/
- WCPattern(const CMString & rhs);
+ WCPattern(const CMStringW &rhs);
protected:
/**
This currently is not used, so don't try to do anything with it.
@memo Holds all the compiled patterns for quick access.
*/
- static std::map<CMString, WCPattern *> compiledWCPatterns;
+ static std::map<CMStringW, WCPattern*> compiledWCPatterns;
/**
Holds all of the registered patterns as strings. Due to certain problems
with compilation of patterns, especially with capturing groups, this seemed
to be the best way to do it.
*/
- static std::map<CMString, std::pair<CMString, unsigned long> > registeredWCPatterns;
+ static std::map<CMStringW, std::pair<CMStringW, unsigned long> > registeredWCPatterns;
protected:
/**
Holds all the NFA nodes used. This makes deletion of a pattern, as well as
@@ -1006,7 +1006,7 @@ protected: /**
The actual regular expression we rerpesent
*/
- CMString pattern;
+ CMStringW pattern;
/**
Flag used during compilation. Once the pattern is successfully compiled,
<code>error</code> is no longer used.
@@ -1052,7 +1052,7 @@ protected: must have appeared in one or both of <code>s1</code> and
<code>s2</code>.
*/
- CMString classUnion(CMString s1, CMString s2) const;
+ CMStringW classUnion(CMStringW s1, CMStringW s2) const;
/**
Calculates the intersection of two strings. This function will first sort
the strings and then use a simple selection algorithm to find the
@@ -1062,7 +1062,7 @@ protected: @return A new string containing all unique characters. Each character
must have appeared both <code>s1</code> and <code>s2</code>.
*/
- CMString classIntersect(CMString s1, CMString s2) const;
+ CMStringW classIntersect(CMStringW s1, CMStringW s2) const;
/**
Calculates the negation of a string. The negation is the set of all
characters between <code>\x00</code> and <code>\xFF</code> not
@@ -1072,7 +1072,7 @@ protected: @return A new string containing all unique characters. Each character
must have appeared both <code>s1</code> and <code>s2</code>.
*/
- CMString classNegate(CMString s1) const;
+ CMStringW classNegate(CMStringW s1) const;
/**
Creates a new "class" representing the range from <code>low</code> thru
<code>hi</code>. This function will wrap if <code>low</code> >
@@ -1082,7 +1082,7 @@ protected: @param hi The ending character
@return A new string containing all the characters from low thru hi.
*/
- CMString classCreateRange(wchar_t low, wchar_t hi) const;
+ CMStringW classCreateRange(wchar_t low, wchar_t hi) const;
/**
Extracts a decimal number from the substring of member-variable
@@ -1132,24 +1132,24 @@ protected: @return A string of unique characters contained in the current class being
parsed
*/
- CMString parseClass();
+ CMStringW parseClass();
/**
Parses the current POSIX class being examined in
<code>{@link pattern pattern}</code>.
@return A string of unique characters representing the POSIX class being
parsed
*/
- CMString parsePosix();
+ CMStringW parsePosix();
/**
Returns a string containing the octal character being parsed
@return The string contained the octal value being parsed
*/
- CMString parseOctal();
+ CMStringW parseOctal();
/**
Returns a string containing the hex character being parsed
@return The string contained the hex value being parsed
*/
- CMString parseHex();
+ CMStringW parseHex();
/**
Returns a new node representing the back reference being parsed
@return The new node representing the back reference being parsed
@@ -1164,7 +1164,7 @@ protected: quotation.
@return The characters represented by the class
*/
- CMString parseEscape(bool & inv, bool & quo);
+ CMStringW parseEscape(bool & inv, bool & quo);
/**
Parses a supposed registered pattern currently under compilation. If the
sequence of characters does point to a registered pattern, then the
@@ -1228,7 +1228,7 @@ public: pointer. Upon failure, <code>compile</code> returns
<code>NULL</code>
*/
- static WCPattern * compile(const CMString & pattern,
+ static WCPattern * compile(const CMStringW & pattern,
const unsigned long mode = 0);
/**
Dont use this function. This function will compile a pattern, and cache
@@ -1243,7 +1243,7 @@ public: <code>WCPattern</code> pointer. Upon failure, <code>compile</code>
returns <code>NULL</code>.
*/
- static WCPattern * compileAndKeep(const CMString & pattern,
+ static WCPattern * compileAndKeep(const CMStringW & pattern,
const unsigned long mode = 0);
/**
@@ -1265,9 +1265,9 @@ public: during the replacement process
@return The text with the replacement string substituted where necessary
*/
- static CMString replace(const CMString & pattern,
- const CMString & str,
- const CMString & replacementText,
+ static CMStringW replace(const CMStringW & pattern,
+ const CMStringW & str,
+ const CMStringW & replacementText,
const unsigned long mode = 0);
/**
@@ -1276,12 +1276,12 @@ public: configurable. A typical invocation looks like:
<p>
<code>
- CMString str(strSize, 0);<br>
+ CMStringW str(strSize, 0);<br>
FILE * fp = fopen(fileName, "r");<br>
fread((char*)str.data(), strSize * 2, 1, fp);<br>
fclose(fp);<br>
<br>
- std::vector<CMString> lines = WCPattern::split(L"[\r\n]+", str, true);<br>
+ std::vector<CMStringW> lines = WCPattern::split(L"[\r\n]+", str, true);<br>
<br>
</code>
@@ -1293,8 +1293,8 @@ public: during the split process
@return All substrings of <code>str</code> split across <code>pattern</code>.
*/
- static std::vector<CMString> split(const CMString & pattern,
- const CMString & str,
+ static std::vector<CMStringW> split(const CMStringW & pattern,
+ const CMStringW & str,
const bool keepEmptys = 0,
const unsigned long limit = 0,
const unsigned long mode = 0);
@@ -1317,8 +1317,8 @@ public: during the find process
@return All instances of <code>pattern</code> in <code>str</code>
*/
- static std::vector<CMString> findAll(const CMString & pattern,
- const CMString & str,
+ static std::vector<CMStringW> findAll(const CMStringW & pattern,
+ const CMStringW & str,
const unsigned long mode = 0);
/**
@@ -1330,8 +1330,8 @@ public: during the replacement process
@return True if <code>str</code> is recognized by <code>pattern</code>
*/
- static bool matches(const CMString & pattern,
- const CMString & str,
+ static bool matches(const CMStringW & pattern,
+ const CMStringW & str,
const unsigned long mode = 0);
/**
@@ -1353,8 +1353,8 @@ public: @return Success/Failure. Fails only if <code>pattern</code> has invalid
syntax
*/
- static bool registerWCPattern(const CMString & name,
- const CMString & pattern,
+ static bool registerWCPattern(const CMStringW & name,
+ const CMStringW & pattern,
const unsigned long mode = 0);
/**
@@ -1372,7 +1372,7 @@ public: A typical invocation looks like this:
<p>
<code>
- std::pair<CMString, int> match = WCPattern::findNthMatch(L"\\d{1,3}", L"192.168.1.101:22", 1);<br>
+ std::pair<CMStringW, int> match = WCPattern::findNthMatch(L"\\d{1,3}", L"192.168.1.101:22", 1);<br>
wprintf(L"%s %i\n", match.first.c_str(), match.second);<br>
<br>
Output: 168 4<br>
@@ -1387,8 +1387,8 @@ public: <code>str</code>. You can check for success/failure by making sure
that the integer returned is greater than or equal to zero.
*/
- static std::pair<CMString, int> findNthMatch(const CMString & pattern,
- const CMString & str,
+ static std::pair<CMStringW, int> findNthMatch(const CMStringW & pattern,
+ const CMStringW & str,
const int matchNum,
const unsigned long mode = 0);
public:
@@ -1397,12 +1397,12 @@ public: */
~WCPattern();
- CMString replace(const CMString & str,
- const CMString & replacementText);
- std::vector<CMString> split(const CMString & str, const bool keepEmptys = 0,
+ CMStringW replace(const CMStringW & str,
+ const CMStringW & replacementText);
+ std::vector<CMStringW> split(const CMStringW & str, const bool keepEmptys = 0,
const unsigned long limit = 0);
- std::vector<CMString> findAll(const CMString & str);
- bool matches(const CMString & str);
+ std::vector<CMStringW> findAll(const CMStringW & str);
+ bool matches(const CMStringW & str);
/**
Returns the flags used during compilation of this pattern
@return The flags used during compilation of this pattern
@@ -1412,14 +1412,14 @@ public: Returns the regular expression this pattern represents
@return The regular expression this pattern represents
*/
- CMString getWCPattern() const;
+ CMStringW getWCPattern() const;
/**
Creates a matcher object using the specified string and this pattern.
@param str The string to match against
@return A new matcher using object using this pattern and the specified
string
*/
- WCMatcher * createWCMatcher(const CMString & str);
+ WCMatcher * createWCMatcher(const CMStringW & str);
};
class NFAUNode
@@ -1430,7 +1430,7 @@ public: NFAUNode();
virtual ~NFAUNode();
virtual void findAllNodes(std::map<NFAUNode*, bool> & soFar);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const = 0;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const = 0;
inline virtual bool isGroupHeadNode() const { return false; }
inline virtual bool isStartOfInputNode() const { return false; }
};
@@ -1440,7 +1440,7 @@ protected: wchar_t ch;
public:
NFACharUNode(const wchar_t c);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFACICharUNode : public NFAUNode
{
@@ -1448,19 +1448,19 @@ protected: wchar_t ch;
public:
NFACICharUNode(const wchar_t c);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAStartUNode : public NFAUNode
{
public:
NFAStartUNode();
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAEndUNode : public NFAUNode
{
public:
NFAEndUNode();
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAQuantifierUNode : public NFAUNode
{
@@ -1471,7 +1471,7 @@ public: NFAQuantifierUNode(WCPattern * pat, NFAUNode * internal,
const int minMatch = WCPattern::MIN_QMATCH,
const int maxMatch = WCPattern::MAX_QMATCH);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAGreedyQuantifierUNode : public NFAQuantifierUNode
{
@@ -1479,8 +1479,8 @@ public: NFAGreedyQuantifierUNode(WCPattern * pat, NFAUNode * internal,
const int minMatch = WCPattern::MIN_QMATCH,
const int maxMatch = WCPattern::MAX_QMATCH);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
- virtual int matchInternal(const CMString & str, WCMatcher * matcher, const int curInd, const int soFar) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int matchInternal(const CMStringW & str, WCMatcher * matcher, const int curInd, const int soFar) const;
};
class NFALazyQuantifierUNode : public NFAQuantifierUNode
{
@@ -1488,7 +1488,7 @@ public: NFALazyQuantifierUNode(WCPattern * pat, NFAUNode * internal,
const int minMatch = WCPattern::MIN_QMATCH,
const int maxMatch = WCPattern::MAX_QMATCH);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAPossessiveQuantifierUNode : public NFAQuantifierUNode
{
@@ -1496,13 +1496,13 @@ public: NFAPossessiveQuantifierUNode(WCPattern * pat, NFAUNode * internal,
const int minMatch = WCPattern::MIN_QMATCH,
const int maxMatch = WCPattern::MAX_QMATCH);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAAcceptUNode : public NFAUNode
{
public:
NFAAcceptUNode();
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAClassUNode : public NFAUNode
{
@@ -1510,8 +1510,8 @@ public: bool inv;
std::map<wchar_t, bool> vals;
NFAClassUNode(const bool invert = 0);
- NFAClassUNode(const CMString & clazz, const bool invert);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ NFAClassUNode(const CMStringW & clazz, const bool invert);
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFACIClassUNode : public NFAUNode
{
@@ -1519,14 +1519,14 @@ public: bool inv;
std::map<wchar_t, bool> vals;
NFACIClassUNode(const bool invert = 0);
- NFACIClassUNode(const CMString & clazz, const bool invert);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ NFACIClassUNode(const CMStringW & clazz, const bool invert);
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFASubStartUNode : public NFAUNode
{
public:
NFASubStartUNode();
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAOrUNode : public NFAUNode
{
@@ -1535,21 +1535,21 @@ public: NFAUNode * two;
NFAOrUNode(NFAUNode * first, NFAUNode * second);
virtual void findAllNodes(std::map<NFAUNode*, bool> & soFar);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAQuoteUNode : public NFAUNode
{
public:
- CMString qStr;
- NFAQuoteUNode(const CMString & quoted);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ CMStringW qStr;
+ NFAQuoteUNode(const CMStringW & quoted);
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFACIQuoteUNode : public NFAUNode
{
public:
- CMString qStr;
- NFACIQuoteUNode(const CMString & quoted);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ CMStringW qStr;
+ NFACIQuoteUNode(const CMStringW & quoted);
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFALookAheadUNode : public NFAUNode
{
@@ -1558,40 +1558,40 @@ public: NFAUNode * inner;
NFALookAheadUNode(NFAUNode * internal, const bool positive);
virtual void findAllNodes(std::map<NFAUNode*, bool> & soFar);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFALookBehindUNode : public NFAUNode
{
public:
bool pos;
- CMString mStr;
- NFALookBehindUNode(const CMString & str, const bool positive);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ CMStringW mStr;
+ NFALookBehindUNode(const CMStringW & str, const bool positive);
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAStartOfLineUNode : public NFAUNode
{
public:
NFAStartOfLineUNode();
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAEndOfLineUNode : public NFAUNode
{
public:
NFAEndOfLineUNode();
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAReferenceUNode : public NFAUNode
{
public:
int gi;
NFAReferenceUNode(const int groupIndex);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAStartOfInputUNode : public NFAUNode
{
public:
NFAStartOfInputUNode();
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
inline virtual bool isStartOfInputNode() const { return false; }
};
class NFAEndOfInputUNode : public NFAUNode
@@ -1599,27 +1599,27 @@ class NFAEndOfInputUNode : public NFAUNode public:
bool term;
NFAEndOfInputUNode(const bool lookForTerm);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAWordBoundaryUNode : public NFAUNode
{
public:
bool pos;
NFAWordBoundaryUNode(const bool positive);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAEndOfMatchUNode : public NFAUNode
{
public:
NFAEndOfMatchUNode();
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAGroupHeadUNode : public NFAUNode
{
public:
int gi;
NFAGroupHeadUNode(const int groupIndex);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
inline virtual bool isGroupHeadNode() const { return false; }
};
class NFAGroupTailUNode : public NFAUNode
@@ -1627,14 +1627,14 @@ class NFAGroupTailUNode : public NFAUNode public:
int gi;
NFAGroupTailUNode(const int groupIndex);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAGroupLoopPrologueUNode : public NFAUNode
{
public:
int gi;
NFAGroupLoopPrologueUNode(const int groupIndex);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
class NFAGroupLoopUNode : public NFAUNode
{
@@ -1644,10 +1644,10 @@ public: NFAGroupLoopUNode(NFAUNode * internal, const int minMatch,
const int maxMatch, const int groupIndex, const int matchType);
virtual void findAllNodes(std::map<NFAUNode*, bool> & soFar);
- virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
- int matchGreedy(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
- int matchLazy(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
- int matchPossessive(const CMString & str, WCMatcher * matcher, const int curInd = 0) const;
+ virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
+ int matchGreedy(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
+ int matchLazy(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
+ int matchPossessive(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const;
};
#endif
|