Read/Write & analyze WML- and config-files. More...
#include "serialization/parser.hpp"#include "config.hpp"#include "log.hpp"#include "gettext.hpp"#include "wesconfig.h"#include "serialization/preprocessor.hpp"#include "serialization/tokenizer.hpp"#include "serialization/string_utils.hpp"#include "serialization/validator.hpp"#include <stack>#include <boost/algorithm/string/replace.hpp>#include <boost/iostreams/filtering_stream.hpp>#include <boost/iostreams/filter/bzip2.hpp>#include <boost/iostreams/filter/gzip.hpp>#include <boost/variant/static_visitor.hpp>
Go to the source code of this file.
Macros | |
| #define | ERR_CF LOG_STREAM(err, log_config) |
| #define | WRN_CF LOG_STREAM(warn, log_config) |
| #define | LOG_CF LOG_STREAM(info, log_config) |
Functions | |
| void | read (config &cfg, std::istream &in, abstract_validator *validator) |
| void | read (config &cfg, const std::string &in, abstract_validator *validator) |
| template<typename decompressor > | |
| void | read_compressed (config &cfg, std::istream &file, abstract_validator *validator) |
| void | read_gz (config &cfg, std::istream &file, abstract_validator *validator) |
| might throw a std::ios_base::failure especially a gzip_error More... | |
| void | read_bz2 (config &cfg, std::istream &file, abstract_validator *validator) |
| might throw a std::ios_base::failure especially bzip2_error More... | |
| void | write_key_val (std::ostream &out, const std::string &key, const config::attribute_value &value, unsigned level, std::string &textdomain) |
| void | write_open_child (std::ostream &out, const std::string &child, unsigned int level) |
| void | write_close_child (std::ostream &out, const std::string &child, unsigned int level) |
| static void | write_internal (config const &cfg, std::ostream &out, std::string &textdomain, size_t tab=0) |
| static void | write_internal (configr_of const &cfg, std::ostream &out, std::string &textdomain, size_t tab=0) |
| void | write (std::ostream &out, configr_of const &cfg, unsigned int level) |
| template<typename compressor > | |
| void | write_compressed (std::ostream &out, configr_of const &cfg) |
| void | write_gz (std::ostream &out, configr_of const &cfg) |
| void | write_bz2 (std::ostream &out, configr_of const &cfg) |
Variables | |
| static lg::log_domain | log_config ("config") |
| static const size_t | max_recursion_levels = 1000 |
Read/Write & analyze WML- and config-files.
Definition in file parser.cpp.
| #define ERR_CF LOG_STREAM(err, log_config) |
Definition at line 43 of file parser.cpp.
Referenced by write_internal().
| #define LOG_CF LOG_STREAM(info, log_config) |
Definition at line 45 of file parser.cpp.
Referenced by read_compressed().
| #define WRN_CF LOG_STREAM(warn, log_config) |
Definition at line 44 of file parser.cpp.
| void read | ( | config & | cfg, |
| std::istream & | in, | ||
| abstract_validator * | validator | ||
| ) |
Definition at line 400 of file parser.cpp.
Referenced by preferences::base_manager::base_manager(), savegame::save_index_class::data(), get_addon_install_info(), get_addon_pbl_info(), ai::configuration::get_side_config_from_file(), handle_preprocess_command(), ng::create_engine::init_all_levels(), persist_file_context::load(), campaignd::server::load_blacklist(), cutter::load_config(), campaignd::server::load_config(), font::load_font_config(), load_language_list(), editor::map_context::load_scenario(), gui2::load_settings(), main(), preprocess_resource(), wesnothd::server::read_config(), schema_validation::schema_validator::read_config_file(), game_config::config_cache::read_configs(), input_stream::read_line(), wesnothd::room_manager::read_rooms(), savegame::read_save_file(), help::help_text_area::set_items(), unicode_cast(), and ucs4::iterator_base< string_type, update_implementation >::update().
| void read | ( | config & | cfg, |
| const std::string & | in, | ||
| abstract_validator * | validator | ||
| ) |
Definition at line 405 of file parser.cpp.
| void read_bz2 | ( | config & | cfg, |
| std::istream & | file, | ||
| abstract_validator * | validator | ||
| ) |
might throw a std::ios_base::failure especially bzip2_error
Definition at line 460 of file parser.cpp.
Referenced by savegame::read_save_file().
| void read_compressed | ( | config & | cfg, |
| std::istream & | file, | ||
| abstract_validator * | validator | ||
| ) |
Definition at line 412 of file parser.cpp.
References LOG_CF.
| void read_gz | ( | config & | cfg, |
| std::istream & | file, | ||
| abstract_validator * | validator | ||
| ) |
might throw a std::ios_base::failure especially a gzip_error
Definition at line 454 of file parser.cpp.
Referenced by savegame::save_index_class::data(), network_asio::connection::handle_read(), twesnothd_connection::handle_read(), wesnothd::ban_manager::read(), game_config::config_cache::read_file(), wesnothd::room_manager::read_rooms(), and savegame::read_save_file().
| void write | ( | std::ostream & | out, |
| configr_of const & | cfg, | ||
| unsigned int | level | ||
| ) |
Definition at line 621 of file parser.cpp.
References PACKAGE, and write_internal().
Referenced by help::help_text_area::handle_ref_cfg(), gui2::unit_mode_controller::handle_stuff_list_selection(), addons_client::install_addon(), preprocess_resource(), events::menu_handler::save_map(), set_addon_pbl_info(), unicode_cast(), write_compressed(), campaignd::server::write_config(), preferences::write_preferences(), and savegame::save_index_class::write_save_index().
| void write_bz2 | ( | std::ostream & | out, |
| configr_of const & | cfg | ||
| ) |
Definition at line 644 of file parser.cpp.
| void write_close_child | ( | std::ostream & | out, |
| const std::string & | child, | ||
| unsigned int | level | ||
| ) |
Definition at line 570 of file parser.cpp.
Referenced by config_writer::close_child(), and write_internal().
| void write_compressed | ( | std::ostream & | out, |
| configr_of const & | cfg | ||
| ) |
Definition at line 628 of file parser.cpp.
References write().
| void write_gz | ( | std::ostream & | out, |
| configr_of const & | cfg | ||
| ) |
Definition at line 639 of file parser.cpp.
Referenced by twesnothd_connection::send_data(), network_asio::connection::transfer(), and savegame::save_index_class::write_save_index().
|
static |
Definition at line 575 of file parser.cpp.
References config::all_children_range(), config::attribute_range(), ERR_CF, error(), i, max_recursion_levels, config::valid_id(), write_close_child(), write_key_val(), and write_open_child().
Referenced by write(), and write_internal().
|
static |
Definition at line 600 of file parser.cpp.
References configr_of::data_, ERR_CF, error(), max_recursion_levels, configr_of::subtags_, config::valid_id(), write_close_child(), write_internal(), and write_open_child().
| void write_key_val | ( | std::ostream & | out, |
| const std::string & | key, | ||
| const config::attribute_value & | value, | ||
| unsigned | level, | ||
| std::string & | textdomain | ||
| ) |
Definition at line 558 of file parser.cpp.
References config::attribute_value::apply_visitor().
Referenced by write_internal().
| void write_open_child | ( | std::ostream & | out, |
| const std::string & | child, | ||
| unsigned int | level | ||
| ) |
Definition at line 565 of file parser.cpp.
Referenced by config_writer::open_child(), and write_internal().
|
static |
|
static |
Definition at line 47 of file parser.cpp.
Referenced by write_internal().
1.8.8