|
Ocean
|
This class implements an application or module configuration toolkit using files as input or output. More...
#include <FileConfig.h>
Data Structures | |
| class | ConfigScanner |
| This scanner is able to scan the specific config file type. More... | |
| class | FileValue |
| Definition of a file value object. More... | |
Public Member Functions | |
| FileConfig () | |
| Creates a new config object. | |
| FileConfig (const std::string &filename, const bool read=true) | |
| Creates a new config object by a given configuration file. | |
| const std::string & | filename () const |
| Returns the config file. | |
| bool | setFilename (const std::string &filename, const bool read=true) |
| Sets the filename of the new config objects. | |
| bool | read () override |
| Reads / loads all values of this configuration. | |
| bool | write () override |
| Writes / saves all values of this configuration. | |
| unsigned int | values () const override |
| Returns the number of sub values. | |
| unsigned int | values (const std::string &name) const override |
| Returns the number of sub values with a given name. | |
| bool | exist (const std::string &name) const override |
| Returns whether this value holds at least one specified sub value. | |
| FileValue & | value (const unsigned int index, std::string &name) override |
| Returns a sub value specified by it's index. | |
| bool | value (const unsigned int index, std::string &name, Value **value) override |
| Returns a sub value specified by it's index. | |
| FileValue & | value (const std::string &name, const unsigned int index) override |
| Returns a sub value specified by it's name and it's index if more than one value exists with the same name. | |
| bool | value (const std::string &name, const unsigned int index, Value **value) override |
| Returns a sub value specified by it's name and it's index if more than one value exists with the same name. | |
| FileValue & | add (const std::string &name) override |
| Adds a new sub value specified by it's name. | |
| FileValue & | operator[] (const std::string &name) override |
| Returns a sub value specified by it's name. | |
| bool | isEmpty () const |
| Returns whether this file configuration container does not hold any values. | |
Public Member Functions inherited from Ocean::Config | |
| virtual | ~Config () |
| Destructs a configuration toolkit. | |
| Timestamp | writeTimestamp () const |
| Returns the timestamp of the last write execution. | |
Static Public Member Functions | |
| static bool | write (const FileValues &values, std::ostream &stream) |
| Writes objects to a given output stream explicitly. | |
Protected Types | |
| typedef std::multimap< std::string, FileValue > | FileValues |
| Definition of a map mapping value names to value objects. | |
Protected Member Functions | |
| bool | readSubValues (FileValues &values, Scanner &scanner, bool stopWithBrackets) |
| Reads sub values. | |
Protected Member Functions inherited from Ocean::Config | |
| Config () | |
| Creates a new configuration toolkit. | |
| Config (const Config &config)=delete | |
| Disabled copy constructor. | |
| Config & | operator= (const Config &config)=delete |
| Disabled copy operator. | |
Static Protected Member Functions | |
| static bool | write (const FileValues &values, std::ostream &stream, unsigned int offset) |
| Writes values to a stream with a given tab offset. | |
| static bool | writeTabs (std::ostream &stream, unsigned int offset) |
| Writes a given number of tabs. | |
| static FileValue & | nullValue () |
| Returns the default value holding no data. | |
Static Protected Member Functions inherited from Ocean::Config | |
| static Value & | nullValue () |
| Returns the default value holding no data. | |
Protected Attributes | |
| FileValues | values_ |
| Roots objects. | |
| std::string | filename_ |
| Filename of this config object. | |
Protected Attributes inherited from Ocean::Config | |
| Timestamp | writeTimestamp_ |
| Holds the timestamp of the most recent write execution. | |
Additional Inherited Members | |
Public Types inherited from Ocean::Config | |
| enum | ValueType { TYPE_INVALID , TYPE_UNDEFINED , TYPE_BOOL , TYPE_INT , TYPE_NUMBER , TYPE_STRING , TYPE_MULTI_BOOL , TYPE_MULTI_INT , TYPE_MULTI_NUMBER , TYPE_MULTI_STRING , TYPE_GROUP } |
| Definition of different value types. More... | |
This class implements an application or module configuration toolkit using files as input or output.
|
protected |
Definition of a map mapping value names to value objects.
| Ocean::IO::FileConfig::FileConfig | ( | ) |
Creates a new config object.
|
explicit |
Creates a new config object by a given configuration file.
| filename | Configuration file |
| read | True, to load the file directly |
|
overridevirtual |
Adds a new sub value specified by it's name.
| name | The name of the sub value to create |
Reimplemented from Ocean::Config.
|
overridevirtual |
Returns whether this value holds at least one specified sub value.
Reimplemented from Ocean::Config.
|
inline |
Returns the config file.
|
inline |
Returns whether this file configuration container does not hold any values.
|
staticprotected |
Returns the default value holding no data.
|
overridevirtual |
Returns a sub value specified by it's name.
Reimplemented from Ocean::Config.
|
overridevirtual |
Reads / loads all values of this configuration.
Reimplemented from Ocean::Config.
|
protected |
Reads sub values.
| values | Sub values to fill |
| scanner | The scanner used for token scanning |
| stopWithBrackets | Determines whether to stop at a closing bracket |
| bool Ocean::IO::FileConfig::setFilename | ( | const std::string & | filename, |
| const bool | read = true |
||
| ) |
Sets the filename of the new config objects.
All old config objects will be released before.
| filename | to set |
| read | True, to load the file directly |
|
overridevirtual |
Returns a sub value specified by it's name and it's index if more than one value exists with the same name.
Reimplemented from Ocean::Config.
|
overridevirtual |
Returns a sub value specified by it's name and it's index if more than one value exists with the same name.
Reimplemented from Ocean::Config.
|
overridevirtual |
Returns a sub value specified by it's index.
Reimplemented from Ocean::Config.
|
overridevirtual |
Returns a sub value specified by it's index.
Reimplemented from Ocean::Config.
|
overridevirtual |
|
overridevirtual |
Returns the number of sub values with a given name.
Reimplemented from Ocean::Config.
|
overridevirtual |
Writes / saves all values of this configuration.
Reimplemented from Ocean::Config.
|
static |
Writes objects to a given output stream explicitly.
| values | The values to write |
| stream | Target stream |
|
staticprotected |
Writes values to a stream with a given tab offset.
| values | The values to write |
| stream | Target stream |
| offset | Tab offset |
|
staticprotected |
Writes a given number of tabs.
| stream | Target stream |
| offset | Tab offset |
|
protected |
Filename of this config object.
|
protected |
Roots objects.