2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: fileconf.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxFileConfig
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxFileConfig
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
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
|
2008-05-10 05:44:43 -04:00
|
|
|
form @c "key = value" defining the keys and lines of special form
|
|
|
|
@c "[group]" indicating the start of each group.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
2009-02-20 06:34:52 -05:00
|
|
|
@category{cfg}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxFileConfig::Save
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxFileConfig : public wxConfigBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Read the config data from the specified stream instead of the associated file,
|
|
|
|
as usual.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see Save()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-01 09:55:38 -04:00
|
|
|
wxFileConfig(wxInputStream& is, const wxMBConv& conv = wxConvAuto());
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Return the full path to the file which would be used by wxFileConfig as global,
|
2008-04-01 09:55:38 -04:00
|
|
|
system-wide, file if it were constructed with @a basename as "global filename"
|
|
|
|
parameter in the constructor.
|
|
|
|
|
|
|
|
Notice that this function cannot be used if @a basename is already a full path name.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
static wxFileName GetGlobalFile(const wxString& basename);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Return the full path to the file which would be used by wxFileConfig as local,
|
2008-04-01 09:55:38 -04:00
|
|
|
user-specific, file if it were constructed with @a basename as "local filename"
|
|
|
|
parameter in the constructor.
|
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
@a style has the same meaning as in @ref wxConfigBase::wxConfigBase "wxConfig constructor"
|
2008-03-08 08:52:38 -05:00
|
|
|
and can contain any combination of styles but only wxCONFIG_USE_SUBDIR bit is
|
|
|
|
examined by this function.
|
2008-04-01 09:55:38 -04:00
|
|
|
|
|
|
|
Notice that this function cannot be used if @a basename is already a full path name.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-05-10 05:44:43 -04:00
|
|
|
static wxFileName GetLocalFile(const wxString& basename, int style = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Saves all config data to the given stream, returns @true if data was saved
|
|
|
|
successfully or @false on error.
|
2008-04-01 09:55:38 -04:00
|
|
|
|
|
|
|
Note the interaction of this function with the internal "dirty flag": the
|
2008-03-08 08:52:38 -05:00
|
|
|
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.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see wxConfigBase::Flush
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-14 15:48:14 -04:00
|
|
|
virtual bool Save(wxOutputStream& os, const wxMBConv& conv = wxConvAuto());
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Allows to set 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
|
2008-04-01 09:55:38 -04:00
|
|
|
some sensitive information, such as passwords), you could use @c SetUmask(0077).
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This function doesn't do anything on non-Unix platforms.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxCHANGE_UMASK()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetUmask(int mode);
|
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|