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

Keyfile writer. More...

#include <keyfile-writer.h>

+ Collaboration diagram for sbuild::keyfile_writer:

Public Types

typedef keyfile::error error
 Exception type.
 

Public Member Functions

 keyfile_writer (const keyfile &store)
 The constructor. More...
 
 keyfile_writer (const keyfile &store, const std::string &file)
 The constructor. More...
 
 keyfile_writer (const keyfile &store, std::ostream &stream)
 The constructor. More...
 
virtual ~keyfile_writer ()
 The destructor.
 
virtual void write_stream (std::ostream &stream) const
 Write keyfile to a stream. More...
 

Static Protected Member Functions

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

Protected Attributes

const keyfilestore
 The keyfile to operate with.
 

Friends

std::ostream & operator<< (std::ostream &stream, const keyfile_writer &kp)
 keyfile output to an ostream. More...
 

Detailed Description

Keyfile writer.

Constructor & Destructor Documentation

sbuild::keyfile_writer::keyfile_writer ( const keyfile store)

The constructor.

Parameters
storethe keyfile to operate with.
sbuild::keyfile_writer::keyfile_writer ( const 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 write_stream().

sbuild::keyfile_writer::keyfile_writer ( const keyfile store,
std::ostream &  stream 
)

The constructor.

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

References write_stream().

Member Function Documentation

void sbuild::keyfile_writer::print_comment ( const keyfile::comment_type comment,
std::ostream &  stream 
)
staticprotected

Print a comment to a stream.

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

Parameters
commentthe comment to print.
streamthe 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.

Referenced by write_stream().

+ Here is the caller graph for this function:

void sbuild::keyfile_writer::write_stream ( std::ostream &  stream) const
virtual

Write keyfile to a stream.

The keyfile specified during construction will be used as the source of data.

Parameters
streamthe stream to write to.

References sbuild::keyfile::get_comment(), sbuild::keyfile::get_groups(), sbuild::keyfile::get_keys(), sbuild::keyfile::get_value(), print_comment(), and store.

Referenced by keyfile_writer().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const keyfile_writer kp 
)
friend

keyfile output to an ostream.

Parameters
streamthe stream to output to.
kfthe keyfile to output.
Returns
the stream.

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