2015-06-11 19:16:55 +02:00
|
|
|
class QgsExpressionFieldBuffer
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsexpressionfieldbuffer.h>
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
class ExpressionField
|
|
|
|
{
|
|
|
|
ExpressionField();
|
2017-05-01 16:42:33 +02:00
|
|
|
ExpressionField( const QString &exp, const QgsField &fld );
|
2015-06-11 19:16:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
QgsExpressionFieldBuffer();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an expression to the buffer
|
|
|
|
*
|
|
|
|
* @param exp expression to add
|
|
|
|
* @param fld field to add
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void addExpression( const QString &exp, const QgsField &fld );
|
2015-06-11 19:16:55 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove an expression from the buffer
|
|
|
|
*
|
|
|
|
* @param index index of expression to remove
|
|
|
|
*/
|
|
|
|
void removeExpression( int index );
|
|
|
|
|
2016-10-09 08:56:50 +10:00
|
|
|
/**
|
|
|
|
* Renames an expression field at a given index
|
|
|
|
*
|
|
|
|
* @param index The index of the expression to change
|
|
|
|
* @param name New name for field
|
|
|
|
*
|
|
|
|
* @note added in 3.0
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void renameExpression( int index, const QString &name );
|
2016-10-09 08:56:50 +10:00
|
|
|
|
2015-06-11 19:16:55 +02:00
|
|
|
/**
|
|
|
|
* Changes the expression at a given index
|
|
|
|
*
|
|
|
|
* @param index The index of the expression to change
|
|
|
|
* @param exp The new expression to set
|
|
|
|
*
|
|
|
|
* @note added in 2.9
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void updateExpression( int index, const QString &exp );
|
2015-06-11 19:16:55 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Saves expressions to xml under the layer node
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void writeXml( QDomNode &layer_node, QDomDocument &document ) const;
|
2015-06-11 19:16:55 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Reads expressions from project file
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void readXml( const QDomNode &layer_node );
|
2015-06-11 19:16:55 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds fields with the expressions buffered in this object to a QgsFields object
|
|
|
|
*
|
|
|
|
* @param flds The fields to be updated
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void updateFields( QgsFields &flds );
|
2015-06-11 19:16:55 +02:00
|
|
|
|
2017-01-14 13:46:26 +10:00
|
|
|
QList<QgsExpressionFieldBuffer::ExpressionField> expressions() const;
|
2015-06-11 19:16:55 +02:00
|
|
|
};
|