QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgsunsetattributevalue.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsunsetattributevalue.h
3
------------------------
4
begin : July 2022
5
copyright : (C) 2022 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef QGSUNSETATTRIBUTEVALUE_H
19
#define QGSUNSETATTRIBUTEVALUE_H
20
21
#include "
qgis.h
"
22
#include "qgis_core.h"
23
24
#include <QString>
25
#include <QVariant>
26
27
using namespace
Qt::StringLiterals;
28
35
class
CORE_EXPORT
QgsUnsetAttributeValue
36
{
37
public
:
38
QgsUnsetAttributeValue
() =
default
;
39
43
explicit
QgsUnsetAttributeValue
(
const
QString &
defaultValueClause
);
44
48
QString
defaultValueClause
()
const
{
return
mDefaultValueClause; }
49
53
inline
bool
operator==
(
const
QgsUnsetAttributeValue
& )
const
{
return
true
; }
54
58
inline
bool
operator!=
(
const
QgsUnsetAttributeValue
& )
const
{
return
false
; }
59
60
#ifdef SIP_RUN
61
// clang-format off
62
SIP_PYOBJECT __repr__();
63
% MethodCode
64
QString str;
65
if
( !sipCpp->defaultValueClause().isEmpty() )
66
str = u
"<QgsUnsetAttributeValue: %1>"
_s.arg( sipCpp->defaultValueClause() );
67
else
68
str = u
"<QgsUnsetAttributeValue>"
_s;
69
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
70
% End
71
// clang-format on
72
#endif
73
75
operator
QVariant()
const
76
{
77
return
QVariant::fromValue( *
this
);
78
}
79
80
private
:
81
QString mDefaultValueClause;
82
};
83
84
Q_DECLARE_METATYPE
(
QgsUnsetAttributeValue
)
85
86
#ifndef SIP_RUN
87
#if ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 ) ) || defined( __clang__ )
88
#pragma GCC diagnostic push
89
#pragma GCC diagnostic ignored "-Wattributes"
90
#elif defined( _MSC_VER )
91
__pragma( warning( push ) ) __pragma( warning( disable : 4273 ) )
92
#endif
93
#endif
94
95
inline
bool
CORE_EXPORT
operator==
(
const
QgsUnsetAttributeValue
&value,
const
QString &other )
96
{
97
return
other == value.
defaultValueClause
();
98
}
99
100
#ifndef SIP_RUN
101
#if ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 ) ) || defined( __clang__ )
102
#pragma GCC diagnostic pop
103
#elif defined( _MSC_VER )
104
__pragma( warning( pop ) )
105
#endif
106
#endif
107
108
inline
bool
operator!=
(
const
QgsUnsetAttributeValue
&value,
const
QString &other )
109
{
110
return
other != value.
defaultValueClause
();
111
}
112
113
#ifndef SIP_RUN
114
inline
bool
operator==
(
const
QString &other,
const
QgsUnsetAttributeValue
&value )
115
{
116
return
other == value.
defaultValueClause
();
117
}
118
119
inline
bool
operator!=
(
const
QString &other,
const
QgsUnsetAttributeValue
&value )
120
{
121
return
other != value.
defaultValueClause
();
122
}
123
#endif
124
125
#endif
// QGSUNSETATTRIBUTEVALUE_H
QgsUnsetAttributeValue
Represents a default, "not-specified" value for a feature attribute.
Definition
qgsunsetattributevalue.h:36
QgsUnsetAttributeValue::operator==
bool operator==(const QgsUnsetAttributeValue &) const
QgsUnsetAttributeValues are always considered equal to each other, regardless of what the original pr...
Definition
qgsunsetattributevalue.h:53
QgsUnsetAttributeValue::QgsUnsetAttributeValue
QgsUnsetAttributeValue()=default
QgsUnsetAttributeValue::operator!=
bool operator!=(const QgsUnsetAttributeValue &) const
QgsUnsetAttributeValues are always considered equal to each other, regardless of what the original pr...
Definition
qgsunsetattributevalue.h:58
QgsUnsetAttributeValue::defaultValueClause
QString defaultValueClause() const
Returns the original data provider's default value clause.
Definition
qgsunsetattributevalue.h:48
qgis.h
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
operator!=
bool operator!=(const QgsUnsetAttributeValue &value, const QString &other)
Definition
qgsunsetattributevalue.h:108
operator==
bool CORE_EXPORT operator==(const QgsUnsetAttributeValue &value, const QString &other)
Definition
qgsunsetattributevalue.h:95
Generated on
for QGIS API Documentation by
1.17.0