QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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"
33 #include "qgseditorwidgetsetup.h"
34 #include "qgsdefaultvalue.h"
35 #include "qgsfield.h"
36 
37 #include <QString>
38 #include <QVariant>
39 #include <QSharedData>
40 
41 /***************************************************************************
42  * This class is considered CRITICAL and any change MUST be accompanied with
43  * full unit tests in testqgsfield.cpp.
44  * See details in QEP #17
45  ****************************************************************************/
46 
47 class QgsFieldPrivate : public QSharedData
48 {
49  public:
50 
51  QgsFieldPrivate( const QString &name = QString(),
52  QVariant::Type type = QVariant::Invalid,
53  QVariant::Type subType = QVariant::Invalid,
54  const QString &typeName = QString(),
55  int len = 0,
56  int prec = 0,
57  const QString &comment = QString() )
58  : name( name )
59  , type( type )
60  , subType( subType )
61  , typeName( typeName )
62  , length( len )
63  , precision( prec )
64  , comment( comment )
65  {
66  }
67 
68  QgsFieldPrivate( const QgsFieldPrivate &other )
69  : QSharedData( other )
70  , name( other.name )
71  , type( other.type )
72  , subType( other.subType )
73  , typeName( other.typeName )
74  , length( other.length )
75  , precision( other.precision )
76  , comment( other.comment )
77  , alias( other.alias )
78  , flags( other.flags )
79  , defaultValueDefinition( other.defaultValueDefinition )
80  , constraints( other.constraints )
81  , isReadOnly( other.isReadOnly )
82  {
83  }
84 
85  ~QgsFieldPrivate() = default;
86 
87  // TODO c++20 - replace with = default
88  bool operator==( const QgsFieldPrivate &other ) const
89  {
90  return ( ( name == other.name ) && ( type == other.type ) && ( subType == other.subType )
91  && ( length == other.length ) && ( precision == other.precision )
92  && ( alias == other.alias ) && ( defaultValueDefinition == other.defaultValueDefinition )
93  && ( constraints == other.constraints ) && ( flags == other.flags )
94  && ( isReadOnly == other.isReadOnly ) );
95  }
96 
98  QString name;
99 
101  QVariant::Type type;
102 
104  QVariant::Type subType;
105 
107  QString typeName;
108 
110  int length;
111 
113  int precision;
114 
116  QString comment;
117 
119  QString alias;
120 
122  QgsField::ConfigurationFlags flags = QgsField::ConfigurationFlag::None;
123 
125  QgsDefaultValue defaultValueDefinition;
126 
128  QgsFieldConstraints constraints;
129 
130  QgsEditorWidgetSetup editorWidgetSetup;
131 
133  bool isReadOnly = false;
134 
135  private:
136  QgsFieldPrivate &operator=( const QgsFieldPrivate & ) = delete;
137 };
138 
140 
141 #endif
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