QGIS API Documentation  2.99.0-Master (e077efd)
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 "qgsfields.h"
26 #include "qgsexpression.h"
27 
33 class CORE_EXPORT QgsExpressionFieldBuffer
34 {
35  public:
36  typedef struct ExpressionField
37  {
38  ExpressionField( const QString& exp, const QgsField& fld )
39  : cachedExpression( exp )
40  , field( fld )
41  {}
42 
46 
48 
55  void addExpression( const QString& exp, const QgsField& fld );
56 
62  void removeExpression( int index );
63 
72  void renameExpression( int index, const QString& name );
73 
82  void updateExpression( int index, const QString& exp );
83 
87  void writeXml( QDomNode& layer_node, QDomDocument& document ) const;
88 
92  void readXml( const QDomNode& layer_node );
93 
99  void updateFields( QgsFields& flds );
100 
101  const QList<ExpressionField>& expressions() const { return mExpressions; }
102 
103  private:
104  QList<ExpressionField> mExpressions;
105 };
106 
107 #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: qgsfields.h:36
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:47
Buffers information about expression fields for a vector layer.