QGIS API Documentation 3.41.0-Master (af5edcb665c)
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#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 , isReadOnly( other.isReadOnly )
89 {
90 }
91
92 ~QgsFieldPrivate() = default;
93
94 // TODO c++20 - replace with = default
95 bool operator==( const QgsFieldPrivate &other ) const
96 {
97 return ( ( name == other.name ) && ( type == other.type ) && ( subType == other.subType )
98 && ( length == other.length ) && ( precision == other.precision )
99 && ( metadata == other.metadata )
100 && ( alias == other.alias ) && ( defaultValueDefinition == other.defaultValueDefinition )
101 && ( constraints == other.constraints ) && ( flags == other.flags )
102 && ( splitPolicy == other.splitPolicy )
103 && ( duplicatePolicy == other.duplicatePolicy )
104 && ( isReadOnly == other.isReadOnly )
105 && ( editorWidgetSetup == other.editorWidgetSetup ) );
106 }
107
109 QString name;
110
112 QMetaType::Type type;
113
115 QMetaType::Type subType;
116
118 QString typeName;
119
121 int length;
122
124 int precision;
125
127 QString comment;
128
130 QMap< int, QVariant > metadata;
131
133 QString alias;
134
137
139 QgsDefaultValue defaultValueDefinition;
140
142 QgsFieldConstraints constraints;
143
144 QgsEditorWidgetSetup editorWidgetSetup;
145
148
151
153 bool isReadOnly = false;
154
155 private:
156 QgsFieldPrivate &operator=( const QgsFieldPrivate & ) = delete;
157};
158
160
161#endif
FieldDomainSplitPolicy
Split policy for field domains.
Definition qgis.h:3691
@ Duplicate
Duplicate original value.
FieldDuplicatePolicy
Duplicate policy for fields.
Definition qgis.h:3723
@ 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:1646
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.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
const QString & typeName
int precision