Crossfire Server, Trunk
inja::Environment Class Reference

Class for changing the configuration. More...

#include <inja.hpp>

+ Collaboration diagram for inja::Environment:

Public Member Functions

void add_callback (const std::string &name, const CallbackFunction &callback)
 Adds a variadic callback. More...
 
void add_callback (const std::string &name, int num_args, const CallbackFunction &callback)
 Adds a callback with given number or arguments. More...
 
void add_void_callback (const std::string &name, const VoidCallbackFunction &callback)
 Adds a variadic void callback. More...
 
void add_void_callback (const std::string &name, int num_args, const VoidCallbackFunction &callback)
 Adds a void callback with given number or arguments. More...
 
 Environment ()
 
 Environment (const std::string &global_path)
 
 Environment (const std::string &input_path, const std::string &output_path)
 
void include_template (const std::string &name, const Template &tmpl)
 
std::string load_file (const std::string &filename)
 
json load_json (const std::string &filename)
 
Template parse (nonstd::string_view input)
 
Template parse_file (const std::string &filename)
 
Template parse_template (const std::string &filename)
 
std::string render (const Template &tmpl, const json &data)
 
std::string render (nonstd::string_view input, const json &data)
 
std::string render_file (const std::string &filename, const json &data)
 
std::string render_file_with_json_file (const std::string &filename, const std::string &filename_data)
 
std::ostream & render_to (std::ostream &os, const Template &tmpl, const json &data)
 
void set_comment (const std::string &open, const std::string &close)
 Sets the opener and closer for template comments. More...
 
void set_expression (const std::string &open, const std::string &close)
 Sets the opener and closer for template expressions. More...
 
void set_line_statement (const std::string &open)
 Sets the opener for template line statements. More...
 
void set_lstrip_blocks (bool lstrip_blocks)
 Sets whether to strip the spaces and tabs from the start of a line to a block. More...
 
void set_search_included_templates_in_files (bool search_in_files)
 Sets the element notation syntax. More...
 
void set_statement (const std::string &open, const std::string &close)
 Sets the opener and closer for template statements. More...
 
void set_throw_at_missing_includes (bool will_throw)
 Sets whether a missing include will throw an error. More...
 
void set_trim_blocks (bool trim_blocks)
 Sets whether to remove the first newline after a block. More...
 
void write (const std::string &filename, const json &data, const std::string &filename_out)
 
void write (const Template &temp, const json &data, const std::string &filename_out)
 
void write_with_json_file (const std::string &filename, const std::string &filename_data, const std::string &filename_out)
 
void write_with_json_file (const Template &temp, const std::string &filename_data, const std::string &filename_out)
 

Private Attributes

FunctionStorage function_storage
 
std::string input_path
 
LexerConfig lexer_config
 
std::string output_path
 
ParserConfig parser_config
 
RenderConfig render_config
 
TemplateStorage template_storage
 

Detailed Description

Class for changing the configuration.

Definition at line 4229 of file inja.hpp.

Constructor & Destructor Documentation

◆ Environment() [1/3]

inja::Environment::Environment ( )
inline

Definition at line 4241 of file inja.hpp.

◆ Environment() [2/3]

inja::Environment::Environment ( const std::string &  global_path)
inlineexplicit

Definition at line 4243 of file inja.hpp.

◆ Environment() [3/3]

inja::Environment::Environment ( const std::string &  input_path,
const std::string &  output_path 
)
inline

Definition at line 4245 of file inja.hpp.

Member Function Documentation

◆ add_callback() [1/2]

void inja::Environment::add_callback ( const std::string &  name,
const CallbackFunction callback 
)
inline

Adds a variadic callback.

Definition at line 4379 of file inja.hpp.

References give::name.

◆ add_callback() [2/2]

void inja::Environment::add_callback ( const std::string &  name,
int  num_args,
const CallbackFunction callback 
)
inline

Adds a callback with given number or arguments.

Definition at line 4393 of file inja.hpp.

References inja::FunctionStorage::add_callback(), and give::name.

+ Here is the call graph for this function:

◆ add_void_callback() [1/2]

void inja::Environment::add_void_callback ( const std::string &  name,
const VoidCallbackFunction callback 
)
inline

Adds a variadic void callback.

Definition at line 4386 of file inja.hpp.

References give::name.

◆ add_void_callback() [2/2]

void inja::Environment::add_void_callback ( const std::string &  name,
int  num_args,
const VoidCallbackFunction callback 
)
inline

Adds a void callback with given number or arguments.

Definition at line 4400 of file inja.hpp.

References inja::FunctionStorage::add_callback(), make_face_from_files::args, and give::name.

+ Here is the call graph for this function:

◆ include_template()

void inja::Environment::include_template ( const std::string &  name,
const Template tmpl 
)
inline

Includes a template with a given name into the environment. Then, a template can be rendered in another template using the include "<name>" syntax.

Definition at line 4408 of file inja.hpp.

References give::name.

◆ load_file()

std::string inja::Environment::load_file ( const std::string &  filename)
inline

Definition at line 4363 of file inja.hpp.

References npc_dialog::filename, and make_face_from_files::parser.

◆ load_json()

json inja::Environment::load_json ( const std::string &  filename)
inline

Definition at line 4368 of file inja.hpp.

References mad_mage_user::file, npc_dialog::filename, and inja::open_file_or_throw().

+ Here is the call graph for this function:

◆ parse()

Template inja::Environment::parse ( nonstd::string_view  input)
inline

Definition at line 4302 of file inja.hpp.

References make_face_from_files::parser.

◆ parse_file()

Template inja::Environment::parse_file ( const std::string &  filename)
inline

Definition at line 4314 of file inja.hpp.

References npc_dialog::filename.

◆ parse_template()

Template inja::Environment::parse_template ( const std::string &  filename)
inline

◆ render() [1/2]

std::string inja::Environment::render ( const Template tmpl,
const json data 
)
inline

Definition at line 4320 of file inja.hpp.

References navar-midane_time::data, and inja::render_to().

+ Here is the call graph for this function:

◆ render() [2/2]

std::string inja::Environment::render ( nonstd::string_view  input,
const json data 
)
inline

Definition at line 4318 of file inja.hpp.

References navar-midane_time::data, and render().

Referenced by render(), and inja::render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render_file()

std::string inja::Environment::render_file ( const std::string &  filename,
const json data 
)
inline

Definition at line 4326 of file inja.hpp.

References navar-midane_time::data, npc_dialog::filename, and inja::render().

+ Here is the call graph for this function:

◆ render_file_with_json_file()

std::string inja::Environment::render_file_with_json_file ( const std::string &  filename,
const std::string &  filename_data 
)
inline

Definition at line 4330 of file inja.hpp.

References navar-midane_time::data, and npc_dialog::filename.

◆ render_to()

std::ostream& inja::Environment::render_to ( std::ostream &  os,
const Template tmpl,
const json data 
)
inline

Definition at line 4358 of file inja.hpp.

References navar-midane_time::data, and inja::Renderer::render_to().

+ Here is the call graph for this function:

◆ set_comment()

void inja::Environment::set_comment ( const std::string &  open,
const std::string &  close 
)
inline

Sets the opener and closer for template comments.

Definition at line 4274 of file inja.hpp.

References CFBank::open().

+ Here is the call graph for this function:

◆ set_expression()

void inja::Environment::set_expression ( const std::string &  open,
const std::string &  close 
)
inline

Sets the opener and closer for template expressions.

Definition at line 4265 of file inja.hpp.

References CFBank::open().

+ Here is the call graph for this function:

◆ set_line_statement()

void inja::Environment::set_line_statement ( const std::string &  open)
inline

Sets the opener for template line statements.

Definition at line 4259 of file inja.hpp.

References CFBank::open().

+ Here is the call graph for this function:

◆ set_lstrip_blocks()

void inja::Environment::set_lstrip_blocks ( bool  lstrip_blocks)
inline

Sets whether to strip the spaces and tabs from the start of a line to a block.

Definition at line 4288 of file inja.hpp.

◆ set_search_included_templates_in_files()

void inja::Environment::set_search_included_templates_in_files ( bool  search_in_files)
inline

Sets the element notation syntax.

Definition at line 4293 of file inja.hpp.

◆ set_statement()

void inja::Environment::set_statement ( const std::string &  open,
const std::string &  close 
)
inline

Sets the opener and closer for template statements.

Definition at line 4249 of file inja.hpp.

References CFBank::open().

+ Here is the call graph for this function:

◆ set_throw_at_missing_includes()

void inja::Environment::set_throw_at_missing_includes ( bool  will_throw)
inline

Sets whether a missing include will throw an error.

Definition at line 4298 of file inja.hpp.

◆ set_trim_blocks()

void inja::Environment::set_trim_blocks ( bool  trim_blocks)
inline

Sets whether to remove the first newline after a block.

Definition at line 4283 of file inja.hpp.

◆ write() [1/2]

void inja::Environment::write ( const std::string &  filename,
const json data,
const std::string &  filename_out 
)
inline

Definition at line 4335 of file inja.hpp.

References navar-midane_time::data, mad_mage_user::file, and npc_dialog::filename.

◆ write() [2/2]

void inja::Environment::write ( const Template temp,
const json data,
const std::string &  filename_out 
)
inline

Definition at line 4341 of file inja.hpp.

References navar-midane_time::data, mad_mage_user::file, inja::render(), and guildbuy::temp.

+ Here is the call graph for this function:

◆ write_with_json_file() [1/2]

void inja::Environment::write_with_json_file ( const std::string &  filename,
const std::string &  filename_data,
const std::string &  filename_out 
)
inline

Definition at line 4347 of file inja.hpp.

References navar-midane_time::data, and npc_dialog::filename.

◆ write_with_json_file() [2/2]

void inja::Environment::write_with_json_file ( const Template temp,
const std::string &  filename_data,
const std::string &  filename_out 
)
inline

Definition at line 4353 of file inja.hpp.

References navar-midane_time::data, and guildbuy::temp.

Field Documentation

◆ function_storage

FunctionStorage inja::Environment::function_storage
private

Definition at line 4237 of file inja.hpp.

◆ input_path

std::string inja::Environment::input_path
private

Definition at line 4230 of file inja.hpp.

◆ lexer_config

LexerConfig inja::Environment::lexer_config
private

Definition at line 4233 of file inja.hpp.

◆ output_path

std::string inja::Environment::output_path
private

Definition at line 4231 of file inja.hpp.

◆ parser_config

ParserConfig inja::Environment::parser_config
private

Definition at line 4234 of file inja.hpp.

◆ render_config

RenderConfig inja::Environment::render_config
private

Definition at line 4235 of file inja.hpp.

◆ template_storage

TemplateStorage inja::Environment::template_storage
private

Definition at line 4238 of file inja.hpp.


The documentation for this class was generated from the following file: