00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PREFERENCESTOOL_H
00021 #define PREFERENCESTOOL_H
00022
00023 #include <libxml/tree.h>
00024
00025
00033 class PreferencesTool
00034 {
00035 public:
00040 static PreferencesTool* get();
00041
00050 bool setPreferencesFile(const char* filePath, const char* version);
00051
00057
00058
00065
00066
00079 bool setPreference(const char* key, const char* attribute, bool flushLater = false);
00080
00093 bool setPreference(const char* key, const int attribute, bool flushLater = false);
00094
00103 const char* getPreference(const char* key, const char* defaultValue);
00104
00113 const int getPreference(const char* key, const int defaultValue);
00114
00120 void removePreference(const char* key);
00121
00126 bool flushPreferences();
00127
00128
00129 protected:
00133 PreferencesTool();
00134
00138 ~PreferencesTool();
00139
00140 private:
00142 static PreferencesTool *preferencesTool;
00143
00144 xmlDocPtr doc;
00145 xmlDtdPtr dtd;
00146 xmlNodePtr rootNode;
00147 xmlNodePtr preferences;
00148
00149 char *preferencesFile;
00150
00156 xmlNodePtr findNode(const char* key);
00157
00162 bool fileExists(const char* filePath);
00163
00168 void checkInitialized();
00169
00173 void cleanTree();
00174 };
00175
00176 #endif