QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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 QgsFieldPrivate(
53 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 )
62 : name( name )
63 , type( type )
64 , subType( subType )
65 , typeName( typeName )
66 , length( len )
67 , precision( prec )
68 , comment( comment )
69 , metadata( metadata )
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 ~QgsFieldPrivate() = default;
94
95 // TODO c++20 - replace with = default
96 bool operator==( const QgsFieldPrivate &other ) const
97 {
98 return (
99 ( name == other.name )
100 && ( type == other.type )
101 && ( subType == other.subType )
102 && ( length == other.length )
103 && ( precision == other.precision )
104 && ( metadata == other.metadata )
105 && ( alias == other.alias )
106 && ( defaultValueDefinition == other.defaultValueDefinition )
107 && ( constraints == other.constraints )
108 && ( flags == other.flags )
109 && ( splitPolicy == other.splitPolicy )
110 && ( duplicatePolicy == other.duplicatePolicy )
111 && ( mergePolicy == other.mergePolicy )
112 && ( isReadOnly == other.isReadOnly )
113 && ( editorWidgetSetup == other.editorWidgetSetup )
114 );
115 }
116
118 QString name;
119
121 QMetaType::Type type;
122
124 QMetaType::Type subType;
125
127 QString typeName;
128
130 int length;
131
133 int precision;
134
136 QString comment;
137
139 QMap< int, QVariant > metadata;
140
142 QString alias;
143
146
148 QgsDefaultValue defaultValueDefinition;
149
151 QgsFieldConstraints constraints;
152
153 QgsEditorWidgetSetup editorWidgetSetup;
154
157
160
163
165 bool isReadOnly = false;
166
167 private:
168 QgsFieldPrivate &operator=( const QgsFieldPrivate & ) = delete;
169};
170
172
173#endif
FieldDomainMergePolicy
Merge policy for field domains.
Definition qgis.h:4040
@ UnsetField
Clears the field value so that the data provider backend will populate using any backend triggers or ...
Definition qgis.h:4044
FieldDomainSplitPolicy
Split policy for field domains.
Definition qgis.h:4023
@ Duplicate
Duplicate original value.
Definition qgis.h:4025
FieldDuplicatePolicy
Duplicate policy for fields.
Definition qgis.h:4060
@ Duplicate
Duplicate original value.
Definition qgis.h:4062
@ NoFlag
No flag is defined.
Definition qgis.h:1801
QFlags< FieldConfigurationFlag > FieldConfigurationFlags
Configuration flags for fields These flags are meant to be user-configurable and are not describing a...
Definition qgis.h:1815
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)