00001
00002
00003 #ifndef __ARC_CONFIG_H__
00004 #define __ARC_CONFIG_H__
00005
00006 #include <string>
00007 #include <list>
00008 #include <arc/XMLNode.h>
00009
00010 namespace Arc {
00011
00013
00023 class Config
00024 : public XMLNode {
00025 private:
00026 std::string file_name_;
00027 public:
00029 Config() : XMLNode(NS(), "ArcConfig") {}
00030 Config(const NS& ns)
00031 : XMLNode(ns, "ArcConfig") {}
00033 Config(const char *filename);
00035 Config(const std::string& xml_str)
00036 : XMLNode(xml_str) {}
00040 Config(XMLNode xml)
00041 : XMLNode(xml) {}
00042 Config(XMLNode xml, const std::string& filename)
00043 : XMLNode(xml) {
00044 file_name_ = filename;
00045 }
00046 ~Config(void);
00048 Config(long cfg_ptr_addr);
00050 Config(const Config& cfg);
00053 void print(void);
00055 bool parse(const char *filename);
00058 const std::string& getFileName(void) const {
00059 return file_name_;
00060 }
00062 void setFileName(const std::string& filename) {
00063 file_name_ = filename;
00064 }
00066 void save(const char *filename);
00067 };
00068
00073 class BaseConfig {
00074 protected:
00075 std::list<std::string> plugin_paths;
00076 public:
00077 std::string key;
00078 std::string cert;
00079 std::string proxy;
00080 std::string cafile;
00081 std::string cadir;
00082 XMLNode overlay;
00083 BaseConfig();
00084 virtual ~BaseConfig() {}
00086 void AddPluginsPath(const std::string& path);
00088 void AddPrivateKey(const std::string& path);
00090 void AddCertificate(const std::string& path);
00092 void AddProxy(const std::string& path);
00094 void AddCAFile(const std::string& path);
00096 void AddCADir(const std::string& path);
00098 void AddOverlay(XMLNode cfg);
00100 void GetOverlay(std::string fname);
00105 virtual XMLNode MakeConfig(XMLNode cfg) const;
00106 };
00107
00108 }
00109
00110 #endif