1 |
Douglas Thrift |
128 |
// Site Mapper |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#ifndef _Page_hpp_ |
8 |
|
|
#define _Page_hpp_ |
9 |
|
|
|
10 |
|
|
#include "SiteMapper.hpp" |
11 |
|
|
|
12 |
Douglas Thrift |
140 |
class Matcher; |
13 |
|
|
|
14 |
Douglas Thrift |
128 |
class Page |
15 |
|
|
{ |
16 |
|
|
private: |
17 |
douglas |
285 |
ext::String address, path, title; |
18 |
|
|
ext::Vector<Page> children; |
19 |
|
|
ext::String childOf; |
20 |
Douglas Thrift |
128 |
public: |
21 |
douglas |
285 |
Page() {} |
22 |
|
|
Page(const ext::String& address, const ext::String& path, const ext::String& title) : address(address), path(path), title(title) {} |
23 |
|
|
Page(const ext::String& url, const ext::String& title) : title(title) { setUrl(url); } |
24 |
Douglas Thrift |
128 |
~Page() {} |
25 |
douglas |
285 |
ext::String& getAddress() { return address; } |
26 |
|
|
ext::String& getPath() { return path; } |
27 |
|
|
ext::String& getTitle() { return title; } |
28 |
|
|
ext::Vector<Page>& getChildren() { return children; } |
29 |
|
|
ext::String& getChildOf() { return childOf; } |
30 |
|
|
ext::String getUrl() const { return ios::String() << "http://" << address << path; } |
31 |
|
|
void setAddress(const ext::String& address) { this->address = address; } |
32 |
|
|
void setPath(const ext::String& path) { this->path = path; } |
33 |
|
|
void setTitle(const ext::String& title) { this->title = title; } |
34 |
|
|
void setChildren(ext::Vector<Page>& children) { this->children = children; } |
35 |
|
|
void setChildOf(const ext::String& childOf) { this->childOf = childOf; } |
36 |
|
|
void setUrl(const ext::String& url); |
37 |
|
|
bool operator==(const ext::String& thing); |
38 |
Douglas Thrift |
140 |
bool operator==(Matcher& matcher); |
39 |
|
|
bool operator==(const Page& page) const; |
40 |
douglas |
285 |
bool operator!=(const ext::String& thing) { return !(*this == thing); } |
41 |
Douglas Thrift |
140 |
bool operator!=(Matcher& matcher) { return !(*this == matcher); } |
42 |
|
|
bool operator!=(const Page& page) const { return !(*this == page); } |
43 |
Douglas Thrift |
128 |
// friends: |
44 |
douglas |
285 |
friend bool operator==(const ext::String& thing, Page& page) { return page == thing; } |
45 |
|
|
friend bool operator==(Matcher& matcher, Page& page) { return page == matcher; } |
46 |
|
|
friend bool operator!=(const ext::String& thing, Page& page) { return page != thing; } |
47 |
|
|
friend bool operator!=(Matcher& matcher, Page& page) { return page != matcher; } |
48 |
|
|
friend xml::TextWriter& operator<<(xml::TextWriter& xml, Page& page); |
49 |
Douglas Thrift |
128 |
}; |
50 |
|
|
|
51 |
|
|
#endif // _Page_hpp_ |