QGIS API Documentation  2.14.0-Essen
qgsfield_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfield_p.h
3  ------------
4  Date : May 2015
5  Copyright : (C) 2015 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSFIELD_PRIVATE_H
17 #define QGSFIELD_PRIVATE_H
18 
20 
21 //
22 // W A R N I N G
23 // -------------
24 //
25 // This file is not part of the QGIS API. It exists purely as an
26 // implementation detail. This header file may change from version to
27 // version without notice, or even be removed.
28 //
29 
30 #include <QString>
31 #include <QVariant>
32 #include <QSharedData>
33 #include "qgsfield.h"
34 
35 /***************************************************************************
36  * This class is considered CRITICAL and any change MUST be accompanied with
37  * full unit tests in testqgsfield.cpp.
38  * See details in QEP #17
39  ****************************************************************************/
40 
41 class QgsFieldPrivate : public QSharedData
42 {
43  public:
44 
45  QgsFieldPrivate( const QString& name = QString(),
46  QVariant::Type type = QVariant::Invalid,
47  const QString& typeName = QString(),
48  int len = 0,
49  int prec = 0,
50  const QString& comment = QString() )
51  : name( name )
52  , type( type )
53  , typeName( typeName )
54  , length( len )
55  , precision( prec )
56  , comment( comment )
57  {
58  }
59 
60  QgsFieldPrivate( const QgsFieldPrivate& other )
61  : QSharedData( other )
62  , name( other.name )
63  , type( other.type )
64  , typeName( other.typeName )
65  , length( other.length )
66  , precision( other.precision )
67  , comment( other.comment )
68  {
69  }
70 
71  ~QgsFieldPrivate() {}
72 
73  bool operator==( const QgsFieldPrivate& other ) const
74  {
75  return (( name == other.name ) && ( type == other.type )
76  && ( length == other.length ) && ( precision == other.precision ) );
77  }
78 
80  QString name;
81 
83  QVariant::Type type;
84 
86  QString typeName;
87 
89  int length;
90 
92  int precision;
93 
95  QString comment;
96 };
97 
98 
99 /***************************************************************************
100  * This class is considered CRITICAL and any change MUST be accompanied with
101  * full unit tests in testqgsfields.cpp.
102  * See details in QEP #17
103  ****************************************************************************/
104 
105 class CORE_EXPORT QgsFieldsPrivate : public QSharedData
106 {
107  public:
108 
109  QgsFieldsPrivate()
110  {
111  }
112 
113  QgsFieldsPrivate( const QgsFieldsPrivate& other )
114  : QSharedData( other )
115  , fields( other.fields )
116  , nameToIndex( other.nameToIndex )
117  {
118  }
119 
120  ~QgsFieldsPrivate() {}
121 
124 
126  QHash<QString, int> nameToIndex;
127 
128 };
129 
131 
132 #endif
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)