Version: 3.1.0
wxRegConfig Class Reference

#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.
 
- 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.
 
virtual ~wxConfigBase ()
 Empty but ensures that dtor of all derived classes is virtual.
 
virtual const wxStringGetPath () const =0
 Retrieve the current path (always as absolute path).
 
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.
 
virtual bool GetFirstEntry (wxString &str, long &index) const =0
 Gets the first entry.
 
virtual bool GetFirstGroup (wxString &str, long &index) const =0
 Gets the first group.
 
virtual bool GetNextEntry (wxString &str, long &index) const =0
 Gets the next entry.
 
virtual bool GetNextGroup (wxString &str, long &index) const =0
 Gets the next group.
 
virtual size_t GetNumberOfEntries (bool bRecursive=false) const =0
 Get number of entries in the current group.
 
virtual size_t GetNumberOfGroups (bool bRecursive=false) const =0
 Get number of entries/subgroups in the current group, with or without its subgroups.
 
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.
 
virtual bool HasEntry (const wxString &strName) const =0
 
virtual bool HasGroup (const wxString &strName) const =0
 
wxString GetAppName () const
 Returns the application name.
 
wxString GetVendorName () const
 Returns the vendor name.
 
virtual bool Flush (bool bCurrentOnly=false)=0
 Permanently writes all changes (otherwise, they're only written from object's destructor).
 
bool Read (const wxString &key, wxString *str) const
 Read a string from the key, returning true if the value was read.
 
bool Read (const wxString &key, wxString *str, const wxString &defaultVal) const
 Read a string from the key.
 
const wxString Read (const wxString &key, const wxString &defaultVal) const
 Another version of Read(), returning the string value directly.
 
bool Read (const wxString &key, long *l) const
 Reads a long value, returning true if the value was found.
 
bool Read (const wxString &key, long *l, long defaultVal) const
 Reads a long value, returning true if the value was found.
 
bool Read (const wxString &key, double *d) const
 Reads a double value, returning true if the value was found.
 
bool Read (const wxString &key, double *d, double defaultVal) const
 Reads a double value, returning true if the value was found.
 
bool Read (const wxString &key, float *f) const
 Reads a float value, returning true if the value was found.
 
bool Read (const wxString &key, float *f, float defaultVal) const
 Reads a float value, returning true if the value was found.
 
bool Read (const wxString &key, bool *b) const
 Reads a boolean value, returning true if the value was found.
 
bool Read (const wxString &key, bool *d, bool defaultVal) const
 Reads a boolean value, returning true if the value was found.
 
bool Read (const wxString &key, wxMemoryBuffer *buf) const
 Reads a binary block, returning true if the value was found.
 
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.
 
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.
 
bool ReadBool (const wxString &key, bool defaultVal) const
 Reads a bool value from the key and returns it.
 
double ReadDouble (const wxString &key, double defaultVal) const
 Reads a double value from the key and returns it.
 
long ReadLong (const wxString &key, long defaultVal) const
 Reads a long value from the key and returns it.
 
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.
 
bool Write (const wxString &key, const wxString &value)
 Writes the wxString value to the config file and returns true on success.
 
bool Write (const wxString &key, long value)
 Writes the long value to the config file and returns true on success.
 
bool Write (const wxString &key, double value)
 Writes the double value to the config file and returns true on success.
 
bool Write (const wxString &key, bool value)
 Writes the bool value to the config file and returns true on success.
 
bool Write (const wxString &key, const wxMemoryBuffer &buf)
 Writes the wxMemoryBuffer value to the config file and returns true on success.
 
bool Write (const wxString &key, T const &buf)
 Writes the specified value to the config file and returns true on success.
 
virtual bool RenameEntry (const wxString &oldName, const wxString &newName)=0
 Renames an entry in the current group.
 
virtual bool RenameGroup (const wxString &oldName, const wxString &newName)=0
 Renames a subgroup of the current group.
 
virtual bool DeleteAll ()=0
 Delete the whole underlying object (disk file, registry key, ...).
 
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.
 
virtual bool DeleteGroup (const wxString &key)=0
 Delete the group (with all subgroups).
 
bool IsExpandingEnvVars () const
 Returns true if we are expanding environment variables in key values.
 
bool IsRecordingDefaults () const
 Returns true if we are writing defaults back to the config file.
 
void SetExpandEnvVars (bool bDoIt=true)
 Determine whether we wish to expand environment variables in key values.
 
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.
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data.
 
 wxObject (const wxObject &other)
 Copy ctor.
 
virtual ~wxObject ()
 Destructor.
 
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).
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class.
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj.
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone.
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer.
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data.
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public.
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined.
 
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.
 

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.
 
static void DontCreateOnDemand ()
 Calling this function will prevent Get() from automatically creating a new config object if the current one is NULL.
 
static wxConfigBaseGet (bool CreateOnDemand=true)
 Get the current config object.
 
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).
 
- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object.
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it.
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data.
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data.
 

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").