QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 #define SIP_NO_FILE
31 
32 #include "qgsfieldconstraints.h"
33 #include "qgseditorwidgetsetup.h"
34 #include "qgsdefaultvalue.h"
35 #include <QString>
36 #include <QVariant>
37 #include <QSharedData>
38 
39 /***************************************************************************
40  * This class is considered CRITICAL and any change MUST be accompanied with
41  * full unit tests in testqgsfield.cpp.
42  * See details in QEP #17
43  ****************************************************************************/
44 
45 class QgsFieldPrivate : public QSharedData
46 {
47  public:
48 
49  QgsFieldPrivate( const QString &name = QString(),
50  QVariant::Type type = QVariant::Invalid,
51  QVariant::Type subType = QVariant::Invalid,
52  const QString &typeName = QString(),
53  int len = 0,
54  int prec = 0,
55  const QString &comment = QString() )
56  : name( name )
57  , type( type )
58  , subType( subType )
59  , typeName( typeName )
60  , length( len )
61  , precision( prec )
62  , comment( comment )
63  {
64  }
65 
66  QgsFieldPrivate( const QgsFieldPrivate &other )
67  : QSharedData( other )
68  , name( other.name )
69  , type( other.type )
70  , subType( other.subType )
71  , typeName( other.typeName )
72  , length( other.length )
73  , precision( other.precision )
74  , comment( other.comment )
75  , alias( other.alias )
76  , defaultValueDefinition( other.defaultValueDefinition )
77  , constraints( other.constraints )
78  {
79  }
80 
81  ~QgsFieldPrivate() = default;
82 
83  bool operator==( const QgsFieldPrivate &other ) const
84  {
85  return ( ( name == other.name ) && ( type == other.type ) && ( subType == other.subType )
86  && ( length == other.length ) && ( precision == other.precision )
87  && ( alias == other.alias ) && ( defaultValueDefinition == other.defaultValueDefinition )
88  && ( constraints == other.constraints ) );
89  }
90 
92  QString name;
93 
95  QVariant::Type type;
96 
98  QVariant::Type subType;
99 
101  QString typeName;
102 
104  int length;
105 
107  int precision;
108 
110  QString comment;
111 
113  QString alias;
114 
116  QgsDefaultValue defaultValueDefinition;
117 
119  QgsFieldConstraints constraints;
120 
121  QgsEditorWidgetSetup editorWidgetSetup;
122 };
123 
125 
126 #endif
int precision
The QgsDefaultValue class provides a container for managing client side default values for fields...
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Stores information about constraints which may be present on a field.
const QString & typeName
Holder for the widget type and its configuration for a field.