00001 #ifndef __ARC_XML_DATABASE_H__ 00002 #define __ARC_XML_DATABASE_H__ 00003 00004 #include <string> 00005 #include <map> 00006 #include <arc/XMLNode.h> 00007 #include "XmlContainer.h" 00008 00009 namespace Arc 00010 { 00011 00012 class XmlDatabase 00013 { 00014 private: 00015 XmlContainer *container_; 00016 00017 public: 00018 XmlDatabase():container_(NULL) { }; 00019 XmlDatabase(const std::string &db_path, const std::string &db_name); 00020 ~XmlDatabase(); 00021 void put(const std::string &name, const std::string &content); 00022 void put(const std::string &name, Arc::XMLNode &doc); 00023 void get(const std::string &name, Arc::XMLNode &doc); 00024 void del(const std::string &name); 00025 Arc::XMLNodeList query(const std::string &name, 00026 const std::string &q); 00027 void queryAll(const std::string &q, 00028 std::map<std::string, Arc::XMLNodeList> &result); 00029 void update(const std::string &name, 00030 const std::string &query, 00031 Arc::XMLNode &new_value); 00032 void checkpoint(); 00033 operator bool(void) {return (*container_);} 00034 bool operator!(void) {return !(*container_);} 00035 }; 00036 00037 } 00038 00039 #endif 00040