SCalc
Public Member Functions
SCalc::ParserResult Class Reference

The result of an SCalc::Session::eval(). More...

#include <expression.hh>

Inheritance diagram for SCalc::ParserResult:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ParserResult (Session *s)
 Constructors/desctructors:
Sessionsession ()
 The SCalc::Session object used.
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 ?
Expressionto_expression ()
 Converts to SCalc::Expression.
virtual int is_syntax_error ()
 Is it a SCalc::SyntaxError ?
SyntaxErrorto_syntax_error ()
 Converts to SCalc::SyntaxError.
virtual int is_func_def ()
 Is it a SCalc::FuncDef ?
FuncDefto_func_def ()
 Converts to SCalc::FuncDef.

Detailed Description

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:


Member Function Documentation

virtual int SCalc::ParserResult::can_delete ( ) [inline, virtual]

Whether or not we can freely delete this result = nearly always yes, unless it is a named function

Reimplemented in SCalc::FuncDef.

virtual int SCalc::ParserResult::is_expression ( ) [inline, virtual]

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().

virtual int SCalc::ParserResult::is_func_def ( ) [inline, virtual]

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().

virtual int SCalc::ParserResult::is_syntax_error ( ) [inline, virtual]

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().

The SCalc::Session object used.

Returns the SCalc::Session in which the expression was parsed.

Referenced by SCalc::Expression::evaluable().

Converts to SCalc::Expression.

Returns a SCalc::Expression object or NULL if the object isn't an expression.

References is_expression().

Converts to SCalc::FuncDef.

Returns a SCalc::FuncDef object or NULL if the object doesn't represent a function definition.

References is_func_def().

Converts to SCalc::SyntaxError.

Returns a SCalc::SyntaxError object or NULL if the object doesn't represent a syntax error.

References is_syntax_error().


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