7 |
|
#ifndef _Page_hpp_ |
8 |
|
#define _Page_hpp_ |
9 |
|
|
10 |
– |
#include "SiteMapper.hpp" |
11 |
– |
|
10 |
|
class Matcher; |
11 |
|
|
12 |
|
class Page |
13 |
|
{ |
14 |
|
private: |
15 |
< |
string address; |
16 |
< |
string path; |
17 |
< |
string title; |
20 |
< |
vector<Page> children; |
21 |
< |
string childOf; |
15 |
> |
std::string address, path, title; |
16 |
> |
std::vector<Page> children; |
17 |
> |
std::string childOf; |
18 |
|
unsigned tab; |
19 |
|
public: |
20 |
< |
Page(const string& address, const string& path, const string& title); |
21 |
< |
Page(const string& url, const string& title); |
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 |
< |
string& getAddress(void) { return address; } |
24 |
< |
string& getPath(void) { return path; } |
25 |
< |
string& getTitle(void) { return title; } |
26 |
< |
vector<Page>& getChildren(void) { return children; } |
27 |
< |
string& getChildOf(void) { return childOf; } |
28 |
< |
string getUrl(void) { return "http://" + address + path; } |
29 |
< |
void setAddress(const string& address) { this->address = address; } |
30 |
< |
void setPath(const string& path) { this->path = path; } |
31 |
< |
void setTitle(const string& title) { this->title = title; } |
32 |
< |
void setChildren(vector<Page>& children) { this->children = children; } |
33 |
< |
void setChildOf(const string& childOf) { this->childOf = childOf; } |
34 |
< |
void setUrl(const string& url); |
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 string& thing); |
36 |
> |
bool operator==(const std::string& thing); |
37 |
|
bool operator==(Matcher& matcher); |
38 |
|
bool operator==(const Page& page) const; |
39 |
< |
bool operator!=(const string& thing) { return !(*this == thing); } |
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 string& thing, Page& page) { return page == |
44 |
< |
thing; } |
45 |
< |
friend bool operator==(Matcher& matcher, Page& page) { return page == |
46 |
< |
matcher; } |
47 |
< |
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); |
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_ |