Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #4353 from nyalldawson/range
New QgsRange template based class for storing interval ranges
  • Loading branch information
nyalldawson committed Apr 18, 2017
2 parents 405da59 + 7949c81 commit 6bb3fa6
Show file tree
Hide file tree
Showing 8 changed files with 703 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/auto_sip.blacklist
Expand Up @@ -94,6 +94,7 @@ core/qgspropertycollection.sip
core/qgsprovidermetadata.sip
core/qgsproviderregistry.sip
core/qgspythonrunner.sip
core/qgsrange.sip
core/qgsrelation.sip
core/qgsrelationmanager.sip
core/qgsrenderchecker.sip
Expand Down
1 change: 1 addition & 0 deletions python/core/core.sip
Expand Up @@ -127,6 +127,7 @@
%Include qgsprovidermetadata.sip
%Include qgsproviderregistry.sip
%Include qgspythonrunner.sip
%Include qgsrange.sip
%Include qgsrelation.sip
%Include qgsrelationmanager.sip
%Include qgsrenderchecker.sip
Expand Down
57 changes: 57 additions & 0 deletions python/core/qgsrange.sip
@@ -0,0 +1,57 @@
class QgsDoubleRange
{
%TypeHeaderCode
#include <qgsrange.h>
%End

public:

QgsDoubleRange( double lower, double upper, bool includeLower = true, bool includeUpper = true );
double lower() const;
double upper() const;
bool includeLower() const;
bool includeUpper() const;
bool isEmpty() const;
bool contains( const QgsDoubleRange &other ) const;
bool contains( double element ) const;
bool overlaps( const QgsDoubleRange &other ) const;
};

class QgsIntRange
{
%TypeHeaderCode
#include <qgsrange.h>
%End

public:

QgsIntRange( int lower, int upper, bool includeLower = true, bool includeUpper = true );
int lower() const;
int upper() const;
bool includeLower() const;
bool includeUpper() const;
bool isEmpty() const;
bool contains( const QgsIntRange &other ) const;
bool contains( int element ) const;
bool overlaps( const QgsIntRange &other ) const;
};

class QgsDateRange
{
%TypeHeaderCode
#include <qgsrange.h>
%End

public:

QgsDateRange( QDate lower, QDate upper, bool includeLower = true, bool includeUpper = true );
QDate lower() const;
QDate upper() const;
bool includeLower() const;
bool includeUpper() const;
bool isEmpty() const;
bool contains( const QgsDateRange &other ) const;
bool contains( QDate element ) const;
bool overlaps( const QgsDateRange &other ) const;
};

1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -762,6 +762,7 @@ SET(QGIS_CORE_HDRS
qgsprovidermetadata.h
qgsproviderregistry.h
qgspythonrunner.h
qgsrange.h
qgsrenderchecker.h
qgsrendercontext.h
qgsruntimeprofiler.h
Expand Down

0 comments on commit 6bb3fa6

Please sign in to comment.