15#ifndef QGSPROPERTYCOLLECTION_H
16#define QGSPROPERTYCOLLECTION_H
47 sipType = sipType_QgsPropertyCollection;
49 sipType = sipType_QgsPropertyCollectionStack;
51 sipType = sipType_QgsAbstractPropertyCollection;
69 QString
name()
const {
return mName; }
75 void setName(
const QString &name ) { mName = name; }
138 QDateTime valueAsDateTime(
int key,
const QgsExpressionContext &context,
const QDateTime &defaultDateTime = QDateTime(),
bool *ok
SIP_OUT =
nullptr )
const;
155 QString valueAsString(
int key,
const QgsExpressionContext &context,
const QString &defaultString = QString(),
bool *ok
SIP_OUT =
nullptr )
const;
172 QColor valueAsColor(
int key,
const QgsExpressionContext &context,
const QColor &defaultColor = QColor(),
bool *ok
SIP_OUT =
nullptr )
const;
343 QSet<int> propertyKeys()
const override;
344 void clear()
override;
345 bool hasProperty(
int key )
const override;
357 QVariant value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const override;
360 bool isActive(
int key )
const override;
361 bool hasActiveProperties()
const override;
362 bool hasDynamicProperties()
const override;
375 void setProperty(
int key,
const QgsProperty &property );
384 void setProperty(
int key,
const QVariant &value );
388 QHash<int, QgsProperty> mProperties;
390 mutable bool mDirty =
false;
391 mutable bool mHasActiveProperties =
false;
392 mutable bool mHasDynamicProperties =
false;
393 mutable int mCount = 0;
432 void clear()
override;
469 bool hasActiveProperties()
const override;
476 bool hasDynamicProperties()
const override;
484 bool isActive(
int key )
const override;
504 QVariant value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const override;
516 QSet<int> propertyKeys()
const override;
517 bool hasProperty(
int key )
const override;
525 QList< QgsPropertyCollection * > mStack;
Abstract base class for QgsPropertyCollection like objects.
virtual QVariant value(int key, const QgsExpressionContext &context, const QVariant &defaultValue=QVariant()) const =0
Returns the calculated value of the property with the specified key from within the collection.
void setName(const QString &name)
Sets the descriptive name for the property collection.
virtual bool hasProperty(int key) const =0
Returns true if the collection contains a property with the specified key.
virtual bool isActive(int key) const =0
Returns true if the collection contains an active property with the specified key.
virtual QgsProperty property(int key) const =0
Returns a matching property from the collection, if one exists.
virtual QSet< int > propertyKeys() const =0
Returns a list of property keys contained within the collection.
virtual QSet< QString > referencedFields(const QgsExpressionContext &context=QgsExpressionContext(), bool ignoreContext=false) const =0
Returns the set of any fields referenced by the active properties from the collection.
virtual void clear()=0
Removes all properties from the collection.
virtual bool prepare(const QgsExpressionContext &context=QgsExpressionContext()) const =0
Prepares the collection against a specified expression context.
virtual bool loadVariant(const QVariant &configuration, const QgsPropertiesDefinition &definitions)=0
Loads this property collection from a QVariantMap, wrapped in a QVariant.
virtual bool hasActiveProperties() const =0
Returns true if the collection has any active properties, or false if all properties within the colle...
QString name() const
Returns the descriptive name of the property collection.
virtual bool hasDynamicProperties() const =0
Returns true if the collection has any active, non-static properties, or false if either all non-stat...
virtual ~QgsAbstractPropertyCollection()=default
virtual QVariant toVariant(const QgsPropertiesDefinition &definitions) const =0
Saves this property collection to a QVariantMap, wrapped in a QVariant.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
An ordered stack of QgsPropertyCollection containers, where collections added later to the stack will...
QgsPropertyCollectionStack()=default
Constructor for QgsPropertyCollectionStack.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
A store for object properties.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.