Skip to content

Commit

Permalink
Add QgsFeatureSource interface as interface for classes which
Browse files Browse the repository at this point in the history
provide feature iterators via a getFeatures method
  • Loading branch information
nyalldawson committed May 25, 2017
1 parent 13a3f2f commit ce063b8
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/core/core.sip
Expand Up @@ -56,6 +56,7 @@
%Include qgsfeatureiterator.sip
%Include qgsfeaturerequest.sip
%Include qgsfeaturesink.sip
%Include qgsfeaturesource.sip
%Include qgsfeedback.sip
%Include qgsfield.sip
%Include qgsfieldconstraints.sip
Expand Down
43 changes: 43 additions & 0 deletions python/core/qgsfeaturesource.sip
@@ -0,0 +1,43 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfeaturesource.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsFeatureSource
{
%Docstring
An interface for objects which provide features via a getFeatures method.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsfeaturesource.h"
%End
public:

virtual ~QgsFeatureSource();

virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const = 0;
%Docstring
Returns an iterator for the features in the source.
An optional ``request`` can be used to optimise the returned
iterator, eg by restricting the returned attributes or geometry.
:rtype: QgsFeatureIterator
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfeaturesource.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -753,6 +753,7 @@ SET(QGIS_CORE_HDRS
qgsfeatureiterator.h
qgsfeaturerequest.h
qgsfeaturesink.h
qgsfeaturesource.h
qgsfeaturestore.h
qgsfieldformatter.h
qgsfield_p.h
Expand Down
48 changes: 48 additions & 0 deletions src/core/qgsfeaturesource.h
@@ -0,0 +1,48 @@
/***************************************************************************
qgsfeaturesource.h
----------------
begin : May 2017
copyright : (C) 2017 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSFEATURESOURCE_H
#define QGSFEATURESOURCE_H

#include "qgis_core.h"
#include "qgis.h"
#include "qgsfeature.h"
#include "qgsfeatureiterator.h"

/**
* \class QgsFeatureSource
* \ingroup core
* An interface for objects which provide features via a getFeatures method.
*
* \since QGIS 3.0
*/
class CORE_EXPORT QgsFeatureSource
{
public:

virtual ~QgsFeatureSource() = default;

/**
* Returns an iterator for the features in the source.
* An optional \a request can be used to optimise the returned
* iterator, eg by restricting the returned attributes or geometry.
*/
virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const = 0;

};

#endif // QGSFEATURESOURCE_H

0 comments on commit ce063b8

Please sign in to comment.