NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
NumeRe::StringLogicParser Class Reference

This class handles all logical operations on string expressions. More...

#include <stringlogicparser.hpp>

Inheritance diagram for NumeRe::StringLogicParser:
Collaboration diagram for NumeRe::StringLogicParser:

Protected Member Functions

bool detectStringLogicals (const std::string &sString)
 This member function is may detect logical expressions in the passed string expression. More...
 
std::string evalStringLogic (std::string sLine, bool &bReturningLogicals)
 This member function will evaluate logical string expressions in the passed command line. More...
 
void concatenateStrings (std::string &sExpr)
 This member function performs the actual string concatenation of the passed string expression. More...
 

Private Member Functions

std::string evalStringTernary (std::string sLine)
 This member function will evaluate the ternary operator for strings. More...
 
std::vector< std::string > getStringTernaryExpression (std::string &sLine, size_t &nPos)
 This member function is a helper for StringLogicParser::evalStringLogic(). More...
 
size_t detectPathTokens (const std::string &sString, size_t nPos)
 This member function is a helper for StringLogicParser::detectStringLogicals(). More...
 
std::string prepareComparisonValues (const std::string &_sLine)
 Removes masked strings, strips spaces and removes surrounding quotation marks and concatenates the values, if necessary. More...
 

Detailed Description

This class handles all logical operations on string expressions.

Definition at line 31 of file stringlogicparser.hpp.

Member Function Documentation

◆ concatenateStrings()

void NumeRe::StringLogicParser::concatenateStrings ( std::string &  sExpr)
protected

This member function performs the actual string concatenation of the passed string expression.

Parameters
sExprstring&
Returns
void

This member is called by StringParser::applyElementaryStringOperations() for the concatenation.

Definition at line 477 of file stringlogicparser.cpp.

References StringViewBase::back(), StringViewBase::front(), StringViewBase::length(), SyntaxError::STRING_ERROR, StringViewBase::strip(), StripSpaces(), StringView::subview(), and StringViewBase::to_string().

Referenced by NumeRe::StringParser::applyElementaryStringOperations(), and prepareComparisonValues().

Here is the call graph for this function:

◆ detectPathTokens()

size_t NumeRe::StringLogicParser::detectPathTokens ( const std::string &  sString,
size_t  nPos 
)
private

This member function is a helper for StringLogicParser::detectStringLogicals().

Parameters
sStringconst string&
nPossize_t
Returns
size_t

This function will identify path tokens, which will start at the passed position.

Definition at line 94 of file stringlogicparser.cpp.

Referenced by detectStringLogicals().

◆ detectStringLogicals()

bool NumeRe::StringLogicParser::detectStringLogicals ( const std::string &  sString)
protected

This member function is may detect logical expressions in the passed string expression.

Parameters
sStringconst string&
Returns
bool

Definition at line 229 of file stringlogicparser.cpp.

References detectPathTokens().

Referenced by NumeRe::StringParser::applyElementaryStringOperations().

Here is the call graph for this function:

◆ evalStringLogic()

string NumeRe::StringLogicParser::evalStringLogic ( std::string  sLine,
bool &  bReturningLogicals 
)
protected

This member function will evaluate logical string expressions in the passed command line.

Parameters
sLinestring
bReturningLogicalsbool&
Returns
string

Definition at line 288 of file stringlogicparser.cpp.

References mu::ParserBase::Eval(), evalStringLogic(), evalStringTernary(), NumeReKernel::getInstance(), getMatchingParenthesis(), NumeReKernel::getParser(), isInQuotes(), prepareComparisonValues(), mu::ParserBase::SetExpr(), StripSpaces(), and toString().

Referenced by NumeRe::StringParser::applyElementaryStringOperations(), evalStringLogic(), evalStringTernary(), and prepareComparisonValues().

Here is the call graph for this function:

◆ evalStringTernary()

string NumeRe::StringLogicParser::evalStringTernary ( std::string  sLine)
private

This member function will evaluate the ternary operator for strings.

Parameters
sLinestring
Returns
string

Definition at line 36 of file stringlogicparser.cpp.

References mu::ParserBase::Eval(), evalStringLogic(), NumeReKernel::getInstance(), NumeReKernel::getParser(), getStringTernaryExpression(), isInQuotes(), mu::ParserBase::SetExpr(), and StripSpaces().

Referenced by evalStringLogic().

Here is the call graph for this function:

◆ getStringTernaryExpression()

vector< string > NumeRe::StringLogicParser::getStringTernaryExpression ( std::string &  sLine,
size_t &  nPos 
)
private

This member function is a helper for StringLogicParser::evalStringLogic().

Parameters
sLinestring&
nPossize_t&
Returns
vector<string>

It will return the expression parts of the current ternary at nPos in the components of the returned vector. nPos ist the position of the question mark.

Definition at line 163 of file stringlogicparser.cpp.

References getMatchingParenthesis(), and SyntaxError::INVALID_INDEX.

Referenced by evalStringTernary().

Here is the call graph for this function:

◆ prepareComparisonValues()

string NumeRe::StringLogicParser::prepareComparisonValues ( const std::string &  _sLine)
private

Removes masked strings, strips spaces and removes surrounding quotation marks and concatenates the values, if necessary.

Parameters
_sLineconst std::string&
Returns
string

Definition at line 133 of file stringlogicparser.cpp.

References concatenateStrings(), evalStringLogic(), removeMaskedStrings(), and StripSpaces().

Referenced by evalStringLogic().

Here is the call graph for this function:

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