Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

regkey.h

Go to the documentation of this file.
00001 #pragma warning (disable:4786)
00002 #ifndef REGKEY_H
00003 #define REGKEY_H
00004 #include <winsock2.h>
00005 #include <list>
00006 #include <string>
00007 #include <abuse/RefCounted.h>
00008 #include <abuse/SysError.h>
00009 
00010 class RegKey
00011 {
00012 public:
00013         RegKey(HKEY base,const std::string& pathname,bool bCreate=true)throw(SysError);
00014         virtual ~RegKey(){};
00015         std::list<std::string> getSubkeys()const throw(SysError);
00016         void erase()throw(SysError);
00017         std::string getValue(const std::string& valueName)const throw(SysError);
00018         DWORD getDwordValue(const std::string& valueName)const throw(SysError);
00019         BYTE* getBinaryValue(const std::string& valueName,BYTE* buf,DWORD dwBufSize)const throw(SysError);
00020         DWORD getBinarySize(const std::string& valueName);
00021         void setValue(const std::string& valueName,const std::string& value) throw(SysError);
00022         void setValue(const std::string& valueName,DWORD value)throw(SysError);
00023         void setValue(const std::string& valueName,const BYTE* buf,DWORD dwBufSize)throw(SysError);
00024         void eraseValue(const std::string& valueName)throw(SysError);
00025         std::list<std::pair<std::string,std::string> > getValues()const throw(SysError);
00026         RegKey createSubkey(const std::string& name)throw (SysError);
00027         operator HKEY()const;
00028         bool hasValue(const std::string& name)const throw(SysError);
00029 
00030 private:
00031         class HKEYWrapper
00032         {
00033         public:
00034                 HKEYWrapper(HKEY hkey,bool bClose=true):m_hkey(hkey),m_bClose(bClose){}
00035                 virtual ~HKEYWrapper()
00036                 {
00037                         if(m_bClose)
00038                                 RegCloseKey(m_hkey);
00039                 }
00040                 HKEY get()const{return m_hkey;}
00041         private:
00042                 void operator=(const HKEYWrapper&); //not implem
00043                 HKEYWrapper(const HKEYWrapper&);//not impl
00044                 HKEY m_hkey;
00045                 bool m_bClose;
00046         };
00047         RefCounted<HKEYWrapper> m_hkey;
00048         RefCounted<HKEYWrapper> m_hkeyfather;
00049         std::string m_name;
00050         size_t readRawData(const std::string& valueName,BYTE* buf,DWORD bufsize)const throw(SysError);
00051 };
00052 
00053 #endif//REGKEY_H

Generated on Thu Jun 16 00:13:14 2005 for Netlib for Abuse! by  doxygen 1.4.3