Version: 3.1.0

#include <wx/msw/regconf.h>

+ Inheritance diagram for wxRegConfig:

Detailed Description

wxRegConfig implements the wxConfigBase interface for storing and retrieving configuration information using Windows registry.

This class is used by default for wxConfig on Windows platforms; see wxFileConfig for an alternative you may want to use (also on Windows).

Library:  wxBase
Category:  Application and System configuration
See also
wxConfigBase

Public Member Functions

 wxRegConfig (const wxString &appName=wxEmptyString, const wxString &vendorName=wxEmptyString, const wxString &localFilename=wxEmptyString, const wxString &globalFilename=wxEmptyString, long style=wxCONFIG_USE_GLOBAL_FILE)
 The wxRegConfig constructor. More...
 
- Public Member Functions inherited from wxConfigBase
 wxConfigBase (const wxString &appName=wxEmptyString, const wxString &vendorName=wxEmptyString, const wxString &localFilename=wxEmptyString, const wxString &globalFilename=wxEmptyString, long style=0, const wxMBConv &conv=wxConvAuto())
 This is the default and only constructor of the wxConfigBase class, and derived classes. More...
 
virtual ~wxConfigBase ()
 Empty but ensures that dtor of all derived classes is virtual. More...
 
virtual const wxStringGetPath () const =0
 Retrieve the current path (always as absolute path). More...
 
virtual void SetPath (const wxString &strPath)=0
 Set current path: if the first character is '/', it is the absolute path, otherwise it is a relative path. More...
 
virtual bool GetFirstEntry (wxString &str, long &index) const =0
 Gets the first entry. More...
 
virtual bool GetFirstGroup (wxString &str, long &index) const =0
 Gets the first group. More...
 
virtual bool GetNextEntry (wxString &str, long &index) const =0
 Gets the next entry. More...
 
virtual bool GetNextGroup (wxString &str, long &index) const =0
 Gets the next group. More...
 
virtual size_t GetNumberOfEntries (bool bRecursive=false) const =0
 Get number of entries in the current group. More...
 
virtual size_t GetNumberOfGroups (bool bRecursive=false) const =0
 Get number of entries/subgroups in the current group, with or without its subgroups. More...
 
bool Exists (const wxString &strName) const
 
virtual wxConfigBase::EntryType GetEntryType (const wxString &name) const
 Returns the type of the given entry or Unknown if the entry doesn't exist. More...
 
virtual bool HasEntry (const wxString &strName) const =0
 
virtual bool HasGroup (const wxString &strName) const =0
 
wxString GetAppName () const
 Returns the application name. More...
 
wxString GetVendorName () const
 Returns the vendor name. More...
 
virtual bool Flush (bool bCurrentOnly=false)=0
 Permanently writes all changes (otherwise, they're only written from object's destructor). More...
 
bool Read (const wxString &key, wxString *str) const
 Read a string from the key, returning true if the value was read. More...
 
bool Read (const wxString &key, wxString *str, const wxString &defaultVal) const
 Read a string from the key. More...
 
const wxString Read (const wxString &key, const wxString &defaultVal) const
 Another version of Read(), returning the string value directly. More...
 
bool Read (const wxString &key, long *l) const
 Reads a long value, returning true if the value was found. More...
 
bool Read (const wxString &key, long *l, long defaultVal) const
 Reads a long value, returning true if the value was found. More...
 
bool Read (const wxString &key, double *d) const
 Reads a double value, returning true if the value was found. More...
 
bool Read (const wxString &key, double *d, double defaultVal) const
 Reads a double value, returning true if the value was found. More...
 
bool Read (const wxString &key, float *f) const
 Reads a float value, returning true if the value was found. More...
 
bool Read (const wxString &key, float *f, float defaultVal) const
 Reads a float value, returning true if the value was found. More...
 
bool Read (const wxString &key, bool *b) const
 Reads a boolean value, returning true if the value was found. More...
 
bool Read (const wxString &key, bool *d, bool defaultVal) const
 Reads a boolean value, returning true if the value was found. More...
 
bool Read (const wxString &key, wxMemoryBuffer *buf) const
 Reads a binary block, returning true if the value was found. More...
 
bool Read (const wxString &key, T *value) const
 Reads a value of type T, for which function wxFromString() is defined, returning true if the value was found. More...
 
bool Read (const wxString &key, T *value, const T &defaultVal) const
 Reads a value of type T, for which function wxFromString() is defined, returning true if the value was found. More...
 
bool ReadBool (const wxString &key, bool defaultVal) const
 Reads a bool value from the key and returns it. More...
 
double ReadDouble (const wxString &key, double defaultVal) const
 Reads a double value from the key and returns it. More...
 
long ReadLong (const wxString &key, long defaultVal) const
 Reads a long value from the key and returns it. More...
 
ReadObject (const wxString &key, T const &defaultVal) const
 Reads a value of type T (for which the function wxFromString() must be defined) from the key and returns it. More...
 
bool Write (const wxString &key, const wxString &value)
 Writes the wxString value to the config file and returns true on success. More...
 
bool Write (const wxString &key, long value)
 Writes the long value to the config file and returns true on success. More...
 
bool Write (const wxString &key, double value)
 Writes the double value to the config file and returns true on success. More...
 
bool Write (const wxString &key, bool value)
 Writes the bool value to the config file and returns true on success. More...
 
bool Write (const wxString &key, const wxMemoryBuffer &buf)
 Writes the wxMemoryBuffer value to the config file and returns true on success. More...
 
bool Write (const wxString &key, T const &buf)
 Writes the specified value to the config file and returns true on success. More...
 
virtual bool RenameEntry (const wxString &oldName, const wxString &newName)=0
 Renames an entry in the current group. More...
 
virtual bool RenameGroup (const wxString &oldName, const wxString &newName)=0
 Renames a subgroup of the current group. More...
 
virtual bool DeleteAll ()=0
 Delete the whole underlying object (disk file, registry key, ...). More...
 
virtual bool DeleteEntry (const wxString &key, bool bDeleteGroupIfEmpty=true)=0
 Deletes the specified entry and the group it belongs to if it was the last key in it and the second parameter is true. More...
 
virtual bool DeleteGroup (const wxString &key)=0
 Delete the group (with all subgroups). More...
 
bool IsExpandingEnvVars () const
 Returns true if we are expanding environment variables in key values. More...
 
bool IsRecordingDefaults () const
 Returns true if we are writing defaults back to the config file. More...
 
void SetExpandEnvVars (bool bDoIt=true)
 Determine whether we wish to expand environment variables in key values. More...
 
void SetRecordDefaults (bool bDoIt=true)
 Sets whether defaults are recorded to the config file whenever an attempt to read the value which is not present in it is done. More...
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data. More...
 
 wxObject (const wxObject &other)
 Copy ctor. More...
 
virtual ~wxObject ()
 Destructor. More...
 
virtual wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class. More...
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj. More...
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone. More...
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer. More...
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public. More...
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More...
 
void * operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
 The new operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More...
 

Additional Inherited Members

- Public Types inherited from wxConfigBase
enum  EntryType {
  Type_Unknown,
  Type_String,
  Type_Boolean,
  Type_Integer,
  Type_Float
}
 
- Static Public Member Functions inherited from wxConfigBase
static wxConfigBaseCreate ()
 Create a new config object and sets it as the current one. More...
 
static void DontCreateOnDemand ()
 Calling this function will prevent Get() from automatically creating a new config object if the current one is NULL. More...
 
static wxConfigBaseGet (bool CreateOnDemand=true)
 Get the current config object. More...
 
static wxConfigBaseSet (wxConfigBase *pConfig)
 Sets the config object as the current one, returns the pointer to the previous current object (both the parameter and returned value may be NULL). More...
 
- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object. More...
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More...
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data. More...
 

Constructor & Destructor Documentation

wxRegConfig::wxRegConfig ( const wxString appName = wxEmptyString,
const wxString vendorName = wxEmptyString,
const wxString localFilename = wxEmptyString,
const wxString globalFilename = wxEmptyString,
long  style = wxCONFIG_USE_GLOBAL_FILE 
)

The wxRegConfig constructor.

For more info see the docs for the wxConfigBase::wxConfigBase() constructor.

Note that wxRegConfig's style argument defaults to wxCONFIG_USE_GLOBAL_FILE, i.e. to the use of the HKLM key (also known as "HKEY_LOCAL_MACHINE").