fix windows build (tests & bindings)

(cherry picked from commit 0c1792a55dd880b2f3f2acf7b5ef89e8fbd5412d)
This commit is contained in:
Juergen E. Fischer 2016-09-14 22:53:34 +02:00
parent 5c1151ccb6
commit 3f3e206a73
2 changed files with 30 additions and 14 deletions

View File

@ -15,12 +15,15 @@
***************************************************************************/
/**
* \ingroup core
* An expression with an additional enabled flag.
*
* QgsOptionalExpression is a container for an expression with an additional enabled/disabled flag.
* This can be used for configuration options where an expression can be enabled
* or diabled but when disabled it shouldn't lose it's information for the case
* it gets re-enabled later on and a user shouldn't be force to redo the configuration.
*
* @note Added in QGIS 3.0
*/
class QgsOptionalExpression
{
%TypeHeaderCode
@ -28,30 +31,39 @@ class QgsOptionalExpression
%End
public:
/**
* A QgsOptionalExpression is disabled by default if default constructed.
* Construct a default optional expression.
* It will be disabled and with an empty expression.
*/
QgsOptionalExpression();
/**
* A QgsOptionalExpression is enabled by default if constructed with an expression.
* Construct an optional expression with the provided expression.
* It will be enabled.
*/
QgsOptionalExpression( const QgsExpression& data );
QgsOptionalExpression( const QgsExpression& expression );
/**
* A QgsOptionalExptression constructed with enabled status and data
* Construct an optional expression with the provided expression and enabled state.
*/
QgsOptionalExpression( const QgsExpression& data, bool enabled );
QgsOptionalExpression( const QgsExpression& expression, bool enabled );
/**
* Compare this QgsOptionalExptression to another one.
* Compare this QgsOptionalExpression to another one.
*
* This will compare the enabled flag and call the == operator
* of the contained class.
*
* @note Added in QGIS 3.0
*/
bool operator== ( const QgsOptionalExpression& other ) const;
operator bool () const;
int operator== ( const QgsOptionalExpression& other ) const;
%MethodCode
sipRes = *sipCpp == *a0;
%End
int __bool__() const;
%MethodCode
sipRes = sipCpp->enabled();
%End
/**
* Check if this optional is enabled
@ -89,12 +101,12 @@ class QgsOptionalExpression
*
* @note Added in QGIS 2.18
*/
void writeXml(QDomElement& parent );
void writeXml( QDomElement& element );
/**
* Read the optional expression from the provided QDomElement.
*
* @note Added in QGIS 2.18
*/
void readXml(const QDomElement& parent );
void readXml( const QDomElement& element );
};

View File

@ -1,5 +1,5 @@
/***************************************************************************
qgsoptionalexpression - %{Cpp:License:ClassName}
qgsoptionalexpression.h - QgsOptionalExpression
---------------------
begin : 8.9.2016
@ -26,7 +26,7 @@
*
* This can be used for configuration options where an expression can be enabled
* or diabled but when disabled it shouldn't lose it's information for the case
* it gets re-enabled later on and a user shoulnd't be force to redo the configuration.
* it gets re-enabled later on and a user shouldn't be force to redo the configuration.
*
* @note Added in QGIS 2.18
*/
@ -69,4 +69,8 @@ class CORE_EXPORT QgsOptionalExpression : public QgsOptional<QgsExpression>
void readXml( const QDomElement& element );
};
#if defined(Q_OS_WIN)
template CORE_EXPORT QgsOptional<QgsExpression>;
#endif
#endif // QGSOPTIONALEXPRESSION_H