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