NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
This class handles the creation and deletion of string vector variables. More...
#include <stringvarfactory.hpp>
Public Member Functions | |
bool | containsStringVectorVars (const std::string &sLine) |
This member function determines, whether there are string vector variables in the passed command line. More... | |
std::string | createTempStringVectorVar (const std::vector< std::string > &vStringVector) |
This member function is used to create a temporary string vector variable. More... | |
void | removeTempStringVectorVars () |
This member function removes all temporary string vector variables. More... | |
bool | containsStringVars (const std::string &sLine) const |
This public member function determines, whether the passed string line contains string variables as part of the expression. More... | |
bool | isStringVar (const std::string &sVarName) const |
Determine, whether the passed string is the identifier of a string variable. More... | |
void | getStringValues (std::string &sLine) |
This public member function resolves all string variable occurences and replaces them with their value or the standard string function signature, if the string variable is connected to a method. More... | |
std::string | getStringValue (const std::string &sVar) const |
Returns the value of the selected string variable. More... | |
void | setStringValue (const std::string &sVar, const std::string &sValue) |
This public member function creates or updates a string variable and fills it with the passed value. More... | |
void | removeStringVar (const std::string &sVar) |
This public member function removes the selected string variable from memory. More... | |
const std::map< std::string, std::string > & | getStringVars () const |
Protected Member Functions | |
StringVector | evaluateStringVectors (std::string sLine) |
This member function evaluates the passed string vector and returns it's evaluated components in separate vector components. More... | |
StringVector | expandStringVectorComponents (std::vector< StringVector > &vStringVector) |
This member function expands the internal multi-expressions in the veector into separate components by enlarging the dimension of the vector. More... | |
void | removeStringVectorVars () |
This member function removes all internal string vector variables. More... | |
std::string | createStringVectorVar (const std::vector< std::string > &vStringVector) |
This member function is used to create a string vector variable. More... | |
bool | isStringVectorVar (const std::string &sVarName) const |
Check, whether the passed string identifies a string vector variable. More... | |
const StringVector & | getStringVectorVar (const std::string &sVarName) const |
Return a reference to the identified string vector variable or throw if it does not exist. More... | |
void | getStringValuesAsInternalVar (std::string &sLine, unsigned int nPos=0) |
This public member function resolves all string variable occurences and replaces them with an internal string vector variable or the standard string function signature, if the string variable is connected to a method. More... | |
Private Member Functions | |
bool | isNumericCandidate (const std::string &sComponent) |
This member function is used to determine, whether a string vector component is numerical parsable. More... | |
bool | checkStringvarDelimiter (const std::string &sToken) const |
This private member function examines the first and the last character of the passed string and determines, whether it is a delimiter or not. More... | |
void | replaceStringVectorVars (std::map< std::string, StringVector > &mVectorVarMap, std::string ¤tline, size_t nCurrentComponent, bool &bHasComponents) |
Replaces all found vectors of the passed map with their nCurrentComponent component. More... | |
std::string | findVectorInMap (const std::map< std::string, StringVector > &mVectorVarMap, const std::vector< std::string > &vStringVector) |
Searches for the passed string in the passed map and returns the key string from the map, if anything found, otherwise an empty string. More... | |
Private Attributes | |
std::map< std::string, StringVector > | m_mStringVectorVars |
std::map< std::string, StringVector > | m_mTempStringVectorVars |
std::map< std::string, std::string > | m_mStringVars |
This class handles the creation and deletion of string vector variables.
Definition at line 33 of file stringvarfactory.hpp.
|
private |
This private member function examines the first and the last character of the passed string and determines, whether it is a delimiter or not.
sToken | const string& |
Definition at line 359 of file stringvarfactory.cpp.
Referenced by containsStringVars(), getStringValues(), and getStringValuesAsInternalVar().
bool NumeRe::StringVarFactory::containsStringVars | ( | const std::string & | sLine | ) | const |
This public member function determines, whether the passed string line contains string variables as part of the expression.
_sLine | const string& |
Definition at line 470 of file stringvarfactory.cpp.
References checkStringvarDelimiter(), and m_mStringVars.
Referenced by NumeRe::StringParser::eval(), NumeRe::StringParser::isStringExpression(), and NumeRe::StringParser::storeStringResults().
bool NumeRe::StringVarFactory::containsStringVectorVars | ( | const std::string & | sLine | ) |
This member function determines, whether there are string vector variables in the passed command line.
sLine | const string& |
Definition at line 128 of file stringvarfactory.cpp.
References m_mStringVectorVars, and m_mTempStringVectorVars.
Referenced by NumeRe::StringParser::eval(), NumeRe::StringParser::evaluateStack(), evaluateStringVectors(), NumeRe::StringParser::isStringExpression(), NumeRe::StringParser::numToString(), and NumeRe::StringParser::replaceDataOccurence().
|
protected |
This member function is used to create a string vector variable.
vStringVector | const vector<string>& |
Definition at line 57 of file stringvarfactory.cpp.
References SyntaxError::invalid_position, m_mStringVectorVars, SyntaxError::STRING_ERROR, and toString().
Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), NumeRe::StringParser::eval(), NumeRe::StringFuncHandler::evalFunction(), NumeRe::StringParser::getDataForString(), getStringValuesAsInternalVar(), and NumeRe::StringParser::numToString().
string NumeRe::StringVarFactory::createTempStringVectorVar | ( | const std::vector< std::string > & | vStringVector | ) |
This member function is used to create a temporary string vector variable.
vStringVector | const vector<string>& |
Temporary string vector variables differ in their name and not cleared by default during an evaluation done in the parser core.
Definition at line 311 of file stringvarfactory.cpp.
References findVectorInMap(), m_mTempStringVectorVars, and toString().
Referenced by handleMafDataAccess(), replaceDataEntities(), Procedure::replaceReturnVal(), and CommandLineParser::setReturnValue().
|
protected |
This member function evaluates the passed string vector and returns it's evaluated components in separate vector components.
sLine | string |
For each contained vector, the complete command line is evaluated and returned as a separate vector component.
Definition at line 167 of file stringvarfactory.cpp.
References containsStringVectorVars(), g_logger, NumeReKernel::getInstance(), getNextArgument(), NumeReKernel::getParser(), mu::ParserBase::GetVectors(), DetachedLogger::info(), isDelimiter(), isInQuotes(), m_mStringVectorVars, m_mTempStringVectorVars, StringVector::push_generic(), replaceStringVectorVars(), toCmdString(), and toString().
Referenced by NumeRe::StringParser::evaluateStack(), and NumeRe::StringParser::replaceDataOccurence().
|
protected |
This member function expands the internal multi-expressions in the veector into separate components by enlarging the dimension of the vector.
vStringVector | std::vector<StringVector>& |
The components are evaluated and inserted into the original vector, replacing the original component with the calculated vector n components, which will enlarge the original vector by n-1 new components.
Definition at line 264 of file stringvarfactory.cpp.
Referenced by NumeRe::StringFuncHandler::evalFunction().
|
private |
Searches for the passed string in the passed map and returns the key string from the map, if anything found, otherwise an empty string.
mVectorVarMap | map<string,StringVector>& |
vStringVector | const vector<string>& |
Definition at line 432 of file stringvarfactory.cpp.
Referenced by createTempStringVectorVar().
std::string NumeRe::StringVarFactory::getStringValue | ( | const std::string & | sVar | ) | const |
Returns the value of the selected string variable.
sVar | const std::string& |
Definition at line 683 of file stringvarfactory.cpp.
References m_mStringVars.
Referenced by NumeReDebugger::gatherLoopBasedInformations().
void NumeRe::StringVarFactory::getStringValues | ( | std::string & | sLine | ) |
This public member function resolves all string variable occurences and replaces them with their value or the standard string function signature, if the string variable is connected to a method.
sLine | std::string& |
Definition at line 609 of file stringvarfactory.cpp.
References checkStringvarDelimiter(), isInQuotes(), m_mStringVars, and replaceStringMethod().
Referenced by FlowCtrl::calc(), cmd_define(), cmd_ifndefined(), cmd_install(), cmd_redefine(), cmd_set(), cmd_stats(), FlowCtrl::compile(), Plot::createSubPlotSet(), evaluateParameterValues(), Procedure::execute(), extractFirstParameterStringValue(), CommandLineParser::getExprAsFileName(), CommandLineParser::getFileParameterValue(), Procedure::ProcCalc(), and saveDataObject().
|
protected |
This public member function resolves all string variable occurences and replaces them with an internal string vector variable or the standard string function signature, if the string variable is connected to a method.
sLine | std::string& |
nPos | unsigned int |
Definition at line 531 of file stringvarfactory.cpp.
References checkStringvarDelimiter(), createStringVectorVar(), isInQuotes(), m_mStringVars, and replaceStringMethod().
Referenced by NumeRe::StringParser::eval().
|
inline |
Definition at line 66 of file stringvarfactory.hpp.
References m_mStringVars.
Referenced by NumeReDebugger::decodeType(), NumeReKernel::evalDebuggerBreakPoint(), ProcedureVarFactory::evaluateProcedureArguments(), NumeReDebugger::getGlobals(), NumeReKernel::getVariableList(), getVarList(), and listDeclaredVariables().
|
protected |
Return a reference to the identified string vector variable or throw if it does not exist.
sVarName | const std::string& |
Definition at line 103 of file stringvarfactory.cpp.
References m_mStringVectorVars, and m_mTempStringVectorVars.
Referenced by NumeRe::StringParser::evaluateStack().
|
private |
This member function is used to determine, whether a string vector component is numerical parsable.
sComponent | const string& |
Definition at line 35 of file stringvarfactory.cpp.
References getMatchingParenthesis().
bool NumeRe::StringVarFactory::isStringVar | ( | const std::string & | sVarName | ) | const |
Determine, whether the passed string is the identifier of a string variable.
sVarName | const std::string& |
Definition at line 512 of file stringvarfactory.cpp.
References m_mStringVars.
Referenced by NumeReDebugger::gatherLoopBasedInformations(), and FlowCtrl::range_based_for_loop().
|
protected |
Check, whether the passed string identifies a string vector variable.
sVarName | const std::string& |
Definition at line 87 of file stringvarfactory.cpp.
References m_mStringVectorVars, and m_mTempStringVectorVars.
Referenced by NumeRe::StringParser::evaluateStack().
void NumeRe::StringVarFactory::removeStringVar | ( | const std::string & | sVar | ) |
This public member function removes the selected string variable from memory.
sVar | const string& |
Definition at line 737 of file stringvarfactory.cpp.
References m_mStringVars.
Referenced by FlowCtrl::reset(), and ProcedureVarFactory::reset().
|
protected |
This member function removes all internal string vector variables.
This member function is called automatically from the parser.
Definition at line 293 of file stringvarfactory.cpp.
References m_mStringVectorVars.
Referenced by NumeRe::StringParser::evalAndFormat().
void NumeRe::StringVarFactory::removeTempStringVectorVars | ( | ) |
This member function removes all temporary string vector variables.
This member function is not called automatically by the parser. It has to be used from the outside.
Definition at line 342 of file stringvarfactory.cpp.
References m_mTempStringVectorVars.
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), NumeReKernel::MainLoop(), Procedure::ProcCalc(), and NumeReKernel::resetAfterError().
|
private |
Replaces all found vectors of the passed map with their nCurrentComponent component.
mVectorVarMap | map<string,StringVector>& |
currentline | string& |
nCurrentComponent | size_t |
bHasComponents | bool& |
Definition at line 387 of file stringvarfactory.cpp.
Referenced by evaluateStringVectors().
void NumeRe::StringVarFactory::setStringValue | ( | const std::string & | sVar, |
const std::string & | sValue | ||
) |
This public member function creates or updates a string variable and fills it with the passed value.
sVar | const string& |
sValue | const string& |
Definition at line 704 of file stringvarfactory.cpp.
References SyntaxError::invalid_position, m_mStringVars, SyntaxError::STRINGVARS_MUSTNT_BEGIN_WITH_A_NUMBER, and SyntaxError::STRINGVARS_MUSTNT_CONTAIN.
Referenced by ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::evaluateProcedureArguments(), FlowCtrl::range_based_for_loop(), and NumeRe::StringParser::storeStringResults().
|
private |
Definition at line 38 of file stringvarfactory.hpp.
Referenced by containsStringVars(), getStringValue(), getStringValues(), getStringValuesAsInternalVar(), getStringVars(), isStringVar(), removeStringVar(), and setStringValue().
|
private |
Definition at line 36 of file stringvarfactory.hpp.
Referenced by containsStringVectorVars(), createStringVectorVar(), evaluateStringVectors(), getStringVectorVar(), isStringVectorVar(), and removeStringVectorVars().
|
private |
Definition at line 37 of file stringvarfactory.hpp.
Referenced by containsStringVectorVars(), createTempStringVectorVar(), evaluateStringVectors(), getStringVectorVar(), isStringVectorVar(), and removeTempStringVectorVars().