sbuild  1.7.1
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
sbuild::keyfile_reader Class Reference

Keyfile reader. More...

#include <keyfile-reader.h>

+ Collaboration diagram for sbuild::keyfile_reader:

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

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

Detailed Description

Keyfile reader.

Constructor & Destructor Documentation

sbuild::keyfile_reader::keyfile_reader ( keyfile store)

The constructor.

Parameters
storethe keyfile to operate with.
sbuild::keyfile_reader::keyfile_reader ( keyfile store,
const std::string &  file 
)

The constructor.

Parameters
storethe keyfile to operate with.
filethe 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.

Parameters
storethe keyfile to operate with.
streamthe stream to load the configuration from.

References read_stream().

Member Function Documentation

void sbuild::keyfile_reader::begin ( )
protectedvirtual

Start processing input.

Any setup may be done here.

References line_number.

Referenced by read_stream().

+ Here is the caller graph for this function:

void sbuild::keyfile_reader::end ( )
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().

+ Here is the caller graph for this function:

void sbuild::keyfile_reader::parse_line ( const std::string &  line)
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.

Parameters
linethe 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().

+ Here is the caller graph for this function:

void sbuild::keyfile_reader::read_stream ( std::istream &  stream)
virtual

Parse keyfile from a stream.

The keyfile specified during construction will be used to store the parsed data.

Parameters
streamthe 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().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  stream,
keyfile_reader kp 
)
friend

keyfile initialisation from an istream.

Parameters
streamthe stream to input from.
kfthe keyfile to set.
Returns
the stream.

The documentation for this class was generated from the following files: