9 |
|
|
10 |
|
#include "SiteMapper.hpp" |
11 |
|
|
12 |
+ |
class Matcher; |
13 |
+ |
|
14 |
|
class Page |
15 |
|
{ |
16 |
|
private: |
18 |
|
string path; |
19 |
|
string title; |
20 |
|
vector<Page> children; |
21 |
+ |
string childOf; |
22 |
+ |
unsigned tab; |
23 |
|
public: |
24 |
|
Page(const string& address, const string& path, const string& title); |
25 |
< |
Page(const string& url); |
25 |
> |
Page(const string& url, const string& title); |
26 |
|
~Page() {} |
27 |
< |
string getAddress(void) const { return address; } |
28 |
< |
string getPath(void) const { return path; } |
29 |
< |
string getTitle(void) const { return title; } |
30 |
< |
vector<Page> getChildren(void) const { return children; } |
31 |
< |
string getUrl(void) const { return "http://" + address + path; } |
27 |
> |
string& getAddress(void) { return address; } |
28 |
> |
string& getPath(void) { return path; } |
29 |
> |
string& getTitle(void) { return title; } |
30 |
> |
vector<Page>& getChildren(void) { return children; } |
31 |
> |
string& getChildOf(void) { return childOf; } |
32 |
> |
string getUrl(void) { return "http://" + address + path; } |
33 |
|
void setAddress(const string& address) { this->address = address; } |
34 |
|
void setPath(const string& path) { this->path = path; } |
35 |
|
void setTitle(const string& title) { this->title = title; } |
36 |
|
void setChildren(vector<Page>& children) { this->children = children; } |
37 |
+ |
void setChildOf(const string& childOf) { this->childOf = childOf; } |
38 |
|
void setUrl(const string& url); |
39 |
< |
bool operator==(const string& thing) const; |
39 |
> |
Page& operator()(unsigned tab) { this->tab = tab; return *this; } |
40 |
> |
bool operator==(const string& thing); |
41 |
> |
bool operator==(Matcher& matcher); |
42 |
|
bool operator==(const Page& page) const; |
43 |
< |
bool operator!=(const string& thing) const; |
44 |
< |
bool operator!=(const Page& page) const; |
45 |
< |
bool operator<(const Page& page) const; |
38 |
< |
bool operator>(const Page& page) const; |
43 |
> |
bool operator!=(const string& thing) { return !(*this == thing); } |
44 |
> |
bool operator!=(Matcher& matcher) { return !(*this == matcher); } |
45 |
> |
bool operator!=(const Page& page) const { return !(*this == page); } |
46 |
|
// friends: |
47 |
< |
friend bool operator==(const string& thing, const Page& page) { return page |
48 |
< |
== thing; } |
49 |
< |
friend bool operator!=(const string& thing, const Page& page) { return page |
50 |
< |
== thing; } |
47 |
> |
friend bool operator==(const string& thing, Page& page) { return page == |
48 |
> |
thing; } |
49 |
> |
friend bool operator==(Matcher& matcher, Page& page) { return page == |
50 |
> |
matcher; } |
51 |
> |
friend bool operator!=(const string& thing, Page& page) { return page != |
52 |
> |
thing; } |
53 |
> |
friend bool operator!=(Matcher& matcher, Page& page) { return page != |
54 |
> |
matcher; } |
55 |
> |
friend ostream& operator<<(ostream& output, Page& page); |
56 |
|
}; |
57 |
|
|
58 |
|
#endif // _Page_hpp_ |