20 #include <QStringList> 26 : mFilter( FilterNone )
28 , mFilterExpression( nullptr )
189 if ( attrNames.
contains( QgsFeatureRequest::AllAttributes ) )
198 Q_FOREACH (
const QString& attrName, attrNames )
256 while ( !mActiveIterators.empty() )
266 mActiveIterators.insert( it );
271 mActiveIterators.remove( it );
277 : mExpression( expression )
278 , mAscending( ascending )
285 : mExpression( expression )
286 , mAscending( ascending )
287 , mNullsFirst( nullsfirst )
315 mAscending ?
"ASC" :
"DESC",
316 mNullsFirst ?
"NULLS FIRST" :
"NULLS LAST" );
341 for ( it = constBegin(); it != constEnd(); ++it )
359 for (
int i = 0; i < clauses.
size(); ++i )
375 for ( it = constBegin(); it != constEnd(); ++it )
382 return usedAttributes;
390 for ( it = constBegin(); it != constEnd(); ++it )
394 results << clause.
dump();
397 return results.
join(
", " );
Class for parsing and evaluation of expressions (formerly called "search strings").
QgsFeatureIds mFilterFids
virtual bool close()=0
end of iterating: free the resources / lock
A rectangle specified with double values.
long limit() const
Returns the maximum number of features to request, or -1 if no limit set.
bool nullsFirst() const
Set if NULLS should be returned first.
bool acceptFeature(const QgsFeature &feature)
Check if a feature is accepted by this requests filter.
QSet< QString > CORE_EXPORT usedAttributes() const
Returns a set of used attributes.
Filter using feature IDs.
QgsSimplifyMethod mSimplifyMethod
bool intersects(const QgsRectangle &r) const
Test for intersection with a rectangle (uses GEOS)
QgsExpression * mFilterExpression
Q_DECL_DEPRECATED QVariant evaluate(const QgsFeature *f)
Evaluate the feature and return the result.
bool ascending() const
Order ascending.
const Flags & flags() const
QString dump() const
Dumps the content to an SQL equivalent.
void iteratorClosed(QgsAbstractFeatureIterator *it)
QDomNode appendChild(const QDomNode &newChild)
QList< OrderByClause > CORE_EXPORT list() const
Get a copy as a list of OrderByClauses.
QString attribute(const QString &name, const QString &defValue) const
QString CORE_EXPORT dump() const
Dumps the content to an SQL equivalent syntax.
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
QStringList referencedColumns() const
Get list of columns referenced by the expression.
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
Container of fields for a vector layer.
void CORE_EXPORT load(const QDomElement &elem)
Deserialize from XML.
QgsFeatureRequest & addOrderBy(const QString &expression, bool ascending=true)
Adds a new OrderByClause, appending it as the least important one.
const QgsGeometry * constGeometry() const
Gets a const pointer to the geometry object associated with this feature.
QString join(const QString &separator) const
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QgsFeatureRequest & operator=(const QgsFeatureRequest &rh)
Assignment operator.
QDomNodeList childNodes() const
QgsExpressionContext mExpressionContext
QDomElement toElement() const
QgsFeatureRequest & combineFilterExpression(const QString &expression)
Modifies the existing filter expression to add an additional expression filter.
QgsFeatureRequest & setExpressionContext(const QgsExpressionContext &context)
Sets the expression context used to evaluate filter expressions.
QgsFeatureRequest & setFilterFid(QgsFeatureId fid)
Set feature ID that should be fetched.
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
void append(const T &value)
QDomDocument ownerDocument() const
OrderByClause(const QString &expression, bool ascending=true)
Creates a new OrderByClause for a QgsFeatureRequest.
void setAttribute(const QString &name, const QString &value)
Internal feature iterator to be implemented within data providers.
int toInt(bool *ok, int base) const
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QgsFeatureRequest()
construct a default request: for all features get attributes and geometries
static const QString AllAttributes
A special attribute that if set matches all attributes.
Obsolete, will be ignored. If a filterRect is set it will be used anyway. Filter using a rectangle...
QgsFeatureRequest & setFlags(const QgsFeatureRequest::Flags &flags)
Set flags that affect how features will be fetched.
Fetch only a subset of attributes (setSubsetOfAttributes sets this flag)
virtual ~QgsAbstractFeatureSource()
QDomText createTextNode(const QString &value)
QgsFeatureId id() const
Get the feature ID for this feature.
int fieldNameIndex(const QString &fieldName) const
Look up field's index from name also looks up case-insensitive if there is no match otherwise...
QString expression() const
Return the original, unmodified expression string.
bool contains(const T &value) const
QgsFeatureRequest & setSimplifyMethod(const QgsSimplifyMethod &simplifyMethod)
Set a simplification method for geometries that will be fetched.
The OrderByClause class represents an order by clause for a QgsFeatureRequest.
bool contains(const T &value) const
QgsExpression expression() const
The expression.
QgsFeatureRequest & setFilterFids(const QgsFeatureIds &fids)
Set feature IDs that should be fetched.
QSet< T > & unite(const QSet< T > &other)
void setAscending(bool ascending)
Set if ascending order is requested.
void CORE_EXPORT save(QDomElement &elem) const
Serialize to XML.
QgsFeatureRequest & setLimit(long limit)
Set the maximum number of features to request.
This class contains information about how to simplify geometries fetched from a QgsFeatureIterator.
QgsFeatureRequest & setOrderBy(const OrderBy &orderBy)
Set a list of order by clauses.
QDomElement createElement(const QString &tagName)
OrderBy orderBy() const
Return a list of order by clauses specified for this feature request.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
const QgsSimplifyMethod & simplifyMethod() const
Get simplification method for geometries that will be fetched.
QgsFeatureRequest & setFilterRect(const QgsRectangle &rect)
Set rectangle from which features will be taken.
CORE_EXPORT OrderBy()
Create a new empty order by.
Represents a list of OrderByClauses, with the most important first and the least important last...
void iteratorOpened(QgsAbstractFeatureIterator *it)
QDomNode at(int index) const
void setNullsFirst(bool nullsFirst)
Set if NULLS should be returned first.