|
15 | 15 | ***************************************************************************/
|
16 | 16 |
|
17 | 17 | /**
|
18 |
| - * \ingroup core |
| 18 | + * An expression with an additional enabled flag. |
19 | 19 | *
|
20 |
| - * QgsOptionalExpression is a container for an expression with an additional enabled/disabled flag. |
| 20 | + * This can be used for configuration options where an expression can be enabled |
| 21 | + * or diabled but when disabled it shouldn't lose it's information for the case |
| 22 | + * it gets re-enabled later on and a user shouldn't be force to redo the configuration. |
21 | 23 | *
|
22 | 24 | * @note Added in QGIS 2.18
|
23 | 25 | */
|
| 26 | + |
24 | 27 | class QgsOptionalExpression
|
25 | 28 | {
|
26 | 29 | %TypeHeaderCode
|
27 | 30 | #include <qgsoptionalexpression.h>
|
28 | 31 | %End
|
29 | 32 | public:
|
30 | 33 | /**
|
31 |
| - * A QgsOptionalExpression is disabled by default if default constructed. |
| 34 | + * Construct a default optional expression. |
| 35 | + * It will be disabled and with an empty expression. |
32 | 36 | */
|
33 | 37 | QgsOptionalExpression();
|
34 | 38 |
|
35 | 39 | /**
|
36 |
| - * A QgsOptionalExpression is enabled by default if constructed with an expression. |
| 40 | + * Construct an optional expression with the provided expression. |
| 41 | + * It will be enabled. |
37 | 42 | */
|
38 |
| - QgsOptionalExpression( const QgsExpression& data ); |
| 43 | + QgsOptionalExpression( const QgsExpression& expression ); |
39 | 44 |
|
40 | 45 | /**
|
41 |
| - * A QgsOptionalExptression constructed with enabled status and data |
| 46 | + * Construct an optional expression with the provided expression and enabled state. |
42 | 47 | */
|
43 |
| - QgsOptionalExpression( const QgsExpression& data, bool enabled ); |
| 48 | + QgsOptionalExpression( const QgsExpression& expression, bool enabled ); |
44 | 49 |
|
45 | 50 | /**
|
46 |
| - * Compare this QgsOptionalExptression to another one. |
| 51 | + * Compare this QgsOptionalExpression to another one. |
47 | 52 | *
|
48 | 53 | * This will compare the enabled flag and call the == operator
|
49 | 54 | * of the contained class.
|
50 | 55 | *
|
51 | 56 | * @note Added in QGIS 2.18
|
52 | 57 | */
|
53 |
| - bool operator== ( const QgsOptionalExpression& other ) const; |
54 |
| - operator bool () const; |
| 58 | + int operator== ( const QgsOptionalExpression& other ) const; |
| 59 | +%MethodCode |
| 60 | + sipRes = *sipCpp == *a0; |
| 61 | +%End |
| 62 | + |
| 63 | + int __bool__() const; |
| 64 | +%MethodCode |
| 65 | + sipRes = sipCpp->enabled(); |
| 66 | +%End |
55 | 67 |
|
56 | 68 | /**
|
57 | 69 | * Check if this optional is enabled
|
@@ -89,12 +101,12 @@ class QgsOptionalExpression
|
89 | 101 | *
|
90 | 102 | * @note Added in QGIS 2.18
|
91 | 103 | */
|
92 |
| - void writeXml(QDomElement& parent ); |
| 104 | + void writeXml( QDomElement& element ); |
93 | 105 |
|
94 | 106 | /**
|
95 | 107 | * Read the optional expression from the provided QDomElement.
|
96 | 108 | *
|
97 | 109 | * @note Added in QGIS 2.18
|
98 | 110 | */
|
99 |
| - void readXml(const QDomElement& parent ); |
| 111 | + void readXml( const QDomElement& element ); |
100 | 112 | };
|
0 commit comments