SDL2lazy
Public Member Functions | Public Attributes | List of all members
SlFormulaItem Class Reference

Public Member Functions

 SlFormulaItem ()
 
 SlFormulaItem (char c)
 
 SlFormulaItem (double value)
 
 ~SlFormulaItem ()
 
SlFormulaItem operator+ (const SlFormulaItem &rhs)
 
SlFormulaItem operator- (const SlFormulaItem &rhs)
 
SlFormulaItem operator* (const SlFormulaItem &rhs)
 
SlFormulaItem operator/ (const SlFormulaItem &rhs)
 
std::string print ()
 

Public Attributes

char what
 
int precedence
 
double data = 0
 

Constructor & Destructor Documentation

SlFormulaItem::SlFormulaItem ( )
inline

Default constructor.

SlFormulaItem::SlFormulaItem ( char  c)

Constructor for operators.

SlFormulaItem::SlFormulaItem ( double  value)

Constructor for numbers.

SlFormulaItem::~SlFormulaItem ( )
inline

Default constructor, nothing to see here.

Member Function Documentation

SlFormulaItem SlFormulaItem::operator* ( const SlFormulaItem &  rhs)

Addition is only possible if both are numbers. data will be summed.

Exceptions
std::runtime_errorwhen one of the summed items is not a number.
SlFormulaItem SlFormulaItem::operator+ ( const SlFormulaItem &  rhs)

Addition is only possible if both are numbers. data will be summed.

Exceptions
std::runtime_errorwhen one of the summed items is not a number.
SlFormulaItem SlFormulaItem::operator- ( const SlFormulaItem &  rhs)

Addition is only possible if both are numbers. data will be summed.

Exceptions
std::runtime_errorwhen one of the summed items is not a number.
SlFormulaItem SlFormulaItem::operator/ ( const SlFormulaItem &  rhs)

Addition is only possible if both are numbers. data will be summed.

Exceptions
std::runtime_errorwhen one of the summed items is not a number.
std::string SlFormulaItem::print ( )

Returns what for operators and data for numbers.

Member Data Documentation

double SlFormulaItem::data = 0

If the item is a number, data holds the value.

int SlFormulaItem::precedence

Precedence is 2 for +, i, 3 for *, / .

char SlFormulaItem::what

The operator symbol or 'n' if number.


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