QGIS API Documentation
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 updateExpression( int index, const QString& exp );
79 
83  void writeXml( QDomNode& layer_node, QDomDocument& document ) const;
84 
88  void readXml( const QDomNode& layer_node );
89 
95  void updateFields( QgsFields& flds );
96 
97  const QList<ExpressionField>& expressions() const { return mExpressions; }
98 
99  private:
100  QList<ExpressionField> mExpressions;
101 };
102 
103 #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:187
ExpressionField(const QString &exp, const QgsField &fld)
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:44
Buffers information about expression fields for a vector layer.
const QList< ExpressionField > & expressions() const