15 #ifndef QGSEXPRESSIONCONTEXT_H
16 #define QGSEXPRESSIONCONTEXT_H
18 #include "qgis_core.h"
23 #include <QStringList>
49 const QString &helpText = QString(),
50 bool usesGeometry =
false,
51 const QSet<QString> &referencedColumns = QSet<QString>(),
52 bool lazyEval =
false,
53 bool handlesNull =
false,
54 bool isContextual =
true )
56 , mUsesGeometry( usesGeometry )
57 , mReferencedColumns( referencedColumns )
68 const QString &helpText = QString(),
69 bool usesGeometry =
false,
70 const QSet<QString> &referencedColumns = QSet<QString>(),
71 bool lazyEval =
false,
72 bool handlesNull =
false,
73 bool isContextual =
true )
75 , mUsesGeometry( usesGeometry )
76 , mReferencedColumns( referencedColumns )
94 QSet<QString> mReferencedColumns;
129 StaticVariable(
const QString &name = QString(),
const QVariant &value = QVariant(),
bool readOnly =
false,
bool isStatic =
false,
const QString &description = QString() )
132 , readOnly( readOnly )
133 , isStatic( isStatic )
134 , description( description )
171 QString
name()
const {
return mName; }
180 void setVariable(
const QString &name,
const QVariant &value,
bool isStatic =
false );
197 bool removeVariable(
const QString &name );
206 bool hasVariable(
const QString &name )
const;
215 QVariant variable(
const QString &name )
const;
222 QStringList variableNames()
const;
230 QStringList filteredVariableNames()
const;
238 bool isReadOnly(
const QString &name )
const;
246 bool isStatic(
const QString &name )
const;
254 QString description(
const QString &name )
const;
268 bool hasFunction(
const QString &name )
const;
285 QStringList functionNames()
const;
332 void setFields(
const QgsFields &fields );
346 bool writeXml( QDomElement &element, QDomDocument &document,
const QgsReadWriteContext &context )
const;
350 QHash<QString, StaticVariable> mVariables;
351 QHash<QString, QgsScopedExpressionFunction * > mFunctions;
352 bool mHasFeature =
false;
401 bool hasVariable(
const QString &name )
const;
412 QVariant variable(
const QString &name )
const;
419 QVariantMap variablesToMap()
const;
428 bool isHighlightedVariable(
const QString &name )
const;
436 QStringList highlightedVariables()
const;
445 void setHighlightedVariables(
const QStringList &variableNames );
455 bool isHighlightedFunction(
const QString &name )
const;
468 void setHighlightedFunctions(
const QStringList &names );
507 QList< QgsExpressionContextScope * >
scopes() {
return mStack; }
522 int indexOfScope(
const QString &scopeName )
const;
532 QStringList variableNames()
const;
540 QStringList filteredVariableNames()
const;
548 bool isReadOnly(
const QString &name )
const;
558 QString description(
const QString &name )
const;
566 bool hasFunction(
const QString &name )
const;
573 QStringList functionNames()
const;
588 int scopeCount()
const;
605 void appendScopes(
const QList<QgsExpressionContextScope *> &scopes
SIP_TRANSFER );
620 QList<QgsExpressionContextScope *> takeScopes()
SIP_SKIP;
643 bool hasFeature() const;
658 void setFields( const
QgsFields &fields );
672 void setOriginalValueVariable( const QVariant &value );
685 void setCachedValue( const QString &key, const QVariant &value ) const;
695 bool hasCachedValue( const QString &key ) const;
707 QVariant cachedValue( const QString &key ) const;
716 void clearCachedValues() const;
719 static const QString EXPR_FIELDS;
721 static const QString EXPR_ORIGINAL_VALUE;
723 static const QString EXPR_SYMBOL_COLOR;
725 static const QString EXPR_SYMBOL_ANGLE;
727 static const QString EXPR_GEOMETRY_PART_COUNT;
729 static const QString EXPR_GEOMETRY_PART_NUM;
731 static const QString EXPR_GEOMETRY_POINT_COUNT;
733 static const QString EXPR_GEOMETRY_POINT_NUM;
735 static const QString EXPR_CLUSTER_SIZE;
737 static const QString EXPR_CLUSTER_COLOR;
742 QStringList mHighlightedVariables;
743 QStringList mHighlightedFunctions;
746 mutable QMap< QString, QVariant > mCachedValues;
750 #endif // QGSEXPRESSIONCONTEXT_H