The Battle for Wesnoth  1.19.0-dev
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::outputfilter_
 
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 26 of file binary_or_text.hpp.

Constructor & Destructor Documentation

◆ config_writer() [1/2]

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

Definition at line 34 of file binary_or_text.cpp.

References compression::bzip2, compress_, filter_, and compression::gzip.

◆ config_writer() [2/2]

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

Definition at line 51 of file binary_or_text.cpp.

References compress_, filter_, game_config::images::level, and compression::none.

◆ ~config_writer()

config_writer::~config_writer ( )

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

Definition at line 70 of file binary_or_text.cpp.

References compression::bzip2, compress_, compression::gzip, and out_.

Member Function Documentation

◆ close_child()

void config_writer::close_child ( const std::string &  key)

◆ good()

bool config_writer::good ( ) const

Definition at line 101 of file binary_or_text.cpp.

References out_.

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

◆ open_child()

void config_writer::open_child ( const std::string &  key)

◆ write()

void config_writer::write ( const config cfg)

◆ write_child()

void config_writer::write_child ( const std::string &  key,
const config cfg 
)

◆ write_key_val()

template<typename T >
void config_writer::write_key_val ( const std::string &  key,
const T &  value 
)
inline

Member Data Documentation

◆ compress_

compression::format config_writer::compress_
private

Definition at line 54 of file binary_or_text.hpp.

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

◆ filter_

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

Definition at line 51 of file binary_or_text.hpp.

Referenced by config_writer().

◆ level_

unsigned int config_writer::level_
private

Definition at line 55 of file binary_or_text.hpp.

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

◆ out_

std::ostream& config_writer::out_
private

◆ out_ptr_

std::ostream* config_writer::out_ptr_
private

Definition at line 52 of file binary_or_text.hpp.

◆ textdomain_

std::string config_writer::textdomain_
private

Definition at line 56 of file binary_or_text.hpp.

Referenced by write_key_val().


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