PDI 0.4.1

Data exchange made easy

PDI::Expression Class Reference

Public Member Functions

 Expression ()
 Builds an empty expression. More...
 
 Expression (const Expression &expr)
 Copies an expression. More...
 
 Expression (Expression &&expr)
 Moves an expression. More...
 
 Expression (const char *expr)
 Builds (i.e. More...
 
 Expression (const std::string &expr)
 Builds (i.e. More...
 
 Expression (long expr)
 Builds an expression that represents an integer. More...
 
 ~Expression ()
 Destroys an expression. More...
 
Expressionoperator= (const Expression &expr)
 Copies an expression. More...
 
Expressionoperator= (Expression &&expr)
 Moves an expression. More...
 
 operator bool () const
 Checks whether this is an empty expression. More...
 
long to_long (Context &ctx) const
 Evaluates an expression as an integer. More...
 
std::string to_string (Context &ctx) const
 Evaluates an expression as a string. More...
 
Ref to_ref (Context &ctx) const
 Evaluates an expression as a data reference. More...
 

Friends

struct Impl
 

Constructor & Destructor Documentation

◆ Expression() [1/6]

PDI::Expression::Expression ( )

Builds an empty expression.

No operation can be used on an empty expression, it can only be assigned to

◆ Expression() [2/6]

PDI::Expression::Expression ( const Expression expr)

Copies an expression.

Parameters
[in]exprthe expression to copy

◆ Expression() [3/6]

PDI::Expression::Expression ( Expression &&  expr)

Moves an expression.

Parameters
[in]exprthe expression to move`

◆ Expression() [4/6]

PDI::Expression::Expression ( const char *  expr)

Builds (i.e.

parse) an expression from a string

The grammar of an expression is as follow:

EXPRESSION := OR_OPERATION | STRING_LITERAL
STRING_LITERAL := ( CHAR | '\' '\' | '\' '$' | REFERENCE | '$' '(' OR_OPERATION ')' )*
OR_OPERATION := AND_OPERATION ( '|' AND_OPERATION )*
AND_OPERATION := EQ_OPERATION ( '&' EQ_OPERATION )*
EQ_OPERATION := ADD_OPERATION ( '=' ADD_OPERATION )*
ADD_OPERATION := MULT_OPERATION ( ( '+' | '-' ) MULT_OPERATION )*
MULT_OPERATION := TERM ( ( '*' | '/' | '%' ) TERM )*
TERM := ( INT_LITERAL | REFERENCE | '(' OR_OPERATION ')' )
REFERENCE := '$' ( IREFERENCE | '{' IREFERENCE '}' )
IREFERENCE := ID ( '[' OR_OPERATION ']' )*
INT_LITERAL ~= (0x)? [0-9]+ ( \. )
ID ~= [a-zA-Z_][a-zA-Z0-9_]*
CHAR ~= [^$\\]
Parameters
[in]exprthe string to parse

◆ Expression() [5/6]

PDI::Expression::Expression ( const std::string &  expr)

Builds (i.e.

parse) an expression from a string

The grammar of an expression is as follow:

EXPRESSION := OR_OPERATION | STRING_LITERAL
STRING_LITERAL := ( CHAR | '\' '\' | '\' '$' | REFERENCE | '$' '(' OR_OPERATION ')' )*
OR_OPERATION := AND_OPERATION ( '|' AND_OPERATION )*
AND_OPERATION := EQ_OPERATION ( '&' EQ_OPERATION )*
EQ_OPERATION := ADD_OPERATION ( '=' ADD_OPERATION )*
ADD_OPERATION := MULT_OPERATION ( ( '+' | '-' ) MULT_OPERATION )*
MULT_OPERATION := TERM ( ( '*' | '/' | '%' ) TERM )*
TERM := ( INT_LITERAL | REFERENCE | '(' OR_OPERATION ')' )
REFERENCE := '$' ( IREFERENCE | '{' IREFERENCE '}' )
IREFERENCE := ID ( '[' OR_OPERATION ']' )*
INT_LITERAL ~= (0x)? [0-9]+ ( \. )
ID ~= [a-zA-Z_][a-zA-Z0-9_]*
CHAR ~= [^$\\]
Parameters
[in]exprthe string to parse

◆ Expression() [6/6]

PDI::Expression::Expression ( long  expr)

Builds an expression that represents an integer.

Parameters
[in]exprthe integer value

◆ ~Expression()

PDI::Expression::~Expression ( )

Destroys an expression.

Member Function Documentation

◆ operator=() [1/2]

Expression& PDI::Expression::operator= ( const Expression expr)

Copies an expression.

Parameters
[in]exprthe expression to copy
Returns
*this

◆ operator=() [2/2]

Expression& PDI::Expression::operator= ( Expression &&  expr)

Moves an expression.

Parameters
[in]exprthe expression to move`
Returns
*this

◆ operator bool()

PDI::Expression::operator bool ( ) const

Checks whether this is an empty expression.

Returns
true if the expression is non-empty

◆ to_long()

long PDI::Expression::to_long ( Context ctx) const

Evaluates an expression as an integer.

Returns
the integer value

◆ to_string()

std::string PDI::Expression::to_string ( Context ctx) const

Evaluates an expression as a string.

Returns
the string value

◆ to_ref()

Ref PDI::Expression::to_ref ( Context ctx) const

Evaluates an expression as a data reference.

Returns
the data reference

Friends And Related Function Documentation

◆ Impl

friend struct Impl
friend

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