|
static std::pair< Expression, long > | parse_reference (const char *reference_str) |
| Parses a string that starts with $ and represents a reference expression.
|
|
◆ Expression() [1/8]
PDI::Expression::Expression |
( |
| ) |
|
Builds an empty expression.
No operation can be used on an empty expression, it can only be assigned to
◆ Expression() [2/8]
PDI::Expression::Expression |
( |
const Expression & |
expr | ) |
|
Copies an expression.
- Parameters
-
[in] | expr | the expression to copy |
◆ Expression() [3/8]
Moves an expression.
- Parameters
-
[in] | expr | the expression to move |
◆ Expression() [4/8]
PDI::Expression::Expression |
( |
const char * |
expr | ) |
|
Builds (i.e.
parse) an expression from a string
The grammar of an expression is as follow:
EXPRESSION := REFERENCE | OPERATION | STRING_LITERAL
STRING_LITERAL := ( CHAR | '\' '\' | '\' '$'
| REFERENCE
| '$' '(' OPERATION ')'
)*
OPERATION := TERM ( OPERATOR TERM )*
TERM := ( INT_LITERAL | REFERENCE | '(' OPERATION ')' )
REFERENCE := '$' ( IREFERENCE | '{' IREFERENCE '}' )
IREFERENCE := ID ( '[' OPERATION ']' | '.' ID )*
INT_LITERAL ~= (0x)? [0-9]+ ( \. )
ID ~= [a-zA-Z_][a-zA-Z0-9_]*
CHAR ~= [^$\\]
OPERATOR ~= [|&=<>+\-\*/%]
- Parameters
-
[in] | expr | the string to parse |
◆ Expression() [5/8]
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 := REFERENCE | OPERATION | STRING_LITERAL
STRING_LITERAL := ( CHAR | '\' '\' | '\' '$'
| REFERENCE
| '$' '(' OPERATION ')'
)*
OPERATION := TERM ( OPERATOR TERM )*
TERM := ( INT_LITERAL | REFERENCE | '(' OPERATION ')' )
REFERENCE := '$' ( IREFERENCE | '{' IREFERENCE '}' )
IREFERENCE := ID ( '[' OPERATION ']' | '.' ID )*
INT_LITERAL ~= (0x)? [0-9]+ ( \. )
ID ~= [a-zA-Z_][a-zA-Z0-9_]*
CHAR ~= [^$\\]
OPERATOR ~= [|&=<>+\-\*/%]
- Parameters
-
[in] | expr | the string to parse |
◆ Expression() [6/8]
PDI::Expression::Expression |
( |
long |
expr | ) |
|
Builds an expression that represents an integer.
- Parameters
-
[in] | expr | the integer value |
◆ Expression() [7/8]
PDI::Expression::Expression |
( |
double |
expr | ) |
|
Builds an expression that represents a float.
- Parameters
-
◆ Expression() [8/8]
PDI::Expression::Expression |
( |
PC_tree_t |
expr | ) |
|
Builds an expression that is parsed from PC_tree_t.
- Parameters
-
[in] | expr | the PC_tree_t value |
◆ ~Expression()
PDI::Expression::~Expression |
( |
| ) |
|
◆ operator=() [1/2]
Copies an expression.
- Parameters
-
[in] | expr | the expression to copy |
- Returns
- *this
◆ operator=() [2/2]
Moves an expression.
- Parameters
-
[in] | expr | the expression to move` |
- Returns
- *this
◆ operator+()
Summation operator of an expression.
- Parameters
-
[in] | expr | the expression to add |
- Returns
- Expression as a result of sum
◆ operator*()
Multiplication operator of an expression.
- Parameters
-
[in] | expr | the expression to multiply |
- Returns
- Expression as a result of multiplication
◆ operator-()
Subtraction operator of an expression.
- Parameters
-
[in] | expr | the expression to subtract |
- Returns
- Expression as a result of subtraction
◆ operator/()
Division operator of an expression.
- Parameters
-
[in] | expr | the expression to divide |
- Returns
- Expression as a result of division
◆ operator%()
Modulo operator of an expression.
- Parameters
-
[in] | expr | the expression to use modulo |
- Returns
- Expression as a result of modulo
◆ 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_double()
double PDI::Expression::to_double |
( |
Context & |
ctx | ) |
const |
Evaluates an expression as a float.
- Returns
- the float value
◆ to_string()
std::string PDI::Expression::to_string |
( |
Context & |
ctx | ) |
const |
Evaluates an expression as a string.
- Returns
- the string value
◆ to_ref() [1/2]
Ref PDI::Expression::to_ref |
( |
Context & |
ctx | ) |
const |
Evaluates an expression as a data reference.
- Parameters
-
ctx | the context in which to evaluate the expression |
- Returns
- the data reference
◆ to_ref() [2/2]
Evaluates an expression as a data reference.
- Parameters
-
ctx | the context in which to evaluate the expression |
type | the type of the created Ref |
- Returns
- the data reference
◆ parse_reference()
static std::pair< Expression, long > PDI::Expression::parse_reference |
( |
const char * |
reference_str | ) |
|
|
static |
Parses a string that starts with $
and represents a reference expression.
- Parameters
-
[in] | reference_str | string that represents a reference expression |
- Returns
- resulted reference exrpession and number of bytes read from reference_str
The documentation for this class was generated from the following file: