1 |
Douglas Thrift |
128 |
// Site Mapper |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#include "Page.hpp" |
8 |
|
|
|
9 |
|
|
Page::Page(const string& address, const string& path, const string& title) |
10 |
|
|
{ |
11 |
|
|
setAddress(address); |
12 |
|
|
setPath(path); |
13 |
|
|
setTitle(title); |
14 |
|
|
} |
15 |
|
|
|
16 |
|
|
Page::Page(const string& url) |
17 |
|
|
{ |
18 |
|
|
setUrl(url); |
19 |
|
|
} |
20 |
|
|
|
21 |
|
|
void Page::setUrl(const string& url) |
22 |
|
|
{ |
23 |
|
|
Matcher matcher("^http://(.+)(/.*)?$"); |
24 |
|
|
|
25 |
|
|
if (url == matcher) |
26 |
|
|
{ |
27 |
|
|
address = matcher[1]; |
28 |
|
|
|
29 |
|
|
if (matcher.size() > 2) |
30 |
|
|
{ |
31 |
|
|
path = matcher[2]; |
32 |
|
|
} |
33 |
|
|
else |
34 |
|
|
{ |
35 |
|
|
path = '/'; |
36 |
|
|
} |
37 |
|
|
} |
38 |
|
|
else |
39 |
|
|
{ |
40 |
|
|
cerr << program << ": Page.setUrl(" << url << ") failure.\n"; |
41 |
|
|
} |
42 |
|
|
} |