QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 <QString>
22 #include <QList>
23 #include <QDomNode>
24 
25 #include "qgsfield.h"
26 #include "qgsexpression.h"
27 
33 class CORE_EXPORT QgsExpressionFieldBuffer
34 {
35  public:
36  typedef struct ExpressionField
37  {
38  ExpressionField() : cachedExpression( expression ) {}
39  ExpressionField( const QString& exp, const QgsField& fld )
40  : expression( exp )
41  , cachedExpression( exp )
42  , field( fld )
43  {}
44 
52 
54 
61  void addExpression( const QString& exp, const QgsField& fld );
62 
68  void removeExpression( int index );
69 
78  void renameExpression( int index, const QString& name );
79 
88  void updateExpression( int index, const QString& exp );
89 
93  void writeXml( QDomNode& layer_node, QDomDocument& document ) const;
94 
98  void readXml( const QDomNode& layer_node );
99 
105  void updateFields( QgsFields& flds );
106 
107  const QList<ExpressionField>& expressions() const { return mExpressions; }
108 
109  private:
110  QList<ExpressionField> mExpressions;
111 };
112 
113 #endif // QGSEXPRESSIONFIELDBUFFER_H
Class for parsing and evaluation of expressions (formerly called "search strings").
static unsigned index
Container of fields for a vector layer.
Definition: qgsfield.h:252
ExpressionField(const QString &exp, const QgsField &fld)
const QList< ExpressionField > & expressions() const
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:44
Buffers information about expression fields for a vector layer.