/
qgsinterval.sip
139 lines (113 loc) · 3.41 KB
/
qgsinterval.sip
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
/** \ingroup core
* \class QgsInterval
* \brief A representation of the interval between two datetime values.
* \note Added in version 2.16
*/
class QgsInterval
{
%TypeHeaderCode
#include <qgsinterval.h>
%End
public:
// YEAR const value taken from postgres query
// SELECT EXTRACT(EPOCH FROM interval '1 year')
//! Seconds per year (average)
static const int YEARS;
//! Seconds per month, based on 30 day month
static const int MONTHS;
//! Seconds per week
static const int WEEKS;
//! Seconds per day
static const int DAY;
//! Seconds per hour
static const int HOUR;
//! Seconds per minute
static const int MINUTE;
/** Default constructor for QgsInterval. Creates an invalid interval.
*/
QgsInterval();
/** Constructor for QgsInterval.
* @param seconds duration of interval in seconds
*/
QgsInterval( double seconds );
/** Returns the interval duration in years (based on an average year length)
* @see setYears()
*/
double years() const;
/** Sets the interval duration in years.
* @param years duration in years (based on average year length)
* @see years()
*/
void setYears( double years );
/** Returns the interval duration in months (based on a 30 day month).
* @see setMonths()
*/
double months() const;
/** Sets the interval duration in months.
* @param months duration in months (based on a 30 day month)
* @see months()
*/
void setMonths( double months );
/** Returns the interval duration in weeks.
* @see setWeeks()
*/
double weeks() const;
/** Sets the interval duration in weeks.
* @param weeks duration in weeks
* @see weeks()
*/
void setWeeks( double weeks );
/** Returns the interval duration in days.
* @see setDays()
*/
double days() const;
/** Sets the interval duration in days.
* @param days duration in days
* @see days()
*/
void setDays( double days );
/** Returns the interval duration in hours.
* @see setHours()
*/
double hours() const;
/** Sets the interval duration in hours.
* @param hours duration in hours
* @see hours()
*/
void setHours( double hours );
/** Returns the interval duration in minutes.
* @see setMinutes()
*/
double minutes() const;
/** Sets the interval duration in minutes.
* @param minutes duration in minutes
* @see minutes()
*/
void setMinutes( double minutes );
/** Returns the interval duration in seconds.
* @see setSeconds()
*/
double seconds() const;
/** Sets the interval duration in seconds.
* @param seconds duration in seconds
* @see seconds()
*/
void setSeconds( double seconds );
/** Returns true if the interval is valid.
* @see setValid()
*/
bool isValid() const;
/** Sets whether the interval is valid.
* @param valid set to true to set the interval as valid.
* @see isValid()
*/
void setValid( bool valid );
bool operator==( QgsInterval other ) const;
/** Converts a string to an interval
* @param string string to parse
* @returns interval, or invalid interval if string could not be parsed
*/
static QgsInterval fromString( const QString& string );
//! Allows direct construction of QVariants from intervals.
operator QVariant() const;
};