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