QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgsselectivemaskingsourceset.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsselectivemaskingsourceset.h
3 ---------------------------
4 begin : January 2026
5 copyright : (C) 2026 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 QGSSELECTIVEMASKINGSOURCESET_H
17#define QGSSELECTIVEMASKINGSOURCESET_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
22
23#include <QString>
24
25using namespace Qt::StringLiterals;
26
27class QDomElement;
28class QDomDocument;
30
40{
41 public:
46
50 bool isValid() const { return mIsValid; }
51
60 void setId( const QString &id ) { mId = id; }
61
70 QString id() const { return mId; }
71
77 QString name() const { return mName; }
78
84 void setName( const QString &name )
85 {
86 mName = name;
87 mIsValid = true;
88 }
89
95 QVector< QgsSelectiveMaskSource > sources() const;
96
102 void setSources( const QVector< QgsSelectiveMaskSource > &sources );
103
107 void append( const QgsSelectiveMaskSource &source );
108
114 QDomElement writeXml( QDomDocument &document, const QgsReadWriteContext &context ) const;
115
121 bool readXml( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
122
126 QgsSelectiveMaskSource &operator[]( int index ) SIP_FACTORY;
127#ifdef SIP_RUN
128 // clang-format off
129 % MethodCode
130 SIP_SSIZE_T idx = sipConvertFromSequenceIndex( a0, sipCpp->size() );
131 if ( idx < 0 )
132 sipIsErr = 1;
133 else
134 sipRes = new QgsSelectiveMaskSource( sipCpp->operator[]( idx ) );
135 % End
136// clang-format on
137#endif
138
142 int size() const;
143
147 bool isEmpty() const;
148
149#ifdef SIP_RUN
150 // clang-format off
151 int __len__() const;
152 % MethodCode
153 sipRes = sipCpp->size();
154 % End
155// clang-format on
156#endif
157
158#ifdef SIP_RUN
159 // clang-format off
160 SIP_PYOBJECT __repr__();
161 % MethodCode
162 if ( !sipCpp->isValid() )
163 {
164 sipRes = PyUnicode_FromString( "<QgsSelectiveMaskingSourceSet: invalid>" );
165 }
166 else if ( !sipCpp->name().isEmpty() )
167 {
168 const QString str = u"<QgsSelectiveMaskingSourceSet: %1 (%2)>"_s.arg(
169 sipCpp->id(),
170 sipCpp->name() );
171 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
172 }
173 else
174 {
175 const QString str = u"<QgsSelectiveMaskingSourceSet: %1>"_s.arg(
176 sipCpp->id() );
177 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
178 }
179 % End
180// clang-format on
181#endif
182
183 // clang-format off
184 private:
185 // clang-format on
186 bool mIsValid
187 = false;
188 QString mId;
189 QString mName;
190 QVector< QgsSelectiveMaskSource > mSources;
191};
192
194
195#endif //QGSSELECTIVEMASKINGSOURCESET_H
A container for the context for various read/write operations on objects.
Encapsulates a single source for selective masking (e.g.
Represents a named set of selective masking sources (QgsSelectiveMaskSource).
void setName(const QString &name)
Sets the set's unique name.
QString id() const
Returns a unique identifier for the set.
QgsSelectiveMaskingSourceSet()
Constructor for an empty (invalid) QgsSelectiveMaskingSourceSet.
void setId(const QString &id)
Sets the unique identifier for the set.
QString name() const
Returns the set's unique name.
bool isValid() const
Returns true if the source set is valid, or false if it is invalid (default constructed).
#define SIP_FACTORY
Definition qgis_sip.h:83
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)