Read/Write & analyze WML- and config-files. More...
#include "serialization/parser.hpp"
#include "config.hpp"
#include "gettext.hpp"
#include "log.hpp"
#include "serialization/preprocessor.hpp"
#include "serialization/string_utils.hpp"
#include "serialization/validator.hpp"
#include "utils/charconv.hpp"
#include "wesconfig.h"
#include <boost/algorithm/string/replace.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <stack>
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 (const config &cfg, std::ostream &out, std::string &textdomain, std::size_t tab=0) |
static void | write_internal (const configr_of &cfg, std::ostream &out, std::string &textdomain, std::size_t tab=0) |
void | write (std::ostream &out, const configr_of &cfg, unsigned int level) |
template<typename compressor > | |
void | write_compressed (std::ostream &out, const configr_of &cfg) |
void | write_gz (std::ostream &out, const configr_of &cfg) |
void | write_bz2 (std::ostream &out, const configr_of &cfg) |
Variables | |
static lg::log_domain | log_config ("config") |
static const std::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 53 of file parser.cpp.
#define LOG_CF LOG_STREAM(info, log_config) |
Definition at line 55 of file parser.cpp.
#define WRN_CF LOG_STREAM(warn, log_config) |
Definition at line 54 of file parser.cpp.
void read | ( | config & | cfg, |
const std::string & | in, | ||
abstract_validator * | validator | ||
) |
Definition at line 634 of file parser.cpp.
void read | ( | config & | cfg, |
std::istream & | in, | ||
abstract_validator * | validator | ||
) |
Definition at line 629 of file parser.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), savegame::save_index_class::data(), gui2::dialogs::editor_edit_unit::editor_edit_unit(), saved_game::expand_map_file(), get_addon_install_info(), get_addon_pbl_info(), ai::configuration::get_side_config_from_file(), handle_preprocess_command(), handle_preprocess_string(), handle_validate_command(), gui2::init(), ng::create_engine::init_all_levels(), lua_wml::intf_load_wml(), lua_wml::intf_parse_wml(), persist_file_context::load(), campaignd::server::load_blacklist(), campaignd::server::load_config(), font::load_font_config(), load_language_list(), prefs::load_preferences(), editor::map_context::load_scenario(), prefs::migrate_preferences(), gui2::dialogs::editor_edit_pbl::pre_show(), preprocess_and_parse(), preprocess_resource(), process_command_args(), achievements::read_achievements_file(), wesnothd::server::read_config(), schema_validation::schema_validator::read_config_file(), game_config::config_cache::read_configs(), savegame::read_save_file(), editor::map_context::save_schedule(), campaignd::server::serve_requests(), editor::map_context::to_config(), unicode_cast(), ucs4::iterator_base< string_type, update_implementation >::update(), and gui2::dialogs::editor_edit_pbl::validate().
void read_bz2 | ( | config & | cfg, |
std::istream & | file, | ||
abstract_validator * | validator | ||
) |
Might throw a std::ios_base::failure especially bzip2_error.
Definition at line 691 of file parser.cpp.
References validator.
Referenced by savegame::read_save_file().
void read_compressed | ( | config & | cfg, |
std::istream & | file, | ||
abstract_validator * | validator | ||
) |
Definition at line 641 of file parser.cpp.
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 685 of file parser.cpp.
References validator.
Referenced by savegame::save_index_class::data(), wesnothd_connection::handle_read(), network_asio::connection::handle_read(), campaignd::server::handle_request_campaign(), campaignd::server::handle_upload(), campaignd::server::load_config(), wesnothd::ban_manager::read(), game_config::config_cache::read_file(), and savegame::read_save_file().
void write | ( | std::ostream & | out, |
const configr_of & | cfg, | ||
unsigned int | level | ||
) |
Definition at line 766 of file parser.cpp.
References game_config::images::level, PACKAGE, and write_internal().
Referenced by campaignd::server::handle_request_campaign(), campaignd::server::handle_request_campaign_list(), campaignd::server::handle_server_id(), lua_wml::intf_wml_tostring(), preprocess_resource(), set_addon_pbl_info(), unicode_cast(), write_addon_install_info(), write_compressed(), campaignd::server::write_config(), prefs::write_preferences(), savegame::save_index_class::write_save_index(), network_asio::connection::~connection(), and wesnothd_connection::~wesnothd_connection().
void write_bz2 | ( | std::ostream & | out, |
const configr_of & | cfg | ||
) |
Definition at line 790 of file parser.cpp.
void write_close_child | ( | std::ostream & | out, |
const std::string & | child, | ||
unsigned int | level | ||
) |
Definition at line 710 of file parser.cpp.
References game_config::images::level.
Referenced by config_writer::close_child(), and write_internal().
void write_compressed | ( | std::ostream & | out, |
const configr_of & | cfg | ||
) |
Definition at line 773 of file parser.cpp.
References write().
void write_gz | ( | std::ostream & | out, |
const configr_of & | cfg | ||
) |
Definition at line 785 of file parser.cpp.
Referenced by wesnothd_connection::send_data(), network_asio::connection::transfer(), and savegame::save_index_class::write_save_index().
|
static |
Definition at line 715 of file parser.cpp.
References config::all_children_view(), config::attribute_range(), ERR_CF, max_recursion_levels, config::valid_attribute(), config::valid_tag(), write_close_child(), write_key_val(), and write_open_child().
Referenced by write(), and write_internal().
|
static |
Definition at line 742 of file parser.cpp.
References configr_of::data_, ERR_CF, max_recursion_levels, configr_of::subtags_, config::valid_tag(), 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 696 of file parser.cpp.
References config_attribute_value::apply_visitor(), and game_config::images::level.
Referenced by gui2::dialogs::editor_edit_unit::update_wml_view(), and write_internal().
void write_open_child | ( | std::ostream & | out, |
const std::string & | child, | ||
unsigned int | level | ||
) |
Definition at line 705 of file parser.cpp.
References game_config::images::level.
Referenced by config_writer::open_child(), and write_internal().
|
static |
|
static |
Definition at line 57 of file parser.cpp.
Referenced by write_internal().