ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/zoe/trunk/Matcher.cpp
(Generate patch)

Comparing trunk/Matcher.cpp (file contents):
Revision 5 by douglas, 2004-07-09T15:04:18-07:00 vs.
Revision 10 by douglas, 2004-07-10T17:01:15-07:00

# Line 1 | Line 1
1 < // Smersh
1 > // Zoe AIM Away Message RSS Feed Generator
2   //
3   // Douglas Thrift
4   //
# Line 6 | Line 6
6  
7   #include "Matcher.hpp"
8  
9 < Matcher::Matcher(const std::string& expression)
9 > Matcher::Matcher(const ext::String& expression) : expression(NULL)
10   {
11        this->expression = NULL;
12
11          (*this)(expression);
12   }
13  
# Line 21 | Line 19 | Matcher::~Matcher()
19          }
20   }
21  
22 < bool Matcher::match(const std::string& stuff)
22 > bool Matcher::match(const ext::String& stuff)
23   {
24          substrings.clear();
25  
# Line 31 | Line 29 | bool Matcher::match(const std::string& s
29  
30                  pcre_fullinfo(expression, NULL, PCRE_INFO_CAPTURECOUNT, &length);
31  
32 <                int* substrings = new int[(++length *= 3)];
33 <                int count = pcre_exec(expression, NULL, stuff.c_str(), stuff.length(),
34 <                        0, 0, substrings, length);
32 >                int* substrings(new int[(++length *= 3)]);
33 >                int count(pcre_exec(expression, NULL, stuff.c_str(), stuff.length(), 0, 0,
34 >                        substrings, length));
35  
36                  if (count > 0)
37                  {
38 <                        char* substring = new char[stuff.length() + 1];
38 >                        char* substring(new char[stuff.length() + 1]);
39  
40 <                        for (int index = 0; index < count; index++)
40 >                        for (int index(0); index < count; ++index)
41                          {
42                                  pcre_copy_substring(stuff.c_str(), substrings, count, index,
43                                          substring, stuff.length() + 1);
# Line 58 | Line 56 | bool Matcher::match(const std::string& s
56          return false;
57   }
58  
59 < Matcher& Matcher::operator()(const std::string& expression)
59 > Matcher& Matcher::operator()(const ext::String& expression)
60   {
61          substrings.clear();
62  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines