1 |
Douglas Thrift |
128 |
// Site Mapper |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
Douglas Thrift |
129 |
#include "Matcher.hpp" |
8 |
Douglas Thrift |
128 |
#include "Page.hpp" |
9 |
|
|
|
10 |
|
|
Page::Page(const string& address, const string& path, const string& title) |
11 |
|
|
{ |
12 |
|
|
setAddress(address); |
13 |
|
|
setPath(path); |
14 |
|
|
setTitle(title); |
15 |
|
|
} |
16 |
|
|
|
17 |
|
|
Page::Page(const string& url) |
18 |
|
|
{ |
19 |
|
|
setUrl(url); |
20 |
|
|
} |
21 |
|
|
|
22 |
|
|
void Page::setUrl(const string& url) |
23 |
|
|
{ |
24 |
|
|
Matcher matcher("^http://(.+)(/.*)?$"); |
25 |
|
|
|
26 |
|
|
if (url == matcher) |
27 |
|
|
{ |
28 |
|
|
address = matcher[1]; |
29 |
|
|
|
30 |
|
|
if (matcher.size() > 2) |
31 |
|
|
{ |
32 |
|
|
path = matcher[2]; |
33 |
|
|
} |
34 |
|
|
else |
35 |
|
|
{ |
36 |
|
|
path = '/'; |
37 |
|
|
} |
38 |
|
|
} |
39 |
|
|
else |
40 |
|
|
{ |
41 |
|
|
cerr << program << ": Page.setUrl(" << url << ") failure.\n"; |
42 |
Douglas Thrift |
129 |
|
43 |
|
|
exit(1); |
44 |
Douglas Thrift |
128 |
} |
45 |
|
|
} |
46 |
Douglas Thrift |
129 |
|
47 |
|
|
bool Page::operator==(const string& thing) |
48 |
|
|
{ |
49 |
|
|
// |
50 |
|
|
|
51 |
|
|
return false; |
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
bool Page::operator==(Page& page) |
55 |
|
|
{ |
56 |
|
|
// |
57 |
|
|
|
58 |
|
|
return false; |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
bool Page::operator<(Page& page) |
62 |
|
|
{ |
63 |
|
|
// |
64 |
|
|
|
65 |
|
|
return false; |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
bool Page::operator>(Page& page) |
69 |
|
|
{ |
70 |
|
|
// |
71 |
|
|
|
72 |
|
|
return false; |
73 |
|
|
} |