The Battle for Wesnoth  1.15.1+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 33 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 240 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 253 of file formula.cpp.

References formula().

Referenced by evaluate(), and 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 54 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 63 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 262 of file formula.cpp.

References e, expr_, and game::error::message.

Referenced by evaluate(), wfl::formula_debugger::evaluate_formula_callback(), and execute().

◆ execute() [2/2]

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

Definition at line 272 of file formula.cpp.

References execute().

◆ str()

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

Definition at line 72 of file formula.hpp.

References str_.

Referenced by wfl::formula_debugger::evaluate_formula_callback(), and formula().

Friends And Related Function Documentation

◆ formula_debugger

friend class formula_debugger
friend

Definition at line 87 of file formula.hpp.

Member Data Documentation

◆ expr_

expression_ptr wfl::formula::expr_
private

Definition at line 80 of file formula.hpp.

Referenced by execute(), and formula().

◆ id_chars

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

Definition at line 74 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 84 of file formula.hpp.

◆ str_

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

Definition at line 81 of file formula.hpp.

Referenced by str().

◆ symbols_

function_symbol_table* wfl::formula::symbols_
private

Definition at line 85 of file formula.hpp.

Referenced by formula().


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