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