|
#pragma once
////////////////////////////////////////////////////////////////////////////////
// forwards
//
class RegKey;
class RegValue;
class KeyImpl;
class ValueImpl;
////////////////////////////////////////////////////////////////////////////////
// class RegKey
//
class RegKey
{
public:
RegKey(const RegKey& other);
~RegKey();
public:
RegKey& operator=(const RegKey& rhs);
bool operator==(const RegKey& other) const;
public:
static
RegKey FromHKEY(HKEY root);
static
RegKey FromFile(const char* filename);
public:
bool IsValid() const;
RegKey Key(LPCTSTR subKeyName) const;
RegValue Value(LPCTSTR valueName) const;
void Commit() const;
private:
RegKey(KeyImpl*);
private:
KeyImpl* m_pImpl;
};
////////////////////////////////////////////////////////////////////////////////
// class RegValue
//
class RegValue
{
public:
RegValue(const RegValue& other);
~RegValue();
public:
RegValue& operator=(const RegValue& rhs);
bool operator==(const RegValue& other) const;
public:
bool Get(bool& out);
bool Set(const bool& in);
bool Get(int& out);
bool Set(const int& in);
bool Get(double& out);
bool Set(const double& in);
bool Get(LPTSTR out, int size);
bool Set(LPCTSTR in);
bool Get(void* out, int size, unsigned long& out_count);
bool Set(void* in, int size);
template <class T>
bool GetT(T& out)
{ unsigned long out_count; return (Get((void*)&out, sizeof(T), out_count) && (out_count == sizeof(T))); }
template <class T>
bool SetT(const T& in)
{ return Set((void*)&in, sizeof(T)); }
private:
RegValue(ValueImpl*);
private:
ValueImpl* m_pImpl;
friend RegKey;
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
A compiler warns of bogasity, ignore it at your peril. Unless you've done the compiler's job yourself, don't criticize it.