![]() |
GemaCoreLib
The GeMA Core library
|
Groups utilitary routines for parsing models. More...
Functions | |
int | parseDimension (QVariant dim, int *nlin, int *ncol, int *ndepth) |
An auxiliary function to parse dimension values that can be expressed both as a single number or a string in the format 'dxd' (and optionally in the format 'dxdxd' if ndepth != NULL). More... | |
bool | parseFormat (QString formatStr, int *fieldWidth, char *format, int *precision) |
An auxiliary function used to parse a format string using the syntax: "%d.%d[fgeGE]" Returns the parsed formats in the arguments fieldWidth, format and precision. More... | |
void | parseDefault (QVariant def, int nlin, int ncol, QString &defString, double *defVal) |
An auxilliary function used to parse a default value definition, accepting scalars, tables or function/constant names. More... | |
bool | parseDataSrcString (QString str, QString &src, QString *unit, int *dim, QString *as) |
bool | parseDataSrc (QVariant def, QString &srcId, QString *unit, int *dim, QString *alias, int *history, bool acceptsNoInterp, GmInterpolatorType *interpType, QVariant *interpParam, QString &err) |
Groups utilitary routines for parsing models.
GMC_API_EXPORT void GmParseUtils::parseDefault | ( | QVariant | def, |
int | nlin, | ||
int | ncol, | ||
QString & | defString, | ||
double * | defVal | ||
) |
An auxilliary function used to parse a default value definition, accepting scalars, tables or function/constant names.
If the value is a function/constant, returns its name in defString and leaves defVal untouched. Otherwise, fills defVal with nlin * ncol default values read from the table or with a repetition of a single scalar value.
PS: Expects that the value in def has been already validated.
GMC_API_EXPORT int GmParseUtils::parseDimension | ( | QVariant | dim, |
int * | nlin, | ||
int * | ncol, | ||
int * | ndepth | ||
) |
An auxiliary function to parse dimension values that can be expressed both as a single number or a string in the format 'dxd' (and optionally in the format 'dxdxd' if ndepth != NULL).
Expects that the value format was already checked by Lua code (with a call to GemaCheckDimensionValue(), for example). Returns 0 if dim is a null object, 1 if it is an integer or 2 if it is a matrix definition (or 3 if ndepth != NULL and the string is formatted with 3 dimension numbers).
For 1D cases, fills nlin with the value (leaving ncol unchanged). For 2D cases, fills nlin and ncol. Fills ndepth only if it is different from NULL and a string with two 'x' is found.
GMC_API_EXPORT bool GmParseUtils::parseFormat | ( | QString | formatStr, |
int * | fieldWidth, | ||
char * | format, | ||
int * | precision | ||
) |
An auxiliary function used to parse a format string using the syntax: "%d.%d[fgeGE]" Returns the parsed formats in the arguments fieldWidth, format and precision.
A missing width or precision is interpreted as 0. A missing format letter is interpreted as 'f'. On errors, the function returns false and does not change any of the output parameters.