parser.cpp File Reference

Read/Write & analyse WML- and config-files. More...

#include "serialization/parser.hpp"
#include "config.hpp"
#include "filesystem.hpp"
#include "gettext.hpp"
#include "language.hpp"
#include "loadscreen.hpp"
#include "log.hpp"
#include "util.hpp"
#include "wesconfig.h"
#include "serialization/binary_wml.hpp"
#include "serialization/preprocessor.hpp"
#include "serialization/string_utils.hpp"
#include "serialization/tokenizer.hpp"
#include <cassert>
#include <sstream>
#include <stack>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>

Include dependency graph for parser.cpp:

Go to the source code of this file.

Defines

#define ERR_CF   LOG_STREAM(err, config)
#define WRN_CF   LOG_STREAM(warn, config)
#define LOG_CF   LOG_STREAM(info, config)

Functions

void read (config &cfg, std::istream &in, std::string *error_log)
void read (config &cfg, std::string &in, std::string *error_log)
void read_gz (config &cfg, std::istream &file, std::string *error_log)
static std::string escaped_string (const std::string &value)
void write_key_val (std::ostream &out, const std::string &key, const t_string &value, unsigned int 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)
void write (std::ostream &out, config const &cfg, unsigned int level)

Variables

static const size_t max_recursion_levels = 1000
static char const * AttributeEquals = "="
static char const * TranslatableAttributePrefix = "_ \""
static char const * AttributePrefix = "\""
static char const * AttributePostfix = "\""
static char const * AttributeContPostfix = " + \n"
static char const * AttributeEndPostfix = "\n"
static char const * TextdomainPrefix = "#textdomain "
static char const * TextdomainPostfix = "\n"
static char const * ElementPrefix = "["
static char const * ElementPostfix = "]\n"
static char const * EndElementPrefix = "[/"
static char const * EndElementPostfix = "]\n"


Detailed Description

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

Definition in file parser.cpp.


Define Documentation

#define ERR_CF   LOG_STREAM(err, config)

Definition at line 42 of file parser.cpp.

#define LOG_CF   LOG_STREAM(info, config)

Definition at line 44 of file parser.cpp.

#define WRN_CF   LOG_STREAM(warn, config)

Definition at line 43 of file parser.cpp.


Function Documentation

static std::string escaped_string ( const std::string &  value  )  [static]

Definition at line 382 of file parser.cpp.

Referenced by write_key_val().

void read ( config cfg,
std::string &  in,
std::string *  error_log 
)

Definition at line 350 of file parser.cpp.

void read ( config cfg,
std::istream &  in,
std::string *  error_log 
)

void read_gz ( config cfg,
std::istream &  file,
std::string *  error_log 
)

Definition at line 356 of file parser.cpp.

Referenced by process_queue(), and read_save_file().

void write ( std::ostream &  out,
config const &  cfg,
unsigned int  level 
)

void write_close_child ( std::ostream &  out,
const std::string &  child,
unsigned int  level 
)

Definition at line 449 of file parser.cpp.

Referenced by config_writer::close_child(), and write_internal().

static void write_internal ( config 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 t_string value,
unsigned int  level,
std::string &  textdomain 
)

Definition at line 392 of file parser.cpp.

References t_string::empty(), and escaped_string().

Referenced by write_internal().

void write_open_child ( std::ostream &  out,
const std::string &  child,
unsigned int  level 
)

Definition at line 443 of file parser.cpp.

Referenced by config_writer::open_child(), and write_internal().


Variable Documentation

char const* AttributeContPostfix = " + \n" [static]

Definition at line 371 of file parser.cpp.

char const* AttributeEndPostfix = "\n" [static]

Definition at line 372 of file parser.cpp.

char const* AttributeEquals = "=" [static]

Definition at line 365 of file parser.cpp.

char const* AttributePostfix = "\"" [static]

Definition at line 369 of file parser.cpp.

char const* AttributePrefix = "\"" [static]

Definition at line 368 of file parser.cpp.

Definition at line 68 of file parser.cpp.

char const* ElementPostfix = "]\n" [static]

Definition at line 378 of file parser.cpp.

char const* ElementPrefix = "[" [static]

Definition at line 377 of file parser.cpp.

std::stack<element> elements

Definition at line 87 of file parser.cpp.

char const* EndElementPostfix = "]\n" [static]

Definition at line 380 of file parser.cpp.

char const* EndElementPrefix = "[/" [static]

Definition at line 379 of file parser.cpp.

Definition at line 83 of file parser.cpp.

const size_t max_recursion_levels = 1000 [static]

Definition at line 46 of file parser.cpp.

std::string name

Definition at line 81 of file parser.cpp.

std::string start_line

Definition at line 84 of file parser.cpp.

char const* TextdomainPostfix = "\n" [static]

Definition at line 375 of file parser.cpp.

char const* TextdomainPrefix = "#textdomain " [static]

Definition at line 374 of file parser.cpp.

Definition at line 69 of file parser.cpp.

char const* TranslatableAttributePrefix = "_ \"" [static]

Definition at line 367 of file parser.cpp.


Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs