00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef INCL_EVOLUTION_SAFE_CONFIG_NODE
00021 # define INCL_EVOLUTION_SAFE_CONFIG_NODE
00022
00023 #include <ConfigNode.h>
00024 #include <boost/shared_ptr.hpp>
00025
00026 #include <map>
00027 #include <utility>
00028 #include <vector>
00029 #include <string>
00030 using namespace std;
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class SafeConfigNode : public ConfigNode {
00042 public:
00043
00044 SafeConfigNode(const boost::shared_ptr<ConfigNode> &node);
00045
00046
00047 SafeConfigNode(const boost::shared_ptr<const ConfigNode> &node);
00048
00049 virtual string getName() const { return m_readOnlyNode->getName(); }
00050
00051
00052 virtual void flush();
00053 virtual string readProperty(const string &property) const;
00054 virtual void setProperty(const string &property,
00055 const string &value,
00056 const string &comment = "",
00057 const string *defValue = NULL);
00058 virtual void readProperties(map<string, string> &props) const;
00059 virtual void removeProperty(const string &property);
00060 virtual bool exists() const { return m_readOnlyNode->exists(); }
00061
00062 private:
00063 boost::shared_ptr<ConfigNode> m_node;
00064 boost::shared_ptr<const ConfigNode> m_readOnlyNode;
00065
00066
00067
00068
00069 static string escape(const string &str);
00070
00071
00072 static string unescape(const string &str);
00073 };
00074
00075 #endif