The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Functions | Variables
parser.cpp File Reference

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>
Include dependency graph for parser.cpp:

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
 

Detailed Description

Read/Write & analyze WML- and config-files.

Definition in file parser.cpp.

Macro Definition Documentation

#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.

Function Documentation

void read ( config cfg,
std::istream &  in,
abstract_validator validator 
)
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().

template<typename decompressor >
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 
)
void write ( std::ostream &  out,
configr_of const &  cfg,
unsigned int  level 
)
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().

template<typename compressor >
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 
)
static void write_internal ( config const &  cfg,
std::ostream &  out,
std::string textdomain,
size_t  tab = 0 
)
static
static void write_internal ( configr_of const &  cfg,
std::ostream &  out,
std::string textdomain,
size_t  tab = 0 
)
static
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().

Variable Documentation

lg::log_domain log_config("config")
static
const size_t max_recursion_levels = 1000
static

Definition at line 47 of file parser.cpp.

Referenced by write_internal().