QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
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 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 , splitPolicy( other.splitPolicy )
86 , isReadOnly( other.isReadOnly )
87 {
88 }
89
90 ~QgsFieldPrivate() = default;
91
92 // TODO c++20 - replace with = default
93 bool operator==( const QgsFieldPrivate &other ) const
94 {
95 return ( ( name == other.name ) && ( type == other.type ) && ( subType == other.subType )
96 && ( length == other.length ) && ( precision == other.precision )
97 && ( metadata == other.metadata )
98 && ( alias == other.alias ) && ( defaultValueDefinition == other.defaultValueDefinition )
99 && ( constraints == other.constraints ) && ( flags == other.flags )
100 && ( splitPolicy == other.splitPolicy )
101 && ( isReadOnly == other.isReadOnly ) );
102 }
103
105 QString name;
106
108 QVariant::Type type;
109
111 QVariant::Type subType;
112
114 QString typeName;
115
117 int length;
118
120 int precision;
121
123 QString comment;
124
126 QMap< int, QVariant > metadata;
127
129 QString alias;
130
132 Qgis::FieldConfigurationFlags flags = Qgis::FieldConfigurationFlag::NoFlag;
133
135 QgsDefaultValue defaultValueDefinition;
136
138 QgsFieldConstraints constraints;
139
140 QgsEditorWidgetSetup editorWidgetSetup;
141
144
146 bool isReadOnly = false;
147
148 private:
149 QgsFieldPrivate &operator=( const QgsFieldPrivate & ) = delete;
150};
151
153
154#endif
FieldDomainSplitPolicy
Split policy for field domains.
Definition qgis.h:2632
@ Duplicate
Duplicate original value.
@ NoFlag
No flag is defined.
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