#include <sbuild-keyfile.h>
Public Types | |
typedef runtime_error_custom< keyfile > | error |
Exception type. | |
enum | priority { PRIORITY_OPTIONAL, PRIORITY_REQUIRED, PRIORITY_DISALLOWED, PRIORITY_DEPRECATED, PRIORITY_OBSOLETE } |
Configuration parameter priority. More... | |
Public Member Functions | |
keyfile () | |
The constructor. | |
keyfile (std::string const &file) | |
The constructor. | |
keyfile (std::istream &stream) | |
The constructor. | |
virtual | ~keyfile () |
The destructor. | |
string_list | get_groups () const |
Get a list of groups. | |
string_list | get_keys (std::string const &group) const |
Get a list of keys in a group. | |
bool | has_group (std::string const &group) const |
Check if a group exists. | |
bool | has_key (std::string const &group, std::string const &key) const |
Check if a key exists. | |
template<typename T> | |
bool | get_value (std::string const &group, std::string const &key, T &value) const |
Get a key value. | |
template<typename T> | |
bool | get_value (std::string const &group, std::string const &key, priority priority, T &value) const |
Get a key value. | |
template<typename T, template< typename T > class C> | |
bool | get_list_value (std::string const &group, std::string const &key, C< T > &value) const |
Get a key value as a list. | |
template<typename T, template< typename T > class C> | |
bool | get_list_value (std::string const &group, std::string const &key, priority priority, C< T > &value) const |
Get a key value as a list. | |
template<typename T> | |
void | set_value (std::string const &group, std::string const &key, T const &value) |
Set a key value. | |
template<typename T, template< typename T > class C> | |
void | set_list_value (std::string const &group, std::string const &key, C< T > const &value) |
Set a key value from a list. | |
void | remove_group (std::string const &group) |
Remove a group. | |
void | remove_key (std::string const &group, std::string const &key) |
Remove a key. | |
Private Types | |
typedef std::tr1::tuple< std::string, std::string, std::string > | item_type |
Key-value-comment tuple. | |
typedef std::map< std::string, item_type > | item_map_type |
Map between key name and key-value-comment tuple. | |
typedef std::tr1::tuple< std::string, item_map_type, std::string > | group_type |
Group-items-comment tuple. | |
typedef std::map< std::string, group_type > | group_map_type |
Map between group name and group-items-comment tuple. | |
Private Member Functions | |
void | check_priority (std::string const &group, std::string const &key, priority priority, bool valid) const |
Check if a key is missing or present when not permitted. | |
const group_type * | find_group (std::string const &group) const |
Find a group by it's name. | |
group_type * | find_group (std::string const &group) |
Find a group by it's name. | |
const item_type * | find_item (std::string const &group, std::string const &key) const |
Find a key by it's group and name. | |
item_type * | find_item (std::string const &group, std::string const &key) |
Find a key by it's group and name. | |
Static Private Member Functions | |
static void | print_comment (std::string const &comment, std::ostream &stream) |
Print a comment to a stream. | |
Private Attributes | |
group_map_type | groups |
The top-level groups. | |
char | separator |
The separator used as a list item delimiter. | |
Friends | |
template<class charT, class traits> | |
std::basic_istream< charT, traits > & | operator>> (std::basic_istream< charT, traits > &stream, keyfile &kf) |
keyfile initialisation from an istream. | |
template<class charT, class traits> | |
std::basic_ostream< charT, traits > & | operator<< (std::basic_ostream< charT, traits > &stream, keyfile const &kf) |
keyfile output to an ostream. |
This class loads an INI-style configuration file from disk. The format is documented in schroot.conf(5). It is based upon the Glib GKeyFile class, which it is intended to replace.
Add support for comments.
Duplicate groups within a keyfile are not currently detected; duplicates are silently discarded.
|
Exception type.
|
|
Map between group name and group-items-comment tuple.
|
|
Group-items-comment tuple.
|
|
Map between key name and key-value-comment tuple.
|
|
Key-value-comment tuple.
|
|
Configuration parameter priority.
|
|
The constructor.
|
|
The constructor.
|
|
The constructor.
|
|
The destructor.
|
|
Check if a key is missing or present when not permitted.
|
|
Find a group by it's name.
|
|
Find a group by it's name.
|
|
Find a key by it's group and name.
|
|
Find a key by it's group and name.
|
|
Get a list of groups.
|
|
Get a list of keys in a group.
|
|
Get a key value as a list. If the value does not exist, is deprecated or obsolete, warn appropriately.
|
|
Get a key value as a list.
Here is the call graph for this function: ![]() |
|
Get a key value. If the value does not exist, is deprecated or obsolete, warn appropriately.
Here is the call graph for this function: ![]() |
|
Get a key value.
Here is the call graph for this function: ![]() |
|
Check if a group exists.
|
|
Check if a key exists.
|
|
Print a comment to a stream. The comment will have hash ('#') marks printed at the start of each line.
|
|
Remove a group.
|
|
Remove a key.
|
|
Set a key value from a list.
|
|
Set a key value.
|
|
keyfile output to an ostream.
|
|
keyfile initialisation from an istream.
|
|
The top-level groups.
|
|
The separator used as a list item delimiter.
|