16 #ifndef QGSEXPRESSION_H 17 #define QGSEXPRESSION_H 19 #include "qgis_core.h" 21 #include <QStringList> 24 #include <QDomDocument> 25 #include <QCoreApplication> 44 class QgsExpressionPrivate;
128 FunctionWrongArgs = 2,
129 FunctionInvalidParams = 3,
130 FunctionNamedArgsError = 4
218 bool isValid() const;
221 bool hasParserError() const;
223 QString parserErrorString() const;
254 QSet<QString> referencedColumns() const;
263 QSet<QString> referencedVariables() const;
270 QSet<QString> referencedFunctions() const;
280 QList<const QgsExpressionNode *> nodes( )
const;
291 QList<const T *> lst;
292 const QList<const QgsExpressionNode *> allNodes( nodes() );
293 for (
const auto &node : allNodes )
295 const T *n =
dynamic_cast<const T *
>( node );
308 QSet<int> referencedAttributeIndexes(
const QgsFields &fields )
const;
311 bool needsGeometry()
const;
331 bool hasEvalError()
const;
333 QString evalErrorString()
const;
335 void setEvalErrorString(
const QString &str );
341 bool isField()
const;
358 void setExpression(
const QString &expression );
365 QString expression()
const;
373 QString dump()
const;
450 static QString replaceExpressionText(
const QString &action,
const QgsExpressionContext *context,
460 static QSet<QString> referencedVariables(
const QString &text );
472 static double evaluateToDouble(
const QString &text,
double fallbackValue );
487 static const QList<QgsExpressionFunction *> &Functions();
489 static const QStringList &BuiltinFunctions();
505 static bool unregisterFunction(
const QString &name );
511 static void cleanRegisteredFunctions();
514 static bool isFunctionName(
const QString &name );
517 static int functionIndex(
const QString &name );
523 static int functionCount();
530 static QString quotedColumnRef( QString name );
537 static QString quotedString( QString text );
547 static QString quotedValue(
const QVariant &value );
558 static QString quotedValue(
const QVariant &value, QVariant::Type type );
568 static QString helpText( QString name );
575 static QStringList tags(
const QString &name );
583 static QString variableHelpText(
const QString &variableName );
594 static QString formatVariableHelp(
const QString &description,
bool showValue =
true,
const QVariant &value = QVariant() );
600 static QString group(
const QString &group );
610 static QString formatPreviewString(
const QVariant &value,
bool htmlOutput =
true );
620 static QString createFieldEqualityExpression(
const QString &fieldName,
const QVariant &value );
623 SIP_PYOBJECT __repr__();
625 QString str = QStringLiteral(
"<QgsExpression: '%1'>" ).arg( sipCpp->expression() );
626 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
641 QgsExpressionPrivate *d =
nullptr;
644 static
void initFunctionHelp()
SIP_SKIP;
646 static
void initVariableHelp() SIP_SKIP;
653 #endif // QGSEXPRESSION_H Class for parsing and evaluation of expressions (formerly called "search strings").
QString errorMsg
The message for the error at this location.
Details about any parser errors that were found when parsing the expression.
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
Abstract base class for all nodes that can appear in an expression.
Encapsulate a field in an attribute table or data source.
DistanceUnit
Units of distance.
A general purpose distance and area calculator, capable of performing ellipsoid based calculations...
A abstract base class for defining QgsExpression functions.
This is the base class for vector data providers.
Represents a vector layer which manages a vector based data sets.
QList< const T * > findNodes() const
Returns a list of all nodes of the given class which are used in this expression. ...
The QgsOgcUtils class provides various utility functions for conversion between OGC (Open Geospatial ...