9 |
|
|
10 |
|
int main(int argc, char* argv[]) |
11 |
|
{ |
12 |
< |
// |
12 |
> |
Zoe::program = argv[0]; |
13 |
> |
|
14 |
> |
for (int index(1); index < argc; ++index) |
15 |
> |
{ |
16 |
> |
ext::String arg(argv[index]); |
17 |
> |
Matcher matcher; |
18 |
> |
|
19 |
> |
if (arg == matcher("^-config=(.*)$")) |
20 |
> |
{ |
21 |
> |
Zoe::config = matcher[1]; |
22 |
> |
} |
23 |
> |
else if (arg == "-D") |
24 |
> |
{ |
25 |
> |
if (!Zoe::debug) Zoe::debug = true; |
26 |
> |
} |
27 |
> |
else |
28 |
> |
{ |
29 |
> |
cerr << "Usage: " << Zoe::program << " [-config=config] [-D]\n"; |
30 |
> |
} |
31 |
> |
} |
32 |
> |
|
33 |
> |
Zoe zoe; |
34 |
|
|
35 |
|
return 0; |
36 |
|
} |
37 |
+ |
|
38 |
+ |
Zoe::Zoe() : rss("zoe.rss") |
39 |
+ |
{ |
40 |
+ |
configure(); |
41 |
+ |
} |
42 |
+ |
|
43 |
+ |
bool Zoe::debug(false); |
44 |
+ |
ext::String Zoe::program, Zoe::config("zoe.xml"); |
45 |
+ |
|
46 |
+ |
void Zoe::configure() |
47 |
+ |
{ |
48 |
+ |
ext::Handle<xml::Document> document(xml::Parse(config)); |
49 |
+ |
ext::Handle<xml::Node> zoe(*document/"zoe"); |
50 |
+ |
|
51 |
+ |
login = *zoe/"login"; |
52 |
+ |
password = *zoe/"password"; |
53 |
+ |
|
54 |
+ |
if (!(*zoe/"rss").IsEmpty()) rss = *zoe/"rss"; |
55 |
+ |
} |