Skip to content

Commit

Permalink
Tighten QgsAbstractLayoutIterator interface
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 5, 2018
1 parent 69ddc32 commit e312d02
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 70 deletions.
38 changes: 0 additions & 38 deletions python/core/layout/qgsabstractlayoutiterator.sip
Original file line number Diff line number Diff line change
Expand Up @@ -49,46 +49,8 @@ Returns the number of features to iterate over.
virtual bool next() = 0;
%Docstring
Iterates to next feature, returning false if no more features exist to iterate over.

.. seealso:: :py:func:`previous()`

.. seealso:: :py:func:`last()`

.. seealso:: :py:func:`first()`
%End

virtual bool previous() = 0;
%Docstring
Iterates to the previous feature, returning false if no previous feature exists.

.. seealso:: :py:func:`next()`

.. seealso:: :py:func:`last()`

.. seealso:: :py:func:`first()`
%End

virtual bool last() = 0;
%Docstring
Seeks to the last feature, returning false if no feature was found.

.. seealso:: :py:func:`next()`

.. seealso:: :py:func:`previous()`

.. seealso:: :py:func:`first()`
%End

virtual bool first() = 0;
%Docstring
Seeks to the first feature, returning false if no feature was found.

.. seealso:: :py:func:`next()`

.. seealso:: :py:func:`previous()`

.. seealso:: :py:func:`last()`
%End
};


Expand Down
34 changes: 31 additions & 3 deletions python/core/layout/qgslayoutatlas.sip
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,39 @@ Returns the current feature number, where a value of 0 corresponds to the first

virtual bool next();

virtual bool previous();

virtual bool first();
bool previous();
%Docstring
Iterates to the previous feature, returning false if no previous feature exists.

.. seealso:: :py:func:`next()`

.. seealso:: :py:func:`last()`

.. seealso:: :py:func:`first()`
%End

bool last();
%Docstring
Seeks to the last feature, returning false if no feature was found.

.. seealso:: :py:func:`next()`

virtual bool last();
.. seealso:: :py:func:`previous()`

.. seealso:: :py:func:`first()`
%End

bool first();
%Docstring
Seeks to the first feature, returning false if no feature was found.

.. seealso:: :py:func:`next()`

.. seealso:: :py:func:`previous()`

.. seealso:: :py:func:`last()`
%End

bool seekTo( int feature );

Expand Down
26 changes: 0 additions & 26 deletions src/core/layout/qgsabstractlayoutiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +45,9 @@ class CORE_EXPORT QgsAbstractLayoutIterator

/**
* Iterates to next feature, returning false if no more features exist to iterate over.
* \see previous()
* \see last()
* \see first()
*/
virtual bool next() = 0;

/**
* Iterates to the previous feature, returning false if no previous feature exists.
* \see next()
* \see last()
* \see first()
*/
virtual bool previous() = 0;

/**
* Seeks to the last feature, returning false if no feature was found.
* \see next()
* \see previous()
* \see first()
*/
virtual bool last() = 0;

/**
* Seeks to the first feature, returning false if no feature was found.
* \see next()
* \see previous()
* \see last()
*/
virtual bool first() = 0;
};

#endif //QGSABSTRACTLAYOUTITERATOR_H
Expand Down
28 changes: 25 additions & 3 deletions src/core/layout/qgslayoutatlas.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,31 @@ class CORE_EXPORT QgsLayoutAtlas : public QObject, public QgsAbstractLayoutItera
public slots:

bool next() override;
bool previous() override;
bool first() override;
bool last() override;

/**
* Iterates to the previous feature, returning false if no previous feature exists.
* \see next()
* \see last()
* \see first()
*/
bool previous();

/**
* Seeks to the last feature, returning false if no feature was found.
* \see next()
* \see previous()
* \see first()
*/
bool last();

/**
* Seeks to the first feature, returning false if no feature was found.
* \see next()
* \see previous()
* \see last()
*/
bool first();

bool seekTo( int feature );

/**
Expand Down

0 comments on commit e312d02

Please sign in to comment.