Skip to content

Commit d56eef1

Browse files
arnaud-morvan3nids
authored andcommittedMay 4, 2017
Sipify core.QgsInterval
1 parent 716fe52 commit d56eef1

File tree

3 files changed

+150
-82
lines changed

3 files changed

+150
-82
lines changed
 

‎python/auto_sip.blacklist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ core/qgsgeometryvalidator.sip
1515
core/qgsgml.sip
1616
core/qgsgmlschema.sip
1717
core/qgshistogram.sip
18-
core/qgsinterval.sip
1918
core/qgsjsonutils.sip
2019
core/qgsmaptopixelgeometrysimplifier.sip
2120
core/qgstransaction.sip

‎python/core/qgsinterval.sip

Lines changed: 145 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,203 @@
1-
/** \ingroup core
2-
* \class QgsInterval
3-
* \brief A representation of the interval between two datetime values.
4-
* \note Added in version 2.16
5-
*/
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/qgsinterval.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
614

715
class QgsInterval
816
{
9-
%TypeHeaderCode
10-
#include <qgsinterval.h>
17+
%Docstring
18+
A representation of the interval between two datetime values.
19+
.. versionadded:: 2.16
1120
%End
1221

22+
%TypeHeaderCode
23+
#include "qgsinterval.h"
24+
%End
1325
public:
1426

15-
// YEAR const value taken from postgres query
16-
// SELECT EXTRACT(EPOCH FROM interval '1 year')
17-
//! Seconds per year (average)
1827
static const int YEARS;
19-
//! Seconds per month, based on 30 day month
28+
%Docstring
29+
Seconds per year (average)
30+
%End
2031
static const int MONTHS;
21-
//! Seconds per week
32+
%Docstring
33+
Seconds per month, based on 30 day month
34+
%End
2235
static const int WEEKS;
23-
//! Seconds per day
36+
%Docstring
37+
Seconds per week
38+
%End
2439
static const int DAY;
25-
//! Seconds per hour
40+
%Docstring
41+
Seconds per day
42+
%End
2643
static const int HOUR;
27-
//! Seconds per minute
44+
%Docstring
45+
Seconds per hour
46+
%End
2847
static const int MINUTE;
48+
%Docstring
49+
Seconds per minute
50+
%End
2951

30-
/** Default constructor for QgsInterval. Creates an invalid interval.
31-
*/
3252
QgsInterval();
53+
%Docstring
54+
Default constructor for QgsInterval. Creates an invalid interval.
55+
%End
3356

34-
/** Constructor for QgsInterval.
35-
* @param seconds duration of interval in seconds
36-
*/
3757
QgsInterval( double seconds );
58+
%Docstring
59+
Constructor for QgsInterval.
60+
\param seconds duration of interval in seconds
61+
%End
3862

39-
/** Returns the interval duration in years (based on an average year length)
40-
* @see setYears()
41-
*/
4263
double years() const;
64+
%Docstring
65+
Returns the interval duration in years (based on an average year length)
66+
.. seealso:: setYears()
67+
:rtype: float
68+
%End
4369

44-
/** Sets the interval duration in years.
45-
* @param years duration in years (based on average year length)
46-
* @see years()
47-
*/
4870
void setYears( double years );
71+
%Docstring
72+
Sets the interval duration in years.
73+
\param years duration in years (based on average year length)
74+
.. seealso:: years()
75+
%End
4976

50-
/** Returns the interval duration in months (based on a 30 day month).
51-
* @see setMonths()
52-
*/
5377
double months() const;
78+
%Docstring
79+
Returns the interval duration in months (based on a 30 day month).
80+
.. seealso:: setMonths()
81+
:rtype: float
82+
%End
5483

55-
/** Sets the interval duration in months.
56-
* @param months duration in months (based on a 30 day month)
57-
* @see months()
58-
*/
5984
void setMonths( double months );
85+
%Docstring
86+
Sets the interval duration in months.
87+
\param months duration in months (based on a 30 day month)
88+
.. seealso:: months()
89+
%End
6090

61-
/** Returns the interval duration in weeks.
62-
* @see setWeeks()
63-
*/
6491
double weeks() const;
92+
%Docstring
93+
Returns the interval duration in weeks.
94+
.. seealso:: setWeeks()
95+
:rtype: float
96+
%End
6597

66-
/** Sets the interval duration in weeks.
67-
* @param weeks duration in weeks
68-
* @see weeks()
69-
*/
7098
void setWeeks( double weeks );
99+
%Docstring
100+
Sets the interval duration in weeks.
101+
\param weeks duration in weeks
102+
.. seealso:: weeks()
103+
%End
71104

72-
/** Returns the interval duration in days.
73-
* @see setDays()
74-
*/
75105
double days() const;
106+
%Docstring
107+
Returns the interval duration in days.
108+
.. seealso:: setDays()
109+
:rtype: float
110+
%End
76111

77-
/** Sets the interval duration in days.
78-
* @param days duration in days
79-
* @see days()
80-
*/
81112
void setDays( double days );
113+
%Docstring
114+
Sets the interval duration in days.
115+
\param days duration in days
116+
.. seealso:: days()
117+
%End
82118

83-
/** Returns the interval duration in hours.
84-
* @see setHours()
85-
*/
86119
double hours() const;
120+
%Docstring
121+
Returns the interval duration in hours.
122+
.. seealso:: setHours()
123+
:rtype: float
124+
%End
87125

88-
/** Sets the interval duration in hours.
89-
* @param hours duration in hours
90-
* @see hours()
91-
*/
92126
void setHours( double hours );
127+
%Docstring
128+
Sets the interval duration in hours.
129+
\param hours duration in hours
130+
.. seealso:: hours()
131+
%End
93132

94-
/** Returns the interval duration in minutes.
95-
* @see setMinutes()
96-
*/
97133
double minutes() const;
134+
%Docstring
135+
Returns the interval duration in minutes.
136+
.. seealso:: setMinutes()
137+
:rtype: float
138+
%End
98139

99-
/** Sets the interval duration in minutes.
100-
* @param minutes duration in minutes
101-
* @see minutes()
102-
*/
103140
void setMinutes( double minutes );
141+
%Docstring
142+
Sets the interval duration in minutes.
143+
\param minutes duration in minutes
144+
.. seealso:: minutes()
145+
%End
104146

105-
/** Returns the interval duration in seconds.
106-
* @see setSeconds()
107-
*/
108147
double seconds() const;
148+
%Docstring
149+
Returns the interval duration in seconds.
150+
.. seealso:: setSeconds()
151+
:rtype: float
152+
%End
109153

110-
/** Sets the interval duration in seconds.
111-
* @param seconds duration in seconds
112-
* @see seconds()
113-
*/
114154
void setSeconds( double seconds );
155+
%Docstring
156+
Sets the interval duration in seconds.
157+
\param seconds duration in seconds
158+
.. seealso:: seconds()
159+
%End
115160

116-
/** Returns true if the interval is valid.
117-
* @see setValid()
118-
*/
119161
bool isValid() const;
162+
%Docstring
163+
Returns true if the interval is valid.
164+
.. seealso:: setValid()
165+
:rtype: bool
166+
%End
120167

121-
/** Sets whether the interval is valid.
122-
* @param valid set to true to set the interval as valid.
123-
* @see isValid()
124-
*/
125168
void setValid( bool valid );
169+
%Docstring
170+
Sets whether the interval is valid.
171+
\param valid set to true to set the interval as valid.
172+
.. seealso:: isValid()
173+
%End
126174

127175
bool operator==( QgsInterval other ) const;
176+
%Docstring
177+
:rtype: bool
178+
%End
128179

129-
/** Converts a string to an interval
130-
* @param string string to parse
131-
* @returns interval, or invalid interval if string could not be parsed
132-
*/
133180
static QgsInterval fromString( const QString &string );
181+
%Docstring
182+
Converts a string to an interval
183+
\param string string to parse
184+
:return: interval, or invalid interval if string could not be parsed
185+
:rtype: QgsInterval
186+
%End
134187

135-
//! Allows direct construction of QVariants from intervals.
136188
operator QVariant() const;
189+
%Docstring
190+
Allows direct construction of QVariants from intervals.
191+
%End
137192

138193
};
139194

195+
196+
197+
/************************************************************************
198+
* This file has been generated automatically from *
199+
* *
200+
* src/core/qgsinterval.h *
201+
* *
202+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
203+
************************************************************************/

‎src/core/qgsinterval.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include <QVariant>
2626

27+
#include "qgis.h"
2728
#include "qgis_core.h"
2829

2930
class QString;
@@ -175,6 +176,8 @@ class CORE_EXPORT QgsInterval
175176

176177
Q_DECLARE_METATYPE( QgsInterval )
177178

179+
#ifndef SIP_RUN
180+
178181
/** Returns the interval between two datetimes.
179182
* \param datetime1 start datetime
180183
* \param datetime2 datetime to subtract, ie subtract datetime2 from datetime1
@@ -210,4 +213,6 @@ QDateTime CORE_EXPORT operator+( const QDateTime &start, const QgsInterval &inte
210213
//! Debug string representation of interval
211214
QDebug operator<<( QDebug dbg, const QgsInterval &interval );
212215
\
216+
#endif
217+
213218
#endif // QGSINTERVAL_H

0 commit comments

Comments
 (0)
Please sign in to comment.