QGIS API Documentation  2.13.0-Master
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 ) : expression( exp ), cachedExpression( exp ), field( fld ) {}
40 
48 
50 
57  void addExpression( const QString& exp, const QgsField& fld );
58 
64  void removeExpression( int index );
65 
74  void updateExpression( int index, const QString& exp );
75 
79  void writeXml( QDomNode& layer_node, QDomDocument& document ) const;
80 
84  void readXml( const QDomNode& layer_node );
85 
91  void updateFields( QgsFields& flds );
92 
93  const QList<ExpressionField>& expressions() const { return mExpressions; }
94 
95  private:
96  QList<ExpressionField> mExpressions;
97 };
98 
99 #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:189
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