#include <config.h>
Inheritance diagram for PConfig:
Construction | |
enum | Source { Environment, System, Application, NumSources } |
PConfig (Source src=Application) | |
PConfig (Source src, const PString &appname) | |
PConfig (Source src, const PString &appname, const PString &manuf) | |
PConfig (const PString §ion, Source src=Application) | |
PConfig (const PString §ion, Source src, const PString &appname) | |
PConfig (const PString §ion, Source src, const PString &appname, const PString &manuf) | |
PConfig (const PFilePath &filename, const PString §ion) | |
Public Types | |
Public Member Functions | |
PConfig (int, const PString &name) | |
~PConfig () | |
Section functions | |
virtual void | SetDefaultSection (const PString §ion) |
virtual PString | GetDefaultSection () const |
virtual PStringList | GetSections () const |
virtual PStringList | GetKeys () const |
virtual PStringList | GetKeys (const PString §ion) const |
virtual PStringToString | GetAllKeyValues () const |
virtual PStringToString | GetAllKeyValues (const PString §ion) const |
virtual void | DeleteSection () |
virtual void | DeleteSection (const PString §ion) |
virtual void | DeleteKey (const PString &key) |
virtual void | DeleteKey (const PString §ion, const PString &key) |
virtual BOOL | HasKey (const PString &key) const |
virtual BOOL | HasKey (const PString §ion, const PString &key) const |
Get/Set variables | |
virtual PString | GetString (const PString &key) const |
virtual PString | GetString (const PString &key, const PString &dflt) const |
virtual PString | GetString (const PString §ion, const PString &key, const PString &dflt) const |
virtual void | SetString (const PString &key, const PString &value) |
virtual void | SetString (const PString §ion, const PString &key, const PString &value) |
virtual BOOL | GetBoolean (const PString &key, BOOL dflt=FALSE) const |
virtual BOOL | GetBoolean (const PString §ion, const PString &key, BOOL dflt=FALSE) const |
virtual void | SetBoolean (const PString &key, BOOL value) |
virtual void | SetBoolean (const PString §ion, const PString &key, BOOL value) |
virtual long | GetInteger (const PString &key, long dflt=0) const |
virtual long | GetInteger (const PString §ion, const PString &key, long dflt=0) const |
virtual void | SetInteger (const PString &key, long value) |
virtual void | SetInteger (const PString §ion, const PString &key, long value) |
virtual PInt64 | GetInt64 (const PString &key, PInt64 dflt=0) const |
virtual PInt64 | GetInt64 (const PString §ion, const PString &key, PInt64 dflt=0) const |
virtual void | SetInt64 (const PString &key, PInt64 value) |
virtual void | SetInt64 (const PString §ion, const PString &key, PInt64 value) |
virtual double | GetReal (const PString &key, double dflt=0) const |
virtual double | GetReal (const PString §ion, const PString &key, double dflt=0) const |
virtual void | SetReal (const PString &key, double value) |
virtual void | SetReal (const PString §ion, const PString &key, double value) |
virtual PTime | GetTime (const PString &key) const |
virtual PTime | GetTime (const PString &key, const PTime &dflt) const |
virtual PTime | GetTime (const PString §ion, const PString &key) const |
virtual PTime | GetTime (const PString §ion, const PString &key, const PTime &dflt) const |
virtual void | SetTime (const PString &key, const PTime &value) |
virtual void | SetTime (const PString §ion, const PString &key, const PTime &value) |
Protected Attributes | |
PString | defaultSection |
The current section for variable values. | |
PXConfig * | config |
Configuration information follows a three level hierarchy: { file}, { section} and { variable}. Thus, a configuration file consists of a number of sections each with a number of variables selected by a { key}. Each variable has an associated value.
Note that the evironment source for configuration information does not have sections. The section is ignored and the same set of keys are available.
The configuration file is a standard text file for the platform with its internals appearing in the form: {verbatim} [Section String] Key Name=Value String {verbatim}
|
|
Create a new configuration object. Once a source is selected for the configuration it cannot be changed. Only at the next level of the hierarchy (sections) are selection able to be made dynamically with an active PConfig object.
|
|
Create a new configuration object.
|
|
Create a new configuration object.
|
|
Create a new configuration object.
|
|
Create a new configuration object.
|
|
Create a new configuration object.
|
|
Create a new configuration object.
|
|
|
|
|
|
Delete the particular variable in the specified section.
|
|
Delete the particular variable in the specified section. If the section name is not specified then the default section is used. Note that the variable and key are removed from the file. The key will no longer appear in the GetKeys() function. If you wish to delete the value without deleting the key, use SetString() to set it to the empty string.
|
|
Delete all variables in the specified section.
|
|
Delete all variables in the specified section. If the section name is not specified then the default section is deleted. Note that the section header is also removed so the section will not appear in the GetSections() function. |
|
Get all of the keys in the section and their values.
|
|
Get all of the keys in the section and their values. If the section name is not specified then use the default section.
|
|
Get a boolean variable determined by the key in the section.
|
|
Get a boolean variable determined by the key in the section. If the section name is not specified then the default section is used. The boolean value can be specified in a number of ways. The TRUE value is returned if the string value for the variable begins with either the 'T' character or the 'Y' character. Alternatively if the string can be converted to a numeric value, a non-zero value will also return TRUE. Thus the values can be Key=True, Key=Yes or Key=1 for TRUE and Key=False, Key=No, or Key=0 for FALSE. If the key is not present the value returned is the that provided by the #dlft# parameter. Note that this is different from the key being present but having no value, in which case FALSE is returned.
|
|
Get the default section for variable operations. All functions that deal with keys and get or set configuration values will use this section unless an explicit section name is specified. Note when the Environment# source is being used the default section may be retrieved but it is ignored.
|
|
Get a 64 bit integer variable determined by the key in the section.
|
|
Get a 64 bit integer variable determined by the key in the section. If the section name is not specified then the default section is used. If the key is not present the value returned is the that provided by the #dlft# parameter. Note that this is different from the key being present but having no value, in which case zero is returned.
|
|
|
|
|
|
Get a list of all the keys in the section.
|
|
Get a list of all the keys in the section. If the section name is not specified then use the default section.
|
|
Get a floating point variable determined by the key in the section.
|
|
Get a floating point variable determined by the key in the section. If the section name is not specified then the default section is used. If the key is not present the value returned is the that provided by the #dlft# parameter. Note that this is different from the key being present but having no value, in which case zero is returned.
|
|
Get all of the section names currently specified in the file. A section is the part specified by the [ and ] characters. Note when the Environment# source is being used this will return an empty list as there are no section present.
|
|
Get a string variable determined by the key in the section.
|
|
Get a string variable determined by the key in the section.
|
|
Get a string variable determined by the key in the section. If the section name is not specified then the default section is used. If the key is not present the value returned is the that provided by the #dlft# parameter. Note that this is different from the key being present but having no value, in which case an empty string is returned.
|
|
Get a PTime# variable determined by the key in the section.
|
|
Get a PTime# variable determined by the key in the section.
|
|
Get a PTime# variable determined by the key in the section.
|
|
Get a PTime# variable determined by the key in the section. If the section name is not specified then the default section is used. If the key is not present the value returned is the that provided by the #dlft# parameter. Note that this is different from the key being present but having no value, in which case zero is returned.
|
|
Determine if the particular variable in the section is actually present.
|
|
Determine if the particular variable in the section is actually present. This function allows a caller to distinguish between getting a saved value or using the default value. For example if you called GetString("MyKey", "DefVal") there is no way to distinguish between the default "DefVal" being used, or the user had explicitly saved the value "DefVal" into the PConfig.
|
|
Set a boolean variable determined by the key in the section.
|
|
Set a boolean variable determined by the key in the section. If the section name is not specified then the default section is used. If value is TRUE then the string "True" is written to the variable otherwise the string "False" is set.
|
|
Set the default section for variable operations. All functions that deal with keys and get or set configuration values will use this section unless an explicit section name is specified. Note when the Environment# source is being used the default section may be set but it is ignored.
|
|
Set a 64 bit integer variable determined by the key in the section.
|
|
Set a 64 bit integer variable determined by the key in the section. If the section name is not specified then the default section is used. The value is always formatted as a signed number with no leading or trailing blanks.
|
|
Set an integer variable determined by the key in the section.
|
|
Set an integer variable determined by the key in the section. If the section name is not specified then the default section is used. The value is always formatted as a signed number with no leading or trailing blanks.
|
|
Set a floating point variable determined by the key in the section.
|
|
Set a floating point variable determined by the key in the section. If the section name is not specified then the default section is used. The value is always formatted as a signed decimal or exponential form number with no leading or trailing blanks, ie it uses the g formatter from the printf() function.
|
|
Set a string variable determined by the key in the section.
|
|
Set a string variable determined by the key in the section. If the section name is not specified then the default section is used.
|
|
Set a PTime# variable determined by the key in the section.
|
|
Set a PTime# variable determined by the key in the section. If the section name is not specified then the default section is used.
|
|
|
|
The current section for variable values.
|