The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
config_writer Class Reference

Class for writing a config out to a file in pieces. More...

#include <binary_or_text.hpp>

Public Member Functions

 config_writer (std::ostream &out, compression::format compress)
 
 config_writer (std::ostream &out, bool compress, int level=-1)
 
 ~config_writer ()
 Default implementation, but defined out-of-line for efficiency reasons. More...
 
void write (const config &cfg)
 
void write_child (const std::string &key, const config &cfg)
 
void open_child (const std::string &key)
 
void close_child (const std::string &key)
 
bool good () const
 
template<typename T >
void write_key_val (const std::string &key, const T &value)
 This template function will work with any type that can be assigned to an attribute_value. More...
 

Private Attributes

boost::iostreams::filtering_stream
< boost::iostreams::output
filter_
 
std::ostream * out_ptr_
 
std::ostream & out_
 
compression::format compress_
 
unsigned int level_
 
std::string textdomain_
 

Detailed Description

Class for writing a config out to a file in pieces.

Definition at line 29 of file binary_or_text.hpp.

Constructor & Destructor Documentation

config_writer::config_writer ( std::ostream &  out,
compression::format  compress 
)

Definition at line 36 of file binary_or_text.cpp.

References compression::BZIP2, compress_, filter_, and compression::GZIP.

config_writer::config_writer ( std::ostream &  out,
bool  compress,
int  level = -1 
)

Definition at line 54 of file binary_or_text.cpp.

References compress_, and filter_.

config_writer::~config_writer ( )

Default implementation, but defined out-of-line for efficiency reasons.

Definition at line 73 of file binary_or_text.cpp.

References compression::BZIP2, compress_, compression::GZIP, and out_.

Member Function Documentation

void config_writer::close_child ( const std::string key)
bool config_writer::good ( ) const

Definition at line 105 of file binary_or_text.cpp.

References out_.

Referenced by savegame::savegame::finish_save_game().

void config_writer::open_child ( const std::string key)
void config_writer::write ( const config cfg)
void config_writer::write_child ( const std::string key,
const config cfg 
)
template<typename T >
void config_writer::write_key_val ( const std::string key,
const T &  value 
)
inline

This template function will work with any type that can be assigned to an attribute_value.

Definition at line 47 of file binary_or_text.hpp.

References level_, out_, and textdomain_.

Referenced by statistics::stats::write(), preproc_define::write(), preproc_define::write_argument(), write_battle_result_map(), savegame::savegame::write_game(), statistics::write_stats(), and write_str_int_map().

Member Data Documentation

compression::format config_writer::compress_
private

Definition at line 58 of file binary_or_text.hpp.

Referenced by config_writer(), and ~config_writer().

boost::iostreams::filtering_stream<boost::iostreams::output> config_writer::filter_
private

Definition at line 55 of file binary_or_text.hpp.

Referenced by config_writer().

unsigned int config_writer::level_
private

Definition at line 59 of file binary_or_text.hpp.

Referenced by close_child(), open_child(), write(), write_child(), and write_key_val().

std::ostream& config_writer::out_
private
std::ostream* config_writer::out_ptr_
private

Definition at line 56 of file binary_or_text.hpp.

std::string config_writer::textdomain_
private

Definition at line 60 of file binary_or_text.hpp.

Referenced by write_key_val().


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