QGIS API Documentation 3.99.0-Master (7d2ca374f2d)
Loading...
Searching...
No Matches
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
31#include "qgis.h"
32#include "qgsdefaultvalue.h"
34#include "qgsfield.h"
35#include "qgsfieldconstraints.h"
36
37#include <QSharedData>
38#include <QString>
39#include <QVariant>
40
41#define SIP_NO_FILE
42
43/***************************************************************************
44 * This class is considered CRITICAL and any change MUST be accompanied with
45 * full unit tests in testqgsfield.cpp.
46 * See details in QEP #17
47 ****************************************************************************/
48
49class QgsFieldPrivate : public QSharedData
50{
51 public:
52
53 QgsFieldPrivate( const QString &name = QString(),
54 QMetaType::Type type = QMetaType::Type::UnknownType,
55 QMetaType::Type subType = QMetaType::Type::UnknownType,
56 const QString &typeName = QString(),
57 int len = 0,
58 int prec = 0,
59 const QString &comment = QString(),
60 const QMap< int, QVariant > &metadata = QMap< int, QVariant >() )
61 : name( name )
62 , type( type )
63 , subType( subType )
64 , typeName( typeName )
65 , length( len )
66 , precision( prec )
67 , comment( comment )
68 , metadata( metadata )
69 {
70 }
71
72 QgsFieldPrivate( const QgsFieldPrivate &other )
73 : QSharedData( other )
74 , name( other.name )
75 , type( other.type )
76 , subType( other.subType )
77 , typeName( other.typeName )
78 , length( other.length )
79 , precision( other.precision )
80 , comment( other.comment )
81 , metadata( other.metadata )
82 , alias( other.alias )
83 , flags( other.flags )
84 , defaultValueDefinition( other.defaultValueDefinition )
85 , constraints( other.constraints )
86 , editorWidgetSetup( other.editorWidgetSetup )
87 , splitPolicy( other.splitPolicy )
88 , duplicatePolicy( other.duplicatePolicy )
89 , mergePolicy( other.mergePolicy )
90 , isReadOnly( other.isReadOnly )
91 {
92 }
93
94 ~QgsFieldPrivate() = default;
95
96 // TODO c++20 - replace with = default
97 bool operator==( const QgsFieldPrivate &other ) const
98 {
99 return ( ( name == other.name ) && ( type == other.type ) && ( subType == other.subType )
100 && ( length == other.length ) && ( precision == other.precision )
101 && ( metadata == other.metadata )
102 && ( alias == other.alias ) && ( defaultValueDefinition == other.defaultValueDefinition )
103 && ( constraints == other.constraints ) && ( flags == other.flags )
104 && ( splitPolicy == other.splitPolicy )
105 && ( duplicatePolicy == other.duplicatePolicy )
106 && ( mergePolicy == other.mergePolicy )
107 && ( isReadOnly == other.isReadOnly )
108 && ( editorWidgetSetup == other.editorWidgetSetup ) );
109 }
110
112 QString name;
113
115 QMetaType::Type type;
116
118 QMetaType::Type subType;
119
121 QString typeName;
122
124 int length;
125
127 int precision;
128
130 QString comment;
131
133 QMap< int, QVariant > metadata;
134
136 QString alias;
137
140
142 QgsDefaultValue defaultValueDefinition;
143
145 QgsFieldConstraints constraints;
146
147 QgsEditorWidgetSetup editorWidgetSetup;
148
151
154
157
159 bool isReadOnly = false;
160
161 private:
162 QgsFieldPrivate &operator=( const QgsFieldPrivate & ) = delete;
163};
164
166
167#endif
FieldDomainMergePolicy
Merge policy for field domains.
Definition qgis.h:4009
@ UnsetField
Clears the field value so that the data provider backend will populate using any backend triggers or ...
Definition qgis.h:4013
FieldDomainSplitPolicy
Split policy for field domains.
Definition qgis.h:3992
@ Duplicate
Duplicate original value.
Definition qgis.h:3994
FieldDuplicatePolicy
Duplicate policy for fields.
Definition qgis.h:4029
@ Duplicate
Duplicate original value.
Definition qgis.h:4031
@ NoFlag
No flag is defined.
Definition qgis.h:1795
QFlags< FieldConfigurationFlag > FieldConfigurationFlags
Configuration flags for fields These flags are meant to be user-configurable and are not describing a...
Definition qgis.h:1809
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)