QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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 QVariant::Type type = QVariant::Invalid,
54 QVariant::Type subType = QVariant::Invalid,
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 , isReadOnly( other.isReadOnly )
88 {
89 }
90
91 ~QgsFieldPrivate() = default;
92
93 // TODO c++20 - replace with = default
94 bool operator==( const QgsFieldPrivate &other ) const
95 {
96 return ( ( name == other.name ) && ( type == other.type ) && ( subType == other.subType )
97 && ( length == other.length ) && ( precision == other.precision )
98 && ( metadata == other.metadata )
99 && ( alias == other.alias ) && ( defaultValueDefinition == other.defaultValueDefinition )
100 && ( constraints == other.constraints ) && ( flags == other.flags )
101 && ( splitPolicy == other.splitPolicy )
102 && ( isReadOnly == other.isReadOnly )
103 && ( editorWidgetSetup == other.editorWidgetSetup ) );
104 }
105
107 QString name;
108
110 QVariant::Type type;
111
113 QVariant::Type subType;
114
116 QString typeName;
117
119 int length;
120
122 int precision;
123
125 QString comment;
126
128 QMap< int, QVariant > metadata;
129
131 QString alias;
132
135
137 QgsDefaultValue defaultValueDefinition;
138
140 QgsFieldConstraints constraints;
141
142 QgsEditorWidgetSetup editorWidgetSetup;
143
146
148 bool isReadOnly = false;
149
150 private:
151 QgsFieldPrivate &operator=( const QgsFieldPrivate & ) = delete;
152};
153
155
156#endif
FieldDomainSplitPolicy
Split policy for field domains.
Definition: qgis.h:3182
@ 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:1323
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