sbuild
1.6.10
|
Configuration file parser. More...
#include <sbuild-basic-keyfile.h>
Public Types | |
typedef K::group_name_type | group_name_type |
Group name. | |
typedef K::key_type | key_type |
Key name. | |
typedef K::value_type | value_type |
Value. | |
typedef K::comment_type | comment_type |
Comment. | |
typedef K::size_type | size_type |
Line number. | |
typedef std::vector< group_name_type > | group_list |
Vector of groups. | |
typedef std::vector< value_type > | value_list |
Vector of values. | |
![]() | |
enum | priority { PRIORITY_OPTIONAL, PRIORITY_REQUIRED, PRIORITY_DISALLOWED, PRIORITY_DEPRECATED, PRIORITY_OBSOLETE } |
Configuration parameter priority. More... | |
enum | error_code { BAD_FILE, DEPRECATED_KEY, DEPRECATED_KEY_NL, DISALLOWED_KEY, DISALLOWED_KEY_NL, DUPLICATE_GROUP, DUPLICATE_KEY, INVALID_GROUP, INVALID_KEY, INVALID_LINE, MISSING_KEY, MISSING_KEY_NL, NO_GROUP, NO_KEY, OBSOLETE_KEY, OBSOLETE_KEY_NL, PASSTHROUGH_G, PASSTHROUGH_GK, PASSTHROUGH_LG, PASSTHROUGH_LGK, UNKNOWN_KEY } |
Error codes. More... | |
typedef parse_error< error_code > | error |
Exception type. | |
Public Member Functions | |
basic_keyfile () | |
The constructor. | |
basic_keyfile (std::string const &file) | |
The constructor. More... | |
basic_keyfile (std::istream &stream) | |
The constructor. More... | |
virtual | ~basic_keyfile () |
The destructor. | |
group_list | get_groups () const |
Get a list of groups. More... | |
key_list | get_keys (group_name_type const &group) const |
Get a list of keys in a group. More... | |
void | check_keys (group_name_type const &group, key_list const &keys) const |
Check for unused keys in a group. More... | |
bool | has_group (group_name_type const &group) const |
Check if a group exists. More... | |
bool | has_key (group_name_type const &group, key_type const &key) const |
Check if a key exists. More... | |
void | set_group (group_name_type const &group, comment_type const &comment) |
Set a group. More... | |
void | set_group (group_name_type const &group, comment_type const &comment, size_type line) |
Set a group. More... | |
comment_type | get_comment (group_name_type const &group) const |
Get a group comment. More... | |
comment_type | get_comment (group_name_type const &group, key_type const &key) const |
Get a key comment. More... | |
size_type | get_line (group_name_type const &group) const |
Get a group line number. More... | |
size_type | get_line (group_name_type const &group, key_type const &key) const |
Get a key line number. More... | |
template<typename T > | |
bool | get_value (group_name_type const &group, key_type const &key, T &value) const |
Get a key value. More... | |
template<typename T > | |
bool | get_value (group_name_type const &group, key_type const &key, priority priority, T &value) const |
Get a key value. More... | |
bool | get_locale_string (group_name_type const &group, key_type const &key, value_type &value) const |
Get a localised key string value. More... | |
bool | get_locale_string (group_name_type const &group, key_type const &key, priority priority, value_type &value) const |
Get a localised key string value. More... | |
bool | get_locale_string (group_name_type const &group, key_type const &key, std::string const &locale, value_type &value) const |
Get a localised key string value for a specific locale. More... | |
bool | get_locale_string (group_name_type const &group, key_type const &key, std::string const &locale, priority priority, value_type &value) const |
Get a localised key string value for a specific locale. More... | |
template<typename C > | |
bool | get_list_value (group_name_type const &group, key_type const &key, C &container) const |
Get a key value as a list. More... | |
template<typename C > | |
bool | get_list_value (group_name_type const &group, key_type const &key, priority priority, C &container) const |
Get a key value as a list. More... | |
template<typename C > | |
bool | get_set_value (group_name_type const &group, key_type const &key, C &container) const |
Get a key value as a set. More... | |
template<typename C > | |
bool | get_set_value (group_name_type const &group, key_type const &key, priority priority, C &container) const |
Get a key value as a set. More... | |
template<typename T > | |
void | set_value (group_name_type const &group, key_type const &key, T const &value) |
Set a key value. More... | |
template<typename T > | |
void | set_value (group_name_type const &group, key_type const &key, T const &value, comment_type const &comment) |
Set a key value. More... | |
template<typename T > | |
void | set_value (group_name_type const &group, key_type const &key, T const &value, comment_type const &comment, size_type line) |
Set a key value. More... | |
template<typename I > | |
void | set_list_value (group_name_type const &group, key_type const &key, I begin, I end) |
Set a key value from a list. More... | |
template<typename I > | |
void | set_list_value (group_name_type const &group, key_type const &key, I begin, I end, comment_type const &comment) |
Set a key value from a list. More... | |
template<typename I > | |
void | set_list_value (group_name_type const &group, key_type const &key, I begin, I end, comment_type const &comment, size_type line) |
Set a key value from a list. More... | |
template<typename I > | |
void | set_set_value (group_name_type const &group, key_type const &key, I begin, I end) |
Set a key value from a set. More... | |
template<typename I > | |
void | set_set_value (group_name_type const &group, key_type const &key, I begin, I end, comment_type const &comment) |
Set a key value from a set. More... | |
template<typename I > | |
void | set_set_value (group_name_type const &group, key_type const &key, I begin, I end, comment_type const &comment, size_type line) |
Set a key value from a set. More... | |
void | remove_group (group_name_type const &group) |
Remove a group. More... | |
void | remove_key (group_name_type const &group, key_type const &key) |
Remove a key. More... | |
basic_keyfile & | operator+= (basic_keyfile const &rhs) |
Add a basic_keyfile to the basic_keyfile. More... | |
![]() | |
keyfile_base () | |
The constructor. | |
virtual | ~keyfile_base () |
The destructor. | |
Static Public Member Functions | |
template<class C , typename T > | |
static void | set_object_value (C const &object, T(C::*method)() const, basic_keyfile &basic_keyfile, group_name_type const &group, key_type const &key) |
Set a key value from an object method return value. More... | |
template<class C , typename T > | |
static void | set_object_value (C const &object, T const &(C::*method)() const, basic_keyfile &basic_keyfile, group_name_type const &group, key_type const &key) |
Set a key value from an object method return value reference. More... | |
template<class C , typename T > | |
static void | set_object_list_value (C const &object, T(C::*method)() const, basic_keyfile &basic_keyfile, group_name_type const &group, key_type const &key) |
Set a key list value from an object method return value. More... | |
template<class C , typename T > | |
static void | set_object_list_value (C const &object, T const &(C::*method)() const, basic_keyfile &basic_keyfile, group_name_type const &group, key_type const &key) |
Set a key list value from an object method return value. More... | |
template<class C , typename T > | |
static void | set_object_set_value (C const &object, T(C::*method)() const, basic_keyfile &basic_keyfile, group_name_type const &group, key_type const &key) |
Set a key set value from an object method return value. More... | |
template<class C , typename T > | |
static void | set_object_set_value (C const &object, T const &(C::*method)() const, basic_keyfile &basic_keyfile, group_name_type const &group, key_type const &key) |
Set a key set value from an object method return value. More... | |
template<class C , typename T > | |
static void | get_object_value (C &object, void(C::*method)(T param), basic_keyfile const &basic_keyfile, group_name_type const &group, key_type const &key, basic_keyfile::priority priority) |
Get a key value and set it in an object using an object method. More... | |
template<class C , typename T > | |
static void | get_object_value (C &object, void(C::*method)(T const ¶m), basic_keyfile const &basic_keyfile, group_name_type const &group, key_type const &key, basic_keyfile::priority priority) |
Get a key value and set it by reference in an object using an object method. More... | |
template<class C , typename T > | |
static void | get_object_list_value (C &object, void(C::*method)(T param), basic_keyfile const &basic_keyfile, group_name_type const &group, key_type const &key, basic_keyfile::priority priority) |
Get a key list value and set it in an object using an object method. More... | |
template<class C , typename T > | |
static void | get_object_list_value (C &object, void(C::*method)(T const ¶m), basic_keyfile const &basic_keyfile, group_name_type const &group, key_type const &key, basic_keyfile::priority priority) |
Get a key list value and set it by reference in an object using an object method. More... | |
template<class C , typename T > | |
static void | get_object_set_value (C &object, void(C::*method)(T param), basic_keyfile const &basic_keyfile, group_name_type const &group, key_type const &key, basic_keyfile::priority priority) |
Get a key set value and set it in an object using an object method. More... | |
template<class C , typename T > | |
static void | get_object_set_value (C &object, void(C::*method)(T const ¶m), basic_keyfile const &basic_keyfile, group_name_type const &group, key_type const &key, basic_keyfile::priority priority) |
Get a key set value and set it by reference in an object using an object method. More... | |
Private Types | |
typedef P | parse_type |
Parse type. | |
typedef std::tuple< key_type, value_type, comment_type, size_type > | item_type |
Key-value-comment-line tuple. | |
typedef std::map< key_type, item_type > | item_map_type |
Map between key name and key-value-comment tuple. | |
typedef std::tuple< group_name_type, item_map_type, comment_type, size_type > | group_type |
Group-items-comment-line tuple. | |
typedef std::map< group_name_type, group_type > | group_map_type |
Map between group name and group-items-comment tuple. | |
typedef std::vector< key_type > | key_list |
Vector of keys. | |
Private Member Functions | |
const group_type * | find_group (group_name_type const &group) const |
Find a group by it's name. More... | |
group_type * | find_group (group_name_type const &group) |
Find a group by it's name. More... | |
const item_type * | find_item (group_name_type const &group, key_type const &key) const |
Find a key by it's group and name. More... | |
item_type * | find_item (group_name_type const &group, key_type const &key) |
Find a key by it's group and name. More... | |
void | check_priority (group_name_type const &group, key_type const &key, priority priority, bool valid) const |
Check if a key is missing or present when not permitted. More... | |
Static Private Member Functions | |
static void | print_comment (comment_type const &comment, std::ostream &stream) |
Print a comment to a stream. More... | |
Private Attributes | |
group_map_type | groups |
The top-level groups. | |
value_type | separator |
The separator used as a list item delimiter. | |
Friends | |
template<typename _K , typename _P > | |
basic_keyfile< _K, _P > | operator+ (basic_keyfile< _K, _P > const &lhs, basic_keyfile< _K, _P > const &rhs) |
Add a basic_keyfile to the basic_keyfile. More... | |
template<class charT , class traits > | |
std::basic_istream< charT, traits > & | operator>> (std::basic_istream< charT, traits > &stream, basic_keyfile &kf) |
basic_keyfile initialisation from an istream. More... | |
template<class charT , class traits > | |
std::basic_ostream< charT, traits > & | operator<< (std::basic_ostream< charT, traits > &stream, basic_keyfile const &kf) |
basic_keyfile output to an ostream. More... | |
Configuration file parser.
This class loads an INI-style configuration file from a file or stream. The format is documented in schroot.conf(5).
sbuild::basic_keyfile< K, P >::basic_keyfile | ( | std::string const & | file | ) |
The constructor.
file | the file to load the configuration from. |
sbuild::basic_keyfile< K, P >::basic_keyfile | ( | std::istream & | stream | ) |
The constructor.
stream | the stream to load the configuration from. |
void sbuild::basic_keyfile< K, P >::check_keys | ( | group_name_type const & | group, |
key_list const & | keys | ||
) | const |
Check for unused keys in a group.
If keys other than the specified keys exist in the specified group, print a warning about unknown keys having been used.
group | the group to use. |
keys | the keys which have been used. |
|
private |
Check if a key is missing or present when not permitted.
group | the group the key is in. |
key | the key to get. |
priority | the key priority. |
valid | true if key exists, false if not existing. |
|
private |
Find a group by it's name.
group | the group to find. |
|
private |
Find a group by it's name.
group | the group to find. |
|
private |
Find a key by it's group and name.
group | the group the key is in. |
key | the key to find |
|
private |
Find a key by it's group and name.
group | the group the key is in. |
key | the key to find |
comment_type sbuild::basic_keyfile< K, P >::get_comment | ( | group_name_type const & | group | ) | const |
Get a group comment.
group | the group to find. |
comment_type sbuild::basic_keyfile< K, P >::get_comment | ( | group_name_type const & | group, |
key_type const & | key | ||
) | const |
Get a key comment.
group | the group to find. |
key | the key to find. |
group_list sbuild::basic_keyfile< K, P >::get_groups | ( | ) | const |
Get a list of groups.
Referenced by sbuild::chroot_config::load_keyfile().
key_list sbuild::basic_keyfile< K, P >::get_keys | ( | group_name_type const & | group | ) | const |
Get a list of keys in a group.
group | the group to use. |
Referenced by sbuild::chroot::set_keyfile().
size_type sbuild::basic_keyfile< K, P >::get_line | ( | group_name_type const & | group | ) | const |
Get a group line number.
group | the group to find. |
Referenced by sbuild::chroot_config::add(), sbuild::basic_keyfile< K, P >::get_object_list_value(), sbuild::basic_keyfile< K, P >::get_object_set_value(), sbuild::basic_keyfile< K, P >::get_object_value(), and sbuild::chroot::set_keyfile().
size_type sbuild::basic_keyfile< K, P >::get_line | ( | group_name_type const & | group, |
key_type const & | key | ||
) | const |
Get a key line number.
group | the group to find. |
key | the key to find. |
|
inline |
Get a key value as a list.
group | the group the key is in. |
key | the key to get. |
container | the container to store the key's value in. The value type must be settable from an istream and be copyable. The list must be a container with a standard insert method. |
References sbuild::log_exception_warning(), sbuild::parse_value(), and sbuild::split_string().
Referenced by sbuild::basic_keyfile< K, P >::get_object_list_value().
|
inline |
Get a key value as a list.
If the value does not exist, is deprecated or obsolete, warn appropriately.
group | the group the key is in. |
key | the key to get. |
priority | the priority of the option. |
container | the container to store the key's value in. The value type must be settable from an istream and be copyable. The list must be a container with a standard insert method. |
bool sbuild::basic_keyfile< K, P >::get_locale_string | ( | group_name_type const & | group, |
key_type const & | key, | ||
value_type & | value | ||
) | const |
Get a localised key string value.
group | the group the key is in. |
key | the key to get. |
value | the string to store the key's localised value in. |
bool sbuild::basic_keyfile< K, P >::get_locale_string | ( | group_name_type const & | group, |
key_type const & | key, | ||
priority | priority, | ||
value_type & | value | ||
) | const |
Get a localised key string value.
If the value does not exist, is deprecated or obsolete, warn appropriately.
group | the group the key is in. |
key | the key to get. |
priority | the priority of the option. |
value | the string to store the key's localised value in. |
bool sbuild::basic_keyfile< K, P >::get_locale_string | ( | group_name_type const & | group, |
key_type const & | key, | ||
std::string const & | locale, | ||
value_type & | value | ||
) | const |
Get a localised key string value for a specific locale.
group | the group the key is in. |
key | the key to get. |
locale | the locale to use. |
value | the string to store the key's localised value in. |
bool sbuild::basic_keyfile< K, P >::get_locale_string | ( | group_name_type const & | group, |
key_type const & | key, | ||
std::string const & | locale, | ||
priority | priority, | ||
value_type & | value | ||
) | const |
Get a localised key string value for a specific locale.
If the value does not exist, is deprecated or obsolete, warn appropriately.
group | the group the key is in. |
key | the key to get. |
locale | the locale to use. |
priority | the priority of the option. |
value | the string to store the key's localised value in. |
|
inlinestatic |
Get a key list value and set it in an object using an object method.
This is the same as calling get_list_value directly, but handles exceptions being thrown by the object method, and deserialisation errors, which are turned into error exceptions pointing to the group, key and line number in the input file.
object | the object to use. |
method | the object method to call. |
basic_keyfile | the basic_keyfile to use. |
group | the group the key is in. |
key | the key to set. |
priority | the key priority. |
References sbuild::basic_keyfile< K, P >::get_line(), sbuild::basic_keyfile< K, P >::get_list_value(), sbuild::basic_keyfile_parser< K >::group, sbuild::basic_keyfile_parser< K >::key, and sbuild::basic_keyfile_parser< K >::value.
Referenced by sbuild::chroot_facet_session::set_keyfile(), sbuild::chroot_facet_source_clonable::set_keyfile(), and sbuild::chroot::set_keyfile().
|
inlinestatic |
Get a key list value and set it by reference in an object using an object method.
This is the same as calling get_list_value directly, but handles exceptions being thrown by the object method, and deserialisation errors, which are turned into error exceptions pointing to the group, key and line number in the input file.
object | the object to use. |
method | the object method to call. |
basic_keyfile | the basic_keyfile to use. |
group | the group the key is in. |
key | the key to set. |
priority | the key priority. |
References sbuild::basic_keyfile< K, P >::get_line(), sbuild::basic_keyfile< K, P >::get_list_value(), sbuild::basic_keyfile_parser< K >::group, sbuild::basic_keyfile_parser< K >::key, and sbuild::basic_keyfile_parser< K >::value.
|
inlinestatic |
Get a key set value and set it in an object using an object method.
This is the same as calling get_set_value directly, but handles exceptions being thrown by the object method, and deserialisation errors, which are turned into error exceptions pointing to the group, key and line number in the input file.
object | the object to use. |
method | the object method to call. |
basic_keyfile | the basic_keyfile to use. |
group | the group the key is in. |
key | the key to set. |
priority | the key priority. |
References sbuild::basic_keyfile< K, P >::get_line(), sbuild::basic_keyfile< K, P >::get_set_value(), sbuild::basic_keyfile_parser< K >::group, sbuild::basic_keyfile_parser< K >::key, and sbuild::basic_keyfile_parser< K >::value.
Referenced by sbuild::chroot_facet_userdata::set_keyfile().
|
inlinestatic |
Get a key set value and set it by reference in an object using an object method.
This is the same as calling get_set_value directly, but handles exceptions being thrown by the object method, and deserialisation errors, which are turned into error exceptions pointing to the group, key and line number in the input file.
object | the object to use. |
method | the object method to call. |
basic_keyfile | the basic_keyfile to use. |
group | the group the key is in. |
key | the key to set. |
priority | the key priority. |
References sbuild::basic_keyfile< K, P >::get_line(), sbuild::basic_keyfile< K, P >::get_set_value(), sbuild::basic_keyfile_parser< K >::group, sbuild::basic_keyfile_parser< K >::key, and sbuild::basic_keyfile_parser< K >::value.
|
inlinestatic |
Get a key value and set it in an object using an object method.
This is the same as calling get_value directly, but handles exceptions being thrown by the object method, and deserialisation errors, which are turned into error exceptions pointing to the group, key and line number in the input file.
object | the object to use. |
method | the object method to call. |
basic_keyfile | the basic_keyfile to use. |
group | the group the key is in. |
key | the key to set. |
priority | the key priority. |
References sbuild::basic_keyfile< K, P >::get_line(), sbuild::basic_keyfile< K, P >::get_value(), and sbuild::basic_keyfile_parser< K >::value.
Referenced by sbuild::chroot_directory_base::set_keyfile(), sbuild::chroot_block_device_base::set_keyfile(), sbuild::chroot_facet_personality::set_keyfile(), sbuild::chroot_loopback::set_keyfile(), sbuild::chroot_lvm_snapshot::set_keyfile(), sbuild::chroot_custom::set_keyfile(), sbuild::chroot_facet_mountable::set_keyfile(), sbuild::chroot_facet_session::set_keyfile(), sbuild::chroot_btrfs_snapshot::set_keyfile(), sbuild::chroot_file::set_keyfile(), sbuild::chroot_facet_union::set_keyfile(), sbuild::chroot_facet_source_clonable::set_keyfile(), and sbuild::chroot::set_keyfile().
|
inlinestatic |
Get a key value and set it by reference in an object using an object method.
This is the same as calling get_value directly, but handles exceptions being thrown by the object method, and deserialisation errors, which are turned into error exceptions pointing to the group, key and line number in the input file.
object | the object to use. |
method | the object method to call. |
basic_keyfile | the basic_keyfile to use. |
group | the group the key is in. |
key | the key to set. |
priority | the key priority. |
References sbuild::basic_keyfile< K, P >::get_line(), sbuild::basic_keyfile< K, P >::get_value(), and sbuild::basic_keyfile_parser< K >::value.
|
inline |
Get a key value as a set.
group | the group the key is in. |
key | the key to get. |
container | the container to store the key's value in. The value type must be settable from an istream and be copyable. The set must be a container with a standard insert method. |
References sbuild::log_exception_warning(), sbuild::parse_value(), and sbuild::split_string().
Referenced by sbuild::basic_keyfile< K, P >::get_object_set_value().
|
inline |
Get a key value as a set.
If the value does not exist, is deprecated or obsolete, warn appropriately.
group | the group the key is in. |
key | the key to get. |
priority | the priority of the option. |
container | the container to store the key's value in. The value type must be settable from an istream and be copyable. The set must be a container with a standard insert method. |
|
inline |
Get a key value.
group | the group the key is in. |
key | the key to get. |
value | the value to store the key's value in. This must be settable from an istream and be copyable. |
References sbuild::DEBUG_INFO, sbuild::DEBUG_NOTICE, sbuild::log_debug(), sbuild::log_exception_warning(), and sbuild::parse_value().
Referenced by sbuild::basic_keyfile< K, P >::get_object_value(), sbuild::chroot_config::load_keyfile(), and sbuild::chroot::set_keyfile().
|
inline |
Get a key value.
If the value does not exist, is deprecated or obsolete, warn appropriately.
group | the group the key is in. |
key | the key to get. |
priority | the priority of the option. |
value | the value to store the key's value in. This must be settable from an istream and be copyable. |
References sbuild::basic_keyfile_parser< K >::key, and sbuild::basic_keyfile_parser< K >::value.
bool sbuild::basic_keyfile< K, P >::has_group | ( | group_name_type const & | group | ) | const |
Check if a group exists.
group | the group to check for. |
bool sbuild::basic_keyfile< K, P >::has_key | ( | group_name_type const & | group, |
key_type const & | key | ||
) | const |
Check if a key exists.
group | the group the key is in. |
key | the key to check for. |
Referenced by sbuild::chroot_directory_base::set_keyfile().
basic_keyfile& sbuild::basic_keyfile< K, P >::operator+= | ( | basic_keyfile< K, P > const & | rhs | ) |
Add a basic_keyfile to the basic_keyfile.
rhs | the basic_keyfile to add. |
|
staticprivate |
Print a comment to a stream.
The comment will have hash ('#') marks printed at the start of each line.
comment | the comment to print. |
stream | the stream to output to. |
void sbuild::basic_keyfile< K, P >::remove_group | ( | group_name_type const & | group | ) |
Remove a group.
group | the group to remove. |
Referenced by sbuild::chroot::get_keyfile().
void sbuild::basic_keyfile< K, P >::remove_key | ( | group_name_type const & | group, |
key_type const & | key | ||
) |
Remove a key.
group | the group the key is in. |
key | the key to remove. |
void sbuild::basic_keyfile< K, P >::set_group | ( | group_name_type const & | group, |
comment_type const & | comment | ||
) |
Set a group.
The group will be created (and the comment set) only if the group does not already exist.
group | the group to set. |
comment | the comment to set. |
void sbuild::basic_keyfile< K, P >::set_group | ( | group_name_type const & | group, |
comment_type const & | comment, | ||
size_type | line | ||
) |
Set a group.
The group will be created (and the comment set) only if the group does not already exist.
group | the group to set. |
comment | the comment to set. |
line | the line number in the input file, or 0 otherwise. |
|
inline |
Set a key value from a list.
group | the group the key is in. |
key | the key to set. |
begin | an iterator referring to the start of the list. The value type must allow output to an ostream. |
end | an iterator referring to the end of the list. |
Referenced by sbuild::basic_keyfile< K, P >::set_object_list_value().
|
inline |
Set a key value from a list.
group | the group the key is in. |
key | the key to set. |
begin | an iterator referring to the start of the list. The value type must allow output to an ostream. |
end | an iterator referring to the end of the list. |
comment | the comment for this key. |
|
inline |
Set a key value from a list.
group | the group the key is in. |
key | the key to set. |
begin | an iterator referring to the start of the list. The value type must allow output to an ostream. |
end | an iterator referring to the end of the list. |
comment | the comment for this key. |
line | the line number in the input file, or 0 otherwise. |
References sbuild::basic_keyfile_parser< K >::end().
|
inlinestatic |
Set a key list value from an object method return value.
The method must return a container with begin() and end() methods which return forward iterators. This is the same as calling set_list_value directly, but handles exceptions being thrown by the object method, which are turned into error exceptions.
object | the object to use. |
method | the object method to call. |
basic_keyfile | the basic_keyfile to use. |
group | the group the key is in. |
key | the key to set. |
References sbuild::basic_keyfile_parser< K >::begin(), sbuild::basic_keyfile_parser< K >::end(), and sbuild::basic_keyfile< K, P >::set_list_value().
Referenced by sbuild::chroot_facet_source_clonable::get_keyfile(), and sbuild::chroot::get_keyfile().
|
inlinestatic |
Set a key list value from an object method return value.
The method must return a container reference with begin() and end() methods which return forward iterators. This is the same as calling set_list_value directly, but handles exceptions being thrown by the object method, which are turned into error exceptions.
object | the object to use. |
method | the object method to call. |
basic_keyfile | the basic_keyfile to use. |
group | the group the key is in. |
key | the key to set. |
References sbuild::basic_keyfile_parser< K >::begin(), sbuild::basic_keyfile_parser< K >::end(), and sbuild::basic_keyfile< K, P >::set_list_value().
|
inlinestatic |
Set a key set value from an object method return value.
The method must return a container with begin() and end() methods which return forward iterators. This is the same as calling set_set_value directly, but handles exceptions being thrown by the object method, which are turned into error exceptions.
object | the object to use. |
method | the object method to call. |
basic_keyfile | the basic_keyfile to use. |
group | the group the key is in. |
key | the key to set. |
References sbuild::basic_keyfile_parser< K >::begin(), sbuild::basic_keyfile_parser< K >::end(), and sbuild::basic_keyfile< K, P >::set_set_value().
Referenced by sbuild::chroot_facet_userdata::get_keyfile().
|
inlinestatic |
Set a key set value from an object method return value.
The method must return a container reference with begin() and end() methods which return forward iterators. This is the same as calling set_set_value directly, but handles exceptions being thrown by the object method, which are turned into error exceptions.
object | the object to use. |
method | the object method to call. |
basic_keyfile | the basic_keyfile to use. |
group | the group the key is in. |
key | the key to set. |
References sbuild::basic_keyfile_parser< K >::begin(), sbuild::basic_keyfile_parser< K >::end(), and sbuild::basic_keyfile< K, P >::set_set_value().
|
inlinestatic |
Set a key value from an object method return value.
This is the same as calling set_value directly, but handles exceptions being thrown by the object method, which are turned into error exceptions.
object | the object to use. |
method | the object method to call. |
basic_keyfile | the basic_keyfile to use. |
group | the group the key is in. |
key | the key to set. |
References sbuild::basic_keyfile< K, P >::set_value().
Referenced by sbuild::chroot_directory_base::get_keyfile(), sbuild::chroot_block_device_base::get_keyfile(), sbuild::chroot_facet_personality::get_keyfile(), sbuild::chroot_loopback::get_keyfile(), sbuild::chroot_lvm_snapshot::get_keyfile(), sbuild::chroot_custom::get_keyfile(), sbuild::chroot_facet_mountable::get_keyfile(), sbuild::chroot_facet_session::get_keyfile(), sbuild::chroot_btrfs_snapshot::get_keyfile(), sbuild::chroot_file::get_keyfile(), sbuild::chroot_facet_union::get_keyfile(), sbuild::chroot_facet_source_clonable::get_keyfile(), and sbuild::chroot::get_keyfile().
|
inlinestatic |
Set a key value from an object method return value reference.
This is the same as calling set_value directly, but handles exceptions being thrown by the object method, which are turned into error exceptions.
object | the object to use. |
method | the object method to call. |
basic_keyfile | the basic_keyfile to use. |
group | the group the key is in. |
key | the key to set. |
References sbuild::basic_keyfile< K, P >::set_value().
|
inline |
Set a key value from a set.
group | the group the key is in. |
key | the key to set. |
begin | an iterator referring to the start of the set. The value type must allow output to an ostream. |
end | an iterator referring to the end of the set. |
Referenced by sbuild::basic_keyfile< K, P >::set_object_set_value().
|
inline |
Set a key value from a set.
group | the group the key is in. |
key | the key to set. |
begin | an iterator referring to the start of the set. The value type must allow output to an ostream. |
end | an iterator referring to the end of the set. |
comment | the comment for this key. |
References sbuild::basic_keyfile_parser< K >::comment.
|
inline |
Set a key value from a set.
group | the group the key is in. |
key | the key to set. |
begin | an iterator referring to the start of the set. The value type must allow output to an ostream. |
end | an iterator referring to the end of the set. |
comment | the comment for this key. |
line | the line number in the input file, or 0 otherwise. |
References sbuild::basic_keyfile_parser< K >::comment.
|
inline |
Set a key value.
group | the group the key is in. |
key | the key to set. |
value | the value to get the key's value from. This must allow output to an ostream. |
Referenced by sbuild::chroot_facet_userdata::get_keyfile(), and sbuild::basic_keyfile< K, P >::set_object_value().
|
inline |
Set a key value.
group | the group the key is in. |
key | the key to set. |
value | the value to get the key's value from. This must allow output to an ostream. |
comment | the comment for this key. |
|
inline |
Set a key value.
group | the group the key is in. |
key | the key to set. |
value | the value to get the key's value from. This must allow output to an ostream. |
comment | the comment for this key. |
line | the line number in the input file, or 0 otherwise. |
References sbuild::basic_keyfile_parser< K >::comment, and sbuild::basic_keyfile_parser< K >::value.
|
friend |
Add a basic_keyfile to the basic_keyfile.
lhs | the basic_keyfile to add to. |
rhs | the values to add. |
|
friend |
basic_keyfile output to an ostream.
stream | the stream to output to. |
kf | the basic_keyfile to output. |
|
friend |
basic_keyfile initialisation from an istream.
stream | the stream to input from. |
kf | the basic_keyfile to set. |