SCalc
|
The result of an SCalc::Session::eval(). More...
#include <expression.hh>
Public Member Functions | |
ParserResult (Session *s) | |
Constructors/desctructors: | |
Session * | session () |
The SCalc::Session object used. More... | |
virtual std::string | pretty_print ()=0 |
Pretty printing of the result ? | |
virtual int | can_delete () |
Conversion functions | |
ParserResult as such is not directly usable: you need to check its actual type and convert it to an appropriate subtype with these functions. | |
virtual int | is_expression () |
Is it a SCalc::Expression ? More... | |
Expression * | to_expression () |
Converts to SCalc::Expression. More... | |
virtual int | is_syntax_error () |
Is it a SCalc::SyntaxError ? More... | |
SyntaxError * | to_syntax_error () |
Converts to SCalc::SyntaxError. More... | |
virtual int | is_func_def () |
Is it a SCalc::FuncDef ? More... | |
FuncDef * | to_func_def () |
Converts to SCalc::FuncDef. More... | |
The result of an SCalc::Session::eval().
The base class for all the things the parser can return. As the parser can return quite a whole bunch of different things, it is not wise to use SCalc::Expression as the carrier for all. Instead, here comes this small wrapper that enables one to check the return type of everything. A ParserResult can be:
|
inlinevirtual |
Whether or not we can freely delete this result = nearly always yes, unless it is a named function
Reimplemented in SCalc::FuncDef.
|
inlinevirtual |
Is it a SCalc::Expression ?
Returns true if the object is a SCalc::Expression or one of its children.
Reimplemented in SCalc::Expression.
Referenced by to_expression().
|
inlinevirtual |
Is it a SCalc::FuncDef ?
Returns true if the object is a SCalc::FuncDef or one of its children.
Reimplemented in SCalc::FuncDef.
Referenced by to_func_def().
|
inlinevirtual |
Is it a SCalc::SyntaxError ?
Returns true if the object is a SCalc::SyntaxError or one of its children.
Reimplemented in SCalc::SyntaxError.
Referenced by to_syntax_error().
|
inline |
The SCalc::Session object used.
Returns the SCalc::Session in which the expression was parsed.
Referenced by SCalc::Expression::evaluable().
|
inline |
Converts to SCalc::Expression.
Returns a SCalc::Expression object or NULL if the object isn't an expression.
References is_expression().
|
inline |
Converts to SCalc::FuncDef.
Returns a SCalc::FuncDef object or NULL if the object doesn't represent a function definition.
References is_func_def(), and pretty_print().
|
inline |
Converts to SCalc::SyntaxError.
Returns a SCalc::SyntaxError object or NULL if the object doesn't represent a syntax error.
References is_syntax_error().