2016-09-08 11:06:22 +02:00
|
|
|
/***************************************************************************
|
|
|
|
qgsoptionalexpression.sip - QgsOptionalExpression
|
|
|
|
|
|
|
|
---------------------
|
|
|
|
begin : 8.9.2016
|
|
|
|
copyright : (C) 2016 by Matthias Kuhn
|
|
|
|
email : matthias@opengis.ch
|
|
|
|
***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
/**
|
2016-09-14 22:53:34 +02:00
|
|
|
* An expression with an additional enabled flag.
|
2016-09-08 11:06:22 +02:00
|
|
|
*
|
2016-09-14 22:53:34 +02:00
|
|
|
* This can be used for configuration options where an expression can be enabled
|
2017-01-16 15:13:30 +01:00
|
|
|
* or disabled but when disabled it shouldn't lose it's information for the case
|
2016-09-14 22:53:34 +02:00
|
|
|
* it gets re-enabled later on and a user shouldn't be force to redo the configuration.
|
2016-09-08 11:06:22 +02:00
|
|
|
*
|
|
|
|
* @note Added in QGIS 3.0
|
|
|
|
*/
|
2016-09-14 22:53:34 +02:00
|
|
|
|
2016-09-08 11:06:22 +02:00
|
|
|
class QgsOptionalExpression
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsoptionalexpression.h>
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
/**
|
2016-09-14 22:53:34 +02:00
|
|
|
* Construct a default optional expression.
|
|
|
|
* It will be disabled and with an empty expression.
|
2016-09-08 11:06:22 +02:00
|
|
|
*/
|
|
|
|
QgsOptionalExpression();
|
|
|
|
|
|
|
|
/**
|
2016-09-14 22:53:34 +02:00
|
|
|
* Construct an optional expression with the provided expression.
|
|
|
|
* It will be enabled.
|
2016-09-08 11:06:22 +02:00
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsOptionalExpression( const QgsExpression &expression );
|
2016-09-08 11:06:22 +02:00
|
|
|
|
|
|
|
/**
|
2016-09-14 22:53:34 +02:00
|
|
|
* Construct an optional expression with the provided expression and enabled state.
|
2016-09-08 11:06:22 +02:00
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsOptionalExpression( const QgsExpression &expression, bool enabled );
|
2016-09-08 11:06:22 +02:00
|
|
|
|
|
|
|
/**
|
2016-09-14 22:53:34 +02:00
|
|
|
* Compare this QgsOptionalExpression to another one.
|
2016-09-08 11:06:22 +02:00
|
|
|
*
|
|
|
|
* This will compare the enabled flag and call the == operator
|
|
|
|
* of the contained class.
|
|
|
|
*
|
|
|
|
* @note Added in QGIS 3.0
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
int operator== ( const QgsOptionalExpression &other ) const;
|
2016-09-14 22:53:34 +02:00
|
|
|
%MethodCode
|
|
|
|
sipRes = *sipCpp == *a0;
|
|
|
|
%End
|
|
|
|
|
|
|
|
int __bool__() const;
|
|
|
|
%MethodCode
|
|
|
|
sipRes = sipCpp->enabled();
|
|
|
|
%End
|
2016-09-08 11:06:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if this optional is enabled
|
|
|
|
*
|
|
|
|
* @note Added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
bool enabled() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set if this optional is enabled
|
|
|
|
*
|
|
|
|
* @note Added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
void setEnabled( bool enabled );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Access the payload data
|
|
|
|
*
|
|
|
|
* @note Added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
QgsExpression data() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the payload data
|
|
|
|
*
|
|
|
|
* @note Added in QGIS 3.0
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void setData( const QgsExpression &data );
|
2016-09-14 08:30:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Save the optional expression to the provided QDomElement.
|
|
|
|
*
|
|
|
|
* The caller is responsible to pass an empty QDomElement and to append it to
|
|
|
|
* a parent element.
|
|
|
|
*
|
|
|
|
* @note Added in QGIS 2.18
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void writeXml( QDomElement &element );
|
2016-09-14 08:30:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Read the optional expression from the provided QDomElement.
|
|
|
|
*
|
|
|
|
* @note Added in QGIS 2.18
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void readXml( const QDomElement &element );
|
2016-09-08 11:06:22 +02:00
|
|
|
};
|