The Battle for Wesnoth  1.19.15+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)
 Function to use the WML preprocessor on a file. More...
 
filesystem::scoped_istream preprocess_file (const std::string &fname)
 
filesystem::scoped_istream preprocess_string (const std::string &contents, const std::string &textdomain, preproc_map &defines)
 Function to use the WML preprocessor on a string. More...
 
filesystem::scoped_istream preprocess_string (const std::string &contents, const std::string &textdomain)
 
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 234 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 239 of file preprocessor.cpp.

◆ preprocess_file() [1/2]

filesystem::scoped_istream preprocess_file ( const std::string &  fname)

Definition at line 1742 of file preprocessor.cpp.

References log_scope.

◆ preprocess_file() [2/2]

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

◆ 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() [1/2]

filesystem::scoped_istream preprocess_string ( const std::string &  contents,
const std::string &  textdomain 
)

Definition at line 1751 of file preprocessor.cpp.

References log_scope, and game_config::path.

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

◆ preprocess_string() [2/2]

filesystem::scoped_istream preprocess_string ( const std::string &  contents,
const std::string &  textdomain,
preproc_map defines 
)

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.
Returns
The resulting preprocessed string.

Definition at line 1763 of file preprocessor.cpp.

References log_scope, and game_config::path.