Elementa v8.0.0
Minimalistic library for any C++ application (C++11 and up)
Loading...
Searching...
No Matches
elementa::parsing::Expression::OpDatumWrapper Class Reference

A class to wrap any expression datum or complete operation as a datum. More...

Description

A class to wrap any expression datum or complete operation as a datum.

It derives from ExprElement to be managed by evaluation methods designed for expressions. Notice that these objects refer to the elements in the original expression through smart pointers. If the original expression is deleted, they remain, and vice versa.

Definition at line 539 of file expressions.h.

#include "expressions.h"

Inheritance diagram for elementa::parsing::Expression::OpDatumWrapper:
Collaboration diagram for elementa::parsing::Expression::OpDatumWrapper:

Public Attributes

char what
 'd' -> datum from postfix, 'o' -> scanned operation More...
 
ExprElement::Ptr pdatum
 Datum in original expression if 'd'. More...
 
struct {
ExprElement::Ptr poper
 Operator in original expression. More...
 
ExprElement::PList operands
 Operands (class: TreeNode) More...
 
oper
 All operation data in original expression if 'o'.
 

Public Member Functions

ExprElement::Kind kind (void) const
 Return datum since in a tree everything is dealt with as a datum. More...
 
std::string to_string (void) const
 Return a one-line text representing the node. More...
 
Virtual methods
bool isDatum (void) const noexcept
 Return TRUE if the element is a datum (not a grouping). More...
 
bool isOperation (void) const noexcept
 Return TRUE if the element is an operation. More...
 
bool isOpeningGrouping (void) const noexcept
 Return TRUE if the element is an opening grouping. More...
 
bool isClosingGrouping (void) const noexcept
 Return TRUE if the element is a closing grouping. More...
 
bool isGrouping (void) const noexcept
 Return TRUE if the element is a grouping. More...
 
bool isOpeningArgs (void) const noexcept
 Return TRUE if the element is an opening args. More...
 
bool isClosingArgs (void) const noexcept
 Return TRUE if the element is a closing args. More...
 
bool isGroupingArgs (void) const noexcept
 Return TRUE if the element is an args grouping. More...
 
bool isSepArgs (void) const noexcept
 Return TRUE if the element is a sep args. More...
 
bool isDatumTypedAs (int ty) const noexcept
 Return TRUE if the element is a datum of a given type. More...
 
virtual int type (void) const
 Can be overriden to return the type of the element (an int value). More...
 

Types, consts., etc.

 ELE_CLASS_ENUM (Kind, kDatum, kGroupOpen, kGroupClose, kArgsOpen, kArgsClose, kArgsSep, kOperation)
 Kind ot the elements.
 
using Ptr = std::shared_ptr< ExprElement >
 A safe, polymorphic pointer to an element for container use. More...
 

Member Typedef Documentation

◆ Ptr

using elementa::parsing::ExprElement::Ptr = std::shared_ptr<ExprElement>
inherited

A safe, polymorphic pointer to an element for container use.

Definition at line 68 of file expressions.h.

Member Function Documentation

◆ kind()

ExprElement::Kind elementa::parsing::Expression::OpDatumWrapper::kind ( void  ) const
inlinevirtual

Return datum since in a tree everything is dealt with as a datum.

Implements elementa::parsing::ExprElement.

Definition at line 552 of file expressions.h.

◆ to_string()

std::string elementa::parsing::Expression::OpDatumWrapper::to_string ( void  ) const
virtual

Return a one-line text representing the node.

Reimplemented from elementa::parsing::ExprElement.

◆ isDatum()

bool elementa::parsing::ExprElement::isDatum ( void  ) const
inlinenoexceptinherited

Return TRUE if the element is a datum (not a grouping).

Definition at line 114 of file expressions.h.

References elementa::parsing::ExprElement::kind().

Referenced by elementa::parsing::ExprElement::isDatumTypedAs().

◆ isOperation()

bool elementa::parsing::ExprElement::isOperation ( void  ) const
inlinenoexceptinherited

Return TRUE if the element is an operation.

Definition at line 117 of file expressions.h.

References elementa::parsing::ExprElement::kind().

◆ isOpeningGrouping()

bool elementa::parsing::ExprElement::isOpeningGrouping ( void  ) const
inlinenoexceptinherited

Return TRUE if the element is an opening grouping.

Definition at line 120 of file expressions.h.

References elementa::parsing::ExprElement::kind().

Referenced by elementa::parsing::ExprElement::isGrouping().

◆ isClosingGrouping()

bool elementa::parsing::ExprElement::isClosingGrouping ( void  ) const
inlinenoexceptinherited

Return TRUE if the element is a closing grouping.

Definition at line 124 of file expressions.h.

References elementa::parsing::ExprElement::kind().

Referenced by elementa::parsing::ExprElement::isGrouping().

◆ isGrouping()

bool elementa::parsing::ExprElement::isGrouping ( void  ) const
inlinenoexceptinherited

Return TRUE if the element is a grouping.

Definition at line 128 of file expressions.h.

References elementa::parsing::ExprElement::isClosingGrouping(), and elementa::parsing::ExprElement::isOpeningGrouping().

◆ isOpeningArgs()

bool elementa::parsing::ExprElement::isOpeningArgs ( void  ) const
inlinenoexceptinherited

Return TRUE if the element is an opening args.

Definition at line 132 of file expressions.h.

References elementa::parsing::ExprElement::kind().

Referenced by elementa::parsing::ExprElement::isGroupingArgs().

◆ isClosingArgs()

bool elementa::parsing::ExprElement::isClosingArgs ( void  ) const
inlinenoexceptinherited

Return TRUE if the element is a closing args.

Definition at line 136 of file expressions.h.

References elementa::parsing::ExprElement::kind().

Referenced by elementa::parsing::ExprElement::isGroupingArgs().

◆ isGroupingArgs()

bool elementa::parsing::ExprElement::isGroupingArgs ( void  ) const
inlinenoexceptinherited

Return TRUE if the element is an args grouping.

Definition at line 140 of file expressions.h.

References elementa::parsing::ExprElement::isClosingArgs(), and elementa::parsing::ExprElement::isOpeningArgs().

◆ isSepArgs()

bool elementa::parsing::ExprElement::isSepArgs ( void  ) const
inlinenoexceptinherited

Return TRUE if the element is a sep args.

Definition at line 144 of file expressions.h.

References elementa::parsing::ExprElement::kind().

◆ isDatumTypedAs()

bool elementa::parsing::ExprElement::isDatumTypedAs ( int  ty) const
inlinenoexceptinherited

Return TRUE if the element is a datum of a given type.

Definition at line 148 of file expressions.h.

References elementa::parsing::ExprElement::isDatum(), and elementa::parsing::ExprElement::type().

◆ type()

virtual int elementa::parsing::ExprElement::type ( void  ) const
inlinevirtualinherited

Can be overriden to return the type of the element (an int value).

Override it to provide a particular type if you are working with typed expressions. Ignore it otherwise.

Definition at line 157 of file expressions.h.

Referenced by elementa::parsing::ExprElement::isDatumTypedAs().

Member Data Documentation

◆ what

char elementa::parsing::Expression::OpDatumWrapper::what

'd' -> datum from postfix, 'o' -> scanned operation

Definition at line 543 of file expressions.h.

◆ pdatum

ExprElement::Ptr elementa::parsing::Expression::OpDatumWrapper::pdatum

Datum in original expression if 'd'.

Definition at line 544 of file expressions.h.


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