Skip to content
Permalink
Browse files

Export QgsOptional<QgsExpression> to dll/so

  • Loading branch information
m-kuhn committed Sep 14, 2016
1 parent 406757d commit 3d514db61ab8fc3b1675d8ed5384bc11270a3b15
@@ -80,4 +80,21 @@ class QgsOptionalExpression
* @note Added in QGIS 3.0
*/
void setData( const QgsExpression& data );

/**
* 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
*/
void writeXml(QDomElement& parent );

/**
* Read the optional expression from the provided QDomElement.
*
* @note Added in QGIS 2.18
*/
void readXml(const QDomElement& parent );
};
@@ -163,7 +163,7 @@ SET(QGIS_CORE_SRCS
qgsofflineediting.cpp
qgsogcutils.cpp
qgsogrutils.cpp
qgsoptional.cpp
qgsoptionalexpression.cpp
qgsowsconnection.cpp
qgspaintenginehack.cpp
qgspallabeling.cpp

This file was deleted.

@@ -130,8 +130,8 @@ class CORE_EXPORT QgsOptional
}

private:
T mData;
bool mEnabled;
T mData;
};

#endif // QGSOPTIONAL_H
@@ -0,0 +1,48 @@
/***************************************************************************
qgsoptionalexpression - QgsOptionalExpression
---------------------
begin : 14.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. *
* *
***************************************************************************/

#include "qgsoptionalexpression.h"

QgsOptionalExpression::QgsOptionalExpression()
: QgsOptional<QgsExpression>()
{

}

QgsOptionalExpression::QgsOptionalExpression( const QgsExpression& expression )
: QgsOptional<QgsExpression>( expression )
{

}

QgsOptionalExpression::QgsOptionalExpression( const QgsExpression& expression, bool enabled )
: QgsOptional<QgsExpression>( expression, enabled )
{

}

void QgsOptionalExpression::writeXml( QDomElement& element )
{
QDomText exp = element.ownerDocument().createTextNode( data().expression() );
element.setAttribute( "enabled", enabled() );
element.appendChild( exp );
}

void QgsOptionalExpression::readXml( const QDomElement& element )
{
setEnabled( element.attribute( "enabled" ).toInt() );
setData( element.text() );
}
@@ -28,6 +28,43 @@
*
* Added in QGIS 3.0
*/
typedef QgsOptional<QgsExpression> QgsOptionalExpression;

class CORE_EXPORT QgsOptionalExpression : public QgsOptional<QgsExpression>
{
public:
/**
* Construct a default optional expression.
* It will be disabled and with an empty expression.
*/
QgsOptionalExpression();

/**
* Construct an optional expression with the provided expression.
* It will be enabled.
*/
QgsOptionalExpression( const QgsExpression& expression );

/**
* Construct an optional expression with the provided expression and enabled state.
*/
QgsOptionalExpression( const QgsExpression& expression, bool enabled );

/**
* 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
*/
void writeXml( QDomElement& element );

/**
* Read the optional expression from the provided QDomElement.
*
* @note Added in QGIS 2.18
*/
void readXml( const QDomElement& element );
};

#endif // QGSOPTIONALEXPRESSION_H

0 comments on commit 3d514db

Please sign in to comment.
You can’t perform that action at this time.