QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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  , alias( other.alias )
69  , defaultValueExpression( other.defaultValueExpression )
70  {
71  }
72 
73  ~QgsFieldPrivate() {}
74 
75  bool operator==( const QgsFieldPrivate& other ) const
76  {
77  return (( name == other.name ) && ( type == other.type )
78  && ( length == other.length ) && ( precision == other.precision )
79  && ( alias == other.alias ) && ( defaultValueExpression == other.defaultValueExpression ) );
80  }
81 
83  QString name;
84 
86  QVariant::Type type;
87 
89  QString typeName;
90 
92  int length;
93 
95  int precision;
96 
98  QString comment;
99 
101  QString alias;
102 
104  QString defaultValueExpression;
105 };
106 
107 
108 /***************************************************************************
109  * This class is considered CRITICAL and any change MUST be accompanied with
110  * full unit tests in testqgsfields.cpp.
111  * See details in QEP #17
112  ****************************************************************************/
113 
114 class CORE_EXPORT QgsFieldsPrivate : public QSharedData
115 {
116  public:
117 
118  QgsFieldsPrivate()
119  {
120  }
121 
122  QgsFieldsPrivate( const QgsFieldsPrivate& other )
123  : QSharedData( other )
124  , fields( other.fields )
125  , nameToIndex( other.nameToIndex )
126  {
127  }
128 
129  ~QgsFieldsPrivate() {}
130 
133 
135  QHash<QString, int> nameToIndex;
136 
137 };
138 
140 
141 #endif
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)