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

Comparing SiteMapper/SiteMapper.cpp (file contents):
Revision 154 by Douglas Thrift, 2004-06-04T02:40:33-07:00 vs.
Revision 237 by Douglas Thrift, 2004-09-10T16:22:07-07:00

# Line 4 | Line 4
4   //
5   // $Id$
6  
7 #ifdef _WIN32
8 #pragma warning(disable:4503)
9 #endif
10
7   #include "SiteMapper.hpp"
8   #include "Matcher.hpp"
9   #include "Page.hpp"
# Line 40 | Line 36 | int main(int argc, char* argv[])
36                  }
37          }
38  
39 <        if (siteIndex != "" && siteMap != "")
39 >        if (!siteIndex.empty() && !siteMap.empty())
40          {
41                  SiteMapper mapper(siteIndex, siteMap);
42          }
# Line 64 | Line 60 | void SiteMapper::oldMap(const string& si
60          ext::Handle<xml::Document> document(xml::Parse(siteMap));
61          ext::Handle<xml::Node> list(*document/"page"/"section"/"list");
62  
63 <        comment = *document/"comment()";
63 >        comment = ext::String(*document/"comment()");
64  
65          oldMap(pages, list);
66   }
# Line 76 | Line 72 | void SiteMapper::oldMap(vector<Page>& pa
72          for (xml::NodeSet::Iterator node(nodes.Begin()); node != nodes.End();
73                  ++node)
74          {
75 <                string url(**node/"link"/"@address"), title(**node/"link");
75 >                string url(ext::String(**node/"link"/"@address")),
76 >                        title(ext::String(**node/"link"));
77                  Page page(url, title);
78                  ext::Handle<xml::Node> list(**node/"list");
79  
# Line 94 | Line 91 | void SiteMapper::newIndex(const string&
91          for (xml::NodeSet::Iterator node(nodes.Begin()); node != nodes.End();
92                  ++node)
93          {
94 <                string address(**node/"address");
95 <                string port(**node/"port");
94 >                string address(ext::String(**node/"address"));
95 >                string port(ext::String(**node/"port"));
96  
97                  if (!port.empty())
98                  {
99                          address += ':' + port;
100                  }
101  
102 <                string path(**node/"path"), title(**node/"title");
102 >                string path(ext::String(**node/"path")),
103 >                        title(ext::String(**node/"title"));
104                  Page page(address, path, title);
105                  Matcher matcher;
106  
107                  if (page == matcher(string("^Douglas\\sThrift's\\sWebsite\\s\\|\\sDou")
108                          + "glas\\sThrift's\\sBlog:\\s(.+)$"))
109                  {
110 <                        if (Matcher("^\\w+\\s\\d\\d\\d\\d\\sArchives$") == matcher[1])
110 >                        if (Matcher("^\\w+\\s\\d{4}\\sArchives$") == matcher[1])
111                          {
112                                  page.setTitle(matcher[1]);
113  
# Line 147 | Line 145 | bool SiteMapper::newIndex(vector<Page>&
145  
146                                  pages[index] = page;
147  
148 +                                cout << "Updated: " << page.getUrl() << '\n';
149 +
150                                  return true;
151                          }
152                          else if (matcher('^' + pages[index].getPath()) == page)
# Line 210 | Line 210 | void SiteMapper::newMap(vector<Page>& pa
210          for (multimap<string, Page>::iterator itor(newPages.lower_bound(childOf));
211                  itor != newPages.upper_bound(childOf); itor++)
212          {
213 +                cout << "Added: " << itor->second.getUrl() << '\n';
214 +
215                  pages.push_back(itor->second);
216          }
217  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines