class
ConfigurationGroupGroup of values in configuration file.
Contents
Provides access to values and subgroups. See Configuration class documentation for usage example.
Derived classes
- class Configuration
- Parser and writer for configuration files.
Constructors, destructors, conversion operators
- ConfigurationGroup() explicit
- Default constructor.
- ConfigurationGroup(const ConfigurationGroup& other)
- Copy constructor.
- ConfigurationGroup(ConfigurationGroup&& other)
- Move constructor.
Public functions
- auto operator=(const ConfigurationGroup& other) -> ConfigurationGroup&
- Copy assignment.
- auto operator=(ConfigurationGroup&& other) -> ConfigurationGroup&
- Move assignment.
- auto configuration() -> Configuration*
- Enclosing configuration.
- auto configuration() const -> const Configuration*
- auto isEmpty() const -> bool
- Whether the group is empty.
- void clear()
- Clear group.
Group operations
- auto hasGroups() const -> bool
- Whether this group has subgroups.
- auto groupCount() const -> unsigned int
- Count of all subgroups.
-
auto hasGroup(const std::
string& name, unsigned int index = 0) const -> bool - Whether given group exists.
-
auto groupCount(const std::
string& name) const -> unsigned int - Count of groups with given name.
-
auto group(const std::
string& name, unsigned int index = 0) -> ConfigurationGroup* - Group of given name.
-
auto group(const std::
string& name, unsigned int index = 0) const -> const ConfigurationGroup* -
auto groups(const std::
string& name) -> std:: vector<ConfigurationGroup*> - All groups with given name.
-
auto groups(const std::
string& name) const -> std:: vector<const ConfigurationGroup*> -
void addGroup(const std::
string& name, ConfigurationGroup* group) - Add new group.
-
auto addGroup(const std::
string& name) -> ConfigurationGroup* - Add new group.
-
auto removeGroup(const std::
string& name, unsigned int index = 0) -> bool - Remove group.
- auto removeGroup(ConfigurationGroup* group) -> bool
- Remove group.
-
void removeAllGroups(const std::
string& name) - Remove all groups with given name.
Value operations
- auto hasValues() const -> bool
- Whether this group has any values.
- auto valueCount() const -> unsigned int
- Count of all values in the group.
-
auto hasValue(const std::
string& key, unsigned int index = 0) const -> bool - Whether value exists.
-
auto valueCount(const std::
string& key) const -> unsigned int - Count of values with given key.
-
template<class T = std::auto value(const std::
string> string& key, unsigned int index = 0, ConfigurationValueFlags flags = ConfigurationValueFlags()) const -> T - Value.
-
template<class T = std::auto value(const std::
string> string& key, ConfigurationValueFlags flags) const -> T -
template<class T = std::auto values(const std::
string> string& key, ConfigurationValueFlags flags = ConfigurationValueFlags()) const -> std:: vector<T> - All values with given key.
-
auto setValue(const std::
string& key, std:: string value, unsigned int index = 0, ConfigurationValueFlags flags = ConfigurationValueFlags()) -> bool - Set string value.
-
auto setValue(const std::
string& key, const char* value, unsigned int index = 0, ConfigurationValueFlags flags = ConfigurationValueFlags()) -> bool -
auto setValue(const std::
string& key, std:: string value, ConfigurationValueFlags flags) -> bool -
auto setValue(const std::
string& key, const char* value, ConfigurationValueFlags flags) -> bool -
template<class T>auto setValue(const std::
string& key, const T& value, unsigned int index = 0, ConfigurationValueFlags flags = ConfigurationValueFlags()) -> bool - Set value converted from given type.
-
template<class T>auto setValue(const std::
string& key, const T& value, ConfigurationValueFlags flags) -> bool -
void addValue(std::
string key, std:: string value, ConfigurationValueFlags flags = ConfigurationValueFlags()) - Add new value.
-
void addValue(std::
string key, const char* value, ConfigurationValueFlags flags = ConfigurationValueFlags()) -
template<class T>void addValue(std::
string key, const T& value, ConfigurationValueFlags flags = ConfigurationValueFlags()) - Add new value.
-
auto removeValue(const std::
string& key, unsigned int index = 0) -> bool - Remove value.
-
void removeAllValues(const std::
string& key) - Remove all values with given key.
Function documentation
Corrade:: Utility:: ConfigurationGroup:: ConfigurationGroup() explicit
Default constructor.
Pointer to enclosing configuration is set to nullptr
, call addGroup() to add it somewhere.
Corrade:: Utility:: ConfigurationGroup:: ConfigurationGroup(const ConfigurationGroup& other)
Copy constructor.
Pointer to enclosing configuration is set to nullptr
, call addGroup() to add it somewhere.
Corrade:: Utility:: ConfigurationGroup:: ConfigurationGroup(ConfigurationGroup&& other)
Move constructor.
Pointer to enclosing configuration is set to nullptr
, call addGroup() to add it somewhere.
ConfigurationGroup& Corrade:: Utility:: ConfigurationGroup:: operator=(const ConfigurationGroup& other)
Copy assignment.
Pointer to enclosing configuration stays the same as in original object.
ConfigurationGroup& Corrade:: Utility:: ConfigurationGroup:: operator=(ConfigurationGroup&& other)
Move assignment.
Pointer to enclosing configuration stays the same as in original object.
Configuration* Corrade:: Utility:: ConfigurationGroup:: configuration()
Enclosing configuration.
Returns nullptr
if the group is not part of any configuration.
const Configuration* Corrade:: Utility:: ConfigurationGroup:: configuration() const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool Corrade:: Utility:: ConfigurationGroup:: isEmpty() const
Whether the group is empty.
If the group is empty, there aren't any values, subgroups, empty lines or comments.
bool Corrade:: Utility:: ConfigurationGroup:: hasGroups() const
Whether this group has subgroups.
unsigned int Corrade:: Utility:: ConfigurationGroup:: groupCount() const
Count of all subgroups.
bool Corrade:: Utility:: ConfigurationGroup:: hasGroup(const std:: string& name,
unsigned int index = 0) const
Whether given group exists.
Parameters | |
---|---|
name | Name |
index | Group index. Default is first found group. |
unsigned int Corrade:: Utility:: ConfigurationGroup:: groupCount(const std:: string& name) const
Count of groups with given name.
ConfigurationGroup* Corrade:: Utility:: ConfigurationGroup:: group(const std:: string& name,
unsigned int index = 0)
Group of given name.
Parameters | |
---|---|
name | Name |
index | Group index. Default is first found group. |
Returns pointer to group on success, nullptr
otherwise.
const ConfigurationGroup* Corrade:: Utility:: ConfigurationGroup:: group(const std:: string& name,
unsigned int index = 0) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
std:: vector<const ConfigurationGroup*> Corrade:: Utility:: ConfigurationGroup:: groups(const std:: string& name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Corrade:: Utility:: ConfigurationGroup:: addGroup(const std:: string& name,
ConfigurationGroup* group)
Add new group.
Parameters | |
---|---|
name | Name. The name must not be empty and must not contain newline or any of []/ characters. |
group | Existing group. |
Adds given group at the end of current group. The group must not be part of any existing configuration.
ConfigurationGroup* Corrade:: Utility:: ConfigurationGroup:: addGroup(const std:: string& name)
Add new group.
Parameters | |
---|---|
name | Name. The name must not be empty and must not contain newline or any of []/ characters. |
Adds new group at the end of file, returns newly created group.
bool Corrade:: Utility:: ConfigurationGroup:: removeGroup(const std:: string& name,
unsigned int index = 0)
Remove group.
Parameters | |
---|---|
name | Name of the group |
index | Group index. Default is first found group. |
Returns true
if given group was found and removed, false
otherwise.
bool Corrade:: Utility:: ConfigurationGroup:: removeGroup(ConfigurationGroup* group)
Remove group.
Returns true
if given group was found and removed, false
otherwise.
void Corrade:: Utility:: ConfigurationGroup:: removeAllGroups(const std:: string& name)
Remove all groups with given name.
bool Corrade:: Utility:: ConfigurationGroup:: hasValues() const
Whether this group has any values.
unsigned int Corrade:: Utility:: ConfigurationGroup:: valueCount() const
Count of all values in the group.
bool Corrade:: Utility:: ConfigurationGroup:: hasValue(const std:: string& key,
unsigned int index = 0) const
Whether value exists.
Parameters | |
---|---|
key | Key |
index | Value index. Default is first found value. |
unsigned int Corrade:: Utility:: ConfigurationGroup:: valueCount(const std:: string& key) const
Count of values with given key.
template<class T = std:: string>
T Corrade:: Utility:: ConfigurationGroup:: value(const std:: string& key,
unsigned int index = 0,
ConfigurationValueFlags flags = ConfigurationValueFlags()) const
Value.
Parameters | |
---|---|
key | Key |
index | Value index. Default is first found value. |
flags | Flags |
Directly returns the value. If the key is not found, returns default constructed value. If T
is not std::
template<class T = std:: string>
T Corrade:: Utility:: ConfigurationGroup:: value(const std:: string& key,
ConfigurationValueFlags flags) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Calls the above with index
set to 0
.
template<class T = std:: string>
std:: vector<T> Corrade:: Utility:: ConfigurationGroup:: values(const std:: string& key,
ConfigurationValueFlags flags = ConfigurationValueFlags()) const
All values with given key.
Parameters | |
---|---|
key | Key |
flags | Flags |
If T
is not std::
bool Corrade:: Utility:: ConfigurationGroup:: setValue(const std:: string& key,
std:: string value,
unsigned int index = 0,
ConfigurationValueFlags flags = ConfigurationValueFlags())
Set string value.
Parameters | |
---|---|
key | Key. The key must not be empty and must not contain newline or = character. |
value | Value |
index | Value index. Default is first found value. |
flags | Flags |
If the key already exists, changes it to new value. If the key doesn't exist, adds a new key with given name. Returns false
if index
is larger than actual value count, true
otherwise.
bool Corrade:: Utility:: ConfigurationGroup:: setValue(const std:: string& key,
const char* value,
unsigned int index = 0,
ConfigurationValueFlags flags = ConfigurationValueFlags())
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool Corrade:: Utility:: ConfigurationGroup:: setValue(const std:: string& key,
std:: string value,
ConfigurationValueFlags flags)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Calls the above with index
set to 0
.
bool Corrade:: Utility:: ConfigurationGroup:: setValue(const std:: string& key,
const char* value,
ConfigurationValueFlags flags)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Calls the above with index
set to 0
.
template<class T>
bool Corrade:: Utility:: ConfigurationGroup:: setValue(const std:: string& key,
const T& value,
unsigned int index = 0,
ConfigurationValueFlags flags = ConfigurationValueFlags())
Set value converted from given type.
Uses ConfigurationValue::
template<class T>
bool Corrade:: Utility:: ConfigurationGroup:: setValue(const std:: string& key,
const T& value,
ConfigurationValueFlags flags)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Calls the above with index
set to 0
.
void Corrade:: Utility:: ConfigurationGroup:: addValue(std:: string key,
std:: string value,
ConfigurationValueFlags flags = ConfigurationValueFlags())
Add new value.
Parameters | |
---|---|
key | Key. The key must not be empty and must not contain newline or = character. |
value | Value |
flags | Flags |
Adds new key/value pair at the end of current group (it means also after all comments).
void Corrade:: Utility:: ConfigurationGroup:: addValue(std:: string key,
const char* value,
ConfigurationValueFlags flags = ConfigurationValueFlags())
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
void Corrade:: Utility:: ConfigurationGroup:: addValue(std:: string key,
const T& value,
ConfigurationValueFlags flags = ConfigurationValueFlags())
Add new value.
Uses ConfigurationValue::
bool Corrade:: Utility:: ConfigurationGroup:: removeValue(const std:: string& key,
unsigned int index = 0)
Remove value.
Parameters | |
---|---|
key | Key |
index | Value index. Default is first found value. |
Returns true
if given value was found and removed, false
otherwise.
void Corrade:: Utility:: ConfigurationGroup:: removeAllValues(const std:: string& key)
Remove all values with given key.