ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/SiteMapper/Page.cpp
Revision: 132
Committed: 2004-03-24T15:58:55-08:00 (21 years, 2 months ago) by Douglas Thrift
File size: 1175 byte(s)
Log Message:
Ack, how could I do that?

File Contents

# Content
1 // Site Mapper
2 //
3 // Douglas Thrift
4 //
5 // $Id$
6
7 #include "Matcher.hpp"
8 #include "Page.hpp"
9
10 Page::Page(const string& address, const string& path, const string& title)
11 {
12 setAddress(address);
13 setPath(path);
14 setTitle(title);
15 }
16
17 Page::Page(const string& url)
18 {
19 setUrl(url);
20 }
21
22 void Page::setUrl(const string& url)
23 {
24 Matcher matcher("^http://(.+)(/.*)?$");
25
26 if (url == matcher)
27 {
28 address = matcher[1];
29
30 if (matcher.size() > 2)
31 {
32 path = matcher[2];
33 }
34 else
35 {
36 path = '/';
37 }
38 }
39 else
40 {
41 cerr << program << ": Page.setUrl(" << url << ") failure.\n";
42
43 exit(1);
44 }
45 }
46
47 bool Page::operator==(const string& thing)
48 {
49 if (address == thing)
50 {
51 return true;
52 }
53 else if (path == thing)
54 {
55 return true;
56 }
57 else if (title == thing)
58 {
59 return true;
60 }
61
62 return false;
63 }
64
65 bool Page::operator==(Page& page)
66 {
67 if (address == page.address)
68 {
69 if (path == page.path || title == page.title) return true;
70 }
71
72 return false;
73 }
74
75 bool Page::operator<(Page& page)
76 {
77 if (address < page.address) if (path < page.path) return true;
78
79 return false;
80 }
81
82 bool Page::operator>(Page& page)
83 {
84 if (address > page.address) if (path > page.path) return true;
85
86 return false;
87 }

Properties

Name Value
svn:eol-style native
svn:keywords Id