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" |
36 |
|
} |
37 |
|
} |
38 |
|
|
39 |
< |
if (siteIndex != "" && siteMap != "") |
39 |
> |
if (!siteIndex.empty() && !siteMap.empty()) |
40 |
|
{ |
41 |
|
SiteMapper mapper(siteIndex, siteMap); |
42 |
|
} |
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 |
|
} |
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 |
|
|
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 |
|
|
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) |
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 |
|
|