1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsinterval.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
%ModuleHeaderCode
#include "qgsunittypes.h"
%End
class QgsInterval
{
%Docstring(signature="appended")
A representation of the interval between two datetime values.
%End
%TypeHeaderCode
#include "qgsinterval.h"
%End
public:
static const int YEARS;
static const int MONTHS;
static const int WEEKS;
static const int DAY;
static const int HOUR;
static const int MINUTE;
QgsInterval();
%Docstring
Default constructor for QgsInterval. Creates an invalid interval.
%End
QgsInterval( double seconds );
%Docstring
Constructor for QgsInterval.
:param seconds: duration of interval in seconds
%End
QgsInterval( double duration, Qgis::TemporalUnit unit );
%Docstring
Constructor for QgsInterval, using the specified ``duration`` and
``units``.
%End
QgsInterval( double years, double months, double weeks, double days, double hours, double minutes, double seconds );
%Docstring
Constructor for QgsInterval, using the specified ``years``, ``months``,
``weeks``, ``days``, ``hours``, ``minutes`` and ``seconds``.
.. note::
Month units assumes a 30 day month length.
.. note::
Year units assumes a 365.25 day year length.
.. versionadded:: 3.14
%End
SIP_PYOBJECT __repr__();
%MethodCode
QString str;
if ( ! sipCpp->isValid() )
str = QStringLiteral( "<QgsInterval: invalid>" );
else if ( sipCpp->originalUnit() != Qgis::TemporalUnit::Unknown )
str = QStringLiteral( "<QgsInterval: %1 %2>" ).arg( sipCpp->originalDuration() ).arg( QgsUnitTypes::toString( sipCpp->originalUnit() ) );
else
str = QStringLiteral( "<QgsInterval: %1 seconds>" ).arg( sipCpp->seconds() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
double years() const;
%Docstring
Returns the interval duration in years (based on an average year length)
If the :py:func:`~QgsInterval.originalUnit` is
:py:class:`QgsUnitTypes`.TemporalYears then this value will match the
exact number of months as returned by
:py:func:`~QgsInterval.originalDuration`, otherwise it will be
calculated using the average year length (31557600 seconds).
.. seealso:: :py:func:`setYears`
%End
void setYears( double years );
%Docstring
Sets the interval duration in years.
Replaces the interval size and changes the original interval unit and
duration, :py:func:`originalDuration` and :py:func:`originalUnit`.
Changes the original unit to :py:class:`QgsUnitTypes`.TemporalYears
:param years: duration in years (based on average year length)
.. seealso:: :py:func:`years`
%End
double months() const;
%Docstring
Returns the interval duration in months (based on a 30 day month).
If the :py:func:`~QgsInterval.originalUnit` is
:py:class:`QgsUnitTypes`.TemporalMonths then this value will match the
exact number of months as returned by
:py:func:`~QgsInterval.originalDuration`, otherwise it will be
calculated using the assumption that a month consists of exactly 30
days.
.. seealso:: :py:func:`setMonths`
%End
void setMonths( double months );
%Docstring
Sets the interval duration in months.
Replaces the interval size and changes the original interval unit and
duration, :py:func:`originalDuration` and :py:func:`originalUnit`.
Changes the original unit to :py:class:`QgsUnitTypes`.TemporalMonths
:param months: duration in months (based on a 30 day month)
.. seealso:: :py:func:`months`
%End
double weeks() const;
%Docstring
Returns the interval duration in weeks.
If the :py:func:`~QgsInterval.originalUnit` is
:py:class:`QgsUnitTypes`.TemporalWeeks then this value will match the
exact number of weeks as returned by
:py:func:`~QgsInterval.originalDuration`, otherwise it will be
calculated using the QgsInterval.WEEKS constant.
.. seealso:: :py:func:`setWeeks`
%End
void setWeeks( double weeks );
%Docstring
Sets the interval duration in weeks.
Replaces the interval size and changes the original interval unit and
duration, :py:func:`originalDuration` and :py:func:`originalUnit`.
Changes the original unit to :py:class:`QgsUnitTypes`.TemporalWeeks
:param weeks: duration in weeks
.. seealso:: :py:func:`weeks`
%End
double days() const;
%Docstring
Returns the interval duration in days.
If the :py:func:`~QgsInterval.originalUnit` is
:py:class:`QgsUnitTypes`.TemporalDays then this value will match the
exact number of days as returned by
:py:func:`~QgsInterval.originalDuration`, otherwise it will be
calculated using the QgsInterval.DAY constant.
.. seealso:: :py:func:`setDays`
%End
void setDays( double days );
%Docstring
Sets the interval duration in days.
Replaces the interval size and changes the original interval unit and
duration, :py:func:`originalDuration` and :py:func:`originalUnit`.
Changes the original unit to :py:class:`QgsUnitTypes`.TemporalDays
:param days: duration in days
.. seealso:: :py:func:`days`
%End
double hours() const;
%Docstring
Returns the interval duration in hours.
If the :py:func:`~QgsInterval.originalUnit` is
:py:class:`QgsUnitTypes`.TemporalHours then this value will match the
exact number of hours as returned by
:py:func:`~QgsInterval.originalDuration`, otherwise it will be
calculated using the QgsInterval.HOUR constant.
.. seealso:: :py:func:`setHours`
%End
void setHours( double hours );
%Docstring
Sets the interval duration in hours.
Replaces the interval size and changes the original interval unit and
duration, :py:func:`originalDuration` and :py:func:`originalUnit`.
The original unit to :py:class:`QgsUnitTypes`.TemporalHours
:param hours: duration in hours
.. seealso:: :py:func:`hours`
%End
double minutes() const;
%Docstring
Returns the interval duration in minutes.
If the :py:func:`~QgsInterval.originalUnit` is
:py:class:`QgsUnitTypes`.TemporalMinutes then this value will match the
exact number of minutes as returned by
:py:func:`~QgsInterval.originalDuration`, otherwise it will be
calculated using the QgsInterval.MINUTE constant.
.. seealso:: :py:func:`setMinutes`
%End
void setMinutes( double minutes );
%Docstring
Sets the interval duration in minutes.
Replaces the interval size and changes the original interval unit and
duration, :py:func:`originalDuration` and :py:func:`originalUnit`.
Changes the original unit to :py:class:`QgsUnitTypes`.TemporalMinutes
:param minutes: duration in minutes
.. seealso:: :py:func:`minutes`
%End
double seconds() const;
%Docstring
Returns the interval duration in seconds.
.. seealso:: :py:func:`setSeconds`
%End
void setSeconds( double seconds );
%Docstring
Sets the interval duration in seconds.
Replaces the interval size and changes the original interval unit and
duration, :py:func:`originalDuration` and :py:func:`originalUnit`.
Changes the original unit to :py:class:`QgsUnitTypes`.TemporalSeconds
:param seconds: duration in seconds
.. seealso:: :py:func:`seconds`
%End
bool isValid() const;
%Docstring
Returns ``True`` if the interval is valid.
.. seealso:: :py:func:`setValid`
%End
void setValid( bool valid );
%Docstring
Sets whether the interval is valid.
:param valid: set to ``True`` to set the interval as valid.
.. seealso:: :py:func:`isValid`
%End
double originalDuration() const;
%Docstring
Returns the original interval duration.
This original interval duration can be updated through calling
QgsInterval setter methods.
.. seealso:: :py:func:`originalUnit` for the corresponding unit.
If the original interval duration is not available or interval was set
with a mix of units, calling :py:func:`~QgsInterval.originalUnit` will
return :py:class:`QgsUnitTypes`.TemporalUnknownUnit
Returns 0.0 if the original duration was not set.
.. versionadded:: 3.18
%End
Qgis::TemporalUnit originalUnit() const;
%Docstring
Returns the original interval temporal unit.
The interval temporal unit can be set through the QgsInterval
constructors or through the available setter methods.
Returns :py:class:`QgsUnitTypes`.TemporalUnknownUnit if unit was not set
when creating the QgsInterval instance or interval was set with a mix of
units.
.. seealso:: :py:func:`originalDuration`
.. versionadded:: 3.18
%End
bool operator==( QgsInterval other ) const;
bool operator!=( QgsInterval other ) const;
static QgsInterval fromString( const QString &string );
%Docstring
Converts a string to an interval
:param string: string to parse
:return: interval, or invalid interval if string could not be parsed
%End
operator QVariant() const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsinterval.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|