QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsvectorlayerjoinbuffer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorlayerjoinbuffer.h
3  ---------------------------
4  begin : Feb 09, 2011
5  copyright : (C) 2011 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole 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 QGSVECTORLAYERJOINBUFFER_H
19 #define QGSVECTORLAYERJOINBUFFER_H
20 
21 #include "qgsfeature.h"
22 #include "qgsvectorlayer.h"
23 
24 #include <QHash>
25 #include <QString>
26 
27 
28 
29 
31 class CORE_EXPORT QgsVectorLayerJoinBuffer
32 {
33  public:
36 
39  void addJoin( const QgsVectorJoinInfo& joinInfo );
40 
42  void removeJoin( const QString& joinLayerId );
43 
47  void updateFields( QgsFields& fields );
48 
50  void createJoinCaches();
51 
53  void writeXml( QDomNode& layer_node, QDomDocument& document ) const;
54 
56  void readXml( const QDomNode& layer_node );
57 
59  bool containsJoins() const { return !mVectorJoins.isEmpty(); }
60 
61  const QList< QgsVectorJoinInfo >& vectorJoins() const { return mVectorJoins; }
62 
67  const QgsVectorJoinInfo* joinForFieldIndex( int index, const QgsFields& fields, int& sourceFieldIndex ) const;
68 
69  private:
70 
72  QList< QgsVectorJoinInfo > mVectorJoins;
73 
75  void cacheJoinLayer( QgsVectorJoinInfo& joinInfo );
76 };
77 
78 #endif // QGSVECTORLAYERJOINBUFFER_H