QGIS API Documentation  3.20.0-Odense (decaadbb31)
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  , isReadOnly( other.isReadOnly )
82  {
83  }
84 
85  ~QgsFieldPrivate() = default;
86 
87  bool operator==( const QgsFieldPrivate &other ) const
88  {
89  return ( ( name == other.name ) && ( type == other.type ) && ( subType == other.subType )
90  && ( length == other.length ) && ( precision == other.precision )
91  && ( alias == other.alias ) && ( defaultValueDefinition == other.defaultValueDefinition )
92  && ( constraints == other.constraints ) && ( flags == other.flags )
93  && ( isReadOnly == other.isReadOnly ) );
94  }
95 
97  QString name;
98 
100  QVariant::Type type;
101 
103  QVariant::Type subType;
104 
106  QString typeName;
107 
109  int length;
110 
112  int precision;
113 
115  QString comment;
116 
118  QString alias;
119 
121  QgsField::ConfigurationFlags flags = QgsField::ConfigurationFlag::None;
122 
124  QgsDefaultValue defaultValueDefinition;
125 
127  QgsFieldConstraints constraints;
128 
129  QgsEditorWidgetSetup editorWidgetSetup;
130 
132  bool isReadOnly = false;
133 
134  private:
135  QgsFieldPrivate &operator=( const QgsFieldPrivate & ) = delete;
136 };
137 
139 
140 #endif
The QgsDefaultValue class provides a container for managing client side default values for fields.
Holder for the widget type and its configuration for a field.
Stores information about constraints which may be present on a field.
@ None
No flag is defined.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
const QString & typeName
int precision