15 #ifndef QGSEXPRESSIONCONTEXT_H
16 #define QGSEXPRESSIONCONTEXT_H
18 #include "qgis_core.h"
23 #include <QStringList>
51 const QString &helpText = QString(),
52 bool usesGeometry =
false,
53 const QSet<QString> &referencedColumns = QSet<QString>(),
54 bool lazyEval =
false,
55 bool handlesNull =
false,
56 bool isContextual =
true )
58 , mUsesGeometry( usesGeometry )
59 , mReferencedColumns( referencedColumns )
70 const QString &helpText = QString(),
71 bool usesGeometry =
false,
72 const QSet<QString> &referencedColumns = QSet<QString>(),
73 bool lazyEval =
false,
74 bool handlesNull =
false,
75 bool isContextual =
true )
77 , mUsesGeometry( usesGeometry )
78 , mReferencedColumns( referencedColumns )
96 QSet<QString> mReferencedColumns;
131 StaticVariable(
const QString &name = QString(),
const QVariant &value = QVariant(),
bool readOnly =
false,
bool isStatic =
false,
const QString &description = QString() )
134 , readOnly( readOnly )
135 , isStatic( isStatic )
136 , description( description )
173 QString
name()
const {
return mName; }
182 void setVariable(
const QString &name,
const QVariant &value,
bool isStatic =
false );
199 bool removeVariable(
const QString &name );
208 bool hasVariable(
const QString &name )
const;
217 QVariant variable(
const QString &name )
const;
224 QStringList variableNames()
const;
232 QStringList filteredVariableNames()
const;
240 bool isReadOnly(
const QString &name )
const;
248 bool isStatic(
const QString &name )
const;
256 QString description(
const QString &name )
const;
270 bool hasFunction(
const QString &name )
const;
287 QStringList functionNames()
const;
367 void setFields(
const QgsFields &fields );
381 bool writeXml( QDomElement &element, QDomDocument &document,
const QgsReadWriteContext &context )
const;
385 QHash<QString, StaticVariable> mVariables;
386 QHash<QString, QgsScopedExpressionFunction * > mFunctions;
387 bool mHasFeature =
false;
389 bool mHasGeometry =
false;
438 bool hasVariable(
const QString &name )
const;
449 QVariant variable(
const QString &name )
const;
456 QVariantMap variablesToMap()
const;
465 bool isHighlightedVariable(
const QString &name )
const;
473 QStringList highlightedVariables()
const;
482 void setHighlightedVariables(
const QStringList &variableNames );
492 bool isHighlightedFunction(
const QString &name )
const;
505 void setHighlightedFunctions(
const QStringList &names );
544 QList< QgsExpressionContextScope * >
scopes() {
return mStack; }
559 int indexOfScope(
const QString &scopeName )
const;
569 QStringList variableNames()
const;
577 QStringList filteredVariableNames()
const;
585 bool isReadOnly(
const QString &name )
const;
595 QString description(
const QString &name )
const;
603 bool hasFunction(
const QString &name )
const;
610 QStringList functionNames()
const;
625 int scopeCount()
const;
642 void appendScopes(
const QList<QgsExpressionContextScope *> &scopes
SIP_TRANSFER );
657 QList<QgsExpressionContextScope *> takeScopes()
SIP_SKIP;
680 bool hasFeature() const;
703 bool hasGeometry() const;
719 void setFields( const
QgsFields &fields );
733 void setOriginalValueVariable( const QVariant &value );
746 void setCachedValue( const QString &key, const QVariant &value ) const;
756 bool hasCachedValue( const QString &key ) const;
768 QVariant cachedValue( const QString &key ) const;
777 void clearCachedValues() const;
803 static const QString EXPR_FIELDS;
805 static const QString EXPR_ORIGINAL_VALUE;
807 static const QString EXPR_SYMBOL_COLOR;
809 static const QString EXPR_SYMBOL_ANGLE;
811 static const QString EXPR_GEOMETRY_PART_COUNT;
813 static const QString EXPR_GEOMETRY_PART_NUM;
819 static const QString EXPR_GEOMETRY_RING_NUM;
821 static const QString EXPR_GEOMETRY_POINT_COUNT;
823 static const QString EXPR_GEOMETRY_POINT_NUM;
825 static const QString EXPR_CLUSTER_SIZE;
827 static const QString EXPR_CLUSTER_COLOR;
832 QStringList mHighlightedVariables;
833 QStringList mHighlightedFunctions;
838 mutable QMap< QString, QVariant > mCachedValues;
842 #endif // QGSEXPRESSIONCONTEXT_H