sbuild
1.7.1
|
Keyfile reader. More...
#include <keyfile-reader.h>
Public Types | |
typedef keyfile::error | error |
Exception type. | |
Public Member Functions | |
keyfile_reader (keyfile &store) | |
The constructor. More... | |
keyfile_reader (keyfile &store, const std::string &file) | |
The constructor. More... | |
keyfile_reader (keyfile &store, std::istream &stream) | |
The constructor. More... | |
virtual | ~keyfile_reader () |
The destructor. | |
virtual void | read_stream (std::istream &stream) |
Parse keyfile from a stream. More... | |
Protected Member Functions | |
virtual void | begin () |
Start processing input. More... | |
virtual void | parse_line (const std::string &line) |
Parse a line of input. More... | |
virtual void | end () |
Stop processing input. More... | |
Protected Attributes | |
keyfile & | store |
The keyfile to operate with. | |
keyfile::group_name_type | group |
Group name. | |
bool | group_set |
Group name is set. | |
keyfile::key_type | key |
Key name. | |
bool | key_set |
Key name is set. | |
keyfile::value_type | value |
Value. | |
bool | value_set |
Value is set. | |
keyfile::comment_type | comment |
Comment. | |
bool | comment_set |
Comment is set. | |
keyfile::size_type | line_number |
Line number. | |
Friends | |
std::istream & | operator>> (std::istream &stream, keyfile_reader &kp) |
keyfile initialisation from an istream. More... | |
Keyfile reader.
sbuild::keyfile_reader::keyfile_reader | ( | keyfile & | store) |
The constructor.
store | the keyfile to operate with. |
sbuild::keyfile_reader::keyfile_reader | ( | keyfile & | store, |
const std::string & | file | ||
) |
The constructor.
store | the keyfile to operate with. |
file | the file to load the configuration from. |
References sbuild::keyfile::BAD_FILE, and read_stream().
sbuild::keyfile_reader::keyfile_reader | ( | keyfile & | store, |
std::istream & | stream | ||
) |
The constructor.
store | the keyfile to operate with. |
stream | the stream to load the configuration from. |
References read_stream().
|
protectedvirtual |
Start processing input.
Any setup may be done here.
References line_number.
Referenced by read_stream().
|
protectedvirtual |
Stop processing input.
Any cleanup may be done here. For example, any cached group or item may be set here.
Referenced by read_stream().
|
protectedvirtual |
Parse a line of input.
This function will be called for every line of input in the source file. The input line, line, is parsed appropriately. Any of the group, key, value, and comment members are set as required. If any of these members are ready for insertion into the keyfile, then the corresponding _set member must be set to true to signal the fact to the caller.
line | the line to parse. |
References comment, comment_set, group_set, sbuild::keyfile::INVALID_GROUP, sbuild::keyfile::INVALID_LINE, key, key_set, line_number, sbuild::keyfile::NO_GROUP, sbuild::keyfile::NO_KEY, value, and value_set.
Referenced by read_stream().
|
virtual |
Parse keyfile from a stream.
The keyfile specified during construction will be used to store the parsed data.
stream | the stream to read from. |
References begin(), comment, sbuild::keyfile::DUPLICATE_GROUP, sbuild::keyfile::DUPLICATE_KEY, end(), group_set, sbuild::keyfile::has_group(), sbuild::keyfile::has_key(), key, key_set, line_number, parse_line(), sbuild::keyfile::set_group(), sbuild::keyfile::set_value(), store, value, and value_set.
Referenced by keyfile_reader().
|
friend |
keyfile initialisation from an istream.
stream | the stream to input from. |
kf | the keyfile to set. |