ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/SiteMapper/Page.cpp
(Generate patch)

Comparing SiteMapper/Page.cpp (file contents):
Revision 285 by douglas, 2004-11-28T03:01:11-08:00 vs.
Revision 330 by douglas, 2004-12-13T20:46:08-08:00

# Line 4 | Line 4
4   //
5   // $Id$
6  
7 < #include "Matcher.hpp"
8 < #include "Page.hpp"
7 > #include "SiteMapper.hpp"
8 > #include "Matcher/Matcher.hpp"
9  
10   void Page::setUrl(const ext::String& url)
11   {
12 <        Matcher matcher("^http://(.+)(/.*)?$");
12 >        api::Cerr << PCRE_MULTILINE << " = " << Matcher::defaults << ios::NewLine;
13 >
14 >        Matcher matcher("^http://(.+)(/.*)?$", (PCRE_UNGREEDY | PCRE_DOTALL));
15 >
16 >        api::Cerr << (PCRE_UNGREEDY | PCRE_DOTALL) << " = " << matcher.options << ios::NewLine;
17  
18          if (url == matcher)
19          {
20                  address = matcher[1];
21  
22 <                if (matcher.size() > 2)
19 <                {
20 <                        path = matcher[2];
21 <                }
22 <                else
23 <                {
24 <                        path = "/";
25 <                }
22 >                if (matcher.size() > 2) path = matcher[2]; else path = "/";
23          }
24          else
25          {
26                  api::Cerr << program << ": Page.setUrl(" << url << ") failure.\n";
27  
28 <                std::exit(1);
28 >                throw;
29          }
30   }
31  
32   bool Page::operator==(const ext::String& thing)
33   {
34 <        if (address == thing)
38 <        {
39 <                return true;
40 <        }
41 <        else if (path == thing)
42 <        {
43 <                return true;
44 <        }
45 <        else if (title == thing)
46 <        {
47 <                return true;
48 <        }
49 <
50 <        return false;
34 >        return address == thing || path == thing || title == thing;
35   }
36  
37   bool Page::operator==(Matcher& matcher)
38   {
39 <        if (address == matcher)
56 <        {
57 <                return true;
58 <        }
59 <        else if (path == matcher)
60 <        {
61 <                return true;
62 <        }
63 <        else if (title == matcher)
64 <        {
65 <                return true;
66 <        }
67 <
68 <        return false;
39 >        return address == matcher || path == matcher || title == matcher;
40   }
41  
42   bool Page::operator==(const Page& page) const

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines