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