#include <csbuild-debian-changes.h>

Public Types | |
| 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_KEY, INVALID_LINE, MISSING_KEY, MISSING_KEY_NL, NO_KEY, OBSOLETE_KEY, OBSOLETE_KEY_NL, PASSTHROUGH_K, PASSTHROUGH_LK } |
| Error codes. More... | |
| typedef sbuild::parse_error < error_code > | error |
| Exception type. | |
Public Member Functions | |
| debian_changes () | |
| The constructor. | |
| debian_changes (std::string const &file) | |
| The constructor. | |
| debian_changes (std::istream &stream) | |
| The constructor. | |
| virtual | ~debian_changes () |
| The destructor. | |
| sbuild::string_list | get_keys () const |
| Get a list of keys. | |
| bool | has_key (key_type const &key) const |
| Check if a key exists. | |
| size_type | get_line (key_type const &key) const |
| Get a key line number. | |
| template<typename T> | |
| bool | get_value (key_type const &key, T &value) const |
| Get a key value. | |
| template<typename T> | |
| bool | get_value (key_type const &key, priority priority, T &value) const |
| Get a key value. | |
| bool | get_value (key_type const &key, value_type &value) const |
| Get a key value. | |
| bool | get_value (key_type const &key, priority priority, value_type &value) const |
| Get a key value. | |
| template<typename C> | |
| bool | get_list_value (key_type const &key, C &container, std::string const &separator) const |
| Get a key value as a list. | |
| template<typename C> | |
| bool | get_list_value (key_type const &key, priority priority, C &container) const |
| Get a key value as a list. | |
| template<typename T> | |
| void | set_value (key_type const &key, T const &value) |
| Set a key value. | |
| template<typename T> | |
| void | set_value (key_type const &key, T const &value, size_type line) |
| Set a key value. | |
| void | set_value (key_type const &key, value_type const &value) |
| Set a key value. | |
| void | set_value (key_type const &key, value_type const &value, size_type line) |
| Set a key value. | |
| template<typename I> | |
| void | set_list_value (key_type const &key, I begin, I end) |
| Set a key value from a list. | |
| template<typename I> | |
| void | set_list_value (key_type const &key, I begin, I end, std::string const &separator, size_type line) |
| Set a key value from a list. | |
| void | remove_key (key_type const &key) |
| Remove a key. | |
| debian_changes & | operator+= (debian_changes const &rhs) |
| Add a debian_changes to the debian_changes. | |
Static Public Member Functions | |
| template<class C, typename T> | |
| static void | set_object_value (C const &object, T(C::*method)() const, debian_changes &debian_changes, debian_changes::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, debian_changes &debian_changes, debian_changes::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, debian_changes &debian_changes, debian_changes::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, debian_changes &debian_changes, debian_changes::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), debian_changes const &debian_changes, debian_changes::key_type const &key, debian_changes::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 ¶m), debian_changes const &debian_changes, debian_changes::key_type const &key, debian_changes::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), debian_changes const &debian_changes, debian_changes::key_type const &key, debian_changes::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 ¶m), debian_changes const &debian_changes, debian_changes::key_type const &key, debian_changes::priority priority) |
| Get a key list value and set it by reference in an object using an object method. | |
Private Types | |
| typedef std::string | key_type |
| typedef std::vector< std::string > | value_type |
| typedef unsigned int | size_type |
| typedef std::tr1::tuple < key_type, value_type, size_type > | item_type |
| Key-value-line tuple. | |
| typedef std::map< key_type, item_type > | item_map_type |
| Map between key name and key-value-comment tuple. | |
Private Member Functions | |
| const item_type * | find_item (key_type const &key) const |
| Find a key by its name. | |
| item_type * | find_item (key_type const &key) |
| Find a key by its name. | |
| void | check_priority (key_type const &key, priority priority, bool valid) const |
| Check if a key is missing or present when not permitted. | |
Private Attributes | |
| item_map_type | items |
| The top-level items. | |
Friends | |
| debian_changes | operator+ (debian_changes const &lhs, debian_changes const &rhs) |
| Add a debian_changes to the debian_changes. | |
| template<class charT, class traits> | |
| std::basic_istream< charT, traits > & | operator>> (std::basic_istream< charT, traits > &stream, debian_changes &dc) |
| debian_changes initialisation from an istream. | |
| template<class charT, class traits> | |
| std::basic_ostream< charT, traits > & | operator<< (std::basic_ostream< charT, traits > &stream, debian_changes const &dc) |
| debian_changes output to an ostream. | |
This class is a generic parser for the file format used in Debian changes files for binary and source uploads (.changes and .dsc files).
Definition at line 45 of file csbuild-debian-changes.h.
typedef std::string csbuild::debian_changes::key_type [private] |
Definition at line 48 of file csbuild-debian-changes.h.
typedef std::vector<std::string> csbuild::debian_changes::value_type [private] |
Definition at line 49 of file csbuild-debian-changes.h.
typedef unsigned int csbuild::debian_changes::size_type [private] |
Definition at line 50 of file csbuild-debian-changes.h.
typedef std::tr1::tuple<key_type,value_type,size_type> csbuild::debian_changes::item_type [private] |
typedef std::map<key_type,item_type> csbuild::debian_changes::item_map_type [private] |
Map between key name and key-value-comment tuple.
Definition at line 57 of file csbuild-debian-changes.h.
Configuration parameter priority.
Definition at line 61 of file csbuild-debian-changes.h.
Error codes.
Definition at line 71 of file csbuild-debian-changes.h.
| debian_changes::debian_changes | ( | ) |
| debian_changes::debian_changes | ( | std::string const & | file | ) |
The constructor.
| file | the file to load the configuration from. |
Definition at line 96 of file csbuild-debian-changes.cc.
References BAD_FILE.
| debian_changes::debian_changes | ( | std::istream & | stream | ) |
The constructor.
| stream | the stream to load the configuration from. |
Definition at line 111 of file csbuild-debian-changes.cc.
| debian_changes::~debian_changes | ( | ) | [virtual] |
| sbuild::string_list debian_changes::get_keys | ( | ) | const |
Get a list of keys.
Definition at line 122 of file csbuild-debian-changes.cc.
References items.
| bool debian_changes::has_key | ( | key_type const & | key | ) | const |
Check if a key exists.
| key | the key to check for. |
Definition at line 135 of file csbuild-debian-changes.cc.
References find_item().
| debian_changes::size_type debian_changes::get_line | ( | key_type const & | key | ) | const |
Get a key line number.
| key | the key to find. |
Definition at line 141 of file csbuild-debian-changes.cc.
References find_item().
Referenced by check_priority(), get_list_value(), get_object_list_value(), get_object_value(), and get_value().

| bool csbuild::debian_changes::get_value | ( | key_type const & | key, | |
| T & | value | |||
| ) | const [inline] |
Get a key value.
| 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. |
Definition at line 148 of file csbuild-debian-changes.h.
References sbuild::DEBUG_INFO, sbuild::DEBUG_NOTICE, find_item(), get_line(), sbuild::log_debug(), log_exception_warning(), sbuild::parse_value(), PASSTHROUGH_K, and PASSTHROUGH_LK.
Referenced by get_list_value(), get_object_value(), and get_value().

| bool csbuild::debian_changes::get_value | ( | 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.
| 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. |
Definition at line 196 of file csbuild-debian-changes.h.
References check_priority(), and get_value().
| bool debian_changes::get_value | ( | key_type const & | key, | |
| value_type & | value | |||
| ) | const |
Get a key value.
| key | the key to get. | |
| value | the value to store the key's value in. |
Definition at line 151 of file csbuild-debian-changes.cc.
References sbuild::DEBUG_INFO, sbuild::DEBUG_NOTICE, find_item(), and sbuild::log_debug().
| bool debian_changes::get_value | ( | key_type const & | key, | |
| priority | priority, | |||
| value_type & | value | |||
| ) | const |
Get a key value.
If the value does not exist, is deprecated or obsolete, warn appropriately.
| key | the key to get. | |
| priority | the priority of the option. | |
| value | the value to store the key's value in. |
Definition at line 169 of file csbuild-debian-changes.cc.
References check_priority(), and get_value().
| bool csbuild::debian_changes::get_list_value | ( | key_type const & | key, | |
| C & | container, | |||
| std::string const & | separator | |||
| ) | const [inline] |
Get a key value as a list.
| key | the key to get. Note that if the key contains multiple lines, each line will be split using the separator. | |
| 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. | |
| separator | the characters to separate the values. |
Definition at line 247 of file csbuild-debian-changes.h.
References get_line(), get_value(), items, log_exception_warning(), sbuild::parse_value(), PASSTHROUGH_K, PASSTHROUGH_LK, and sbuild::split_string().
Referenced by get_list_value(), and get_object_list_value().

| bool csbuild::debian_changes::get_list_value | ( | 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.
| 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. |
Definition at line 310 of file csbuild-debian-changes.h.
References check_priority(), and get_list_value().
| void csbuild::debian_changes::set_value | ( | key_type const & | key, | |
| T const & | value | |||
| ) | [inline] |
Set a key value.
| key | the key to set. | |
| value | the value to get the key's value from. This must allow output to an ostream. |
Definition at line 328 of file csbuild-debian-changes.h.
Referenced by operator+=(), set_list_value(), set_object_value(), and set_value().

| void csbuild::debian_changes::set_value | ( | key_type const & | key, | |
| T const & | value, | |||
| size_type | line | |||
| ) | [inline] |
Set a key value.
| key | the key to set. | |
| value | the value to get the key's value from. This must allow output to an ostream. | |
| line | the line number in the input file, or 0 otherwise. |
Definition at line 344 of file csbuild-debian-changes.h.
References items.
| void csbuild::debian_changes::set_value | ( | key_type const & | key, | |
| value_type const & | value | |||
| ) | [inline] |
Set a key value.
| key | the key to set. | |
| value | the value to get the key's value from. |
Definition at line 369 of file csbuild-debian-changes.h.
References set_value().
| void debian_changes::set_value | ( | key_type const & | key, | |
| value_type const & | value, | |||
| size_type | line | |||
| ) |
Set a key value.
| key | the key to set. | |
| value | the value to get the key's value from. | |
| line | the line number in the input file, or 0 otherwise. |
Definition at line 179 of file csbuild-debian-changes.cc.
References items.
| void csbuild::debian_changes::set_list_value | ( | key_type const & | key, | |
| I | begin, | |||
| I | end | |||
| ) | [inline] |
Set a key value from a list.
| 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. |
Definition at line 397 of file csbuild-debian-changes.h.
Referenced by set_object_list_value().

| void csbuild::debian_changes::set_list_value | ( | key_type const & | key, | |
| I | begin, | |||
| I | end, | |||
| std::string const & | separator, | |||
| size_type | line | |||
| ) | [inline] |
Set a key value from a list.
| 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. | |
| separator | the characters to separate the values. | |
| line | the line number in the input file, or 0 otherwise. |
Definition at line 416 of file csbuild-debian-changes.h.
References set_value().
| void debian_changes::remove_key | ( | key_type const & | key | ) |
Remove a key.
| key | the key to remove. |
Definition at line 192 of file csbuild-debian-changes.cc.
References items.
| debian_changes & debian_changes::operator+= | ( | debian_changes const & | rhs | ) |
Add a debian_changes to the debian_changes.
| rhs | the debian_changes to add. |
Definition at line 200 of file csbuild-debian-changes.cc.
References items, and set_value().
| const debian_changes::item_type * debian_changes::find_item | ( | key_type const & | key | ) | const [private] |
Find a key by its name.
| key | the key to find |
Definition at line 226 of file csbuild-debian-changes.cc.
References items.
Referenced by get_line(), get_value(), and has_key().

| debian_changes::item_type * debian_changes::find_item | ( | key_type const & | key | ) | [private] |
Find a key by its name.
| key | the key to find |
Definition at line 236 of file csbuild-debian-changes.cc.
References items.
| void debian_changes::check_priority | ( | key_type const & | key, | |
| priority | priority, | |||
| bool | valid | |||
| ) | const [private] |
Check if a key is missing or present when not permitted.
| key | the key to get. | |
| priority | the key priority. | |
| valid | true if key exists, false if not existing. |
Definition at line 246 of file csbuild-debian-changes.cc.
References DEPRECATED_KEY, DEPRECATED_KEY_NL, DISALLOWED_KEY, DISALLOWED_KEY_NL, get_line(), log_exception_warning(), MISSING_KEY, MISSING_KEY_NL, OBSOLETE_KEY, OBSOLETE_KEY_NL, PRIORITY_DEPRECATED, PRIORITY_DISALLOWED, PRIORITY_OBSOLETE, PRIORITY_REQUIRED, and sbuild::error_base::set_reason().
Referenced by get_list_value(), and get_value().

| static void csbuild::debian_changes::set_object_value | ( | C const & | object, | |
| T(C::*)() const | method, | |||
| debian_changes & | debian_changes, | |||
| debian_changes::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.
| object | the object to use. | |
| method | the object method to call. | |
| debian_changes | the debian_changes to use. | |
| key | the key to set. |
Definition at line 598 of file csbuild-debian-changes.h.
References PASSTHROUGH_K, and set_value().
| static void csbuild::debian_changes::set_object_value | ( | C const & | object, | |
| T const &(C::*)() const | method, | |||
| debian_changes & | debian_changes, | |||
| debian_changes::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.
| object | the object to use. | |
| method | the object method to call. | |
| debian_changes | the debian_changes to use. | |
| key | the key to set. |
Definition at line 626 of file csbuild-debian-changes.h.
References PASSTHROUGH_K, and set_value().
| static void csbuild::debian_changes::set_object_list_value | ( | C const & | object, | |
| T(C::*)() const | method, | |||
| debian_changes & | debian_changes, | |||
| debian_changes::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.
| object | the object to use. | |
| method | the object method to call. | |
| debian_changes | the debian_changes to use. | |
| key | the key to set. |
Definition at line 655 of file csbuild-debian-changes.h.
References PASSTHROUGH_K, and set_list_value().
| static void csbuild::debian_changes::set_object_list_value | ( | C const & | object, | |
| T const &(C::*)() const | method, | |||
| debian_changes & | debian_changes, | |||
| debian_changes::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.
| object | the object to use. | |
| method | the object method to call. | |
| debian_changes | the debian_changes to use. | |
| key | the key to set. |
Definition at line 687 of file csbuild-debian-changes.h.
References PASSTHROUGH_K, and set_list_value().
| static void csbuild::debian_changes::get_object_value | ( | C & | object, | |
| void(C::*)(T param) | method, | |||
| debian_changes const & | debian_changes, | |||
| debian_changes::key_type const & | key, | |||
| debian_changes::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 key and line number in the input file.
| object | the object to use. | |
| method | the object method to call. | |
| debian_changes | the debian_changes to use. | |
| key | the key to set. | |
| priority | the key priority. |
Definition at line 719 of file csbuild-debian-changes.h.
References get_line(), get_value(), PASSTHROUGH_K, and PASSTHROUGH_LK.
| static void csbuild::debian_changes::get_object_value | ( | C & | object, | |
| void(C::*)(T const ¶m) | method, | |||
| debian_changes const & | debian_changes, | |||
| debian_changes::key_type const & | key, | |||
| debian_changes::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 key and line number in the input file.
| object | the object to use. | |
| method | the object method to call. | |
| debian_changes | the debian_changes to use. | |
| key | the key to set. | |
| priority | the key priority. |
Definition at line 756 of file csbuild-debian-changes.h.
References get_line(), get_value(), PASSTHROUGH_K, and PASSTHROUGH_LK.
| static void csbuild::debian_changes::get_object_list_value | ( | C & | object, | |
| void(C::*)(T param) | method, | |||
| debian_changes const & | debian_changes, | |||
| debian_changes::key_type const & | key, | |||
| debian_changes::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 key and line number in the input file.
| object | the object to use. | |
| method | the object method to call. | |
| debian_changes | the debian_changes to use. | |
| key | the key to set. | |
| priority | the key priority. |
Definition at line 793 of file csbuild-debian-changes.h.
References get_line(), get_list_value(), PASSTHROUGH_K, and PASSTHROUGH_LK.
| static void csbuild::debian_changes::get_object_list_value | ( | C & | object, | |
| void(C::*)(T const ¶m) | method, | |||
| debian_changes const & | debian_changes, | |||
| debian_changes::key_type const & | key, | |||
| debian_changes::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 key and line number in the input file.
| object | the object to use. | |
| method | the object method to call. | |
| debian_changes | the debian_changes to use. | |
| key | the key to set. | |
| priority | the key priority. |
Definition at line 833 of file csbuild-debian-changes.h.
References get_line(), get_list_value(), PASSTHROUGH_K, and PASSTHROUGH_LK.
| debian_changes operator+ | ( | debian_changes const & | lhs, | |
| debian_changes const & | rhs | |||
| ) | [friend] |
Add a debian_changes to the debian_changes.
| lhs | the debian_changes to add to. | |
| rhs | the values to add. |
Definition at line 217 of file csbuild-debian-changes.cc.
| std::basic_istream<charT,traits>& operator>> | ( | std::basic_istream< charT, traits > & | stream, | |
| debian_changes & | dc | |||
| ) | [friend] |
debian_changes initialisation from an istream.
| stream | the stream to input from. | |
| kf | the debian_changes to set. |
Definition at line 478 of file csbuild-debian-changes.h.
| std::basic_ostream<charT,traits>& operator<< | ( | std::basic_ostream< charT, traits > & | stream, | |
| debian_changes const & | dc | |||
| ) | [friend] |
debian_changes output to an ostream.
| stream | the stream to output to. | |
| dc | the debian_changes to output. |
Definition at line 531 of file csbuild-debian-changes.h.
item_map_type csbuild::debian_changes::items [private] |
The top-level items.
Definition at line 582 of file csbuild-debian-changes.h.
Referenced by find_item(), get_keys(), get_list_value(), operator+=(), remove_key(), and set_value().
1.5.4