5 |
|
// $Id$ |
6 |
|
|
7 |
|
#include "SiteMapper.hpp" |
8 |
< |
#include "Matcher.hpp" |
9 |
< |
#include "Page.hpp" |
8 |
> |
#include "Matcher/Matcher.hpp" |
9 |
|
|
10 |
|
#include <menes-api/exename.hpp> |
11 |
|
#include <menes-app/application.hpp> |
12 |
|
|
14 |
– |
ext::String program; |
15 |
– |
bool debug(false); |
16 |
– |
|
13 |
|
struct SiteMapperCommand : public app::Application |
14 |
|
{ |
15 |
|
virtual int Run(const app::ArgumentList& args) |
16 |
|
{ |
17 |
< |
program = api::GetExecutablePath().GetName(); |
17 |
> |
SiteMapper::program = api::GetExecutablePath().GetName(); |
18 |
|
|
19 |
|
ext::String siteIndex, siteMap; |
20 |
|
|
32 |
|
} |
33 |
|
else if (*arg == "-D") |
34 |
|
{ |
35 |
< |
if (!debug) debug = true; |
35 |
> |
if (!SiteMapper::debug) SiteMapper::debug = true; |
36 |
|
} |
37 |
|
} |
38 |
|
|
42 |
|
} |
43 |
|
else |
44 |
|
{ |
45 |
< |
api::Cout << "Usage: " << program << " -index=index -map=map [-D]\n"; |
45 |
> |
api::Cout << "Usage: " << SiteMapper::program << " -index=index -map=map [-D]\n"; |
46 |
|
} |
47 |
|
|
48 |
|
return 0; |
56 |
|
newMap(siteMap); |
57 |
|
} |
58 |
|
|
59 |
+ |
ext::String SiteMapper::program; |
60 |
+ |
bool SiteMapper::debug(false); |
61 |
+ |
|
62 |
|
void SiteMapper::oldMap(const ext::String& siteMap) |
63 |
|
{ |
64 |
|
ext::Handle<xml::Document> document(xml::Parse(siteMap)); |
66 |
|
|
67 |
|
comment = *document/"comment()"; |
68 |
|
|
69 |
< |
if (debug) api::Cerr << "comment = " << comment << '\n'; |
69 |
> |
if (debug) api::Cerr << "comment = " << comment << ios::NewLine; |
70 |
|
|
71 |
|
oldMap(pages, list); |
72 |
|
} |
141 |
|
|
142 |
|
*page_ = page; |
143 |
|
|
144 |
< |
api::Cout << "Updated: " << page.getUrl() << "\n"; |
144 |
> |
api::Cout << "Updated: " << page.getUrl() << ios::NewLine; |
145 |
|
|
146 |
|
return true; |
147 |
|
} |
193 |
|
|
194 |
|
_for (MultiMap::const_iterator, itor, newPages.lower_bound(childOf), newPages.upper_bound(childOf)) |
195 |
|
{ |
196 |
< |
api::Cout << "Added: " << itor->second.getUrl() << "\n"; |
196 |
> |
api::Cout << "Added: " << itor->second.getUrl() << ios::NewLine; |
197 |
|
|
198 |
|
pages.InsertLast(itor->second); |
199 |
|
} |