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

Comparing trunk/Zoe.cpp (file contents):
Revision 38 by douglas, 2004-07-22T22:42:40-07:00 vs.
Revision 43 by douglas, 2004-08-15T21:33:25-07:00

# Line 48 | Line 48 | int main(int argc, char* argv[])
48                  {
49                          if (!Zoe::debug) Zoe::debug = true;
50                  }
51 <                else
52 <                {
53 <                        cerr << "Usage: " << Zoe::program << " [-config=config] "
54 <                                "[-collector] [-publisher] [-color] [-D]\n";
55 <
56 <                        return 1;
57 <                }
51 >                else Zoe::usage();
52          }
53  
54          Zoe zoe;
# Line 64 | Line 58 | int main(int argc, char* argv[])
58  
59   Zoe::Zoe()
60   {
61 +        if (!(collector || publisher)) usage();
62 +        
63          configure();
64          initialize();
65  
# Line 75 | Line 71 | bool Zoe::debug(false), Zoe::collector(f
71           Zoe::color(false);
72   ext::String Zoe::program, Zoe::config("zoe.xml");
73  
74 + void Zoe::usage()
75 + {
76 +        cerr << "Usage: " << Zoe::program << " [-config=config] [-collector] "
77 +                "[-publisher] [-color] [-D]\n";
78 +
79 +        exit(1);
80 + }
81 +
82   ext::String Zoe::generator(Generator generator)
83   {
84          ext::String generator_(generator == all || generator == agent ? "Zoe" : "");
# Line 148 | Line 152 | void Zoe::configure()
152                  << "   password = " << std::string(database.password.GetSize(), '*')
153                  << "\n   db = " << database.db << "\n}\n";
154  
155 +        std::string link(*zoe/"link");
156          xml::NodeSet buddies(*zoe/"buddy");
157  
158          for (xml::NodeSet::Iterator buddy(buddies.Begin()); buddy != buddies.End();
159                  ++buddy)
160          {
161 <                this->buddies.insert(Buddy(**buddy/"login", **buddy/"rss",
162 <                        **buddy/"atom"));
161 >                Buddy buddy_(**buddy/"login", **buddy/"rss", **buddy/"atom",
162 >                        !(**buddy/"link").IsEmpty() ? **buddy/"link" : link);
163 >
164 >                this->buddies.insert(buddy_);
165          }
166  
167          if (debug)
# Line 165 | Line 172 | void Zoe::configure()
172                          buddy != this->buddies.end(); ++buddy)
173                  {
174                          cerr << "   " << *buddy << " = {\n      rss = " << buddy->getRss()
175 <                                << "\n      atom = " << buddy->getAtom() << "\n   }\n";
175 >                                << "\n      atom = " << buddy->getAtom() << "\n      link = "
176 >                                << buddy->getLink() << "\n   }\n";
177                  }
178  
179                  cerr << "}\n";
180          }
181  
174        if (!collector && !publisher)
175        {
176                collector = true;
177                publisher = true;
178        }
179
182          if (debug) cerr << "collector = " << lexical_cast<ext::String>(collector)
183                  << "\npublisher = " << lexical_cast<ext::String>(publisher)
184                  << "\ncolor = " << lexical_cast<ext::String>(color) << '\n';

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines