This class is used to read and write standard configuration files.
More...
#include "<SaS/Common/config.hpp>"
|
| config () |
| config - Constructor. More...
|
|
virtual | ~config () |
| config - Destructor. More...
|
|
bool | Add (const char *tag, const char *value, bool override=false) |
| Add a TAG/VALUE, the default is to fail if TAG already exists in the configuration data. More...
|
|
bool | Add (const char *tag, const char *value, int Code1, int Code2, bool override=false) |
| Add a TAG/VALUE, the default is to fail if TAG already exists in the configuration data. More...
|
|
virtual InstanceCount_t | decInstance () const |
| Decrement the instance. More...
|
|
const char * | Get (const char *tag) const |
| Get the value associated with tag (key). More...
|
|
const char * | Get (const char *tag, int &Code1, int &Code2) const |
| Get the value associated with tag (key). More...
|
|
virtual InstanceCount_t | getInstance () const |
|
int | Has (const char *tag) const |
| See if the tag (key) is in this configuration file. More...
|
|
virtual InstanceCount_t | incInstance () const |
| Increment the instance. More...
|
|
void | operator delete (void *ToFree) |
|
bool | Read (const char *configFileName) |
| Read in the named configuration file. More...
|
|
bool | Remove (const char *tag, const char *value=nullptr, bool all=false) |
| Delete TAG from the configuration. More...
|
|
bool | Write (const char *ConfigFileName) const |
| Write the configuration data to the named file. More...
|
|
This class is used to read and write standard configuration files.
Blank lines and lines starting with '#' are ignored. Everything after a '#' in a line is ignored.
- Deprecated:
- This object is being deprecated as back end code.
- See also
- Preference Preference uses config for file I/O. The Preference object has more options for varying data types.
Definition at line 112 of file config.hpp.
◆ config()
SoftwareAndServices::Library::Common::config::config |
( |
| ) |
|
◆ ~config()
virtual SoftwareAndServices::Library::Common::config::~config |
( |
| ) |
|
|
virtual |
◆ Add() [1/2]
bool SoftwareAndServices::Library::Common::config::Add |
( |
const char * |
tag, |
|
|
const char * |
value, |
|
|
bool |
override = false |
|
) |
| |
Add a TAG/VALUE, the default is to fail if TAG already exists in the configuration data.
- Parameters
-
tag | The name of the tag to write. |
value | The value to associate with this tag. |
override | Only override an existing entry, if override is TRUE. |
- Returns
- TRUE if added.
◆ Add() [2/2]
bool SoftwareAndServices::Library::Common::config::Add |
( |
const char * |
tag, |
|
|
const char * |
value, |
|
|
int |
Code1, |
|
|
int |
Code2, |
|
|
bool |
override = false |
|
) |
| |
Add a TAG/VALUE, the default is to fail if TAG already exists in the configuration data.
- Parameters
-
tag | The name of the tag to write. |
value | The value to associate with this tag. |
Code1 | A code value used by Preferences. |
Code2 | A code value used by Preferences. |
override | Only override an existing entry, if override is TRUE. |
- Returns
- TRUE if added.
◆ decInstance()
Decrement the instance.
- Returns
- The instance count, after decrementing it.
Definition at line 129 of file instance.hpp.
◆ Get() [1/2]
const char* SoftwareAndServices::Library::Common::config::Get |
( |
const char * |
tag | ) |
const |
Get the value associated with tag (key).
The results are stored in StringCache, caller must StringCache::remove them when done.
- Parameters
-
- Returns
- The value, or nullptr if no such tag exists.
◆ Get() [2/2]
const char* SoftwareAndServices::Library::Common::config::Get |
( |
const char * |
tag, |
|
|
int & |
Code1, |
|
|
int & |
Code2 |
|
) |
| const |
Get the value associated with tag (key).
The results are stored in StringCache, caller must StringCache::remove them when done.
- Parameters
-
| tag | A key to look for. |
[out] | Code1 | The code type used by Preference. |
[out] | Code2 | The code type used by Preference. |
- Returns
- The value, or nullptr if no such tag exists.
◆ getInstance()
- Returns
- The current instance count.
Definition at line 118 of file instance.hpp.
◆ Has()
int SoftwareAndServices::Library::Common::config::Has |
( |
const char * |
tag | ) |
const |
See if the tag (key) is in this configuration file.
- Parameters
-
- Returns
- The Code type stored, or zero if not found.
◆ incInstance()
Increment the instance.
- Returns
- The instance value, after incrementing it.
Definition at line 109 of file instance.hpp.
◆ Read()
bool SoftwareAndServices::Library::Common::config::Read |
( |
const char * |
configFileName | ) |
|
Read in the named configuration file.
- Parameters
-
configFileName | The name of the file to read. |
- Returns
- TRUE if parsed successfully.
◆ Remove()
bool SoftwareAndServices::Library::Common::config::Remove |
( |
const char * |
tag, |
|
|
const char * |
value = nullptr , |
|
|
bool |
all = false |
|
) |
| |
Delete TAG from the configuration.
If VALUE is NOT null, then delete all that match TAG/VALUE. If 'all' is true and VALUE is nullptr then delete all TAG that match 'tag'
- Parameters
-
tag | The tag to look up. |
value | If not nullptr, only delete if it has this value. |
all | If TRUE delete all tags with a matching name. |
- Returns
- TRUE if it worked.
◆ Write()
bool SoftwareAndServices::Library::Common::config::Write |
( |
const char * |
ConfigFileName | ) |
const |
Write the configuration data to the named file.
- Parameters
-
ConfigFileName | The name of the file to write. |
- Returns
- TRUE if written.
The documentation for this class was generated from the following file: