mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
sipify QgsExpressionContext, QgsFeatureRequest, QgsOptionalExpression
This commit is contained in:
parent
afc9788881
commit
8231d7528b
@ -1,9 +1,6 @@
|
||||
core/conversions.sip
|
||||
core/qgsexception.sip
|
||||
core/qgis.sip
|
||||
core/qgsexpressioncontext.sip
|
||||
core/qgsfeaturerequest.sip
|
||||
core/qgsoptionalexpression.sip
|
||||
core/qgspaintenginehack.sip
|
||||
core/qgspainting.sip
|
||||
core/qgspallabeling.sip
|
||||
|
@ -498,9 +498,6 @@ struct QgsVertexId
|
||||
%End
|
||||
|
||||
bool operator==( QgsVertexId other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
bool operator!=( QgsVertexId other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
|
@ -24,9 +24,6 @@ class QgsCurve: QgsAbstractGeometry
|
||||
QgsCurve();
|
||||
|
||||
virtual bool operator==( const QgsCurve &other ) const = 0;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
virtual bool operator!=( const QgsCurve &other ) const = 0;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
|
@ -62,9 +62,6 @@ class QgsPointV2: QgsAbstractGeometry
|
||||
%End
|
||||
|
||||
bool operator==( const QgsPointV2 &pt ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
bool operator!=( const QgsPointV2 &pt ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
|
@ -23,9 +23,6 @@ class QgsPolygonV2: QgsCurvePolygon
|
||||
QgsPolygonV2();
|
||||
|
||||
bool operator==( const QgsPolygonV2 &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
bool operator!=( const QgsPolygonV2 &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
|
@ -258,11 +258,6 @@ Copy constructor
|
||||
%End
|
||||
|
||||
bool operator==( const QgsRectangle &r1 ) const;
|
||||
%Docstring
|
||||
Comparison operator
|
||||
:return: True if rectangles are equal
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
bool operator!=( const QgsRectangle &r1 ) const;
|
||||
%Docstring
|
||||
|
@ -50,9 +50,6 @@ class QgsTriangle : QgsPolygonV2
|
||||
%End
|
||||
|
||||
bool operator==( const QgsTriangle &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
bool operator!=( const QgsTriangle &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
|
@ -52,10 +52,6 @@ class QgsActionScope
|
||||
%End
|
||||
|
||||
bool operator==( const QgsActionScope &other ) const;
|
||||
%Docstring
|
||||
Compares two action scopes
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
QgsExpressionContextScope expressionContextScope() const;
|
||||
%Docstring
|
||||
|
@ -113,9 +113,6 @@ Gradient color at stop
|
||||
%End
|
||||
|
||||
bool operator==( const QgsGradientStop &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
};
|
||||
|
||||
typedef QList<QgsGradientStop> QgsGradientStopsList;
|
||||
|
@ -463,12 +463,6 @@ Returns whether this CRS is correctly initialized and usable
|
||||
%End
|
||||
|
||||
bool operator==( const QgsCoordinateReferenceSystem &srs ) const;
|
||||
%Docstring
|
||||
Overloaded == operator used to compare to CRS's.
|
||||
|
||||
Internally it will use authid() for comparison.
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
bool operator!=( const QgsCoordinateReferenceSystem &srs ) const;
|
||||
%Docstring
|
||||
|
@ -68,9 +68,6 @@ class QgsEditFormConfig
|
||||
|
||||
|
||||
bool operator==( const QgsEditFormConfig &o );
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
void addTab( QgsAttributeEditorElement *data /Transfer/ );
|
||||
%Docstring
|
||||
|
@ -108,13 +108,6 @@ Implicit sharing was added in 2.14
|
||||
~QgsExpression();
|
||||
|
||||
bool operator==( const QgsExpression &other ) const;
|
||||
%Docstring
|
||||
Compares two expressions. The operator returns true
|
||||
if the expression string is equal.
|
||||
|
||||
.. versionadded:: 3.0
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
bool isValid() const;
|
||||
%Docstring
|
||||
@ -456,9 +449,6 @@ Returns the default value for the parameter.
|
||||
%End
|
||||
|
||||
bool operator==( const QgsExpression::Parameter &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
};
|
||||
|
||||
@ -658,9 +648,6 @@ The help text for the function.
|
||||
%End
|
||||
|
||||
bool operator==( const QgsExpression::Function &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
virtual bool handlesNull() const;
|
||||
%Docstring
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,32 +1,73 @@
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/qgsfeaturerequest.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsFeatureRequest
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsfeaturerequest.h>
|
||||
%Docstring
|
||||
This class wraps a request for features to a vector layer (or directly its vector data provider).
|
||||
The request may apply a filter to fetch only a particular subset of features. Currently supported filters:
|
||||
- no filter - all features are returned
|
||||
- feature id - only feature that matches given feature id is returned
|
||||
- feature ids - only features that match any of the given feature ids are returned
|
||||
- filter expression - only features that match the given filter expression are returned
|
||||
|
||||
Additionally a spatial rectangle can be set in combination:
|
||||
Only features that intersect given rectangle should be fetched. For the sake of speed,
|
||||
the intersection is often done only using feature's bounding box. There is a flag
|
||||
ExactIntersect that makes sure that only intersecting features will be returned.
|
||||
|
||||
For efficiency, it is also possible to tell provider that some data is not required:
|
||||
- NoGeometry flag
|
||||
- SubsetOfAttributes flag
|
||||
- SimplifyMethod for geometries to fetch
|
||||
|
||||
The options may be chained, e.g.:
|
||||
QgsFeatureRequest().setFilterRect(QgsRectangle(0,0,1,1)).setFlags(QgsFeatureRequest.ExactIntersect)
|
||||
|
||||
Examples:
|
||||
- fetch all features:
|
||||
QgsFeatureRequest()
|
||||
- fetch all features, only one attribute
|
||||
QgsFeatureRequest().setSubsetOfAttributes(QStringList("myfield"), provider->fieldMap())
|
||||
- fetch all features, without geometries
|
||||
QgsFeatureRequest().setFlags(QgsFeatureRequest.NoGeometry)
|
||||
- fetch only features from particular extent
|
||||
QgsFeatureRequest().setFilterRect(QgsRectangle(0,0,1,1))
|
||||
- fetch only one feature
|
||||
QgsFeatureRequest().setFilterFid(45)
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsfeaturerequest.h"
|
||||
%End
|
||||
public:
|
||||
enum Flag
|
||||
{
|
||||
NoFlags,
|
||||
NoGeometry, //!< Geometry is not required. It may still be returned if e.g. required for a filter condition.
|
||||
SubsetOfAttributes, //!< Fetch only a subset of attributes (setSubsetOfAttributes sets this flag)
|
||||
ExactIntersect //!< Use exact geometry intersection (slower) instead of bounding boxes
|
||||
NoGeometry,
|
||||
SubsetOfAttributes,
|
||||
ExactIntersect
|
||||
};
|
||||
typedef QFlags<QgsFeatureRequest::Flag> Flags;
|
||||
|
||||
/**
|
||||
* Types of filters.
|
||||
*/
|
||||
|
||||
enum FilterType
|
||||
{
|
||||
FilterNone, //!< No filter is applied
|
||||
FilterFid, //!< Filter using feature ID
|
||||
FilterExpression, //!< Filter using expression
|
||||
FilterFids //!< Filter using feature IDs
|
||||
FilterNone,
|
||||
FilterFid,
|
||||
FilterExpression,
|
||||
FilterFids
|
||||
};
|
||||
|
||||
//! Handling of features with invalid geometries
|
||||
enum InvalidGeometryCheck
|
||||
{
|
||||
GeometryNoCheck,
|
||||
@ -34,382 +75,511 @@ class QgsFeatureRequest
|
||||
GeometryAbortOnInvalid,
|
||||
};
|
||||
|
||||
/**
|
||||
* The OrderByClause class represents an order by clause for a QgsFeatureRequest.
|
||||
*
|
||||
* It can be a simple field or an expression. Multiple order by clauses can be added to
|
||||
* a QgsFeatureRequest to fine tune the behavior if a single field or expression is not
|
||||
* enough to completely specify the required behavior.
|
||||
*
|
||||
* If expression compilation is activated in the settings and the expression can be
|
||||
* translated for the provider in question, it will be evaluated on provider side.
|
||||
* If one of these two premises does not apply, the ordering will take place locally
|
||||
* which results in increased memory and CPU usage.
|
||||
*
|
||||
* If the ordering is done on strings, the order depends on the system's locale if the
|
||||
* local fallback implementation is used. The order depends on the server system's locale
|
||||
* and implementation if ordering is done on the server.
|
||||
*
|
||||
* In case the fallback code needs to be used, a limit set on the request will be respected
|
||||
* for the features returned by the iterator but internally all features will be requested
|
||||
* from the provider.
|
||||
*
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
class OrderByClause
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Creates a new OrderByClause for a QgsFeatureRequest
|
||||
*
|
||||
* @param expression The expression to use for ordering
|
||||
* @param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
|
||||
* If the order is ascending, by default nulls are last
|
||||
* If the order is descending, by default nulls are first
|
||||
*/
|
||||
OrderByClause( const QString &expression, bool ascending = true );
|
||||
/**
|
||||
* Creates a new OrderByClause for a QgsFeatureRequest
|
||||
*
|
||||
* @param expression The expression to use for ordering
|
||||
* @param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
|
||||
* @param nullsfirst If true, NULLS are at the beginning, if false, NULLS are at the end
|
||||
*/
|
||||
OrderByClause( const QString &expression, bool ascending, bool nullsfirst );
|
||||
{
|
||||
%Docstring
|
||||
The OrderByClause class represents an order by clause for a QgsFeatureRequest.
|
||||
|
||||
/**
|
||||
* The expression
|
||||
* @return the expression
|
||||
*/
|
||||
QgsExpression expression() const;
|
||||
It can be a simple field or an expression. Multiple order by clauses can be added to
|
||||
a QgsFeatureRequest to fine tune the behavior if a single field or expression is not
|
||||
enough to completely specify the required behavior.
|
||||
|
||||
/**
|
||||
* Prepare the expression with the given context.
|
||||
*
|
||||
* \see QgsExpression::prepare
|
||||
*
|
||||
* \since QGIS 3.0
|
||||
*/
|
||||
bool prepare( QgsExpressionContext *context );
|
||||
If expression compilation is activated in the settings and the expression can be
|
||||
translated for the provider in question, it will be evaluated on provider side.
|
||||
If one of these two premises does not apply, the ordering will take place locally
|
||||
which results in increased memory and CPU usage.
|
||||
|
||||
/**
|
||||
* Order ascending
|
||||
* @return If ascending order is requested
|
||||
*/
|
||||
bool ascending() const;
|
||||
If the ordering is done on strings, the order depends on the system's locale if the
|
||||
local fallback implementation is used. The order depends on the server system's locale
|
||||
and implementation if ordering is done on the server.
|
||||
|
||||
/**
|
||||
* Set if ascending order is requested
|
||||
*/
|
||||
void setAscending( bool ascending );
|
||||
In case the fallback code needs to be used, a limit set on the request will be respected
|
||||
for the features returned by the iterator but internally all features will be requested
|
||||
from the provider.
|
||||
|
||||
/**
|
||||
* Set if NULLS should be returned first
|
||||
* @return if NULLS should be returned first
|
||||
*/
|
||||
bool nullsFirst() const;
|
||||
|
||||
/**
|
||||
* Set if NULLS should be returned first
|
||||
*/
|
||||
void setNullsFirst( bool nullsFirst );
|
||||
|
||||
/**
|
||||
* Dumps the content to an SQL equivalent
|
||||
*/
|
||||
QString dump() const;
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents a list of OrderByClauses, with the most important first and the least
|
||||
* important last.
|
||||
*
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
class OrderBy
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create a new empty order by
|
||||
*/
|
||||
OrderBy();
|
||||
|
||||
/**
|
||||
* Create a new order by from a list of clauses
|
||||
*/
|
||||
OrderBy( const QList<QgsFeatureRequest::OrderByClause> &other );
|
||||
|
||||
/**
|
||||
* Get a copy as a list of OrderByClauses
|
||||
*
|
||||
* This is only required in python where the inheritance
|
||||
* is not properly propagated and this makes it usable.
|
||||
*/
|
||||
QList<QgsFeatureRequest::OrderByClause> list() const;
|
||||
|
||||
/**
|
||||
* Serialize to XML
|
||||
*/
|
||||
void save( QDomElement &elem ) const;
|
||||
|
||||
/**
|
||||
* Deserialize from XML
|
||||
*/
|
||||
void load( const QDomElement &elem );
|
||||
|
||||
/**
|
||||
* Returns a set of used attributes
|
||||
*/
|
||||
QSet<QString> usedAttributes() const;
|
||||
|
||||
/**
|
||||
* Dumps the content to an SQL equivalent syntax
|
||||
*/
|
||||
QString dump() const;
|
||||
};
|
||||
|
||||
/**
|
||||
* A special attribute that if set matches all attributes
|
||||
*/
|
||||
static const QString ALL_ATTRIBUTES;
|
||||
|
||||
//! construct a default request: for all features get attributes and geometries
|
||||
QgsFeatureRequest();
|
||||
//! construct a request with feature ID filter
|
||||
explicit QgsFeatureRequest( QgsFeatureId fid );
|
||||
//! construct a request with rectangle filter
|
||||
explicit QgsFeatureRequest( const QgsRectangle &rect );
|
||||
//! construct a request with a filter expression
|
||||
explicit QgsFeatureRequest( const QgsExpression &expr, const QgsExpressionContext &context = QgsExpressionContext() );
|
||||
//! copy constructor
|
||||
QgsFeatureRequest( const QgsFeatureRequest &rh );
|
||||
|
||||
~QgsFeatureRequest();
|
||||
|
||||
/**
|
||||
* Return the filter type which is currently set on this request
|
||||
*
|
||||
* @return Filter type
|
||||
*/
|
||||
FilterType filterType() const;
|
||||
|
||||
/**
|
||||
* Set rectangle from which features will be taken. Empty rectangle removes the filter.
|
||||
*/
|
||||
QgsFeatureRequest &setFilterRect( const QgsRectangle &rect );
|
||||
|
||||
/**
|
||||
* Get the rectangle from which features will be taken.
|
||||
*/
|
||||
const QgsRectangle &filterRect() const;
|
||||
|
||||
//! Set feature ID that should be fetched.
|
||||
QgsFeatureRequest &setFilterFid( qint64 fid );
|
||||
//! Get the feature ID that should be fetched.
|
||||
qint64 filterFid() const;
|
||||
|
||||
//! Set feature IDs that should be fetched.
|
||||
QgsFeatureRequest &setFilterFids( const QgsFeatureIds &fids );
|
||||
//! Get feature IDs that should be fetched.
|
||||
const QgsFeatureIds &filterFids() const;
|
||||
|
||||
/**
|
||||
* Sets invalid geometry checking behavior.
|
||||
* \note Invalid geometry checking is not performed when retrieving features
|
||||
* directly from a QgsVectorDataProvider.
|
||||
* \see invalidGeometryCheck()
|
||||
* \since QGIS 3.0
|
||||
*/
|
||||
QgsFeatureRequest &setInvalidGeometryCheck( InvalidGeometryCheck check );
|
||||
|
||||
/**
|
||||
* Returns the invalid geometry checking behavior.
|
||||
* \see setInvalidGeometryCheck()
|
||||
* \since QGIS 3.0
|
||||
*/
|
||||
InvalidGeometryCheck invalidGeometryCheck() const;
|
||||
|
||||
/**
|
||||
* Sets a callback function to use when encountering an invalid geometry and
|
||||
* invalidGeometryCheck() is set to GeometryAbortOnInvalid. This function will be
|
||||
* called using the feature with invalid geometry as a parameter.
|
||||
* \since QGIS 3.0
|
||||
* \see invalidGeometryCallback()
|
||||
*/
|
||||
QgsFeatureRequest &setInvalidGeometryCallback( SIP_PYCALLABLE /AllowNone/ );
|
||||
%MethodCode
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
||||
sipCpp->setInvalidGeometryCallback([a0](const QgsFeature &arg) {
|
||||
SIP_BLOCK_THREADS
|
||||
Py_XDECREF( sipCallMethod(NULL, a0, "D", &arg, sipType_QgsFeature, NULL) );
|
||||
SIP_UNBLOCK_THREADS
|
||||
});
|
||||
|
||||
sipRes = sipCpp;
|
||||
|
||||
Py_END_ALLOW_THREADS
|
||||
.. versionadded:: 2.14
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsfeaturerequest.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
OrderByClause( const QString &expression, bool ascending = true );
|
||||
%Docstring
|
||||
Creates a new OrderByClause for a QgsFeatureRequest
|
||||
|
||||
\param expression The expression to use for ordering
|
||||
\param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
|
||||
If the order is ascending, by default nulls are last
|
||||
If the order is descending, by default nulls are first
|
||||
%End
|
||||
|
||||
OrderByClause( const QString &expression, bool ascending, bool nullsfirst );
|
||||
%Docstring
|
||||
Creates a new OrderByClause for a QgsFeatureRequest
|
||||
|
||||
\param expression The expression to use for ordering
|
||||
\param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
|
||||
\param nullsfirst If true, NULLS are at the beginning, if false, NULLS are at the end
|
||||
%End
|
||||
|
||||
OrderByClause( const QgsExpression &expression, bool ascending = true );
|
||||
%Docstring
|
||||
Creates a new OrderByClause for a QgsFeatureRequest
|
||||
|
||||
\param expression The expression to use for ordering
|
||||
\param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
|
||||
If the order is ascending, by default nulls are last
|
||||
If the order is descending, by default nulls are first
|
||||
%End
|
||||
|
||||
OrderByClause( const QgsExpression &expression, bool ascending, bool nullsfirst );
|
||||
%Docstring
|
||||
Creates a new OrderByClause for a QgsFeatureRequest
|
||||
|
||||
\param expression The expression to use for ordering
|
||||
\param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
|
||||
\param nullsfirst If true, NULLS are at the beginning, if false, NULLS are at the end
|
||||
%End
|
||||
|
||||
QgsExpression expression() const;
|
||||
%Docstring
|
||||
The expression
|
||||
:return: the expression
|
||||
:rtype: QgsExpression
|
||||
%End
|
||||
|
||||
bool prepare( QgsExpressionContext *context );
|
||||
%Docstring
|
||||
Prepare the expression with the given context.
|
||||
|
||||
.. seealso:: QgsExpression.prepare
|
||||
|
||||
.. versionadded:: 3.0
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
bool ascending() const;
|
||||
%Docstring
|
||||
Order ascending
|
||||
:return: If ascending order is requested
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
void setAscending( bool ascending );
|
||||
%Docstring
|
||||
Set if ascending order is requested
|
||||
%End
|
||||
|
||||
bool nullsFirst() const;
|
||||
%Docstring
|
||||
Set if NULLS should be returned first
|
||||
:return: if NULLS should be returned first
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
void setNullsFirst( bool nullsFirst );
|
||||
%Docstring
|
||||
Set if NULLS should be returned first
|
||||
%End
|
||||
|
||||
QString dump() const;
|
||||
%Docstring
|
||||
Dumps the content to an SQL equivalent
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
class OrderBy
|
||||
{
|
||||
%Docstring
|
||||
Represents a list of OrderByClauses, with the most important first and the least
|
||||
important last.
|
||||
|
||||
.. versionadded:: 2.14
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsfeaturerequest.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
OrderBy();
|
||||
%Docstring
|
||||
Create a new empty order by
|
||||
%End
|
||||
|
||||
OrderBy( const QList<QgsFeatureRequest::OrderByClause> &other );
|
||||
%Docstring
|
||||
Create a new order by from a list of clauses
|
||||
%End
|
||||
|
||||
QList<QgsFeatureRequest::OrderByClause> list() const;
|
||||
%Docstring
|
||||
Get a copy as a list of OrderByClauses
|
||||
|
||||
This is only required in Python where the inheritance
|
||||
is not properly propagated and this makes it usable.
|
||||
:rtype: list of QgsFeatureRequest.OrderByClause
|
||||
%End
|
||||
|
||||
void save( QDomElement &elem ) const;
|
||||
%Docstring
|
||||
Serialize to XML
|
||||
%End
|
||||
|
||||
void load( const QDomElement &elem );
|
||||
%Docstring
|
||||
Deserialize from XML
|
||||
%End
|
||||
|
||||
QSet<QString> usedAttributes() const;
|
||||
%Docstring
|
||||
Returns a set of used attributes
|
||||
:rtype: set of str
|
||||
%End
|
||||
|
||||
QString dump() const;
|
||||
%Docstring
|
||||
Dumps the content to an SQL equivalent syntax
|
||||
:rtype: str
|
||||
%End
|
||||
};
|
||||
|
||||
static const QString ALL_ATTRIBUTES;
|
||||
%Docstring
|
||||
A special attribute that if set matches all attributes
|
||||
%End
|
||||
|
||||
QgsFeatureRequest();
|
||||
%Docstring
|
||||
construct a default request: for all features get attributes and geometries
|
||||
%End
|
||||
explicit QgsFeatureRequest( QgsFeatureId fid );
|
||||
%Docstring
|
||||
construct a request with feature ID filter
|
||||
%End
|
||||
explicit QgsFeatureRequest( const QgsFeatureIds &fids );
|
||||
%Docstring
|
||||
construct a request with feature ID filter
|
||||
%End
|
||||
explicit QgsFeatureRequest( const QgsRectangle &rect );
|
||||
%Docstring
|
||||
construct a request with rectangle filter
|
||||
%End
|
||||
explicit QgsFeatureRequest( const QgsExpression &expr, const QgsExpressionContext &context = QgsExpressionContext() );
|
||||
%Docstring
|
||||
construct a request with a filter expression
|
||||
%End
|
||||
QgsFeatureRequest( const QgsFeatureRequest &rh );
|
||||
%Docstring
|
||||
copy constructor
|
||||
%End
|
||||
|
||||
FilterType filterType() const;
|
||||
%Docstring
|
||||
Return the filter type which is currently set on this request
|
||||
|
||||
:return: Filter type
|
||||
:rtype: FilterType
|
||||
%End
|
||||
|
||||
QgsFeatureRequest &setFilterRect( const QgsRectangle &rect );
|
||||
%Docstring
|
||||
Set rectangle from which features will be taken. Empty rectangle removes the filter.
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
const QgsRectangle &filterRect() const;
|
||||
%Docstring
|
||||
Get the rectangle from which features will be taken. If the returned
|
||||
rectangle is null, then no filter rectangle is set.
|
||||
:rtype: QgsRectangle
|
||||
%End
|
||||
|
||||
QgsFeatureRequest &setFilterFid( QgsFeatureId fid );
|
||||
%Docstring
|
||||
Set feature ID that should be fetched.
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
QgsFeatureId filterFid() const;
|
||||
%Docstring
|
||||
Get the feature ID that should be fetched.
|
||||
:rtype: QgsFeatureId
|
||||
%End
|
||||
|
||||
QgsFeatureRequest &setFilterFids( const QgsFeatureIds &fids );
|
||||
%Docstring
|
||||
Set feature IDs that should be fetched.
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
const QgsFeatureIds &filterFids() const;
|
||||
%Docstring
|
||||
Get feature IDs that should be fetched.
|
||||
:rtype: QgsFeatureIds
|
||||
%End
|
||||
|
||||
QgsFeatureRequest &setInvalidGeometryCheck( InvalidGeometryCheck check );
|
||||
%Docstring
|
||||
Sets invalid geometry checking behavior.
|
||||
.. note::
|
||||
|
||||
Invalid geometry checking is not performed when retrieving features
|
||||
directly from a QgsVectorDataProvider.
|
||||
.. seealso:: invalidGeometryCheck()
|
||||
.. versionadded:: 3.0
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
InvalidGeometryCheck invalidGeometryCheck() const;
|
||||
%Docstring
|
||||
Returns the invalid geometry checking behavior.
|
||||
.. seealso:: setInvalidGeometryCheck()
|
||||
.. versionadded:: 3.0
|
||||
:rtype: InvalidGeometryCheck
|
||||
%End
|
||||
|
||||
QgsFeatureRequest &setInvalidGeometryCallback( SIP_PYCALLABLE / AllowNone / );
|
||||
%Docstring
|
||||
Sets a callback function to use when encountering an invalid geometry and
|
||||
invalidGeometryCheck() is set to GeometryAbortOnInvalid. This function will be
|
||||
called using the feature with invalid geometry as a parameter.
|
||||
.. versionadded:: 3.0
|
||||
.. seealso:: invalidGeometryCallback()
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
%MethodCode
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
||||
sipCpp->setInvalidGeometryCallback( [a0]( const QgsFeature &arg )
|
||||
{
|
||||
SIP_BLOCK_THREADS
|
||||
Py_XDECREF( sipCallMethod( NULL, a0, "D", &arg, sipType_QgsFeature, NULL ) );
|
||||
SIP_UNBLOCK_THREADS
|
||||
} );
|
||||
|
||||
sipRes = sipCpp;
|
||||
|
||||
Py_END_ALLOW_THREADS
|
||||
%End
|
||||
|
||||
/**
|
||||
* Returns the callback function to use when encountering an invalid geometry and
|
||||
* invalidGeometryCheck() is set to GeometryAbortOnInvalid.
|
||||
* \since QGIS 3.0
|
||||
* \note not available in Python bindings
|
||||
* \see setInvalidGeometryCallback()
|
||||
*/
|
||||
// std::function< void( const QgsFeature & ) > invalidGeometryCallback() const;
|
||||
|
||||
/** Set the filter expression. {@see QgsExpression}
|
||||
* @param expression expression string
|
||||
* @see filterExpression
|
||||
* @see setExpressionContext
|
||||
*/
|
||||
QgsFeatureRequest &setFilterExpression( const QString &expression );
|
||||
%Docstring
|
||||
.. seealso:: QgsExpression}
|
||||
\param expression expression string
|
||||
.. seealso:: filterExpression
|
||||
.. seealso:: setExpressionContext
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
/** Returns the filter expression if set.
|
||||
* @see setFilterExpression
|
||||
* @see expressionContext
|
||||
*/
|
||||
QgsExpression *filterExpression() const;
|
||||
%Docstring
|
||||
Returns the filter expression if set.
|
||||
.. seealso:: setFilterExpression
|
||||
.. seealso:: expressionContext
|
||||
:rtype: QgsExpression
|
||||
%End
|
||||
|
||||
/** Modifies the existing filter expression to add an additional expression filter. The
|
||||
* filter expressions are combined using AND, so only features matching both
|
||||
* the existing expression and the additional expression will be returned.
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
QgsFeatureRequest &combineFilterExpression( const QString &expression );
|
||||
%Docstring
|
||||
Modifies the existing filter expression to add an additional expression filter. The
|
||||
filter expressions are combined using AND, so only features matching both
|
||||
the existing expression and the additional expression will be returned.
|
||||
.. versionadded:: 2.14
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
/** Returns the expression context used to evaluate filter expressions.
|
||||
* @note added in QGIS 2.12
|
||||
* @see setExpressionContext
|
||||
* @see filterExpression
|
||||
*/
|
||||
QgsExpressionContext *expressionContext();
|
||||
%Docstring
|
||||
Returns the expression context used to evaluate filter expressions.
|
||||
.. versionadded:: 2.12
|
||||
.. seealso:: setExpressionContext
|
||||
.. seealso:: filterExpression
|
||||
:rtype: QgsExpressionContext
|
||||
%End
|
||||
|
||||
/** Sets the expression context used to evaluate filter expressions.
|
||||
* @note added in QGIS 2.12
|
||||
* @see expressionContext
|
||||
* @see setFilterExpression
|
||||
*/
|
||||
QgsFeatureRequest &setExpressionContext( const QgsExpressionContext &context );
|
||||
%Docstring
|
||||
Sets the expression context used to evaluate filter expressions.
|
||||
.. versionadded:: 2.12
|
||||
.. seealso:: expressionContext
|
||||
.. seealso:: setFilterExpression
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
/**
|
||||
* Disables filter conditions.
|
||||
* The spatial filter (filterRect) will be kept in place.
|
||||
*
|
||||
* @return The object the method is called on for chaining
|
||||
*
|
||||
* @note Added in 2.12
|
||||
*/
|
||||
QgsFeatureRequest &disableFilter();
|
||||
%Docstring
|
||||
Disables filter conditions.
|
||||
The spatial filter (filterRect) will be kept in place.
|
||||
|
||||
:return: The object the method is called on for chaining
|
||||
|
||||
.. versionadded:: 2.12
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
/**
|
||||
* Adds a new OrderByClause, appending it as the least important one.
|
||||
*
|
||||
* @param expression The expression to use for ordering
|
||||
* @param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
|
||||
* If the order is ascending, by default nulls are last
|
||||
* If the order is descending, by default nulls are first
|
||||
*
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
|
||||
QgsFeatureRequest &addOrderBy( const QString &expression, bool ascending = true );
|
||||
/**
|
||||
* Adds a new OrderByClause, appending it as the least important one.
|
||||
*
|
||||
* @param expression The expression to use for ordering
|
||||
* @param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
|
||||
* @param nullsfirst If true, NULLS are at the beginning, if false, NULLS are at the end
|
||||
*
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
%Docstring
|
||||
Adds a new OrderByClause, appending it as the least important one.
|
||||
|
||||
\param expression The expression to use for ordering
|
||||
\param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
|
||||
If the order is ascending, by default nulls are last
|
||||
If the order is descending, by default nulls are first
|
||||
|
||||
.. versionadded:: 2.14
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
QgsFeatureRequest &addOrderBy( const QString &expression, bool ascending, bool nullsfirst );
|
||||
%Docstring
|
||||
Adds a new OrderByClause, appending it as the least important one.
|
||||
|
||||
/**
|
||||
* Return a list of order by clauses specified for this feature request.
|
||||
*
|
||||
* @note added in 2.14
|
||||
*/
|
||||
QgsFeatureRequest::OrderBy orderBy() const;
|
||||
\param expression The expression to use for ordering
|
||||
\param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
|
||||
\param nullsfirst If true, NULLS are at the beginning, if false, NULLS are at the end
|
||||
|
||||
/**
|
||||
* Set a list of order by clauses.
|
||||
*
|
||||
* @note added in 2.14
|
||||
*/
|
||||
QgsFeatureRequest &setOrderBy( const QgsFeatureRequest::OrderBy &orderBy );
|
||||
.. versionadded:: 2.14
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
OrderBy orderBy() const;
|
||||
%Docstring
|
||||
Return a list of order by clauses specified for this feature request.
|
||||
|
||||
.. versionadded:: 2.14
|
||||
:rtype: OrderBy
|
||||
%End
|
||||
|
||||
QgsFeatureRequest &setOrderBy( const OrderBy &orderBy );
|
||||
%Docstring
|
||||
Set a list of order by clauses.
|
||||
|
||||
.. versionadded:: 2.14
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
/** Set the maximum number of features to request.
|
||||
* @param limit maximum number of features, or -1 to request all features.
|
||||
* @see limit()
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
QgsFeatureRequest &setLimit( long limit );
|
||||
%Docstring
|
||||
Set the maximum number of features to request.
|
||||
\param limit maximum number of features, or -1 to request all features.
|
||||
.. seealso:: limit()
|
||||
.. versionadded:: 2.14
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
/** Returns the maximum number of features to request, or -1 if no limit set.
|
||||
* @see setLimit
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
long limit() const;
|
||||
%Docstring
|
||||
Returns the maximum number of features to request, or -1 if no limit set.
|
||||
.. seealso:: setLimit
|
||||
.. versionadded:: 2.14
|
||||
:rtype: long
|
||||
%End
|
||||
|
||||
//! Set flags that affect how features will be fetched
|
||||
QgsFeatureRequest &setFlags( const Flags &flags );
|
||||
QgsFeatureRequest &setFlags( QgsFeatureRequest::Flags flags );
|
||||
%Docstring
|
||||
Set flags that affect how features will be fetched
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
const Flags &flags() const;
|
||||
%Docstring
|
||||
:rtype: Flags
|
||||
%End
|
||||
|
||||
//! Set a subset of attributes that will be fetched. Empty list means that all attributes are used.
|
||||
//! To disable fetching attributes, reset the FetchAttributes flag (which is set by default)
|
||||
QgsFeatureRequest &setSubsetOfAttributes( const QgsAttributeList &attrs );
|
||||
/**
|
||||
* Return the subset of attributes which at least need to be fetched
|
||||
* @return A list of attributes to be fetched
|
||||
*/
|
||||
%Docstring
|
||||
To disable fetching attributes, reset the FetchAttributes flag (which is set by default)
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
QgsAttributeList subsetOfAttributes() const;
|
||||
%Docstring
|
||||
Return the subset of attributes which at least need to be fetched
|
||||
:return: A list of attributes to be fetched
|
||||
:rtype: QgsAttributeList
|
||||
%End
|
||||
|
||||
//! Set a subset of attributes by names that will be fetched
|
||||
QgsFeatureRequest &setSubsetOfAttributes( const QStringList &attrNames, const QgsFields &fields );
|
||||
%Docstring
|
||||
Set a subset of attributes by names that will be fetched
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
QgsFeatureRequest &setSubsetOfAttributes( const QSet<QString> &attrNames, const QgsFields &fields );
|
||||
%Docstring
|
||||
Set a subset of attributes by names that will be fetched
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
|
||||
//! Set a simplification method for geometries that will be fetched
|
||||
//! @note added in 2.2
|
||||
QgsFeatureRequest &setSimplifyMethod( const QgsSimplifyMethod &simplifyMethod );
|
||||
//! Get simplification method for geometries that will be fetched
|
||||
//! @note added in 2.2
|
||||
%Docstring
|
||||
.. versionadded:: 2.2
|
||||
:rtype: QgsFeatureRequest
|
||||
%End
|
||||
const QgsSimplifyMethod &simplifyMethod() const;
|
||||
%Docstring
|
||||
.. versionadded:: 2.2
|
||||
:rtype: QgsSimplifyMethod
|
||||
%End
|
||||
|
||||
/**
|
||||
* Check if a feature is accepted by this requests filter
|
||||
*
|
||||
* @param feature The feature which will be tested
|
||||
*
|
||||
* @return true, if the filter accepts the feature
|
||||
*
|
||||
* @note added in 2.1
|
||||
*/
|
||||
bool acceptFeature( const QgsFeature &feature );
|
||||
%Docstring
|
||||
Check if a feature is accepted by this requests filter
|
||||
|
||||
\param feature The feature which will be tested
|
||||
|
||||
:return: true, if the filter accepts the feature
|
||||
|
||||
.. versionadded:: 2.1
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
QFlags<QgsFeatureRequest::Flag> operator|(QgsFeatureRequest::Flag f1, QFlags<QgsFeatureRequest::Flag> f2);
|
||||
|
||||
|
||||
|
||||
|
||||
/** Base class that can be used for any class that is capable of returning features
|
||||
* @note added in 2.4
|
||||
*/
|
||||
class QgsAbstractFeatureSource
|
||||
{
|
||||
%Docstring
|
||||
Base class that can be used for any class that is capable of returning features
|
||||
.. versionadded:: 2.4
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <qgsfeaturerequest.h>
|
||||
#include "qgsfeaturerequest.h"
|
||||
%End
|
||||
public:
|
||||
virtual ~QgsAbstractFeatureSource();
|
||||
|
||||
/**
|
||||
* Get an iterator for features matching the specified request
|
||||
* @param request The request
|
||||
* @return A feature iterator
|
||||
*/
|
||||
virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) = 0;
|
||||
%Docstring
|
||||
Get an iterator for features matching the specified request
|
||||
\param request The request
|
||||
:return: A feature iterator
|
||||
:rtype: QgsFeatureIterator
|
||||
%End
|
||||
|
||||
protected:
|
||||
void iteratorOpened( QgsAbstractFeatureIterator *it );
|
||||
void iteratorClosed( QgsAbstractFeatureIterator *it );
|
||||
|
||||
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/qgsfeaturerequest.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
@ -60,9 +60,6 @@ class QgsField
|
||||
virtual ~QgsField();
|
||||
|
||||
bool operator==( const QgsField &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
bool operator!=( const QgsField &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
|
@ -125,9 +125,6 @@ class QgsFieldConstraints
|
||||
%End
|
||||
|
||||
bool operator==( const QgsFieldConstraints &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
};
|
||||
|
||||
|
@ -275,10 +275,6 @@ Utility function to return a list of QgsField instances
|
||||
%End
|
||||
|
||||
bool operator==( const QgsFields &other ) const;
|
||||
%Docstring
|
||||
.. versionadded:: 2.6
|
||||
:rtype: bool
|
||||
%End
|
||||
bool operator!=( const QgsFields &other ) const;
|
||||
%Docstring
|
||||
.. versionadded:: 2.6
|
||||
|
@ -173,9 +173,6 @@ Seconds per minute
|
||||
%End
|
||||
|
||||
bool operator==( QgsInterval other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
static QgsInterval fromString( const QString &string );
|
||||
%Docstring
|
||||
|
@ -62,10 +62,6 @@ Return the ID of the layer this dependency depends on
|
||||
%End
|
||||
|
||||
bool operator==( const QgsMapLayerDependency &other ) const;
|
||||
%Docstring
|
||||
Comparison operator
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
//! hash operator
|
||||
long __hash__() const;
|
||||
|
@ -68,9 +68,6 @@ The maximum size in millimeters, or 0.0 if unset
|
||||
%End
|
||||
|
||||
bool operator==( const QgsMapUnitScale &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
bool operator!=( const QgsMapUnitScale &other ) const;
|
||||
%Docstring
|
||||
|
@ -1,3 +1,14 @@
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/qgsoptionalexpression.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsOptionalExpression
|
||||
{
|
||||
%Docstring
|
||||
@ -34,52 +45,50 @@ class QgsOptionalExpression
|
||||
%End
|
||||
|
||||
|
||||
/**
|
||||
* Compare this QgsOptionalExpression to another one.
|
||||
*
|
||||
* This will compare the enabled flag and call the == operator
|
||||
* of the contained class.
|
||||
*
|
||||
* @note Added in QGIS 3.0
|
||||
*/
|
||||
|
||||
int operator== ( const QgsOptionalExpression &other ) const;
|
||||
%MethodCode
|
||||
sipRes = *sipCpp == *a0;
|
||||
sipRes = *sipCpp == *a0;
|
||||
%End
|
||||
|
||||
|
||||
int __bool__() const;
|
||||
%Docstring
|
||||
:rtype: int
|
||||
%End
|
||||
%MethodCode
|
||||
sipRes = sipCpp->enabled();
|
||||
sipRes = sipCpp->enabled();
|
||||
%End
|
||||
|
||||
/**
|
||||
* Check if this optional is enabled
|
||||
*
|
||||
* @note Added in QGIS 3.0
|
||||
*/
|
||||
bool enabled() const;
|
||||
%Docstring
|
||||
Check if this optional is enabled
|
||||
|
||||
.. versionadded:: 3.0
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/**
|
||||
* Set if this optional is enabled
|
||||
*
|
||||
* @note Added in QGIS 3.0
|
||||
*/
|
||||
void setEnabled( bool enabled );
|
||||
%Docstring
|
||||
Set if this optional is enabled
|
||||
|
||||
.. versionadded:: 3.0
|
||||
%End
|
||||
|
||||
/**
|
||||
* Access the payload data
|
||||
*
|
||||
* @note Added in QGIS 3.0
|
||||
*/
|
||||
QgsExpression data() const;
|
||||
%Docstring
|
||||
Access the payload data
|
||||
|
||||
.. versionadded:: 3.0
|
||||
:rtype: QgsExpression
|
||||
%End
|
||||
|
||||
/**
|
||||
* Set the payload data
|
||||
*
|
||||
* @note Added in QGIS 3.0
|
||||
*/
|
||||
void setData( const QgsExpression &data );
|
||||
%Docstring
|
||||
Set the payload data
|
||||
|
||||
.. versionadded:: 3.0
|
||||
%End
|
||||
|
||||
void writeXml( QDomElement &element );
|
||||
%Docstring
|
||||
@ -98,3 +107,14 @@ class QgsOptionalExpression
|
||||
.. versionadded:: 2.18
|
||||
%End
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/qgsoptionalexpression.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
@ -213,10 +213,6 @@ Calculates azimuth between this point and other one (clockwise in degree, starti
|
||||
%End
|
||||
|
||||
bool operator==( const QgsPoint &other );
|
||||
%Docstring
|
||||
equality operator
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
bool operator!=( const QgsPoint &other ) const;
|
||||
%Docstring
|
||||
|
@ -196,9 +196,6 @@ Copy constructor
|
||||
%End
|
||||
|
||||
bool operator==( const QgsProperty &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
bool operator!=( const QgsProperty &other ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
|
@ -141,10 +141,6 @@ Swaps the sign of the x and y components of the vector.
|
||||
%End
|
||||
|
||||
bool operator==( QgsVector other ) const;
|
||||
%Docstring
|
||||
Equality operator
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
bool operator!=( QgsVector other ) const;
|
||||
%Docstring
|
||||
|
@ -92,7 +92,7 @@ sub dbg_info
|
||||
}
|
||||
}
|
||||
|
||||
sub remove_constructor_or_body {
|
||||
sub detect_following_body_or_list {
|
||||
# https://regex101.com/r/ZaP3tC/4
|
||||
do {no warnings 'uninitialized';
|
||||
if ( $line =~ m/^(\s*)?(explicit )?(virtual )?(static |const )*(([\w:]+(<.*?>)?\s+[*&]?)?(~?\w+|(\w+::)?operator.{1,2})\(([\w=()\/ ,&*<>."-]|::)*\)( (?:const|SIP_[A-Z_]*?))*)\s*((\s*[:,]\s+\w+\(.*\))*\s*\{.*\};?|(?!;))(\s*\/\/.*)?$/
|
||||
@ -100,30 +100,34 @@ sub remove_constructor_or_body {
|
||||
|| $line =~ m/^\s*class.*SIP_SKIP/ ){
|
||||
dbg_info("remove constructor definition, function bodies, member initializing list");
|
||||
my $newline = "$1$2$3$4$5;";
|
||||
if ($line !~ m/{.*}(\s*SIP_\w+)*\s*(\/\/.*)?$/){
|
||||
dbg_info(" go for multiline");
|
||||
remove_initializerlist_or_body() unless $line =~ m/{.*}(\s*SIP_\w+)*\s*(\/\/.*)?$/;
|
||||
$line = $newline;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
sub remove_initializerlist_or_body {
|
||||
do {no warnings 'uninitialized';
|
||||
dbg_info("remove constructor definition, function bodies, member initializing list");
|
||||
$line = $lines[$line_idx];
|
||||
$line_idx++;
|
||||
while ( $line =~ m/^\s*[:,]\s+([\w<>]|::)+\(.*?\)/){
|
||||
dbg_info(" member initializing list");
|
||||
$line = $lines[$line_idx];
|
||||
$line_idx++;
|
||||
}
|
||||
if ( $line =~ m/^\s*\{/ ){
|
||||
my $nesting_index = 0;
|
||||
while ($line_idx < $line_count){
|
||||
dbg_info(" remove body");
|
||||
$nesting_index += $line =~ tr/\{//;
|
||||
$nesting_index -= $line =~ tr/\}//;
|
||||
if ($nesting_index == 0){
|
||||
last;
|
||||
}
|
||||
$line = $lines[$line_idx];
|
||||
$line_idx++;
|
||||
while ( $line =~ m/^\s*[:,]\s+[\w<>]+\(.*?\)/){
|
||||
dbg_info(" member initializing list");
|
||||
$line = $lines[$line_idx];
|
||||
$line_idx++;
|
||||
}
|
||||
if ( $line =~ m/^\s*\{/ ){
|
||||
my $nesting_index = 0;
|
||||
while ($line_idx < $line_count){
|
||||
dbg_info(" remove body");
|
||||
$nesting_index += $line =~ tr/\{//;
|
||||
$nesting_index -= $line =~ tr/\}//;
|
||||
if ($nesting_index == 0){
|
||||
last;
|
||||
}
|
||||
$line = $lines[$line_idx];
|
||||
$line_idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$line = $newline;
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -226,8 +230,8 @@ while ($line_idx < $line_count){
|
||||
if ($line =~ m/^\s*#/){
|
||||
|
||||
# skip #if 0 blocks
|
||||
if ( $line =~ m/^\s*#if 0/){
|
||||
dbg_info("skipping #if 0 block");
|
||||
if ( $line =~ m/^\s*#if (0|defined\(Q_OS_WIN\))/){
|
||||
dbg_info("skipping #if $1 block");
|
||||
my $nesting_index = 0;
|
||||
while ($line_idx < $line_count){
|
||||
$line = $lines[$line_idx];
|
||||
@ -356,7 +360,7 @@ while ($line_idx < $line_count){
|
||||
$MULTILINE_DEFINITION = 0;
|
||||
}
|
||||
# also skip method body if there is one
|
||||
remove_constructor_or_body();
|
||||
detect_following_body_or_list();
|
||||
# line skipped, go to next iteration
|
||||
next;
|
||||
}
|
||||
@ -446,11 +450,13 @@ while ($line_idx < $line_count){
|
||||
}
|
||||
|
||||
# class declaration started
|
||||
# https://regex101.com/r/6FWntP/2
|
||||
if ( $line =~ m/^(\s*class)\s+([A-Z]+_EXPORT)?\s+(\w+)(\s*\:\s*(public|private)\s+\w+(<\w+>)?(::\w+(<\w+>)?)*(,\s*(public|private)\s+\w+(<\w+>)?(::\w+(<\w+>)?)*)*)?(?<annot>\s*SIP_.*)?$/ ){
|
||||
# https://regex101.com/r/6FWntP/5
|
||||
if ( $line =~ m/^(\s*class)\s+([A-Z]+_EXPORT\s+)?(\w+)(\s*\:\s*(public|private)\s+\w+(<([\w]|::)+>)?(::\w+(<\w+>)?)*(,\s*(public|private)\s+\w+(<([\w]|::)+>)?(::\w+(<\w+>)?)*)*)?(?<annot>\s*SIP_.*)?$/ ){
|
||||
dbg_info("class definition started => private");
|
||||
push @ACCESS, PRIVATE;
|
||||
push @global_bracket_nesting_index, 0;
|
||||
my @template_inheritance_template = ();
|
||||
my @template_inheritance_class = ();
|
||||
do {no warnings 'uninitialized';
|
||||
$classname = $3;
|
||||
$line =~ m/\b[A-Z]+_EXPORT\b/ or die "Class $classname in $headerfile should be exported with appropriate [LIB]_EXPORT macro. If this should not be available in python, wrap it in a `#ifndef SIP_RUN` block.";
|
||||
@ -460,8 +466,15 @@ while ($line_idx < $line_count){
|
||||
if ($4){
|
||||
my $m = $4;
|
||||
$m =~ s/public //g;
|
||||
$m =~ s/[,:]?\s*private \w+(::\w+)?//;
|
||||
$m =~ s/(\s*:)?\s*$//;
|
||||
$m =~ s/[,:]?\s*private \w+(::\w+)?//g;
|
||||
while ($m =~ /[,:]\s+(\w+)<((\w|::)+)>/g){
|
||||
dbg_info("template class");
|
||||
push @template_inheritance_template, $1;
|
||||
push @template_inheritance_class, $2;
|
||||
}
|
||||
$m =~ s/\w+<(\w|::)+>//g; # remove template Inheritance, not handled at the moment (see commented lines below)
|
||||
$m =~ s/([:,])\s*,/$1/g;
|
||||
$m =~ s/(\s*[:,])?\s*$//;
|
||||
$line .= $m;
|
||||
}
|
||||
if (defined $+{annot})
|
||||
@ -475,7 +488,14 @@ while ($line_idx < $line_count){
|
||||
$line .= "%Docstring\n$comment\n%End\n";
|
||||
}
|
||||
$line .= "\n%TypeHeaderCode\n#include \"" . basename($headerfile) . "\"";
|
||||
|
||||
# see https://www.riverbankcomputing.com/pipermail/pyqt/2015-May/035893.html
|
||||
# this doesn't work as expected since it leads to double definitions (typedef vs class)
|
||||
# while (@template_inheritance_template) {
|
||||
# my $tpl = pop @template_inheritance_template;
|
||||
# my $cls = pop @template_inheritance_class;
|
||||
# $line .= "\n#include \"" . lc $tpl . ".h\"";
|
||||
# $line .= "\ntypedef $tpl<$cls> $classname;";
|
||||
# }
|
||||
push @output, dbg("CLS")."$line\n";
|
||||
|
||||
# Skip opening curly bracket, we already added that above
|
||||
@ -524,7 +544,10 @@ while ($line_idx < $line_count){
|
||||
}
|
||||
|
||||
# skip non-method member declaration in non-public sections
|
||||
if ( $SIP_RUN != 1 && $ACCESS[$#ACCESS] != PUBLIC && $line =~ m/^\s*(?:mutable\s)?\w+[\w<> *&:,]* \*?\w+( = \w+(\([^()]+\))?)?;/){
|
||||
# https://regex101.com/r/gUBZUk/7
|
||||
if ( $SIP_RUN != 1 &&
|
||||
$ACCESS[$#ACCESS] != PUBLIC &&
|
||||
$line =~ m/^\s*(?:template<\w+>\s+)?(?:(const|mutable|static|friend|unsigned)\s+)*\w+(::\w+)?(<([\w<> *&,()]|::)+>)? \*?\w+( = (-?\d+(\.\d+)?|\w+(\([^()]+\))?))?;/){
|
||||
dbg_info("skip non-method member declaration in non-public sections");
|
||||
next;
|
||||
}
|
||||
@ -586,7 +609,7 @@ while ($line_idx < $line_count){
|
||||
$line =~ s/\s*=\s*default\b//g;
|
||||
|
||||
# remove constructor definition, function bodies, member initializing list
|
||||
$SIP_RUN == 1 or remove_constructor_or_body();
|
||||
$SIP_RUN == 1 or detect_following_body_or_list();
|
||||
|
||||
# remove inline declarations
|
||||
if ( $line =~ m/^(\s*)?(static |const )*(([\w:]+(<.*?>)?\s+(\*|&)?)?(\w+)( (?:const*?))*)\s*(\{.*\});(\s*\/\/.*)?$/ ){
|
||||
@ -639,30 +662,10 @@ while ($line_idx < $line_count){
|
||||
$MULTILINE_DEFINITION = 0;
|
||||
dbg_info("ending multiline");
|
||||
# remove potential following body
|
||||
|
||||
|
||||
if ( $SIP_RUN == 0 && $line !~ m/(\{.*\}|;)\s*(\/\/.*)?$/ ){
|
||||
dbg_info("remove following body of multiline def");
|
||||
my $last_line = $line;
|
||||
$line = $lines[$line_idx];
|
||||
$line_idx++;
|
||||
while ( $line =~ m/^\s*[:,]\s+[\w<>]+\(.*?\)/){
|
||||
dbg_info(" member initializing list");
|
||||
$line = $lines[$line_idx];
|
||||
$line_idx++;
|
||||
}
|
||||
my $nesting_index = 1;
|
||||
if ( $line =~ m/^\s*\{$/ ){
|
||||
while ($line_idx < $line_count){
|
||||
$line = $lines[$line_idx];
|
||||
$line_idx++;
|
||||
$nesting_index += $line =~ tr/\{//;
|
||||
$nesting_index -= $line =~ tr/\}//;
|
||||
if ($nesting_index == 0){
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
remove_initializerlist_or_body();
|
||||
# add missing semi column
|
||||
my $dummy = pop(@output);
|
||||
push @output, dbg("MLT")."$last_line;\n";
|
||||
@ -689,6 +692,7 @@ while ($line_idx < $line_count){
|
||||
$line =~ m/\s*typedef / ||
|
||||
$line =~ m/\s*struct / ||
|
||||
$line =~ m/operator\[\]\(/ ||
|
||||
$line =~ m/operator==/ ||
|
||||
($line =~ m/operator[!+-=*\/\[\]]{1,2}/ && $#ACCESS == 0) || # apparently global operators cannot be documented
|
||||
$line =~ m/^\s*%\w+(.*)?$/ ){
|
||||
dbg_info('skipping comment');
|
||||
|
@ -337,15 +337,15 @@ class CORE_EXPORT QgsExpressionContext
|
||||
* Ownership of the scopes is transferred to the stack.
|
||||
* \since QGIS 3.0
|
||||
*/
|
||||
explicit QgsExpressionContext( const QList<QgsExpressionContextScope *> &scopes );
|
||||
explicit QgsExpressionContext( const QList<QgsExpressionContextScope *> &scopes SIP_TRANSFER );
|
||||
|
||||
/** Copy constructor
|
||||
*/
|
||||
QgsExpressionContext( const QgsExpressionContext &other );
|
||||
|
||||
QgsExpressionContext &operator=( const QgsExpressionContext &other );
|
||||
QgsExpressionContext &operator=( const QgsExpressionContext &other ) SIP_SKIP;
|
||||
|
||||
QgsExpressionContext &operator=( QgsExpressionContext &&other ) noexcept;
|
||||
QgsExpressionContext &operator=( QgsExpressionContext &&other ) noexcept SIP_SKIP;
|
||||
|
||||
~QgsExpressionContext();
|
||||
|
||||
@ -498,7 +498,7 @@ class CORE_EXPORT QgsExpressionContext
|
||||
* \param scopes scopes to append to context
|
||||
* \since QGIS 3.0
|
||||
*/
|
||||
void appendScopes( const QList<QgsExpressionContextScope *> &scopes );
|
||||
void appendScopes( const QList<QgsExpressionContextScope *> &scopes SIP_TRANSFER );
|
||||
|
||||
/**
|
||||
* Removes the last scope from the expression context and return it.
|
||||
@ -690,7 +690,7 @@ class CORE_EXPORT QgsExpressionContextUtils
|
||||
/** Creates a list of three scopes: global, layer's project and layer.
|
||||
* \since QGIS 3.0
|
||||
*/
|
||||
static QList<QgsExpressionContextScope *> globalProjectLayerScopes( const QgsMapLayer *layer );
|
||||
static QList<QgsExpressionContextScope *> globalProjectLayerScopes( const QgsMapLayer *layer ) SIP_FACTORY;
|
||||
|
||||
/** Sets a layer context variable. This variable will be contained within scopes retrieved via
|
||||
* layerScope().
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "qgsexpressioncontext.h"
|
||||
#include "qgssimplifymethod.h"
|
||||
|
||||
typedef QList<int> QgsAttributeList;
|
||||
|
||||
|
||||
/** \ingroup core
|
||||
* This class wraps a request for features to a vector layer (or directly its vector data provider).
|
||||
@ -208,27 +208,28 @@ class CORE_EXPORT QgsFeatureRequest
|
||||
bool mNullsFirst;
|
||||
};
|
||||
|
||||
|
||||
/** \ingroup core
|
||||
* Represents a list of OrderByClauses, with the most important first and the least
|
||||
* important last.
|
||||
*
|
||||
* \since QGIS 2.14
|
||||
*/
|
||||
class OrderBy : public QList<OrderByClause>
|
||||
class CORE_EXPORT OrderBy : public QList<QgsFeatureRequest::OrderByClause>
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Create a new empty order by
|
||||
*/
|
||||
CORE_EXPORT OrderBy()
|
||||
: QList<OrderByClause>()
|
||||
OrderBy()
|
||||
: QList<QgsFeatureRequest::OrderByClause>()
|
||||
{}
|
||||
|
||||
/**
|
||||
* Create a new order by from a list of clauses
|
||||
*/
|
||||
CORE_EXPORT OrderBy( const QList<OrderByClause> &other );
|
||||
OrderBy( const QList<QgsFeatureRequest::OrderByClause> &other );
|
||||
|
||||
/**
|
||||
* Get a copy as a list of OrderByClauses
|
||||
@ -236,27 +237,27 @@ class CORE_EXPORT QgsFeatureRequest
|
||||
* This is only required in Python where the inheritance
|
||||
* is not properly propagated and this makes it usable.
|
||||
*/
|
||||
QList<OrderByClause> CORE_EXPORT list() const;
|
||||
QList<QgsFeatureRequest::OrderByClause> list() const;
|
||||
|
||||
/**
|
||||
* Serialize to XML
|
||||
*/
|
||||
void CORE_EXPORT save( QDomElement &elem ) const;
|
||||
void save( QDomElement &elem ) const;
|
||||
|
||||
/**
|
||||
* Deserialize from XML
|
||||
*/
|
||||
void CORE_EXPORT load( const QDomElement &elem );
|
||||
void load( const QDomElement &elem );
|
||||
|
||||
/**
|
||||
* Returns a set of used attributes
|
||||
*/
|
||||
QSet<QString> CORE_EXPORT usedAttributes() const;
|
||||
QSet<QString> usedAttributes() const;
|
||||
|
||||
/**
|
||||
* Dumps the content to an SQL equivalent syntax
|
||||
*/
|
||||
QString CORE_EXPORT dump() const;
|
||||
QString dump() const;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -330,7 +331,25 @@ class CORE_EXPORT QgsFeatureRequest
|
||||
* \since QGIS 3.0
|
||||
* \see invalidGeometryCallback()
|
||||
*/
|
||||
#ifndef SIP_RUN
|
||||
QgsFeatureRequest &setInvalidGeometryCallback( std::function< void( const QgsFeature & ) > callback );
|
||||
#else
|
||||
QgsFeatureRequest &setInvalidGeometryCallback( SIP_PYCALLABLE / AllowNone / );
|
||||
% MethodCode
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
||||
sipCpp->setInvalidGeometryCallback( [a0]( const QgsFeature &arg )
|
||||
{
|
||||
SIP_BLOCK_THREADS
|
||||
Py_XDECREF( sipCallMethod( NULL, a0, "D", &arg, sipType_QgsFeature, NULL ) );
|
||||
SIP_UNBLOCK_THREADS
|
||||
} );
|
||||
|
||||
sipRes = sipCpp;
|
||||
|
||||
Py_END_ALLOW_THREADS
|
||||
% End
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the callback function to use when encountering an invalid geometry and
|
||||
|
@ -54,6 +54,59 @@ class CORE_EXPORT QgsOptionalExpression : public QgsOptional<QgsExpression>
|
||||
*/
|
||||
QgsOptionalExpression( const QgsExpression &expression, bool enabled );
|
||||
|
||||
|
||||
// SIP does not handle properly template class Inheritance at the moment
|
||||
// following is copied from QgsOptional header
|
||||
#ifdef SIP_RUN
|
||||
|
||||
/**
|
||||
* Compare this QgsOptionalExpression to another one.
|
||||
*
|
||||
* This will compare the enabled flag and call the == operator
|
||||
* of the contained class.
|
||||
*
|
||||
* @note Added in QGIS 3.0
|
||||
*/
|
||||
int operator== ( const QgsOptionalExpression &other ) const;
|
||||
% MethodCode
|
||||
sipRes = *sipCpp == *a0;
|
||||
% End
|
||||
|
||||
|
||||
int __bool__() const;
|
||||
% MethodCode
|
||||
sipRes = sipCpp->enabled();
|
||||
% End
|
||||
|
||||
/**
|
||||
* Check if this optional is enabled
|
||||
*
|
||||
* \since QGIS 3.0
|
||||
*/
|
||||
bool enabled() const;
|
||||
|
||||
/**
|
||||
* Set if this optional is enabled
|
||||
*
|
||||
* \since QGIS 3.0
|
||||
*/
|
||||
void setEnabled( bool enabled );
|
||||
|
||||
/**
|
||||
* Access the payload data
|
||||
*
|
||||
* \since QGIS 3.0
|
||||
*/
|
||||
QgsExpression data() const;
|
||||
|
||||
/**
|
||||
* Set the payload data
|
||||
*
|
||||
* \since QGIS 3.0
|
||||
*/
|
||||
void setData( const QgsExpression &data );
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Save the optional expression to the provided QDomElement.
|
||||
*
|
||||
@ -72,8 +125,10 @@ class CORE_EXPORT QgsOptionalExpression : public QgsOptional<QgsExpression>
|
||||
void readXml( const QDomElement &element );
|
||||
};
|
||||
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
template CORE_EXPORT QgsOptional<QgsExpression>;
|
||||
#endif
|
||||
|
||||
|
||||
#endif // QGSOPTIONALEXPRESSION_H
|
||||
|
@ -44,7 +44,7 @@ typedef QVector<QVariant> QgsSuperClass;
|
||||
%End
|
||||
}
|
||||
|
||||
class QgsSipifyHeader : QtClass<QVariant>
|
||||
class QgsSipifyHeader
|
||||
{
|
||||
%Docstring
|
||||
Documentation goes here
|
||||
@ -125,10 +125,6 @@ Default constructor
|
||||
|
||||
|
||||
bool operator==( const QgsSipifyHeader other );
|
||||
%Docstring
|
||||
Comparison operator should be kept
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
void multilineMethod( const QgsPoint &startPoint,
|
||||
QgsFeatureId featureId,
|
||||
@ -391,6 +387,42 @@ A constructor
|
||||
QFlags<QgsSipifyHeader::MyEnum> operator|(QgsSipifyHeader::MyEnum f1, QFlags<QgsSipifyHeader::MyEnum> f2);
|
||||
|
||||
|
||||
class TemplateInheritance1
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "sipifyheader.h"
|
||||
%End
|
||||
}
|
||||
class TemplateInheritance2
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "sipifyheader.h"
|
||||
%End
|
||||
}
|
||||
class TemplateInheritance3 : SomethingElse
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "sipifyheader.h"
|
||||
%End
|
||||
}
|
||||
class TemplateInheritance4 : SomethingElse1, SomethingElse2
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "sipifyheader.h"
|
||||
%End
|
||||
}
|
||||
class TemplateInheritance5 : SomethingElse
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "sipifyheader.h"
|
||||
%End
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
|
@ -386,6 +386,18 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
|
||||
Some<Other> memberToSkip;
|
||||
QList<QgsMapLayer *> list2skip;
|
||||
QMap<QString, Qt::CheckState> map2skip;
|
||||
FilterType mFilter = FilterNone;
|
||||
QgsFeatureId mFilterFid = -1;
|
||||
QgsFeatureIds mFilterFids;
|
||||
std::unique_ptr< QgsExpression > mFilterExpression;
|
||||
long mLimit = -1;
|
||||
InvalidGeometryCheck mInvalidGeometryFilter = GeometryNoCheck;
|
||||
std::function< void( const QgsFeature & ) > mInvalidGeometryCallback;
|
||||
static QHash<QString, Help> sFunctionHelpTexts;
|
||||
friend class QgsOgcUtils;
|
||||
template<typename> friend class QgsAbstractFeatureIteratorFromSource;
|
||||
const QgsAbstractGeometry *mGeometry = 0;
|
||||
mutable unsigned char *mP;
|
||||
|
||||
private:
|
||||
void privateMethodAreNotShown();
|
||||
@ -460,5 +472,21 @@ class CORE_EXPORT AbstractClass SIP_ABSTRACT
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsSipifyHeader::Flags )
|
||||
|
||||
class CORE_EXPORT TemplateInheritance1 : public QgsTemplate<Something>
|
||||
{
|
||||
}
|
||||
class CORE_EXPORT TemplateInheritance2 : public QgsTemplate<Something>, private SomethingElse
|
||||
{
|
||||
}
|
||||
class CORE_EXPORT TemplateInheritance3 : public QgsTemplate<Something>, public SomethingElse
|
||||
{
|
||||
}
|
||||
class CORE_EXPORT TemplateInheritance4 : public SomethingElse1, public QgsTemplate<Something>, public SomethingElse2
|
||||
{
|
||||
}
|
||||
class CORE_EXPORT TemplateInheritance5 : public SomethingElse, public QgsTemplate<Something>
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user