The Battle for Wesnoth  1.19.0-dev
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
wfl::operator_expression Class Reference
Inheritance diagram for wfl::operator_expression:

Public Member Functions

 operator_expression (const std::string &op, expression_ptr left, expression_ptr right)
 
std::string str () const
 
- Public Member Functions inherited from wfl::formula_expression
 formula_expression (const std::string &name="")
 
virtual ~formula_expression ()
 
variant evaluate (const formula_callable &variables, formula_debugger *fdb=nullptr) const
 
std::string get_name () const
 

Private Types

enum  OP {
  AND , OR , NEQ , LTE ,
  GTE , OP_CAT , OP_IN , GT ='>' ,
  LT ='<' , EQ ='=' , RAN ='~' , ADD ='+' ,
  SUB ='-' , MUL ='*' , DIV ='/' , ADDL ,
  SUBL , MULL , DIVL , DICE ='d' ,
  POW ='^' , MOD =''
}
 

Private Member Functions

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

Static Private Member Functions

static int dice_roll (int num_rolls, int faces)
 

Private Attributes

OP op_
 
std::string op_str_
 
expression_ptr left_
 
expression_ptr right_
 

Detailed Description

Definition at line 695 of file formula.cpp.

Member Enumeration Documentation

◆ OP

Enumerator
AND 
OR 
NEQ 
LTE 
GTE 
OP_CAT 
OP_IN 
GT 
LT 
EQ 
RAN 
ADD 
SUB 
MUL 
DIV 
ADDL 
SUBL 
MULL 
DIVL 
DICE 
POW 
MOD 

Definition at line 801 of file formula.cpp.

Constructor & Destructor Documentation

◆ operator_expression()

wfl::operator_expression::operator_expression ( const std::string &  op,
expression_ptr  left,
expression_ptr  right 
)
inline

Definition at line 698 of file formula.cpp.

References ADDL, AND, DIVL, GTE, LTE, MULL, NEQ, op_, OP_CAT, OP_IN, OR, and SUBL.

Member Function Documentation

◆ dice_roll()

static int wfl::operator_expression::dice_roll ( int  num_rolls,
int  faces 
)
inlinestaticprivate

Definition at line 790 of file formula.cpp.

References randomness::generator, and randomness::rng::get_random_int().

Referenced by execute().

◆ execute()

variant wfl::operator_expression::execute ( const formula_callable variables,
formula_debugger fdb 
) const
inlineprivatevirtual

◆ str()

std::string wfl::operator_expression::str ( ) const
inlinevirtual

Implements wfl::formula_expression.

Definition at line 726 of file formula.cpp.

References left_, op_str_, right_, and s.

Member Data Documentation

◆ left_

expression_ptr wfl::operator_expression::left_
private

Definition at line 806 of file formula.cpp.

Referenced by execute(), and str().

◆ op_

OP wfl::operator_expression::op_
private

Definition at line 804 of file formula.cpp.

Referenced by execute(), and operator_expression().

◆ op_str_

std::string wfl::operator_expression::op_str_
private

Definition at line 805 of file formula.cpp.

Referenced by execute(), and str().

◆ right_

expression_ptr wfl::operator_expression::right_
private

Definition at line 806 of file formula.cpp.

Referenced by execute(), and str().


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