|
NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
This class is an extension to the std::vector<std::string> to provide the vector-like functionalities as requested by the string parser. It also provides the functionality to distinguish between a string and a numerical value. More...
#include <stringdatastructures.hpp>
Public Member Functions | |
| StringVector () | |
| Default constructor. More... | |
| StringVector (const std::string &sStr) | |
| Create a StringVector instance from a string. More... | |
| StringVector (const char *sStr) | |
| Create a StringVector instance from a string. More... | |
| StringVector (bool val) | |
| Create a StringVector instance from a boolean. More... | |
| StringVector (const std::vector< std::string > &vect) | |
| Constructor from a std::vector<std::string>. It is assumed that the vector is already prepared for the local string definition. More... | |
| StringVector (const StringVector &vect) | |
| Copy a StringVector instance. More... | |
| StringVector (const std::vector< bool > &vect) | |
| Create a StringVector instance from a std::vector<bool>. More... | |
| StringVector (size_t n, const std::string &sStr=std::string()) | |
| Create a StringVector with n elements. More... | |
| StringVector (StringVector &&vect)=default | |
| StringVector & | operator= (const StringVector &sVect) |
| Assignment operator overload for a StringVector instance. More... | |
| StringVector & | operator= (StringVector &&sVect)=default |
| StringVector & | operator= (const std::vector< bool > &vect) |
| Assignment operator overload for a std::vector<bool> instance. More... | |
| void | push_back (const std::string &sStr) |
| Append a string to the end of this vector. Will be stored as local string. More... | |
| void | push_back (const char *sStr) |
| Append a string to the end of this vector. Will be stored as local string. More... | |
| void | push_back (const mu::value_type &vVal) |
| Append a mu::value_type to the end of this vector. More... | |
| void | push_back (size_t nVal) |
| Append a size_t to the end of this vector. More... | |
| void | push_back (int nVal) |
| Append an int to the end of this vector. More... | |
| void | push_back (long long int nVal) |
| Append a long long int to the end of this vector. More... | |
| void | push_back (bool nVal) |
| Append a boolean to the end of this vector. More... | |
| void | push_generic (const std::string &sStr) |
| Append a generic string value to the end of this vector. Depending on the existence of surrounding quotation marks, it will be considered as local string or as a generic value. More... | |
| bool | is_string (size_t i) const |
| Check whether the i-th element represents a string or a numeric value. More... | |
| void | convert_to_string (size_t i, size_t minChars=0) |
| Convert the i-th element to a string. More... | |
| StringView | operator[] (size_t i) const |
| Return a view to the i-th element. More... | |
| StringArg | getArg (size_t i) const |
| Create a StringArg instance from the i-th or the 1st element, if this vector is a singleton. More... | |
| std::string | getMasked (size_t i) const |
| Return the contained string with the internal quotation marks as escaped variants. More... | |
| std::string & | getRef (size_t i) |
| Return a reference to the i-th element in this string. More... | |
| std::vector< bool > | operator== (const StringVector &sVect) const |
| Equality operator overload. More... | |
| std::vector< bool > | operator!= (const StringVector &sVect) const |
| Inequality operator overload. More... | |
| std::vector< bool > | operator< (const StringVector &sVect) const |
| Less-than operator overload. More... | |
| std::vector< bool > | operator<= (const StringVector &sVect) const |
| Lesser-equal operator overload. More... | |
| std::vector< bool > | operator> (const StringVector &sVect) const |
| Greater-than operator overload. More... | |
| std::vector< bool > | operator>= (const StringVector &sVect) const |
| Greater-equal operator overload. More... | |
| std::vector< bool > | and_f (const StringVector &sVect) const |
| This member function represents an AND operator. More... | |
| std::vector< bool > | or_f (const StringVector &sVect) const |
| This member function represents an OR operator. More... | |
| std::vector< bool > | xor_f (const StringVector &sVect) const |
| This member function represents an XOR operator. More... | |
| StringVector | operator+ (const StringVector &sVect) const |
| Concatenate two StringVectors. More... | |
| StringVector & | operator+= (const StringVector &sVect) |
| Append a StringVector to this instance. More... | |
| StringVector & | evalIfElse (const StringVector &sLogicals, const StringVector &sIfBranch, const StringVector &sElseBranch) |
| Assign the results of an if-else construct to this StringVector instance. More... | |
Static Public Member Functions | |
| static StringVector | empty_string () |
| Static member function to create a StringVector with one component with zero length. More... | |
| static StringVector | convert_internal (const std::string &sInternal) |
| Static member function to create a StringVector instance from an internal string. More... | |
| static StringVector | convert_literal (const std::string &sLiteral) |
| Static member function to create a StringVector instance from a string literal. More... | |
Private Member Functions | |
| StringView | getVectorized (size_t i) const |
| Get either the i-th element or the 1st element, if this vector has only one component (and is a singleton). More... | |
| mu::value_type | getNumericalVectorized (size_t i) const |
| Get either the i-th element or the 1st element converted as numerical value, if this vector has only one component (and is a singleton). More... | |
| bool | getBooleanVectorized (size_t i) const |
| Get either the i-th element or the 1st element converted as boolean, if this vector has only one component (and is a singleton). More... | |
| void | assign (const StringVector &sVect) |
| Assign another StringVector instance. More... | |
| void | assign (const std::vector< bool > &vect) |
| Assign an instance of a boolean vector. More... | |
| StringVector | operator+ (const std::string &sLiteral) const |
| Concatenate a StringVector and a string literal. More... | |
| StringVector & | operator+= (const std::string &sLiteral) |
| Append a string literal to this StringVector instance. More... | |
Static Private Member Functions | |
| static StringView | makePureString (StringView sStr) |
| Static member function to convert the contained string into a pur C++ string. More... | |
| static std::string | makeLocalString (const std::string &sStr) |
| Static member function to convert the string literal to an internal string for this class. More... | |
Private Attributes | |
| const std::string | m_sDUMMY |
This class is an extension to the std::vector<std::string> to provide the vector-like functionalities as requested by the string parser. It also provides the functionality to distinguish between a string and a numerical value.
Definition at line 145 of file stringdatastructures.hpp.
| StringVector::StringVector | ( | ) |
Default constructor.
Definition at line 173 of file stringdatastructures.cpp.
Referenced by convert_internal(), convert_literal(), operator+(), and operator+=().
| StringVector::StringVector | ( | const std::string & | sStr | ) |
Create a StringVector instance from a string.
| sStr | const std::string& |
Definition at line 197 of file stringdatastructures.cpp.
| StringVector::StringVector | ( | const char * | sStr | ) |
Create a StringVector instance from a string.
| sStr | const char* |
Definition at line 208 of file stringdatastructures.cpp.
| StringVector::StringVector | ( | bool | val | ) |
Create a StringVector instance from a boolean.
| sStr | const std::string& |
Definition at line 219 of file stringdatastructures.cpp.
| StringVector::StringVector | ( | const std::vector< std::string > & | vect | ) |
Constructor from a std::vector<std::string>. It is assumed that the vector is already prepared for the local string definition.
| vect | const std::vector<std::string>& |
Definition at line 186 of file stringdatastructures.cpp.
| StringVector::StringVector | ( | const StringVector & | vect | ) |
Copy a StringVector instance.
| vect | const StringVector& |
Definition at line 229 of file stringdatastructures.cpp.
References assign().
| StringVector::StringVector | ( | const std::vector< bool > & | vect | ) |
Create a StringVector instance from a std::vector<bool>.
| vect | const std::vector<bool>& |
Definition at line 242 of file stringdatastructures.cpp.
References assign().
| StringVector::StringVector | ( | size_t | n, |
| const std::string & | sStr = std::string() |
||
| ) |
Create a StringVector with n elements.
| n | size_t |
| sStr | const std::string& |
Definition at line 255 of file stringdatastructures.cpp.
|
default |
| std::vector< bool > StringVector::and_f | ( | const StringVector & | sVect | ) | const |
This member function represents an AND operator.
| sVect | const StringVector& |
Definition at line 746 of file stringdatastructures.cpp.
References getBooleanVectorized(), and max.
Referenced by NumeRe::StringParser::evaluateStack().
|
private |
Assign an instance of a boolean vector.
| vect | const std::vector<bool>& |
Definition at line 159 of file stringdatastructures.cpp.
|
private |
Assign another StringVector instance.
| sVect | const StringVector& |
Definition at line 146 of file stringdatastructures.cpp.
Referenced by evalIfElse(), operator+=(), operator=(), and StringVector().
|
static |
Static member function to create a StringVector instance from an internal string.
| sInternal | const std::string& |
Definition at line 281 of file stringdatastructures.cpp.
References StringVector().
Referenced by empty_string().
|
static |
Static member function to create a StringVector instance from a string literal.
| sLiteral | const std::string& |
Definition at line 295 of file stringdatastructures.cpp.
References makeLocalString(), and StringVector().
Referenced by NumeRe::StringParser::evaluateStack().
| void StringVector::convert_to_string | ( | size_t | i, |
| size_t | minChars = 0 |
||
| ) |
Convert the i-th element to a string.
| i | size_t |
| minChars | size_t Only used for non-string values |
Definition at line 474 of file stringdatastructures.cpp.
References is_string().
Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), and NumeRe::StringParser::numToString().
|
static |
Static member function to create a StringVector with one component with zero length.
Definition at line 267 of file stringdatastructures.cpp.
References convert_internal().
Referenced by strfnc_getenvvar(), strfnc_getfilelist(), strfnc_getfolderlist(), strfnc_getopt(), strfnc_max(), strfnc_min(), strfnc_replace(), strfnc_replaceall(), strfnc_split(), strfnc_strip(), strfnc_substr(), strfnc_sum(), strfnc_textparse(), and strfnc_to_string().
| StringVector & StringVector::evalIfElse | ( | const StringVector & | sLogicals, |
| const StringVector & | sIfBranch, | ||
| const StringVector & | sElseBranch | ||
| ) |
Assign the results of an if-else construct to this StringVector instance.
| sLogicals | const StringVector& |
| sIfBranch | const StringVector& |
| sElseBranch | const StringVector& |
Definition at line 877 of file stringdatastructures.cpp.
References assign(), getArg(), getBooleanVectorized(), StringArg::getRef(), getRef(), and max.
| StringArg StringVector::getArg | ( | size_t | i | ) | const |
Create a StringArg instance from the i-th or the 1st element, if this vector is a singleton.
| i | size_t |
Definition at line 509 of file stringdatastructures.cpp.
Referenced by NumeRe::StringFuncHandler::callFunction(), NumeRe::StringFuncHandler::callFunctionParallel(), NumeRe::StringFuncHandler::callMultiFunction(), NumeRe::StringFuncHandler::callMultiFunctionParallel(), and evalIfElse().
|
private |
Get either the i-th element or the 1st element converted as boolean, if this vector has only one component (and is a singleton).
| i | size_t |
Definition at line 118 of file stringdatastructures.cpp.
References mu::ParserBase::Eval(), NumeReKernel::getInstance(), NumeReKernel::getParser(), getVectorized(), is_string(), StringViewBase::length(), and mu::ParserBase::SetExpr().
Referenced by and_f(), evalIfElse(), or_f(), and xor_f().
| std::string StringVector::getMasked | ( | size_t | i | ) | const |
Return the contained string with the internal quotation marks as escaped variants.
| i | size_t |
Definition at line 528 of file stringdatastructures.cpp.
|
private |
Get either the i-th element or the 1st element converted as numerical value, if this vector has only one component (and is a singleton).
| i | size_t |
Definition at line 88 of file stringdatastructures.cpp.
References mu::ParserBase::Eval(), NumeReKernel::getInstance(), NumeReKernel::getParser(), getVectorized(), is_string(), and mu::ParserBase::SetExpr().
Referenced by operator!=(), operator==(), operator>(), and operator>=().
| std::string & StringVector::getRef | ( | size_t | i | ) |
Return a reference to the i-th element in this string.
| i | size_t |
Definition at line 579 of file stringdatastructures.cpp.
References toString().
Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), NumeRe::StringParser::createStringOutput(), NumeRe::StringParser::createTerminalOutput(), NumeRe::StringParser::eval(), evalIfElse(), operator+(), strfnc_getkeyval(), and strfnc_idxtolog().
|
private |
Get either the i-th element or the 1st element, if this vector has only one component (and is a singleton).
| i | size_t |
Definition at line 67 of file stringdatastructures.cpp.
References m_sDUMMY, and makePureString().
Referenced by getBooleanVectorized(), getNumericalVectorized(), operator!=(), operator+(), operator==(), operator>(), and operator>=().
| bool StringVector::is_string | ( | size_t | i | ) | const |
Check whether the i-th element represents a string or a numeric value.
| i | size_t |
Definition at line 454 of file stringdatastructures.cpp.
Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), convert_to_string(), NumeRe::StringParser::createAndEvaluateStack(), getBooleanVectorized(), getNumericalVectorized(), operator!=(), operator+(), operator==(), operator>(), operator>=(), NumeRe::StringParser::storeStringToDataObjects(), and strfnc_logtoidx().
|
staticprivate |
Static member function to convert the string literal to an internal string for this class.
| sStr | const std::string& |
Definition at line 49 of file stringdatastructures.cpp.
References toInternalString().
Referenced by convert_literal(), and push_generic().
|
staticprivate |
Static member function to convert the contained string into a pur C++ string.
| sStr | StringView |
Definition at line 31 of file stringdatastructures.cpp.
References StringViewBase::front(), StringViewBase::length(), and StringView::subview().
Referenced by getVectorized(), and operator[]().
| std::vector< bool > StringVector::operator!= | ( | const StringVector & | sVect | ) | const |
Inequality operator overload.
| sVect | const StringVector& |
Definition at line 620 of file stringdatastructures.cpp.
References getNumericalVectorized(), getVectorized(), is_string(), and max.
|
private |
Concatenate a StringVector and a string literal.
| sLiteral | const std::string& |
Definition at line 846 of file stringdatastructures.cpp.
References operator+(), and StringVector().
Referenced by operator+().
| StringVector StringVector::operator+ | ( | const StringVector & | sVect | ) | const |
Concatenate two StringVectors.
| sVect | const StringVector& |
Definition at line 808 of file stringdatastructures.cpp.
References getRef(), getVectorized(), is_string(), max, and StringViewBase::to_string().
|
private |
Append a string literal to this StringVector instance.
| sLiteral | const std::string& |
Definition at line 860 of file stringdatastructures.cpp.
References assign(), and StringVector().
| StringVector & StringVector::operator+= | ( | const StringVector & | sVect | ) |
Append a StringVector to this instance.
| sVect | const StringVector& |
Definition at line 831 of file stringdatastructures.cpp.
References assign().
| std::vector< bool > StringVector::operator< | ( | const StringVector & | sVect | ) | const |
Less-than operator overload.
| sVect | const StringVector& |
Definition at line 620 of file stringdatastructures.cpp.
| std::vector< bool > StringVector::operator<= | ( | const StringVector & | sVect | ) | const |
Lesser-equal operator overload.
| sVect | const StringVector& |
Definition at line 620 of file stringdatastructures.cpp.
| StringVector & StringVector::operator= | ( | const std::vector< bool > & | vect | ) |
Assignment operator overload for a std::vector<bool> instance.
| vect | const std::vector<bool>& |
Definition at line 324 of file stringdatastructures.cpp.
References assign().
| StringVector & StringVector::operator= | ( | const StringVector & | sVect | ) |
Assignment operator overload for a StringVector instance.
| sVect | const StringVector& |
Definition at line 309 of file stringdatastructures.cpp.
References assign().
|
default |
| std::vector< bool > StringVector::operator== | ( | const StringVector & | sVect | ) | const |
Equality operator overload.
| sVect | const StringVector& |
Definition at line 595 of file stringdatastructures.cpp.
References getNumericalVectorized(), getVectorized(), is_string(), and max.
| std::vector< bool > StringVector::operator> | ( | const StringVector & | sVect | ) | const |
Greater-than operator overload.
| sVect | const StringVector& |
Definition at line 695 of file stringdatastructures.cpp.
References getNumericalVectorized(), getVectorized(), is_string(), and max.
| std::vector< bool > StringVector::operator>= | ( | const StringVector & | sVect | ) | const |
Greater-equal operator overload.
| sVect | const StringVector& |
Definition at line 720 of file stringdatastructures.cpp.
References getNumericalVectorized(), getVectorized(), is_string(), and max.
| StringView StringVector::operator[] | ( | size_t | i | ) | const |
Return a view to the i-th element.
| i | size_t |
Definition at line 491 of file stringdatastructures.cpp.
References m_sDUMMY, and makePureString().
| std::vector< bool > StringVector::or_f | ( | const StringVector & | sVect | ) | const |
This member function represents an OR operator.
| sVect | const StringVector& |
Definition at line 767 of file stringdatastructures.cpp.
References getBooleanVectorized(), and max.
Referenced by NumeRe::StringParser::evaluateStack().
| void StringVector::push_back | ( | bool | nVal | ) |
Append a boolean to the end of this vector.
| nVal | bool |
Definition at line 423 of file stringdatastructures.cpp.
References toString().
| void StringVector::push_back | ( | const char * | sStr | ) |
Append a string to the end of this vector. Will be stored as local string.
| sStr | const char* |
Definition at line 353 of file stringdatastructures.cpp.
| void StringVector::push_back | ( | const mu::value_type & | vVal | ) |
Append a mu::value_type to the end of this vector.
| vVal | const mu::value_type& |
Definition at line 367 of file stringdatastructures.cpp.
References toString().
| void StringVector::push_back | ( | const std::string & | sStr | ) |
Append a string to the end of this vector. Will be stored as local string.
| sStr | const std::string& |
Definition at line 339 of file stringdatastructures.cpp.
Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), strfnc_ascii(), strfnc_getfileinfo(), strfnc_getfilelist(), strfnc_getFileParts(), strfnc_getfolderlist(), strfnc_getlasterror(), strfnc_getversioninfo(), strfnc_isalnum(), strfnc_isalpha(), strfnc_isblank(), strfnc_iscntrl(), strfnc_isdigit(), strfnc_isgraph(), strfnc_islower(), strfnc_isprint(), strfnc_ispunct(), strfnc_isspace(), strfnc_isupper(), strfnc_isxdigit(), strfnc_justify(), strfnc_locate(), strfnc_logtoidx(), strfnc_regex(), strfnc_split(), strfnc_strfndall(), strfnc_strmatchall(), strfnc_strunique(), and strfnc_textparse().
| void StringVector::push_back | ( | int | nVal | ) |
Append an int to the end of this vector.
| nVal | int |
Definition at line 395 of file stringdatastructures.cpp.
References toString().
| void StringVector::push_back | ( | long long int | nVal | ) |
Append a long long int to the end of this vector.
| nVal | long long int |
Definition at line 409 of file stringdatastructures.cpp.
References toString().
| void StringVector::push_back | ( | size_t | nVal | ) |
Append a size_t to the end of this vector.
| nVal | size_t |
Definition at line 381 of file stringdatastructures.cpp.
References toString().
| void StringVector::push_generic | ( | const std::string & | sStr | ) |
Append a generic string value to the end of this vector. Depending on the existence of surrounding quotation marks, it will be considered as local string or as a generic value.
| sStr | const std::string& |
Definition at line 440 of file stringdatastructures.cpp.
References makeLocalString().
Referenced by NumeRe::StringFuncHandler::argumentParser(), NumeRe::StringParser::eval(), NumeRe::StringFuncHandler::evalFunction(), NumeRe::StringVarFactory::evaluateStringVectors(), strfnc_getfileinfo(), strfnc_getkeyval(), strfnc_strunique(), and StringResult::StringResult().
| std::vector< bool > StringVector::xor_f | ( | const StringVector & | sVect | ) | const |
This member function represents an XOR operator.
| sVect | const StringVector& |
Definition at line 788 of file stringdatastructures.cpp.
References getBooleanVectorized(), and max.
Referenced by NumeRe::StringParser::evaluateStack().
|
private |
Definition at line 148 of file stringdatastructures.hpp.
Referenced by getMasked(), getVectorized(), and operator[]().