#include </cygdrive/c/Users/Hamis/Cygwin-packaging/wxWidgets3.1/wxWidgets3.1-3.1.5-2.x86_64/src/wxWidgets-3.1.5/interface/wx/fileconf.h>
wxFileConfig implements wxConfigBase interface for storing and retrieving configuration information using plain text files.
The files have a simple format reminiscent of Windows INI files with lines of the form "key = value"
defining the keys and lines of special form "[group]"
indicating the start of each group.
This class is used by default for wxConfig on Unix platforms but may also be used explicitly if you want to use files and not the registry even under Windows.
<>< =''>:</>&;&;< =''>\ </></>
Public Member Functions | |
wxFileConfig (const wxString &appName=wxEmptyString, const wxString &vendorName=wxEmptyString, const wxString &localFilename=wxEmptyString, const wxString &globalFilename=wxEmptyString, long style=wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_GLOBAL_FILE, const wxMBConv &conv=wxConvAuto()) | |
Constructor allowing to choose the file names to use. | |
wxFileConfig (wxInputStream &is, const wxMBConv &conv=wxConvAuto()) | |
Read the config data from the specified stream instead of the associated file, as usual. | |
virtual bool | Save (wxOutputStream &os, const wxMBConv &conv=wxConvAuto()) |
Saves all config data to the given stream, returns true if data was saved successfully or false on error. | |
void | EnableAutoSave () |
Enables saving data to the disk file when this object is destroyed. | |
void | DisableAutoSave () |
Prevent this object from saving data to the disk file when it is destroyed. | |
void | SetUmask (int mode) |
Allows setting the mode to be used for the config file creation. | |
virtual void | SetPath (const wxString &strPath) |
Set current path: if the first character is '/', it is the absolute path, otherwise it is a relative path. | |
virtual const wxString & | GetPath () const |
Retrieve the current path (always as absolute path). | |
virtual bool | GetFirstGroup (wxString &str, long &lIndex) const |
Gets the first group. | |
virtual bool | GetNextGroup (wxString &str, long &lIndex) const |
Gets the next group. | |
virtual bool | GetFirstEntry (wxString &str, long &lIndex) const |
Gets the first entry. | |
virtual bool | GetNextEntry (wxString &str, long &lIndex) const |
Gets the next entry. | |
virtual size_t | GetNumberOfEntries (bool bRecursive=false) const |
Get number of entries in the current group. | |
virtual size_t | GetNumberOfGroups (bool bRecursive=false) const |
Get number of entries/subgroups in the current group, with or without its subgroups. | |
virtual bool | HasGroup (const wxString &strName) const |
virtual bool | HasEntry (const wxString &strName) const |
virtual bool | Flush (bool bCurrentOnly=false) |
Permanently writes all changes (otherwise, they're only written from object's destructor). | |
virtual bool | RenameEntry (const wxString &oldName, const wxString &newName) |
virtual bool | RenameGroup (const wxString &oldName, const wxString &newName) |
virtual bool | DeleteEntry (const wxString &key, bool bGroupIfEmptyAlso=true) |
virtual bool | DeleteGroup (const wxString &szKey) |
virtual bool | DeleteAll () |
![]() | |
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. | |
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. | |
wxString | GetAppName () const |
Returns the application name. | |
wxString | GetVendorName () const |
Returns the vendor name. | |
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, wxLongLong_t *ll) const |
Reads a 64-bit long long value, returning true if the value was found. | |
![]() | |
wxObject () | |
Default ctor; initializes to NULL the internal reference data. | |
wxObject (const wxObject &other) | |
Copy ctor. | |
virtual | ~wxObject () |
Destructor. | |
virtual wxClassInfo * | GetClassInfo () const |
This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). | |
wxObjectRefData * | GetRefData () 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. | |
Static Public Member Functions | |
static wxFileName | GetGlobalFile (const wxString &basename) |
Return the full path to the file which would be used by wxFileConfig as global, system-wide, file if it were constructed with basename as "global filename" parameter in the constructor. | |
static wxFileName | GetLocalFile (const wxString &basename, int style=0) |
Return the full path to the file which would be used by wxFileConfig as local, user-specific, file if it were constructed with basename as "local filename" parameter in the constructor. | |
static wxString | GetGlobalFileName (const wxString &szFile) |
static wxString | GetLocalFileName (const wxString &szFile, int style=0) |
Additional Inherited Members | |
![]() | |
enum | EntryType { Type_Unknown , Type_String , Type_Boolean , Type_Integer , Type_Float } |
Gets the first entry. More... | |
![]() | |
void | AllocExclusive () |
Ensure that this object's data is not shared with any other object. | |
virtual wxObjectRefData * | CreateRefData () const |
Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. | |
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const |
Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. | |
![]() | |
wxObjectRefData * | m_refData |
Pointer to an object which is the object's reference-counted data. | |
wxFileConfig::wxFileConfig | ( | const wxString & | appName = wxEmptyString, |
const wxString & | vendorName = wxEmptyString, | ||
const wxString & | localFilename = wxEmptyString, | ||
const wxString & | globalFilename = wxEmptyString, | ||
long | style = wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_GLOBAL_FILE, | ||
const wxMBConv & | conv = wxConvAuto() ) |
Constructor allowing to choose the file names to use.
If localFilename and/or globalFilename are explicitly specified, they are used as the names of the user and system-wide configuration files (the latter is only read by the program while the former is read from and written to). Otherwise the behaviour depends on style parameter. If it includes wxCONFIG_USE_LOCAL_FILE, then the local file name is constructed from the information in appName and vendorName arguments in a system-dependent way. If wxCONFIG_USE_GLOBAL_FILE is not specified at all (and globalFilename is empty) then the system-wide file is not used at all. Otherwise its name and path are also constructed in the way appropriate for the current platform from the application and vendor names.
wxFileConfig::wxFileConfig | ( | wxInputStream & | is, |
const wxMBConv & | conv = wxConvAuto() ) |
Read the config data from the specified stream instead of the associated file, as usual.
|
virtual |
|
virtual |
|
virtual |
void wxFileConfig::DisableAutoSave | ( | ) |
Prevent this object from saving data to the disk file when it is destroyed.
By default, changes to this object are only saved permanently when Flush() is explicitly called or when it is destroyed. If this method is called, Flush() won't be called automatically from the destructor, meaning that any non-explicitly-flushed changes will be lost.
void wxFileConfig::EnableAutoSave | ( | ) |
Enables saving data to the disk file when this object is destroyed.
This is the default behaviour and this function doesn't need to be called explicitly unless DisableAutoSave() had been previously called.
|
virtual |
Permanently writes all changes (otherwise, they're only written from object's destructor).
Implements wxConfigBase.
|
virtual |
Gets the first entry.
wxPerl Note: In wxPerl this method takes no parameters and returns a 3-element list (continue_flag, string, index_for_getnextentry).
Implements wxConfigBase.
|
virtual |
Gets the first group.
wxPerl Note: In wxPerl this method takes no parameters and returns a 3-element list (continue_flag, string, index_for_getnextentry).
Implements wxConfigBase.
|
static |
Return the full path to the file which would be used by wxFileConfig as global, system-wide, file if it were constructed with basename as "global filename" parameter in the constructor.
Notice that this function cannot be used if basename is already a full path name.
|
static |
Return the full path to the file which would be used by wxFileConfig as local, user-specific, file if it were constructed with basename as "local filename" parameter in the constructor.
style has the same meaning as in wxConfig constructor and can contain any combination of styles but only wxCONFIG_USE_SUBDIR bit is examined by this function.
Notice that this function cannot be used if basename is already a full path name.
|
virtual |
Gets the next entry.
wxPerl Note: In wxPerl this method only takes the index parameter and returns a 3-element list (continue_flag, string, index_for_getnextentry).
Implements wxConfigBase.
|
virtual |
Gets the next group.
wxPerl Note: In wxPerl this method only takes the index parameter and returns a 3-element list (continue_flag, string, index_for_getnextentry).
Implements wxConfigBase.
|
virtual |
Get number of entries in the current group.
Implements wxConfigBase.
|
virtual |
Get number of entries/subgroups in the current group, with or without its subgroups.
Implements wxConfigBase.
|
virtual |
Retrieve the current path (always as absolute path).
Implements wxConfigBase.
|
virtual |
Implements wxConfigBase.
|
virtual |
Implements wxConfigBase.
|
virtual |
|
virtual |
|
virtual |
Saves all config data to the given stream, returns true if data was saved successfully or false on error.
Note the interaction of this function with the internal "dirty flag": the data is saved unconditionally, i.e. even if the object is not dirty. However after saving it successfully, the dirty flag is reset so no changes will be written back to the file this object is associated with until you change its contents again.
|
virtual |
Set current path: if the first character is '/', it is the absolute path, otherwise it is a relative path.
'..' is supported. If strPath doesn't exist, it is created.
Implements wxConfigBase.
void wxFileConfig::SetUmask | ( | int | mode | ) |
Allows setting the mode to be used for the config file creation.
For example, to create a config file which is not readable by other users (useful if it stores some sensitive information, such as passwords), you could use SetUmask(0077)
.
This function doesn't do anything on non-Unix platforms.