ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/SiteMapper/Page.cpp
(Generate patch)

Comparing SiteMapper/Page.cpp (file contents):
Revision 132 by Douglas Thrift, 2004-03-24T15:58:55-08:00 vs.
Revision 140 by Douglas Thrift, 2004-03-25T18:04:04-08:00

# Line 12 | Line 12 | Page::Page(const string& address, const
12          setAddress(address);
13          setPath(path);
14          setTitle(title);
15 +
16 +        tab = 0;
17   }
18  
19 < Page::Page(const string& url)
19 > Page::Page(const string& url, const string& title)
20   {
21          setUrl(url);
22 +        setTitle(title);
23 +
24 +        tab = 0;
25   }
26  
27   void Page::setUrl(const string& url)
# Line 62 | Line 67 | bool Page::operator==(const string& thin
67          return false;
68   }
69  
70 < bool Page::operator==(Page& page)
70 > bool Page::operator==(Matcher& matcher)
71 > {
72 >        if (address == matcher)
73 >        {
74 >                return true;
75 >        }
76 >        else if (path == matcher)
77 >        {
78 >                return true;
79 >        }
80 >        else if (title == matcher)
81 >        {
82 >                return true;
83 >        }
84 >
85 >        return false;
86 > }
87 >
88 > bool Page::operator==(const Page& page) const
89   {
90          if (address == page.address)
91          {
# Line 72 | Line 95 | bool Page::operator==(Page& page)
95          return false;
96   }
97  
98 < bool Page::operator<(Page& page)
98 > bool Page::operator<(const Page& page) const
99 > {
100 >        if (address == page.address)
101 >        {
102 >                return path < page.path;
103 >        }
104 >
105 >        return address < page.address;
106 > }
107 >
108 > bool Page::operator>(const Page& page) const
109   {
110 <        if (address < page.address) if (path < page.path) return true;
110 >        if (address == page.address)
111 >        {
112 >                return path > page.path;
113 >        }
114  
115 <        return false;
115 >        return address > page.address;
116   }
117  
118 < bool Page::operator>(Page& page)
118 > ostream& operator<<(ostream& output, Page& page)
119   {
120 <        if (address > page.address) if (path > page.path) return true;
120 >        string tab(page.tab, '\t');
121  
122 <        return false;
122 >        output << tab << "<item><link address=\"" << page.getUrl() << "\">"
123 >                << page.title << "</link>\n";
124 >
125 >        if (!page.children.empty())
126 >        {
127 >                output << tab << "\t<list>\n";
128 >
129 >                for (list<Page>::iterator itor = page.children.begin(); itor !=
130 >                        page.children.end(); itor++)
131 >                {
132 >                        output << (*itor)(page.tab + 1) << '\n';
133 >                }
134 >
135 >                output << tab << "\t</list>\n";
136 >        }
137 >
138 >        output << tab << "</item>";
139 >
140 >        return output;
141   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines