QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsexpressionfieldbuffer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsexpressionfieldbuffer.h
3  ---------------------------
4  begin : May 27, 2014
5  copyright : (C) 2014 by Matthias Kuhn
6  email : matthias at opengis dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSEXPRESSIONFIELDBUFFER_H
19 #define QGSEXPRESSIONFIELDBUFFER_H
20 
21 #include "qgis_core.h"
22 #include <QString>
23 #include <QList>
24 #include <QDomNode>
25 
26 #include "qgsfields.h"
27 #include "qgsexpression.h"
28 
35 class CORE_EXPORT QgsExpressionFieldBuffer
36 {
37  public:
39  {
40  ExpressionField( const QString &exp, const QgsField &fld )
41  : cachedExpression( exp )
42  , field( fld )
43  {}
44 
47  };
48 
53 
60  void addExpression( const QString &exp, const QgsField &fld );
61 
67  void removeExpression( int index );
68 
77  void renameExpression( int index, const QString &name );
78 
87  void updateExpression( int index, const QString &exp );
88 
92  void writeXml( QDomNode &layer_node, QDomDocument &document ) const;
93 
97  void readXml( const QDomNode &layer_node );
98 
104  void updateFields( QgsFields &flds );
105 
106  QList<QgsExpressionFieldBuffer::ExpressionField> expressions() const { return mExpressions; }
107 
108  private:
109  QList<ExpressionField> mExpressions;
110 };
111 
112 #endif // QGSEXPRESSIONFIELDBUFFER_H
qgsfields.h
QgsExpressionFieldBuffer::QgsExpressionFieldBuffer
QgsExpressionFieldBuffer()=default
Constructor for QgsExpressionFieldBuffer.
QgsExpressionFieldBuffer::ExpressionField::cachedExpression
QgsExpression cachedExpression
Definition: qgsexpressionfieldbuffer.h:45
qgsexpression.h
QgsExpressionFieldBuffer::ExpressionField
Definition: qgsexpressionfieldbuffer.h:39
QgsFields
Container of fields for a vector layer.
Definition: qgsfields.h:45
field
const QgsField & field
Definition: qgsfield.h:456
QgsExpressionFieldBuffer::ExpressionField::field
QgsField field
Definition: qgsexpressionfieldbuffer.h:46
QgsExpressionFieldBuffer::expressions
QList< QgsExpressionFieldBuffer::ExpressionField > expressions() const
Definition: qgsexpressionfieldbuffer.h:106
QgsExpressionFieldBuffer
Buffers information about expression fields for a vector layer.
Definition: qgsexpressionfieldbuffer.h:36
QgsExpressionFieldBuffer::ExpressionField::ExpressionField
ExpressionField(const QString &exp, const QgsField &fld)
Definition: qgsexpressionfieldbuffer.h:40
QgsExpression
Class for parsing and evaluation of expressions (formerly called "search strings").
Definition: qgsexpression.h:105
QgsField
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:50