QGIS/python/core/auto_generated/qgsrange.sip.in
Nyall Dawson 0fc05051dd Fix docstrings for QgsDateRange/QgsDateTimeRange
We can't rely on sip to generate these -- it outputs malformed
docstrings where the constructor docs are incorrectly placed
before the class docstrings
2025-04-11 10:03:58 +10:00

452 lines
12 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsrange.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
template <T>
class QgsRange
{
%Docstring(signature="appended")
A template based class for storing ranges (lower to upper values).
:py:class:`QgsRange` classes represent a range of values of some element
type. For instance, ranges of int might be used to represent integer
ranges.
Ranges can indicate whether the upper and lower values are inclusive or
exclusive. The inclusivity or exclusivity of bounds is considered when
determining things like whether ranges overlap or during calculation of
range intersections.
.. seealso:: :py:class:`QgsDoubleRange`
.. seealso:: :py:class:`QgsIntRange`
.. note::
not available in Python bindings (but class provided for template-based inheritance)
%End
%TypeHeaderCode
#include "qgsrange.h"
%End
public:
QgsRange( T lower, T upper, bool includeLower = true, bool includeUpper = true );
%Docstring
Constructor for QgsRange. The ``lower`` and ``upper`` bounds are
specified, and optionally whether or not these bounds are included in
the range.
%End
QgsRange( T lower, T upper, Qgis::RangeLimits limits );
%Docstring
Constructor for QgsRange. The ``lower`` and ``upper`` bounds are
specified, and whether or not these bounds are included in the range.
.. versionadded:: 3.38
%End
T lower() const;
%Docstring
Returns the lower bound of the range.
.. seealso:: :py:func:`upper`
.. seealso:: :py:func:`includeLower`
%End
T upper() const;
%Docstring
Returns the upper bound of the range.
.. seealso:: :py:func:`lower`
.. seealso:: :py:func:`includeUpper`
%End
bool includeLower() const;
%Docstring
Returns ``True`` if the lower bound is inclusive, or ``False`` if the
lower bound is exclusive.
.. seealso:: :py:func:`lower`
.. seealso:: :py:func:`includeUpper`
%End
bool includeUpper() const;
%Docstring
Returns ``True`` if the upper bound is inclusive, or ``False`` if the
upper bound is exclusive.
.. seealso:: :py:func:`upper`
.. seealso:: :py:func:`includeLower`
%End
Qgis::RangeLimits rangeLimits() const;
%Docstring
Returns the limit handling of the range.
.. versionadded:: 3.38
%End
bool isEmpty() const;
%Docstring
Returns ``True`` if the range is empty, ie the lower bound equals (or
exceeds) the upper bound and either the bounds are exclusive.
.. seealso:: :py:func:`isSingleton`
%End
bool isSingleton() const;
%Docstring
Returns ``True`` if the range consists only of a single value or
instant.
.. seealso:: :py:func:`isEmpty`
%End
bool contains( const QgsRange<T> &other ) const;
%Docstring
Returns ``True`` if this range contains another range.
.. seealso:: :py:func:`overlaps`
%End
bool contains( T element ) const;
%Docstring
Returns ``True`` if this range contains a specified ``element``.
%End
bool overlaps( const QgsRange<T> &other ) const;
%Docstring
Returns ``True`` if this range overlaps another range.
.. seealso:: :py:func:`contains`
%End
bool operator==( const QgsRange<T> &other ) const;
bool operator!=( const QgsRange<T> &other ) const;
protected:
};
typedef QgsRange<double> QgsRangedoubleBase /NoTypeName/;
class QgsDoubleRange : QgsRangedoubleBase
{
%Docstring(signature="appended")
:py:class:`QgsRange` which stores a range of double values.
.. seealso:: :py:class:`QgsIntRange`
.. seealso:: :py:class:`QgsDateRange`
.. seealso:: :py:class:`QgsDateTimeRange`
%End
%TypeHeaderCode
#include "qgsrange.h"
typedef QgsRange<double> QgsRangedoubleBase;
%End
public:
QgsDoubleRange( double lower, double upper, Qgis::RangeLimits limits );
%Docstring
Constructor for QgsDoubleRange. The ``lower`` and ``upper`` bounds are
specified, and whether or not these bounds are included in the range.
.. versionadded:: 3.38
%End
QgsDoubleRange( double lower,
double upper,
bool includeLower = true, bool includeUpper = true );
%Docstring
Constructor for QgsDoubleRange. The ``lower`` and ``upper`` bounds are
specified, and optionally whether or not these bounds are included in
the range.
%End
QgsDoubleRange();
%Docstring
Constructor for QgsDoubleRange containing an infinite range (see
:py:func:`~QgsDoubleRange.isInfinite`).
.. versionadded:: 3.18
%End
bool isInfinite() const;
%Docstring
Returns ``True`` if the range consists of all possible values.
.. versionadded:: 3.18
%End
SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsDoubleRange: %1%2, %3%4>" ).arg( sipCpp->includeLower() ? QStringLiteral( "[" ) : QStringLiteral( "(" ) )
.arg( sipCpp->lower() )
.arg( sipCpp->upper() )
.arg( sipCpp->includeUpper() ? QStringLiteral( "]" ) : QStringLiteral( ")" ) );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
bool operator==( const QgsDoubleRange &other ) const;
bool operator!=( const QgsDoubleRange &other ) const;
};
typedef QgsRange<int> QgsRangeintBase /NoTypeName/;
class QgsIntRange : QgsRangeintBase
{
%Docstring(signature="appended")
:py:class:`QgsRange` which stores a range of integer values.
.. seealso:: :py:class:`QgsDoubleRange`
.. seealso:: :py:class:`QgsDateRange`
.. seealso:: :py:class:`QgsDateTimeRange`
%End
%TypeHeaderCode
#include "qgsrange.h"
typedef QgsRange<int> QgsRangeintBase;
%End
public:
QgsIntRange( int lower, int upper, Qgis::RangeLimits limits );
%Docstring
Constructor for QgsIntRange. The ``lower`` and ``upper`` bounds are
specified, and whether or not these bounds are included in the range.
.. versionadded:: 3.38
%End
QgsIntRange( int lower,
int upper,
bool includeLower = true, bool includeUpper = true );
%Docstring
Constructor for QgsIntRange. The ``lower`` and ``upper`` bounds are
specified, and optionally whether or not these bounds are included in
the range.
%End
QgsIntRange();
%Docstring
Constructor for QgsIntRange containing an infinite range (see
:py:func:`~QgsIntRange.isInfinite`).
.. versionadded:: 3.18
%End
bool isInfinite() const;
%Docstring
Returns ``True`` if the range consists of all possible values.
.. versionadded:: 3.18
%End
SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsIntRange: %1%2, %3%4>" ).arg( sipCpp->includeLower() ? QStringLiteral( "[" ) : QStringLiteral( "(" ) )
.arg( sipCpp->lower() )
.arg( sipCpp->upper() )
.arg( sipCpp->includeUpper() ? QStringLiteral( "]" ) : QStringLiteral( ")" ) );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
};
template <T>
class QgsTemporalRange
{
%Docstring(signature="appended")
A template based class for storing temporal ranges (beginning to end
values).
:py:class:`QgsTemporalRange` classes represent a range of values of some
temporal type. For instance, ranges of QDateTime might be used to
represent datetime ranges.
Ranges can indicate whether the upper and lower values are inclusive or
exclusive. The inclusivity or exclusivity of bounds is considered when
determining things like whether ranges overlap or during calculation of
range intersections.
.. seealso:: :py:class:`QgsDateRange`
.. note::
not available in Python bindings (but class provided for template-based inheritance)
%End
%TypeHeaderCode
#include "qgsrange.h"
%End
public:
QgsTemporalRange( const T &begin, const T &end, bool includeBeginning = true, bool includeEnd = true );
%Docstring
Constructor for QgsTemporalRange. The ``begin`` and ``end`` are
specified, and optionally whether or not these bounds are included in
the range.
.. note::
in Python ``begin`` and ``end`` must be provided.
%End
// default constructor as default value for templates is not handled in SIP
T begin() const;
%Docstring
Returns the beginning of the range.
.. seealso:: :py:func:`end`
.. seealso:: :py:func:`includeBeginning`
%End
T end() const;
%Docstring
Returns the upper bound of the range.
.. seealso:: :py:func:`begin`
.. seealso:: :py:func:`includeEnd`
%End
bool includeBeginning() const;
%Docstring
Returns ``True`` if the beginning is inclusive, or ``False`` if the
beginning is exclusive.
.. seealso:: :py:func:`begin`
.. seealso:: :py:func:`includeEnd`
%End
bool includeEnd() const;
%Docstring
Returns ``True`` if the end is inclusive, or ``False`` if the end is
exclusive.
.. seealso:: :py:func:`end`
.. seealso:: :py:func:`includeBeginning`
%End
bool isInstant() const;
%Docstring
Returns ``True`` if the range consists only of a single instant.
.. seealso:: :py:func:`isEmpty`
.. seealso:: :py:func:`isInfinite`
%End
bool isInfinite() const;
%Docstring
Returns ``True`` if the range consists of all possible values.
.. seealso:: :py:func:`isEmpty`
.. seealso:: :py:func:`isInstant`
%End
bool isEmpty() const;
%Docstring
Returns ``True`` if the range is empty, ie the beginning equals (or
exceeds) the end and either of the bounds are exclusive. A range with
both invalid beginning and end is considered infinite and not empty.
%End
bool contains( const QgsTemporalRange<T> &other ) const;
%Docstring
Returns ``True`` if this range contains another range.
%End
bool contains( const T &element ) const;
%Docstring
Returns ``True`` if this range contains a specified ``element``.
%End
bool overlaps( const QgsTemporalRange<T> &other ) const;
%Docstring
Returns ``True`` if this range overlaps another range.
.. seealso:: :py:func:`contains`
%End
bool extend( const QgsTemporalRange<T> &other );
%Docstring
Extends the range in place by extending this range out to include an
``other`` range. If ``other`` is empty the range is not changed. If the
range is empty and ``other`` is not, the range is changed and set to
``other``.
.. seealso:: :py:func:`isEmpty`
:return: ``True`` if the range was extended
.. versionadded:: 3.12
%End
bool operator==( const QgsTemporalRange<T> &other ) const;
bool operator!=( const QgsTemporalRange<T> &other ) const;
};
typedef QgsTemporalRange< QDate > QgsDateRange;
typedef QgsTemporalRange< QDateTime > QgsDateTimeRange;
@DOCSTRINGSTEMPLATE@%Docstring
@DOCSTRINGSTEMPLATE@:py:class:`QgsRange` which stores a range of date
times. @DOCSTRINGSTEMPLATE@ @DOCSTRINGSTEMPLATE@Invalid QDateTimes as
the beginning or end are permitted. In this case,
@DOCSTRINGSTEMPLATE@the bound is considered to be infinite. E.g.
QgsDateTimeRange(QDateTime(),QDateTime(2017,1,1)) @DOCSTRINGSTEMPLATE@is
treated as a range containing all dates before 2017-1-1.
@DOCSTRINGSTEMPLATE@QgsDateTimeRange(QDateTime(2017,1,1),QDateTime()) is
treated as a range containing all dates after 2017-1-1.
@DOCSTRINGSTEMPLATE@ @DOCSTRINGSTEMPLATE@.. seealso::
:py:class:`QgsDateRange`
@DOCSTRINGSTEMPLATE@%End
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsrange.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/