19#ifndef COMMANDLINEPARSER_HPP
20#define COMMANDLINEPARSER_HPP
56 std::string
parseFileName(std::string& sFileName, std::string& sFileExt,
const std::string& sBasePath)
const;
148 std::string
getExprAsFileName(std::string sFileExt,
const std::string& sBasePath =
"")
const;
157 std::string
getFileParameterValue(std::string sFileExt,
const std::string& sBaseFolder =
"",
const std::string& sDefaultName =
"")
const;
158 std::string
getFileParameterValueForSaving(std::string sFileExt,
const std::string& sBaseFolder =
"",
const std::string& sDefaultName =
"")
const;
159 std::string
getParameterValueAsString(
const std::string& sParameter,
const std::string& sDefaultValue,
bool stripAlways =
false,
bool onlyStringEvaluation =
false)
const;
161 bool hasParam(
const std::string& sParameter)
const;
This class provides the functionality to extract the different components of a command line into the ...
std::vector< mu::value_type > parseExprAsNumericalValues() const
Parses the expression into numerical values, returned as a vector of doubles.
void parse(const std::string &sCommandString, CommandSignature signature)
Private helper member function used for parsing the command line as specified by the command line sig...
std::string m_returnValueStatement
DataAccessParser getExprAsDataObject() const
Parses the expression to a DataAccessParser, which will extract the needed information for the curren...
const std::string & getReturnValueStatement() const
Returns the return value statement for commands with return values.
std::string m_commandLine
std::string getFileParameterValue(std::string sFileExt, const std::string &sBaseFolder="", const std::string &sDefaultName="") const
Parses the value of the common "file" command line parameter and returns a valid filename.
const std::string & getCommandLine() const
Returns the command line used for constructing this instance (e.g. for errors).
std::string getExprAsMathExpression(bool parseDataObjects=false) const
Prepares the expression by calling custom function definitions and resolving vector braces so that th...
std::vector< mu::value_type > getParameterValueAsNumericalValue(const std::string &sParameter) const
Parses the selected parameter as (one or more) numerical value(s) and returns them as a vector of dou...
std::string getParameterValueAsString(const std::string &sParameter, const std::string &sDefaultValue, bool stripAlways=false, bool onlyStringEvaluation=false) const
Parses the selected parameter value as a string and returns it. If the parameter is not found,...
const std::string & getExpr() const
Returns the expression as plain value.
const std::string & getParameterList() const
Returns the parameter list.
std::string getFileParameterValueForSaving(std::string sFileExt, const std::string &sBaseFolder="", const std::string &sDefaultName="") const
Parses the value of the common "file" command line parameter and returns a valid filename....
std::string getTargetTable(Indices &_targetIndices, const std::string &sDefaultTableName)
Evaluates any target=TABLE() statements in the parameter list and returns the needed information....
void setReturnValue(const std::string &sRetVal)
Sets the return value of the current command by simply appending it to the return value statement.
void clearReturnValue()
Removes the return value statement.
const std::string & getCommand() const
Returns the command.
std::string parseExprAsString() const
Prepares the expression by handling all string operations and removing the surrounding quotation mark...
std::string getParameterValue(const std::string &sParameter) const
Simply returns the parameter value or an empty string. Does not do any parsing steps.
@ CMD_PAR
Command-parameter sequence.
@ CMD_DAT_PAR
Command-dataobject-parameter sequence (e.g. fit)
@ CMD_EXPR_set_PAR
Command-expression-set-parameter sequence.
std::vector< std::string > getAllParametersWithValues() const
Returns a vector containing all parameters with values in the current parameter list....
CommandLineParser(const std::string &sCommandLine, CommandSignature signature)
CommandLineParser constructor from a command line and the command signature. Will use the standard fi...
std::string parseFileName(std::string &sFileName, std::string &sFileExt, const std::string &sBasePath) const
Common method to convert a prepared string into a valid file or folder name.
std::string getExprAsFileName(std::string sFileExt, const std::string &sBasePath="") const
Converts the expression to a file name and removes the surrounding quotation marks,...
bool exprContainsDataObjects() const
Simply returns, whether the expression contains any data objects.
IntervalSet parseIntervals(bool bErase=false)
Parses intervals in the parameter list and returns them as a vector. The interval may be deleted,...
bool hasParam(const std::string &sParameter) const
Simple wrapper around findParameter(), if used as a boolean flag.
This class is defined to abstrahize the determination of the correct data object and the calculation ...
This structure is central for managing the indices of a table or cluster read or write data access....
This class represents a set of intervals used together for calculations and simulations.