The Battle for Wesnoth  1.19.7+dev
Classes | Typedefs | Functions
preprocessor.hpp File Reference
#include "deprecation.hpp"
#include "exceptions.hpp"
#include "filesystem.hpp"
#include "game_version.hpp"
#include "utils/optional_fwd.hpp"
#include <iosfwd>
#include <map>
#include <string>
#include <vector>
Include dependency graph for preprocessor.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  preproc_define
 
struct  preproc_config
 
struct  preproc_config::error
 

Typedefs

typedef std::map< std::string, struct preproc_definepreproc_map
 

Functions

std::ostream & operator<< (std::ostream &stream, const preproc_define &def)
 
std::string lineno_string (const std::string &lineno)
 
std::ostream & operator<< (std::ostream &stream, const preproc_map::value_type &def)
 
filesystem::scoped_istream preprocess_file (const std::string &fname, preproc_map *defines=nullptr)
 Function to use the WML preprocessor on a file. More...
 
std::string preprocess_string (const std::string &contents, preproc_map *defines, const std::string &textdomain="wesnoth")
 Function to use the WML preprocessor on a string. More...
 
void preprocess_resource (const std::string &res_name, preproc_map *defines_map, bool write_cfg=false, bool write_plain_cfg=false, const std::string &target_directory="")
 

Typedef Documentation

◆ preproc_map

typedef std::map<std::string, struct preproc_define> preproc_map

Definition at line 34 of file preprocessor.hpp.

Function Documentation

◆ lineno_string()

std::string lineno_string ( const std::string &  lineno)

◆ operator<<() [1/2]

std::ostream& operator<< ( std::ostream &  stream,
const preproc_define def 
)

Definition at line 237 of file preprocessor.cpp.

References preproc_define::location, and preproc_define::value.

◆ operator<<() [2/2]

std::ostream& operator<< ( std::ostream &  stream,
const preproc_map::value_type &  def 
)

Definition at line 242 of file preprocessor.cpp.

◆ preprocess_file()

filesystem::scoped_istream preprocess_file ( const std::string &  fname,
preproc_map defines = nullptr 
)

◆ preprocess_resource()

void preprocess_resource ( const std::string &  res_name,
preproc_map defines_map,
bool  write_cfg = false,
bool  write_plain_cfg = false,
const std::string &  target_directory = "" 
)

◆ preprocess_string()

std::string preprocess_string ( const std::string &  contents,
preproc_map defines,
const std::string &  textdomain = "wesnoth" 
)

Function to use the WML preprocessor on a string.

Parameters
definesA map of symbols defined.
contentsThe string to be preprocessed.
textdomainThe textdomain to associate the contents. Default: wesnoth
Returns
The resulting preprocessed string.

Definition at line 1750 of file preprocessor.cpp.

References log_scope, and game_config::path.

Referenced by handle_preprocess_string(), and editor::map_context::to_config().