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 |
> |
Matcher matcher("^http://(.+)(/.*)?$", (PCRE_UNGREEDY | PCRE_DOTALL)); |
13 |
|
|
14 |
|
if (url == matcher) |
15 |
|
{ |
16 |
|
address = matcher[1]; |
17 |
|
|
18 |
< |
if (matcher.size() > 2) |
19 |
< |
{ |
20 |
< |
path = matcher[2]; |
21 |
< |
} |
22 |
< |
else |
23 |
< |
{ |
24 |
< |
path = "/"; |
25 |
< |
} |
18 |
> |
if (matcher.size() > 2) path = matcher[2]; else path = "/"; |
19 |
|
} |
20 |
|
else |
21 |
|
{ |
22 |
< |
api::Cerr << program << ": Page.setUrl(" << url << ") failure.\n"; |
22 |
> |
api::Cerr << SiteMapper::program << ": Page.setUrl(" << url << ") failure.\n"; |
23 |
|
|
24 |
< |
std::exit(1); |
24 |
> |
throw; |
25 |
|
} |
26 |
|
} |
27 |
|
|
28 |
|
bool Page::operator==(const ext::String& thing) |
29 |
|
{ |
30 |
< |
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; |
30 |
> |
return address == thing || path == thing || title == thing; |
31 |
|
} |
32 |
|
|
33 |
|
bool Page::operator==(Matcher& matcher) |
34 |
|
{ |
35 |
< |
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; |
35 |
> |
return address == matcher || path == matcher || title == matcher; |
36 |
|
} |
37 |
|
|
38 |
|
bool Page::operator==(const Page& page) const |