sbuild::sourcedeps Class Reference

Source dependencies. More...

#include <sbuild-sourcedeps.h>

Collaboration diagram for sbuild::sourcedeps:

Collaboration graph
[legend]
List of all members.

Private Types

typedef std::map< std::string,
string_list > 
dependency_map
 Map of packages to dependency list.
typedef runtime_error_custom<
sourcedeps > 
error
 Exception type.

Private Member Functions

 sourcedeps ()
 The constructor.
 sourcedeps (std::string const &file)
 The constructor.
 sourcedeps (std::istream &stream)
 The constructor.
virtual ~sourcedeps ()
 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.
void set_group (std::string const &group, std::string const &comment)
 Set a group.
std::string get_comment (std::string const &group) const
 Get a group comment.
std::string get_comment (std::string const &group, std::string const &key) const
 Get a key comment.
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.
bool get_locale_string (std::string const &group, std::string const &key, std::string &value) const
 Get a localised key string value.
bool get_locale_string (std::string const &group, std::string const &key, priority priority, std::string &value) const
 Get a localised key string value.
bool get_locale_string (std::string const &group, std::string const &key, std::string const &locale, std::string &value) const
 Get a localised key string value for a specific locale.
bool get_locale_string (std::string const &group, std::string const &key, std::string const &locale, priority priority, std::string &value) const
 Get a localised key string value for a specific locale.
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>
void set_value (std::string const &group, std::string const &key, T const &value, std::string const &comment)
 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.
template<typename T, template< typename T > class C>
void set_list_value (std::string const &group, std::string const &key, C< T > const &value, std::string const &comment)
 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.
sourcedeps & operator+= (sourcedeps const &rhs)
 Add a sourcedeps to the sourcedeps.
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.
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.

Static Private Member Functions

static void print_comment (std::string const &comment, std::ostream &stream)
 Print a comment to a stream.

Private Attributes

sbuild::sourcedeps::special PRIORITY_OPTIONAL
 Configuration parameter priority. The parameter is optional.
sbuild::sourcedeps::special PRIORITY_REQUIRED
 Configuration parameter priority. The parameter is optional. The parameter is required.
sbuild::sourcedeps::special PRIORITY_DISALLOWED
 Configuration parameter priority. The parameter is optional. The parameter is required. The parameter is not allowed in this context.
sbuild::sourcedeps::special PRIORITY_DEPRECATED
 Configuration parameter priority. The parameter is optional. The parameter is required. The parameter is not allowed in this context. The parameter is deprecated, but functional.
sbuild::sourcedeps::special PRIORITY_OBSOLETE
 < The parameter is obsolete, and not functional.
group_map_type groups
 The top-level groups.
char separator
 The separator used as a list item delimiter.

Friends

sourcedeps operator+ (sourcedeps const &lhs, sourcedeps const &rhs)
 Add a sourcedeps to the sourcedeps.
template<class charT, class traits>
std::basic_istream< charT,
traits > & 
operator>> (std::basic_istream< charT, traits > &stream, sourcedeps &kf)
 sourcedeps initialisation from an istream.
template<class charT, class traits>
std::basic_ostream< charT,
traits > & 
operator<< (std::basic_ostream< charT, traits > &stream, sourcedeps const &kf)
 sourcedeps output to an ostream.

Classes

class  special

Detailed Description

Source dependencies.


Member Typedef Documentation

typedef std::map<std::string, string_list> sbuild::sourcedeps::dependency_map [private]
 

Map of packages to dependency list.

typedef runtime_error_custom<sourcedeps> sbuild::sourcedeps::error [private]
 

Exception type.


Constructor & Destructor Documentation

sourcedeps::sourcedeps (   )  [private]
 

The constructor.

sourcedeps::sourcedeps (  std::string const &  file  )  [private]
 

The constructor.

Parameters:
file the file to load the configuration from.

sourcedeps::sourcedeps (  std::istream &  stream  )  [private]
 

The constructor.

Parameters:
stream the stream to load the configuration from.

sourcedeps::~sourcedeps (   )  [private, virtual]
 

The destructor.


Member Function Documentation

void sourcedeps::check_priority (  std::string const &  group,
std::string 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.

sourcedeps::group_type * sourcedeps::find_group (  std::string const &  group  )  [private]
 

Find a group by it's name.

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

const sourcedeps::group_type * sourcedeps::find_group (  std::string 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.

sourcedeps::item_type * sourcedeps::find_item (  std::string const &  group,
std::string 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.

const sourcedeps::item_type * sourcedeps::find_item (  std::string const &  group,
std::string 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.

std::string sourcedeps::get_comment (  std::string const &  group,
std::string const &  key
)  const [private]
 

Get a key comment.

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

std::string sourcedeps::get_comment (  std::string const &  group  )  const [private]
 

Get a group comment.

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

string_list sourcedeps::get_groups (   )  const [private]
 

Get a list of groups.

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

string_list sourcedeps::get_keys (  std::string const &  group  )  const [private]
 

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 T, template< typename T > class C>
bool sbuild::sourcedeps::get_list_value (  std::string const &  group,
std::string const &  key,
priority  priority,
C< T > &  value
)  const [inline, private]
 

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.
value the list value 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 unchanged).

template<typename T, template< typename T > class C>
bool sbuild::sourcedeps::get_list_value (  std::string const &  group,
std::string const &  key,
C< T > &  value
)  const [inline, private]
 

Get a key value as a list.

Parameters:
group the group the key is in.
key the key to get.
value the list value 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 unchanged).

Here is the call graph for this function:

bool sourcedeps::get_locale_string (  std::string const &  group,
std::string const &  key,
std::string const &  locale,
priority  priority,
std::string &  value
)  const [private]
 

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).

bool sourcedeps::get_locale_string (  std::string const &  group,
std::string const &  key,
std::string const &  locale,
std::string &  value
)  const [private]
 

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).

bool sourcedeps::get_locale_string (  std::string const &  group,
std::string const &  key,
priority  priority,
std::string &  value
)  const [private]
 

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).

bool sourcedeps::get_locale_string (  std::string const &  group,
std::string const &  key,
std::string &  value
)  const [private]
 

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 T>
bool sbuild::sourcedeps::get_value (  std::string const &  group,
std::string const &  key,
priority  priority,
T &  value
)  const [inline, private]
 

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).

Here is the call graph for this function:

template<typename T>
bool sbuild::sourcedeps::get_value (  std::string const &  group,
std::string const &  key,
T &  value
)  const [inline, private]
 

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).

Here is the call graph for this function:

bool sourcedeps::has_group (  std::string const &  group  )  const [private]
 

Check if a group exists.

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

bool sourcedeps::has_key (  std::string const &  group,
std::string const &  key
)  const [private]
 

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.

sourcedeps & sourcedeps::operator+= (  sourcedeps const &  rhs  )  [private]
 

Add a sourcedeps to the sourcedeps.

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

void sourcedeps::print_comment (  std::string 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.

void sourcedeps::remove_group (  std::string const &  group  )  [private]
 

Remove a group.

Parameters:
group the group to remove.

void sourcedeps::remove_key (  std::string const &  group,
std::string const &  key
)  [private]
 

Remove a key.

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

void sourcedeps::set_group (  std::string const &  group,
std::string const &  comment
)  [private]
 

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 T, template< typename T > class C>
void sbuild::sourcedeps::set_list_value (  std::string const &  group,
std::string const &  key,
C< T > const &  value,
std::string const &  comment
)  [inline, private]
 

Set a key value from a list.

Parameters:
group the group the key is in.
key the key to set.
value the list value to get the key's value from. The value type must allow output to an ostream. The list must be a container with a standard forward iterator.
comment the comment for this key.

template<typename T, template< typename T > class C>
void sbuild::sourcedeps::set_list_value (  std::string const &  group,
std::string const &  key,
C< T > const &  value
)  [inline, private]
 

Set a key value from a list.

Parameters:
group the group the key is in.
key the key to set.
value the list value to get the key's value from. The value type must allow output to an ostream. The list must be a container with a standard forward iterator.

template<typename T>
void sbuild::sourcedeps::set_value (  std::string const &  group,
std::string const &  key,
T const &  value,
std::string const &  comment
)  [inline, private]
 

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
comment the comment for this key. allow output to an ostream.

template<typename T>
void sbuild::sourcedeps::set_value (  std::string const &  group,
std::string const &  key,
T const &  value
)  [inline, private]
 

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.


Friends And Related Function Documentation

sourcedeps operator+ (  sourcedeps const &  lhs,
sourcedeps const &  rhs
)  [friend]
 

Add a sourcedeps to the sourcedeps.

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

template<class charT, class traits>
std::basic_ostream<charT,traits>& operator<< (  std::basic_ostream< charT, traits > &  stream,
sourcedeps const &  kf
)  [friend]
 

sourcedeps output to an ostream.

template<class charT, class traits>
std::basic_istream<charT,traits>& operator>> (  std::basic_istream< charT, traits > &  stream,
sourcedeps &  kf
)  [friend]
 

sourcedeps initialisation from an istream.


Member Data Documentation

group_map_type sbuild::sourcedeps::groups [private]
 

The top-level groups.

class sbuild::sourcedeps::special sbuild::sourcedeps::PRIORITY_DEPRECATED [private]
 

Configuration parameter priority. The parameter is optional. The parameter is required. The parameter is not allowed in this context. The parameter is deprecated, but functional.

class sbuild::sourcedeps::special sbuild::sourcedeps::PRIORITY_DISALLOWED [private]
 

Configuration parameter priority. The parameter is optional. The parameter is required. The parameter is not allowed in this context.

class sbuild::sourcedeps::special sbuild::sourcedeps::PRIORITY_OBSOLETE [private]
 

< The parameter is obsolete, and not functional.

class sbuild::sourcedeps::special sbuild::sourcedeps::PRIORITY_OPTIONAL [private]
 

Configuration parameter priority. The parameter is optional.

class sbuild::sourcedeps::special sbuild::sourcedeps::PRIORITY_REQUIRED [private]
 

Configuration parameter priority. The parameter is optional. The parameter is required.

char sbuild::sourcedeps::separator [private]
 

The separator used as a list item delimiter.


The documentation for this class was generated from the following files:
Generated on Sun Mar 19 12:08:58 2006 for schroot by  doxygen 1.4.6