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 144 by Douglas Thrift, 2004-03-31T23:21:15-08:00 vs.
Revision 285 by douglas, 2004-11-28T03:01:11-08:00

# Line 7 | Line 7
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 <        tab = 0;
17 < }
18 <
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)
10 > void Page::setUrl(const ext::String& url)
11   {
12          Matcher matcher("^http://(.+)(/.*)?$");
13  
# Line 38 | Line 21 | void Page::setUrl(const string& url)
21                  }
22                  else
23                  {
24 <                        path = '/';
24 >                        path = "/";
25                  }
26          }
27          else
28          {
29 <                cerr << program << ": Page.setUrl(" << url << ") failure.\n";
29 >                api::Cerr << program << ": Page.setUrl(" << url << ") failure.\n";
30  
31 <                exit(1);
31 >                std::exit(1);
32          }
33   }
34  
35 < bool Page::operator==(const string& thing)
35 > bool Page::operator==(const ext::String& thing)
36   {
37          if (address == thing)
38          {
# Line 95 | Line 78 | bool Page::operator==(const Page& page)
78          return false;
79   }
80  
81 < ostream& operator<<(ostream& output, Page& page)
81 > xml::TextWriter& operator<<(xml::TextWriter& xml, Page& page)
82   {
83 <        string tab(page.tab, '\t');
83 >        xml::ScopeElement item(xml, "item");
84  
85 <        output << tab << "<item><link address=\"" << page.getUrl() << "\">"
86 <                << page.title << "</link>\n";
85 >        xml.OpenElement("link");
86 >        xml.SetAttribute("address", page.getUrl());
87 >        xml.OutputText(page.title);
88 >        xml.CloseElement();
89  
90 <        if (!page.children.empty())
90 >        if (!page.children.IsEmpty())
91          {
92 <                output << tab << "\t<list>\n";
108 <
109 <                for (unsigned index = 0; index < page.children.size(); index++)
110 <                {
111 <                        output << page.children[index](page.tab + 2) << '\n';
112 <                }
92 >                xml::ScopeElement list(xml, "list");
93  
94 <                output << tab << "\t</list>\n";
94 >                _mforeach (ext::Vector<Page>, child, page.children) xml << *child;
95          }
96  
97 <        output << tab << "</item>";
118 <
119 <        return output;
97 >        return xml;
98   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines