QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
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 : name( name )
60 , type( type )
61 , subType( subType )
63 , length( len )
64 , precision( prec )
65 , comment( comment )
66 {
67 }
68
69 QgsFieldPrivate( const QgsFieldPrivate &other )
70 : QSharedData( other )
71 , name( other.name )
72 , type( other.type )
73 , subType( other.subType )
74 , typeName( other.typeName )
75 , length( other.length )
76 , precision( other.precision )
77 , comment( other.comment )
78 , alias( other.alias )
79 , flags( other.flags )
80 , defaultValueDefinition( other.defaultValueDefinition )
81 , constraints( other.constraints )
82 , splitPolicy( other.splitPolicy )
83 , isReadOnly( other.isReadOnly )
84 {
85 }
86
87 ~QgsFieldPrivate() = default;
88
89 // TODO c++20 - replace with = default
90 bool operator==( const QgsFieldPrivate &other ) const
91 {
92 return ( ( name == other.name ) && ( type == other.type ) && ( subType == other.subType )
93 && ( length == other.length ) && ( precision == other.precision )
94 && ( alias == other.alias ) && ( defaultValueDefinition == other.defaultValueDefinition )
95 && ( constraints == other.constraints ) && ( flags == other.flags )
96 && ( splitPolicy == other.splitPolicy )
97 && ( isReadOnly == other.isReadOnly ) );
98 }
99
101 QString name;
102
104 QVariant::Type type;
105
107 QVariant::Type subType;
108
110 QString typeName;
111
113 int length;
114
116 int precision;
117
119 QString comment;
120
122 QString alias;
123
125 QgsField::ConfigurationFlags flags = QgsField::ConfigurationFlag::None;
126
128 QgsDefaultValue defaultValueDefinition;
129
131 QgsFieldConstraints constraints;
132
133 QgsEditorWidgetSetup editorWidgetSetup;
134
137
139 bool isReadOnly = false;
140
141 private:
142 QgsFieldPrivate &operator=( const QgsFieldPrivate & ) = delete;
143};
144
146
147#endif
FieldDomainSplitPolicy
Split policy for field domains.
Definition: qgis.h:2273
@ Duplicate
Duplicate original value.
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.
@ None
No flag is defined.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
const QString & typeName
int precision