QGIS API Documentation  2.12.0-Lyon
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 
32 class CORE_EXPORT QgsExpressionFieldBuffer
33 {
34  public:
35  typedef struct ExpressionField
36  {
38  ExpressionField( const QString& exp, const QgsField& fld ) : expression( exp ), field( fld ) {}
39 
43 
45 
52  void addExpression( const QString& exp, const QgsField& fld );
53 
59  void removeExpression( int index );
60 
69  void updateExpression( int index, const QString& exp );
70 
74  void writeXml( QDomNode& layer_node, QDomDocument& document ) const;
75 
79  void readXml( const QDomNode& layer_node );
80 
86  void updateFields( QgsFields& flds );
87 
88  const QList<ExpressionField>& expressions() const { return mExpressions; }
89 
90  private:
91  QList<ExpressionField> mExpressions;
92 };
93 
94 #endif // QGSEXPRESSIONFIELDBUFFER_H
static unsigned index
Container of fields for a vector layer.
Definition: qgsfield.h:177
ExpressionField(const QString &exp, const QgsField &fld)
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:40
Buffers information about expression fields for a vector layer.
const QList< ExpressionField > & expressions() const