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_ |
Class for writing a config out to a file in pieces.
Definition at line 29 of file binary_or_text.hpp.
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.
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_.
void config_writer::close_child | ( | const std::string & | key | ) |
Definition at line 100 of file binary_or_text.cpp.
References level_, out_, and write_close_child().
Referenced by statistics::stats::write(), preproc_define::write(), preproc_define::write_argument(), write_battle_result_map(), write_child(), saved_game::write_config(), savegame::savegame::write_game(), savegame::ingame_savegame::write_game(), savegame::replay_savegame::write_game(), and statistics::write_stats().
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 | ) |
Definition at line 95 of file binary_or_text.cpp.
References level_, out_, and write_open_child().
Referenced by statistics::stats::write(), preproc_define::write(), preproc_define::write_argument(), write_battle_result_map(), write_child(), saved_game::write_config(), savegame::savegame::write_game(), savegame::ingame_savegame::write_game(), savegame::replay_savegame::write_game(), and statistics::write_stats().
Definition at line 83 of file binary_or_text.cpp.
Referenced by campaignd::server::handle_upload(), persist_file_context::save_context(), editor::map_context::save_scenario(), wesnothd::ban_manager::write(), write_child(), game_config::config_cache::write_file(), saved_game::write_general_info(), and wesnothd::room_manager::write_rooms().
void config_writer::write_child | ( | const std::string & | key, |
const config & | cfg | ||
) |
Definition at line 88 of file binary_or_text.cpp.
References close_child(), level_, open_child(), out_, and write().
Referenced by replay_recorder_base::write(), saved_game::write_carryover(), saved_game::write_config(), savegame::ingame_savegame::write_game(), savegame::replay_savegame::write_game(), saved_game::write_general_info(), and saved_game::write_starting_pos().
|
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().
|
private |
Definition at line 58 of file binary_or_text.hpp.
Referenced by config_writer(), and ~config_writer().
|
private |
Definition at line 55 of file binary_or_text.hpp.
Referenced by config_writer().
|
private |
Definition at line 59 of file binary_or_text.hpp.
Referenced by close_child(), open_child(), write(), write_child(), and write_key_val().
|
private |
Definition at line 57 of file binary_or_text.hpp.
Referenced by close_child(), good(), open_child(), write(), write_child(), write_key_val(), and ~config_writer().
|
private |
Definition at line 56 of file binary_or_text.hpp.
|
private |
Definition at line 60 of file binary_or_text.hpp.
Referenced by write_key_val().