NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
stringlogicparser.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2019 Erik Haenel et al.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19#ifndef STRINGLOGICPARSER_HPP
20#define STRINGLOGICPARSER_HPP
21
22#include <string>
23#include <vector>
24
25namespace NumeRe
26{
32 {
33 private:
34 std::string evalStringTernary(std::string sLine);
35 std::vector<std::string> getStringTernaryExpression(std::string& sLine, size_t& nPos);
36 size_t detectPathTokens(const std::string& sString, size_t nPos);
37 std::string prepareComparisonValues(const std::string& _sLine);
38
39 protected:
40 bool detectStringLogicals(const std::string& sString);
41 std::string evalStringLogic(std::string sLine, bool& bReturningLogicals);
42 void concatenateStrings(std::string& sExpr);
43 };
44}
45
46
47#endif // STRINGLOGICPARSER_HPP
48
This class handles all logical operations on string expressions.
std::string prepareComparisonValues(const std::string &_sLine)
Removes masked strings, strips spaces and removes surrounding quotation marks and concatenates the va...
void concatenateStrings(std::string &sExpr)
This member function performs the actual string concatenation of the passed string expression.
std::string evalStringLogic(std::string sLine, bool &bReturningLogicals)
This member function will evaluate logical string expressions in the passed command line.
size_t detectPathTokens(const std::string &sString, size_t nPos)
This member function is a helper for StringLogicParser::detectStringLogicals().
std::vector< std::string > getStringTernaryExpression(std::string &sLine, size_t &nPos)
This member function is a helper for StringLogicParser::evalStringLogic().
std::string evalStringTernary(std::string sLine)
This member function will evaluate the ternary operator for strings.
bool detectStringLogicals(const std::string &sString)
This member function is may detect logical expressions in the passed string expression.