Skip to content

Commit

Permalink
fix windows build (tests & bindings)
Browse files Browse the repository at this point in the history
(cherry picked from commit 0c1792a)
  • Loading branch information
jef-n committed Sep 14, 2016
1 parent 5c1151c commit 3f3e206
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
36 changes: 24 additions & 12 deletions python/core/qgsoptionalexpression.sip
Expand Up @@ -15,43 +15,55 @@
***************************************************************************/

/**
* \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
#include <qgsoptionalexpression.h>
%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
Expand Down Expand Up @@ -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 );
};
8 changes: 6 additions & 2 deletions src/core/qgsoptionalexpression.h
@@ -1,5 +1,5 @@
/***************************************************************************
qgsoptionalexpression - %{Cpp:License:ClassName}
qgsoptionalexpression.h - QgsOptionalExpression
---------------------
begin : 8.9.2016
Expand All @@ -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
*/
Expand Down Expand Up @@ -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

0 comments on commit 3f3e206

Please sign in to comment.