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