sbuild::basic_keyfile< K, P > Class Template Reference

Configuration file parser. More...

#include <sbuild-basic-keyfile.h>

Inheritance diagram for sbuild::basic_keyfile< K, P >:

Inheritance graph
[legend]
Collaboration diagram for sbuild::basic_keyfile< K, P >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 basic_keyfile ()
 The constructor.
 basic_keyfile (std::string const &file)
 The constructor.
 basic_keyfile (std::istream &stream)
 The constructor.
virtual ~basic_keyfile ()
 The destructor.
string_list get_groups () const
 Get a list of groups.
string_list get_keys (group_name_type const &group) const
 Get a list of keys in a group.
bool has_group (group_name_type const &group) const
 Check if a group exists.
bool has_key (group_name_type const &group, key_type const &key) const
 Check if a key exists.
void set_group (group_name_type const &group, comment_type const &comment)
 Set a group.
void set_group (group_name_type const &group, comment_type const &comment, size_type line)
 Set a group.
comment_type get_comment (group_name_type const &group) const
 Get a group comment.
comment_type get_comment (group_name_type const &group, key_type const &key) const
 Get a key comment.
size_type get_line (group_name_type const &group) const
 Get a group line number.
size_type get_line (group_name_type const &group, key_type const &key) const
 Get a key line number.
template<typename T>
bool get_value (group_name_type const &group, key_type const &key, T &value) const
 Get a key value.
template<typename T>
bool get_value (group_name_type const &group, key_type const &key, priority priority, T &value) const
 Get a key value.
bool get_locale_string (group_name_type const &group, key_type const &key, std::string &value) const
 Get a localised key string value.
bool get_locale_string (group_name_type const &group, key_type const &key, priority priority, std::string &value) const
 Get a localised key string value.
bool get_locale_string (group_name_type const &group, key_type const &key, std::string const &locale, std::string &value) const
 Get a localised key string value for a specific locale.
bool get_locale_string (group_name_type const &group, key_type const &key, std::string const &locale, priority priority, std::string &value) const
 Get a localised key string value for a specific locale.
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.
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.
template<typename T>
void set_value (group_name_type const &group, key_type const &key, T const &value)
 Set a key value.
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.
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.
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.
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.
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.
void remove_group (group_name_type const &group)
 Remove a group.
void remove_key (group_name_type const &group, key_type const &key)
 Remove a key.
basic_keyfileoperator+= (basic_keyfile const &rhs)
 Add a basic_keyfile to the basic_keyfile.

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.
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.
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.
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.
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.
template<class C, typename T>
static void get_object_value (C &object, void(C::*method)(T const &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 by reference in an object using an object method.
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.
template<class C, typename T>
static void get_object_list_value (C &object, void(C::*method)(T const &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 by reference in an object using an object method.

Private 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 P parse_type
 Parse type.
typedef std::tr1::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::tr1::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.

Private Member Functions

const group_typefind_group (group_name_type const &group) const
 Find a group by it's name.
group_typefind_group (group_name_type const &group)
 Find a group by it's name.
const item_typefind_item (group_name_type const &group, key_type const &key) const
 Find a key by it's group and name.
item_typefind_item (group_name_type const &group, key_type const &key)
 Find a key by it's group and name.
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.

Static Private Member Functions

static void print_comment (comment_type 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<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.
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.
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.

Detailed Description

template<typename K, typename P = basic_keyfile_parser<K>>
class sbuild::basic_keyfile< K, P >

Configuration file parser.

This class loads an INI-style configuration file from a file or stream. The format is documented in schroot.conf(5). It is an independent reimplementation of the Glib GKeyFile class, which it replaces.


Member Typedef Documentation

template<typename K, typename P = basic_keyfile_parser<K>>
typedef K::group_name_type sbuild::basic_keyfile< K, P >::group_name_type [private]

Group name.

template<typename K, typename P = basic_keyfile_parser<K>>
typedef K::key_type sbuild::basic_keyfile< K, P >::key_type [private]

Key name.

template<typename K, typename P = basic_keyfile_parser<K>>
typedef K::value_type sbuild::basic_keyfile< K, P >::value_type [private]

Value.

template<typename K, typename P = basic_keyfile_parser<K>>
typedef K::comment_type sbuild::basic_keyfile< K, P >::comment_type [private]

Comment.

template<typename K, typename P = basic_keyfile_parser<K>>
typedef K::size_type sbuild::basic_keyfile< K, P >::size_type [private]

Line number.

template<typename K, typename P = basic_keyfile_parser<K>>
typedef P sbuild::basic_keyfile< K, P >::parse_type [private]

Parse type.

template<typename K, typename P = basic_keyfile_parser<K>>
typedef std::tr1::tuple<key_type,value_type,comment_type,size_type> sbuild::basic_keyfile< K, P >::item_type [private]

Key-value-comment-line tuple.

template<typename K, typename P = basic_keyfile_parser<K>>
typedef std::map<key_type,item_type> sbuild::basic_keyfile< K, P >::item_map_type [private]

Map between key name and key-value-comment tuple.

template<typename K, typename P = basic_keyfile_parser<K>>
typedef std::tr1::tuple<group_name_type,item_map_type,comment_type,size_type> sbuild::basic_keyfile< K, P >::group_type [private]

Group-items-comment-line tuple.

template<typename K, typename P = basic_keyfile_parser<K>>
typedef std::map<group_name_type,group_type> sbuild::basic_keyfile< K, P >::group_map_type [private]

Map between group name and group-items-comment tuple.


Constructor & Destructor Documentation

template<typename K, typename P = basic_keyfile_parser<K>>
sbuild::basic_keyfile< K, P >::basic_keyfile (  ) 

The constructor.

template<typename K, typename P = basic_keyfile_parser<K>>
sbuild::basic_keyfile< K, P >::basic_keyfile ( std::string const &  file  ) 

The constructor.

Parameters:
file the file to load the configuration from.

template<typename K, typename P = basic_keyfile_parser<K>>
sbuild::basic_keyfile< K, P >::basic_keyfile ( std::istream &  stream  ) 

The constructor.

Parameters:
stream the stream to load the configuration from.

template<typename K, typename P = basic_keyfile_parser<K>>
virtual sbuild::basic_keyfile< K, P >::~basic_keyfile (  )  [virtual]

The destructor.


Member Function Documentation

template<typename K, typename P = basic_keyfile_parser<K>>
string_list sbuild::basic_keyfile< K, P >::get_groups (  )  const

Get a list of groups.

Returns:
a list of groups in the basic_keyfile. If no groups exist, the list will be empty.

template<typename K, typename P = basic_keyfile_parser<K>>
string_list sbuild::basic_keyfile< K, P >::get_keys ( group_name_type const &  group  )  const

Get a list of keys in a group.

Parameters:
group the group to use.
Returns:
a list of keys in a group. If no keys exist in the group, or the group does not exist, the list will be empty.

template<typename K, typename P = basic_keyfile_parser<K>>
bool sbuild::basic_keyfile< K, P >::has_group ( group_name_type const &  group  )  const

Check if a group exists.

Parameters:
group the group to check for.
Returns:
true if the group exists, otherwise false.

template<typename K, typename P = basic_keyfile_parser<K>>
bool sbuild::basic_keyfile< K, P >::has_key ( group_name_type const &  group,
key_type const &  key 
) const

Check if a key exists.

Parameters:
group the group the key is in.
key the key to check for.
Returns:
true if the key exists, otherwise false.

template<typename K, typename P = basic_keyfile_parser<K>>
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.

Parameters:
group the group to set.
comment the comment to set.

template<typename K, typename P = basic_keyfile_parser<K>>
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.

Parameters:
group the group to set.
comment the comment to set.
line the line number in the input file, or 0 otherwise.

template<typename K, typename P = basic_keyfile_parser<K>>
comment_type sbuild::basic_keyfile< K, P >::get_comment ( group_name_type const &  group  )  const

Get a group comment.

Parameters:
group the group to find.
Returns:
the comment.

template<typename K, typename P = basic_keyfile_parser<K>>
comment_type sbuild::basic_keyfile< K, P >::get_comment ( group_name_type const &  group,
key_type const &  key 
) const

Get a key comment.

Parameters:
group the group to find.
key the key to find.
Returns:
the comment.

template<typename K, typename P = basic_keyfile_parser<K>>
size_type sbuild::basic_keyfile< K, P >::get_line ( group_name_type const &  group  )  const

Get a group line number.

Parameters:
group the group to find.
Returns:
the line number, or 0 if not available.

template<typename K, typename P = basic_keyfile_parser<K>>
size_type sbuild::basic_keyfile< K, P >::get_line ( group_name_type const &  group,
key_type const &  key 
) const

Get a key line number.

Parameters:
group the group to find.
key the key to find.
Returns:
the line number, or 0 if not available.

template<typename K, typename P = basic_keyfile_parser<K>>
template<typename T>
bool sbuild::basic_keyfile< K, P >::get_value ( group_name_type const &  group,
key_type const &  key,
T &  value 
) const [inline]

Get a key value.

Parameters:
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.
Returns:
true if the key was found, otherwise false (in which case value will be unchanged).

template<typename K, typename P = basic_keyfile_parser<K>>
template<typename T>
bool sbuild::basic_keyfile< K, P >::get_value ( group_name_type const &  group,
key_type const &  key,
priority  priority,
T &  value 
) const [inline]

Get a key value.

If the value does not exist, is deprecated or obsolete, warn appropriately.

Parameters:
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.
Returns:
true if the key was found, otherwise false (in which case value will be unchanged).

template<typename K, typename P = basic_keyfile_parser<K>>
bool sbuild::basic_keyfile< K, P >::get_locale_string ( group_name_type const &  group,
key_type const &  key,
std::string &  value 
) const

Get a localised key string value.

Parameters:
group the group the key is in.
key the key to get.
value the string to store the key's localised value in.
Returns:
true if the key was found, otherwise false (in which case value will be unchanged).

template<typename K, typename P = basic_keyfile_parser<K>>
bool sbuild::basic_keyfile< K, P >::get_locale_string ( group_name_type const &  group,
key_type const &  key,
priority  priority,
std::string &  value 
) const

Get a localised key string value.

If the value does not exist, is deprecated or obsolete, warn appropriately.

Parameters:
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.
Returns:
true if the key was found, otherwise false (in which case value will be unchanged).

template<typename K, typename P = basic_keyfile_parser<K>>
bool sbuild::basic_keyfile< K, P >::get_locale_string ( group_name_type const &  group,
key_type const &  key,
std::string const &  locale,
std::string &  value 
) const

Get a localised key string value for a specific locale.

Parameters:
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.
Returns:
true if the key was found, otherwise false (in which case value will be unchanged).

template<typename K, typename P = basic_keyfile_parser<K>>
bool sbuild::basic_keyfile< K, P >::get_locale_string ( group_name_type const &  group,
key_type const &  key,
std::string const &  locale,
priority  priority,
std::string &  value 
) const

Get a localised key string value for a specific locale.

If the value does not exist, is deprecated or obsolete, warn appropriately.

Parameters:
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.
Returns:
true if the key was found, otherwise false (in which case value will be unchanged).

template<typename K, typename P = basic_keyfile_parser<K>>
template<typename C>
bool sbuild::basic_keyfile< K, P >::get_list_value ( group_name_type const &  group,
key_type const &  key,
C &  container 
) const [inline]

Get a key value as a list.

Parameters:
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.
Returns:
true if the key was found, otherwise false (in which case value will be undefined).

template<typename K, typename P = basic_keyfile_parser<K>>
template<typename C>
bool sbuild::basic_keyfile< K, P >::get_list_value ( group_name_type const &  group,
key_type const &  key,
priority  priority,
C &  container 
) const [inline]

Get a key value as a list.

If the value does not exist, is deprecated or obsolete, warn appropriately.

Parameters:
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.
Returns:
true if the key was found, otherwise false (in which case value will be undefined).

template<typename K, typename P = basic_keyfile_parser<K>>
template<typename T>
void sbuild::basic_keyfile< K, P >::set_value ( group_name_type const &  group,
key_type const &  key,
T const &  value 
) [inline]

Set a key value.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
template<typename T>
void sbuild::basic_keyfile< K, P >::set_value ( group_name_type const &  group,
key_type const &  key,
T const &  value,
comment_type const &  comment 
) [inline]

Set a key value.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
template<typename T>
void sbuild::basic_keyfile< K, P >::set_value ( group_name_type const &  group,
key_type const &  key,
T const &  value,
comment_type const &  comment,
size_type  line 
) [inline]

Set a key value.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
template<typename I>
void sbuild::basic_keyfile< K, P >::set_list_value ( group_name_type const &  group,
key_type const &  key,
begin,
end 
) [inline]

Set a key value from a list.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
template<typename I>
void sbuild::basic_keyfile< K, P >::set_list_value ( group_name_type const &  group,
key_type const &  key,
begin,
end,
comment_type const &  comment 
) [inline]

Set a key value from a list.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
template<typename I>
void sbuild::basic_keyfile< K, P >::set_list_value ( group_name_type const &  group,
key_type const &  key,
begin,
end,
comment_type const &  comment,
size_type  line 
) [inline]

Set a key value from a list.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
void sbuild::basic_keyfile< K, P >::remove_group ( group_name_type const &  group  ) 

Remove a group.

Parameters:
group the group to remove.

template<typename K, typename P = basic_keyfile_parser<K>>
void sbuild::basic_keyfile< K, P >::remove_key ( group_name_type const &  group,
key_type const &  key 
)

Remove a key.

Parameters:
group the group the key is in.
key the key to remove.

template<typename K, typename P = basic_keyfile_parser<K>>
basic_keyfile& sbuild::basic_keyfile< K, P >::operator+= ( basic_keyfile< K, P > const &  rhs  ) 

Add a basic_keyfile to the basic_keyfile.

Parameters:
rhs the basic_keyfile to add.
Returns:
the modified basic_keyfile.

template<typename K, typename P = basic_keyfile_parser<K>>
const group_type* sbuild::basic_keyfile< K, P >::find_group ( group_name_type const &  group  )  const [private]

Find a group by it's name.

Parameters:
group the group to find.
Returns:
the group, or 0 if not found.

template<typename K, typename P = basic_keyfile_parser<K>>
group_type* sbuild::basic_keyfile< K, P >::find_group ( group_name_type const &  group  )  [private]

Find a group by it's name.

Parameters:
group the group to find.
Returns:
the group, or 0 if not found.

template<typename K, typename P = basic_keyfile_parser<K>>
const item_type* sbuild::basic_keyfile< K, P >::find_item ( group_name_type const &  group,
key_type const &  key 
) const [private]

Find a key by it's group and name.

Parameters:
group the group the key is in.
key the key to find
Returns:
the key, or 0 if not found.

template<typename K, typename P = basic_keyfile_parser<K>>
item_type* sbuild::basic_keyfile< K, P >::find_item ( group_name_type const &  group,
key_type const &  key 
) [private]

Find a key by it's group and name.

Parameters:
group the group the key is in.
key the key to find
Returns:
the key, or 0 if not found.

template<typename K, typename P = basic_keyfile_parser<K>>
void sbuild::basic_keyfile< K, P >::check_priority ( group_name_type const &  group,
key_type const &  key,
priority  priority,
bool  valid 
) const [private]

Check if a key is missing or present when not permitted.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
static void sbuild::basic_keyfile< K, P >::print_comment ( comment_type const &  comment,
std::ostream &  stream 
) [static, private]

Print a comment to a stream.

The comment will have hash ('#') marks printed at the start of each line.

Parameters:
comment the comment to print.
stream the stream to output to.
Todo:
Use split string or some general iterator/algorithm instead of custom string manipulation. This could be reused by log_exception_* functions and split_string.

template<typename K, typename P = basic_keyfile_parser<K>>
template<class C, typename T>
static void sbuild::basic_keyfile< K, P >::set_object_value ( C const &  object,
T(C::*)() const  method,
basic_keyfile< K, P > &  basic_keyfile,
group_name_type const &  group,
key_type const &  key 
) [inline, static]

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.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
template<class C, typename T>
static void sbuild::basic_keyfile< K, P >::set_object_value ( C const &  object,
T const &(C::*)() const  method,
basic_keyfile< K, P > &  basic_keyfile,
group_name_type const &  group,
key_type const &  key 
) [inline, static]

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.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
template<class C, typename T>
static void sbuild::basic_keyfile< K, P >::set_object_list_value ( C const &  object,
T(C::*)() const  method,
basic_keyfile< K, P > &  basic_keyfile,
group_name_type const &  group,
key_type const &  key 
) [inline, static]

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.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
template<class C, typename T>
static void sbuild::basic_keyfile< K, P >::set_object_list_value ( C const &  object,
T const &(C::*)() const  method,
basic_keyfile< K, P > &  basic_keyfile,
group_name_type const &  group,
key_type const &  key 
) [inline, static]

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.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
template<class C, typename T>
static void sbuild::basic_keyfile< K, P >::get_object_value ( C &  object,
void(C::*)(T param)  method,
basic_keyfile< K, P > const &  basic_keyfile,
group_name_type const &  group,
key_type const &  key,
basic_keyfile< K, P >::priority  priority 
) [inline, static]

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.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
template<class C, typename T>
static void sbuild::basic_keyfile< K, P >::get_object_value ( C &  object,
void(C::*)(T const &param)  method,
basic_keyfile< K, P > const &  basic_keyfile,
group_name_type const &  group,
key_type const &  key,
basic_keyfile< K, P >::priority  priority 
) [inline, static]

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.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
template<class C, typename T>
static void sbuild::basic_keyfile< K, P >::get_object_list_value ( C &  object,
void(C::*)(T param)  method,
basic_keyfile< K, P > const &  basic_keyfile,
group_name_type const &  group,
key_type const &  key,
basic_keyfile< K, P >::priority  priority 
) [inline, static]

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.

Parameters:
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.

template<typename K, typename P = basic_keyfile_parser<K>>
template<class C, typename T>
static void sbuild::basic_keyfile< K, P >::get_object_list_value ( C &  object,
void(C::*)(T const &param)  method,
basic_keyfile< K, P > const &  basic_keyfile,
group_name_type const &  group,
key_type const &  key,
basic_keyfile< K, P >::priority  priority 
) [inline, static]

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.

Parameters:
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.


Friends And Related Function Documentation

template<typename K, typename P = basic_keyfile_parser<K>>
template<typename _K, typename _P>
basic_keyfile<_K, _P> operator+ ( basic_keyfile< _K, _P > const &  lhs,
basic_keyfile< _K, _P > const &  rhs 
) [friend]

Add a basic_keyfile to the basic_keyfile.

Parameters:
lhs the basic_keyfile to add to.
rhs the values to add.
Returns:
the new basic_keyfile.

template<typename K, typename P = basic_keyfile_parser<K>>
template<class charT, class traits>
std::basic_istream<charT,traits>& operator>> ( std::basic_istream< charT, traits > &  stream,
basic_keyfile< K, P > &  kf 
) [friend]

basic_keyfile initialisation from an istream.

Parameters:
stream the stream to input from.
kf the basic_keyfile to set.
Returns:
the stream.

template<typename K, typename P = basic_keyfile_parser<K>>
template<class charT, class traits>
std::basic_ostream<charT,traits>& operator<< ( std::basic_ostream< charT, traits > &  stream,
basic_keyfile< K, P > const &  kf 
) [friend]

basic_keyfile output to an ostream.

Parameters:
stream the stream to output to.
kf the basic_keyfile to output.
Returns:
the stream.


Member Data Documentation

template<typename K, typename P = basic_keyfile_parser<K>>
group_map_type sbuild::basic_keyfile< K, P >::groups [private]

The top-level groups.

template<typename K, typename P = basic_keyfile_parser<K>>
char sbuild::basic_keyfile< K, P >::separator [private]

The separator used as a list item delimiter.


The documentation for this class was generated from the following file:
Generated on Sun Jul 8 21:23:49 2007 for sbuild by  doxygen 1.5.2