![]() |
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). | |
| bool | parseFormat (QString formatStr, int *fieldWidth, char *format, int *precision, bool useDefaults) |
| 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. | |
| void | parseDefault (QVariant def, int nlin, int ncol, QString &defString, double *defVal) |
| An auxiliary function used to parse a default value definition, accepting scalars, tables or function/constant names. | |
| bool | parseDataSrcString (QString str, bool extName, 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, GmInterpolatorSubset *subset, QString &err) |
| int | stringOptionIndex (QString value, const char **optionNames, const char *fieldName, QString &err) |
| Looks for value in optionNames. If found returns the index. If not found returns -1 and fills err with a message. | |
| QVector< quint64 > | parseHexMask (QString hexStr, int max64Groups, const char *fieldName, QString &err) |
| Receives a string with Hex values, like 'a24df5' or '0xa24df5' and returns a vector with max64Groups quint64 values where the least 8 significative bytes are on the first vector entry, the next on entry 1 and so on. If the string mask can not fit in the given number of groups, or if the input string is not an hex string, returns an empty vector, filling err with a message. | |
Groups utilitary routines for parsing models.
| GMC_API_EXPORT void GmParseUtils::parseDefault | ( | QVariant | def, |
| int | nlin, | ||
| int | ncol, | ||
| QString & | defString, | ||
| double * | defVal ) |
An auxiliary 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, | ||
| bool | useDefaults ) |
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.
If useDefaults is set to true, a slight change i sdone to the interpretation of missing format or precision. An empty precision defaults to 6 (the default ANSI C precision for f, g or e). A specified 0 precision remains zero. If formatStr is empty or if the format specifier is missing, a default of 'g' is used.