The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
wfl::formula Class Reference

#include <formula.hpp>

Public Member Functions

 formula (const std::string &str, function_symbol_table *symbols=nullptr)
 
 formula (const tk::token *i1, const tk::token *i2, function_symbol_table *symbols=nullptr)
 
variant evaluate (const formula_callable &variables, formula_debugger *fdb=nullptr) const
 
variant evaluate (formula_debugger *fdb=nullptr) const
 
const std::string & str () const
 

Static Public Member Functions

static variant evaluate (const const_formula_ptr &f, const formula_callable &variables, formula_debugger *fdb=nullptr, variant default_res=variant(0))
 
static formula_ptr create_optional_formula (const std::string &str, function_symbol_table *symbols=nullptr)
 

Static Public Attributes

static const char *const id_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"
 

Private Member Functions

variant execute (const formula_callable &variables, formula_debugger *fdb=nullptr) const
 
variant execute (formula_debugger *fdb) const
 

Private Attributes

expression_ptr expr_
 
std::string str_
 
const std::shared_ptr< function_symbol_tablemanaged_symbols_
 
function_symbol_tablesymbols_
 

Friends

class formula_debugger
 

Detailed Description

Definition at line 34 of file formula.hpp.

Constructor & Destructor Documentation

◆ formula() [1/2]

wfl::formula::formula ( const std::string &  str,
function_symbol_table symbols = nullptr 
)

◆ formula() [2/2]

wfl::formula::formula ( const tk::token i1,
const tk::token i2,
function_symbol_table symbols = nullptr 
)

Definition at line 238 of file formula.cpp.

References expr_, and wfl::parse_expression().

Member Function Documentation

◆ create_optional_formula()

formula_ptr wfl::formula::create_optional_formula ( const std::string &  str,
function_symbol_table symbols = nullptr 
)
static

Definition at line 251 of file formula.cpp.

References formula(), and str().

Referenced by wfl::parse_expression().

◆ evaluate() [1/3]

static variant wfl::formula::evaluate ( const const_formula_ptr f,
const formula_callable variables,
formula_debugger fdb = nullptr,
variant  default_res = variant(0) 
)
inlinestatic

◆ evaluate() [2/3]

variant wfl::formula::evaluate ( const formula_callable variables,
formula_debugger fdb = nullptr 
) const
inline

Definition at line 55 of file formula.hpp.

References wfl::evaluate_formula_callback(), and execute().

◆ evaluate() [3/3]

variant wfl::formula::evaluate ( formula_debugger fdb = nullptr) const
inline

Definition at line 64 of file formula.hpp.

References wfl::evaluate_formula_callback(), and execute().

◆ execute() [1/2]

variant wfl::formula::execute ( const formula_callable variables,
formula_debugger fdb = nullptr 
) const
private

Definition at line 260 of file formula.cpp.

References e, expr_, and PLAIN_LOG.

Referenced by evaluate(), and execute().

◆ execute() [2/2]

variant wfl::formula::execute ( formula_debugger fdb) const
private

Definition at line 270 of file formula.cpp.

References execute().

◆ str()

const std::string& wfl::formula::str ( ) const
inline

Definition at line 73 of file formula.hpp.

References str_.

Referenced by create_optional_formula(), formula(), and game_events::filter_formula::serialize().

Friends And Related Function Documentation

◆ formula_debugger

friend class formula_debugger
friend

Definition at line 88 of file formula.hpp.

Member Data Documentation

◆ expr_

expression_ptr wfl::formula::expr_
private

Definition at line 81 of file formula.hpp.

Referenced by execute(), and formula().

◆ id_chars

const char *const wfl::formula::id_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"
static

Definition at line 75 of file formula.hpp.

Referenced by lua_callable::get_inputs(), and wfl::config_callable::get_inputs().

◆ managed_symbols_

const std::shared_ptr<function_symbol_table> wfl::formula::managed_symbols_
private

Definition at line 85 of file formula.hpp.

◆ str_

std::string wfl::formula::str_
private

Definition at line 82 of file formula.hpp.

Referenced by str().

◆ symbols_

function_symbol_table* wfl::formula::symbols_
private

Definition at line 86 of file formula.hpp.

Referenced by formula().


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