QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 dot kuhn at gmx 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( QString exp, QgsField fld ) : expression( exp ), field( fld ) {}
39 
40  QString expression;
43 
45 
52  void addExpression( const QString& exp, const QgsField& fld );
53 
59  void removeExpression( int index );
60 
64  void writeXml( QDomNode& layer_node, QDomDocument& document ) const;
65 
69  void readXml( const QDomNode& layer_node );
70 
76  void updateFields( QgsFields& flds );
77 
78  const QList<ExpressionField> expressions() const { return mExpressions; }
79 
80  private:
81  QList<ExpressionField> mExpressions;
82 };
83 
84 #endif // QGSEXPRESSIONFIELDBUFFER_H