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 26 of file binary_or_text.hpp.
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::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 | ( | ) |
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_.
void config_writer::close_child | ( | const std::string & | key | ) |
Definition at line 96 of file binary_or_text.cpp.
References level_, out_, and write_close_child().
Referenced by gui2::dialogs::editor_edit_unit::update_wml_view(), preproc_define::write(), statistics_record::stats_t::write(), statistics_record::scenario_stats_t::write(), statistics_record::campaign_stats_t::write(), preproc_define::write_argument(), statistics_record::write_battle_result_map(), write_child(), saved_game::write_config(), savegame::ingame_savegame::write_game(), savegame::replay_savegame::write_game(), and saved_game::write_general_info().
bool config_writer::good | ( | ) | const |
Definition at line 101 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 91 of file binary_or_text.cpp.
References level_, out_, and write_open_child().
Referenced by gui2::dialogs::editor_edit_unit::update_wml_view(), preproc_define::write(), statistics_record::stats_t::write(), statistics_record::scenario_stats_t::write(), statistics_record::campaign_stats_t::write(), preproc_define::write_argument(), statistics_record::write_battle_result_map(), write_child(), saved_game::write_config(), savegame::ingame_savegame::write_game(), savegame::replay_savegame::write_game(), and saved_game::write_general_info().
void config_writer::write | ( | const config & | cfg | ) |
Definition at line 79 of file binary_or_text.cpp.
Referenced by campaignd::server::load_config(), gui2::dialogs::editor_edit_pbl::post_show(), process_command_args(), persist_file_context::save_context(), editor::map_context::save_scenario(), editor::map_context::save_schedule(), wesnothd::ban_manager::write(), statistics_record::stats_t::write(), write_child(), game_config::config_cache::write_file(), and saved_game::write_general_info().
void config_writer::write_child | ( | const std::string & | key, |
const config & | cfg | ||
) |
Definition at line 84 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_point().
|
inline |
This template function will work with any type that can be assigned to an attribute_value.
Definition at line 43 of file binary_or_text.hpp.
References level_, out_, and textdomain_.
Referenced by preproc_define::write(), statistics_record::stats_t::write(), statistics_record::scenario_stats_t::write(), preproc_define::write_argument(), statistics_record::write_battle_result_map(), savegame::savegame::write_game(), and statistics_record::write_str_int_map().
|
private |
Definition at line 54 of file binary_or_text.hpp.
Referenced by config_writer(), and ~config_writer().
|
private |
Definition at line 51 of file binary_or_text.hpp.
Referenced by config_writer().
|
private |
Definition at line 55 of file binary_or_text.hpp.
Referenced by close_child(), open_child(), write(), write_child(), and write_key_val().
|
private |
Definition at line 53 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 52 of file binary_or_text.hpp.
|
private |
Definition at line 56 of file binary_or_text.hpp.
Referenced by write_key_val().