00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef OMNIEVENTS__PERSIST_NODE_H
00025 #define OMNIEVENTS__PERSIST_NODE_H
00026
00027 #ifdef HAVE_CONFIG_H
00028 # include "config.h"
00029 #endif
00030
00031 #include <string>
00032 #include <map>
00033
00034 #ifdef HAVE_IOSTREAM
00035 # include <iostream>
00036 #else
00037 # include <iostream.h>
00038 #endif
00039
00040 #ifdef HAVE_STD_IOSTREAM
00041 using namespace std;
00042 #endif
00043
00044 namespace OmniEvents {
00045
00046 class PersistNode;
00047
00048 class PersistNode
00049 {
00050 public:
00051 PersistNode(){}
00052 PersistNode(istream& is);
00053 ~PersistNode();
00054 void output(ostream& os,string name) const;
00055
00056 public:
00057 inline bool readnode(istream& is);
00058 inline bool readtoken(istream& is, string& tok);
00059 PersistNode* addnode(const string& name);
00060 void delnode(const string& name);
00061 void addattr(const string& keyvalue);
00062 void addattr(const string& key,long value);
00063
00064 public:
00065 bool hasAttr(const string& key) const;
00066 string attrString(const string& key, const string& fallback="") const;
00067 long attrLong( const string& key, long fallback=0 ) const;
00068 PersistNode* child(const string& key) const;
00069
00070 public:
00071 map<string,PersistNode*> _child;
00072 map<string,string> _attr;
00073
00074 friend class omniEventsLog;
00075 };
00076
00077 };
00078
00079 #endif // OMNIEVENTS__PERSIST_NODE_H