00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef HxRegistry_h
00012 #define HxRegistry_h
00013 #pragma warning (disable : 4786)
00014
00015 #include "HxIoFwd.h"
00016 #include "HxString.h"
00017 #include "HxRegKey.h"
00018
00019 #include "HxTracedObject.h"
00020
00021 class L_HXBASIS HxRegistry TRACED_OBJECT
00022 {
00023 public:
00024 HxRegistry();
00025 ~HxRegistry();
00026
00027 static HxRegistry& instance();
00028
00029 int import(HxString fileName);
00030 int import(const char* argv[]);
00031 int exportText(STD_OSTREAM& out) const;
00032 int exportC(STD_OSTREAM& out, HxString label) const;
00033
00034 HxRegKey* insertKey(HxString path);
00035 void eraseKey(HxString path);
00036
00037 HxRegKey* findKey(HxString path) const;
00038
00039 void insertValue(HxString path, const HxRegData&);
00040 void insertValue(HxString path, HxString data);
00041 void insertValue(HxString path, int data);
00042 void eraseValue(HxString path);
00043
00044 HxString findValue(HxString path) const;
00045 int valueExists(HxString path) const;
00046
00047
00048 HxRegKey* setCursorKey(HxString path);
00049 HxRegKey* setCursorUp();
00050 HxRegKey* getCursorKey() const;
00051 HxString getCursorName() const;
00052
00053 HxRegKey* setRootKey();
00054 HxRegKey* getRootKey() const;
00055
00056 STD_OSTREAM& put(STD_OSTREAM&) const;
00057
00058 private:
00059 HxRegistry(const HxRegistry&);
00060 const HxRegistry& operator=(const HxRegistry&);
00061
00062 HxString getCannonicName(HxString) const;
00063 const HxRegValue* doFindValue(HxString path) const;
00064
00065
00066 #pragma warning (disable : 4251)
00067 HxRegKey* _rootKey;
00068 HxRegKey* _cursorKey;
00069
00070 HxString _cursorName;
00071 #pragma warning (default : 4251)
00072 };
00073
00074 inline STD_OSTREAM&
00075 operator<<(STD_OSTREAM& os, const HxRegistry& reg)
00076 {
00077 return reg.put(os);
00078 }
00079
00080 inline void
00081 HxRegistry::insertValue(HxString path, HxString data)
00082 {
00083 insertValue(path, HxRegData(data));
00084 }
00085
00086 inline void
00087 HxRegistry::insertValue(HxString path, int data)
00088 {
00089 insertValue(path, HxRegData(data));
00090 }
00091
00092 inline HxRegKey*
00093 HxRegistry::getCursorKey() const { return _cursorKey; }
00094
00095 inline HxString
00096 HxRegistry::getCursorName() const { return _cursorName; }
00097
00098 inline HxRegKey*
00099 HxRegistry::getRootKey() const { return _rootKey; }
00100
00101 inline HxRegKey*
00102 HxRegistry::setRootKey() { return _cursorKey = _rootKey; }
00103
00104 #endif