Represents a section in a config file.
More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/config/ConfigFileSection.h>
|
| ConfigFileSection (const std::string &name, const std::string &additionalComment="") |
| Constructor: Initializes the section. More...
|
|
| ~ConfigFileSection () |
| Destructor: Deletes all entries. More...
|
|
void | deleteVectorEntries (const std::string &name, unsigned int startindex=0) |
| Deletes all elements of a config vector if their index is greater or equal to startindex. More...
|
|
std::string | getFileEntry () const |
| Returns the title and comment of the section as it will be stored in the file. More...
|
|
const std::string & | getName () const |
| Returns the name of the section. More...
|
|
const std::string & | getOrCreateValue (const std::string &name, const std::string &fallback, bool bString) |
| Returns the value of a given entry in the section. More...
|
|
const std::string & | getOrCreateValue (const std::string &name, unsigned int index, const std::string &fallback, bool bString) |
| Returns the value of a given element of a vector in the section. More...
|
|
const std::string & | getValue (const std::string &name, bool bString) |
| Returns the value of a given entry in the section. More...
|
|
const std::string & | getValue (const std::string &name, unsigned int index, bool bString) |
| Returns the value of a given element of a vector in the section. More...
|
|
unsigned int | getVectorSize (const std::string &name) const |
| Returns the size of a config vector. More...
|
|
void | setComment (const std::string &comment) |
| Changes the comment which is placed after the title of the section in the config file. More...
|
|
void | setValue (const std::string &name, const std::string &value, bool bString) |
| Stores a value in the section. More...
|
|
void | setValue (const std::string &name, unsigned int index, const std::string &value, bool bString) |
| Stores the value of an element of a vector in the section. More...
|
|
|
std::list< ConfigFileEntry * > & | getEntries () |
| Returns the list of entries in this section. More...
|
|
const std::list< ConfigFileEntry * > & | getEntries () const |
|
ConfigFileEntry * | getEntry (const std::string &name) const |
| Returns the entry with given name (or nullptr if it doesn't exist). More...
|
|
ConfigFileEntry * | getEntry (const std::string &name, unsigned int index) const |
| Returns the entry of a vector element with given name and index (or nullptr if it doesn't exist). More...
|
|
ConfigFileEntry * | getOrCreateEntry (const std::string &name, const std::string &fallback, bool bString) |
| Returns the entry with given name. More...
|
|
ConfigFileEntry * | getOrCreateEntry (const std::string &name, unsigned int index, const std::string &fallback, bool bString) |
| Returns the entry that contains an element of a vector with given name. More...
|
|
std::list< ConfigFileEntry * >::iterator | getOrCreateEntryIterator (const std::string &name, const std::string &fallback, bool bString) |
| Returns the iterator to the entry with given name. More...
|
|
std::list< ConfigFileEntry * >::iterator | getOrCreateEntryIterator (const std::string &name, unsigned int index, const std::string &fallback, bool bString) |
| Returns the iterator to the entry of a vector element with given name and index. More...
|
|
Represents a section in a config file.
A section has a name and a list of config values.
orxonox::ConfigFileSection::ConfigFileSection |
( |
const std::string & |
name, |
|
|
const std::string & |
additionalComment = "" |
|
) |
| |
|
inline |
Constructor: Initializes the section.
- Parameters
-
name | The name of the section |
additionalComment | An additional comment placed after the title of the section in the config file |
orxonox::ConfigFileSection::~ConfigFileSection |
( |
| ) |
|
Destructor: Deletes all entries.
void orxonox::ConfigFileSection::deleteVectorEntries |
( |
const std::string & |
name, |
|
|
unsigned int |
startindex = 0 |
|
) |
| |
Deletes all elements of a config vector if their index is greater or equal to startindex.
- Parameters
-
name | The name of the vector |
startindex | The index of the first element that will be deleted |
Returns the list of entries in this section.
const std::list<ConfigFileEntry*>& orxonox::ConfigFileSection::getEntries |
( |
| ) |
const |
|
inlineprivate |
ConfigFileEntry * orxonox::ConfigFileSection::getEntry |
( |
const std::string & |
name | ) |
const |
|
private |
Returns the entry with given name (or nullptr if it doesn't exist).
- Parameters
-
name | The name of the entry |
ConfigFileEntry * orxonox::ConfigFileSection::getEntry |
( |
const std::string & |
name, |
|
|
unsigned int |
index |
|
) |
| const |
|
private |
Returns the entry of a vector element with given name and index (or nullptr if it doesn't exist).
- Parameters
-
name | The name of the vector |
index | The index of the element in the vector |
std::string orxonox::ConfigFileSection::getFileEntry |
( |
| ) |
const |
Returns the title and comment of the section as it will be stored in the file.
const std::string& orxonox::ConfigFileSection::getName |
( |
void |
| ) |
const |
|
inline |
Returns the name of the section.
ConfigFileEntry* orxonox::ConfigFileSection::getOrCreateEntry |
( |
const std::string & |
name, |
|
|
const std::string & |
fallback, |
|
|
bool |
bString |
|
) |
| |
|
inlineprivate |
Returns the entry with given name.
If it doesn't exist, the entry is created using the fallback value.
- Parameters
-
name | The name of the entry |
fallback | The value that will be used if the entry doesn't exist |
bString | If true, the value is treated as string which means some special treatment of special characters. |
ConfigFileEntry* orxonox::ConfigFileSection::getOrCreateEntry |
( |
const std::string & |
name, |
|
|
unsigned int |
index, |
|
|
const std::string & |
fallback, |
|
|
bool |
bString |
|
) |
| |
|
inlineprivate |
Returns the entry that contains an element of a vector with given name.
If it doesn't exist, the entry is created using the fallback value.
- Parameters
-
name | The name of the entry |
index | The index of the element in the vector |
fallback | The value that will be used if the entry doesn't exist |
bString | If true, the value is treated as string which means some special treatment of special characters. |
std::list< ConfigFileEntry * >::iterator orxonox::ConfigFileSection::getOrCreateEntryIterator |
( |
const std::string & |
name, |
|
|
const std::string & |
fallback, |
|
|
bool |
bString |
|
) |
| |
|
private |
Returns the iterator to the entry with given name.
If the entry doesn't exist, it is created using the fallback value.
- Parameters
-
name | The name of the entry |
fallback | The value that will be used if the entry doesn't exist |
bString | If true, the value is treated as string which means some special treatment of special characters. |
std::list< ConfigFileEntry * >::iterator orxonox::ConfigFileSection::getOrCreateEntryIterator |
( |
const std::string & |
name, |
|
|
unsigned int |
index, |
|
|
const std::string & |
fallback, |
|
|
bool |
bString |
|
) |
| |
|
private |
Returns the iterator to the entry of a vector element with given name and index.
If the entry doesn't exist, it is created using the fallback value.
- Parameters
-
name | The name of the vector |
index | The index of the element in the vector |
fallback | The value that will be used if the entry doesn't exist |
bString | If true, the value is treated as string which means some special treatment of special characters. |
const std::string& orxonox::ConfigFileSection::getOrCreateValue |
( |
const std::string & |
name, |
|
|
const std::string & |
fallback, |
|
|
bool |
bString |
|
) |
| |
|
inline |
Returns the value of a given entry in the section.
If it doesn't exist, the entry is created using the fallback value.
- Parameters
-
name | The name of the entry |
fallback | The value that will be used if the entry doesn't exist |
bString | If true, the value is treated as string which means some special treatment of special characters. |
const std::string& orxonox::ConfigFileSection::getOrCreateValue |
( |
const std::string & |
name, |
|
|
unsigned int |
index, |
|
|
const std::string & |
fallback, |
|
|
bool |
bString |
|
) |
| |
|
inline |
Returns the value of a given element of a vector in the section.
If it doesn't exist, the entry is created using the fallback value.
- Parameters
-
name | The name of the vector |
index | The index of the element in the vector |
fallback | The value that will be used if the entry doesn't exist |
bString | If true, the value is treated as string which means some special treatment of special characters. |
const std::string& orxonox::ConfigFileSection::getValue |
( |
const std::string & |
name, |
|
|
bool |
bString |
|
) |
| |
|
inline |
Returns the value of a given entry in the section.
Returns a blank string if the value doesn't exist.
- Parameters
-
name | The name of the entry |
bString | If true, the value is treated as string which means some special treatment of special characters. |
const std::string& orxonox::ConfigFileSection::getValue |
( |
const std::string & |
name, |
|
|
unsigned int |
index, |
|
|
bool |
bString |
|
) |
| |
|
inline |
Returns the value of a given element of a vector in the section.
Returns a blank string if the value doesn't exist.
- Parameters
-
name | The name of the vector |
index | The index of the element in the vector |
bString | If true, the value is treated as string which means some special treatment of special characters. |
unsigned int orxonox::ConfigFileSection::getVectorSize |
( |
const std::string & |
name | ) |
const |
Returns the size of a config vector.
- Parameters
-
name | The name of the vector |
void orxonox::ConfigFileSection::setComment |
( |
const std::string & |
comment | ) |
|
|
inline |
Changes the comment which is placed after the title of the section in the config file.
void orxonox::ConfigFileSection::setValue |
( |
const std::string & |
name, |
|
|
const std::string & |
value, |
|
|
bool |
bString |
|
) |
| |
|
inline |
Stores a value in the section.
If the entry doesn't exist, it's created.
- Parameters
-
name | The name of the entry |
value | The new value |
bString | If true, the value is treated as string which means some special treatment of special characters. |
void orxonox::ConfigFileSection::setValue |
( |
const std::string & |
name, |
|
|
unsigned int |
index, |
|
|
const std::string & |
value, |
|
|
bool |
bString |
|
) |
| |
|
inline |
Stores the value of an element of a vector in the section.
If the entry doesn't exist, it's created.
- Parameters
-
name | The name of the vector |
index | The index of the element in the vector |
value | The new value |
bString | If true, the value is treated as string which means some special treatment of special characters. |
std::string orxonox::ConfigFileSection::additionalComment_ |
|
private |
The additional comment which is placed after the title of the section in the config file.
bool orxonox::ConfigFileSection::bUpdated_ |
|
private |
True if an entry is created.
The list of entries in this section.
std::string orxonox::ConfigFileSection::name_ |
|
private |
The documentation for this class was generated from the following files: