QGIS API Documentation 3.99.0-Master (e9821da5c6b)
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:
42
47
51 bool isValid() const { return mIsValid; }
52
61 void setId( const QString &id ) { mId = id; }
62
71 QString id() const { return mId; }
72
78 QString name() const { return mName; }
79
85 void setName( const QString &name ) { mName = name; mIsValid = true; }
86
92 QVector< QgsSelectiveMaskSource > sources() const;
93
99 void setSources( const QVector< QgsSelectiveMaskSource > &sources );
100
104 void append( const QgsSelectiveMaskSource &source );
105
111 QDomElement writeXml( QDomDocument &document, const QgsReadWriteContext &context ) const;
112
118 bool readXml( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
119
123 QgsSelectiveMaskSource &operator[]( int index ) SIP_FACTORY;
124#ifdef SIP_RUN
125 % MethodCode
126 SIP_SSIZE_T idx = sipConvertFromSequenceIndex( a0, sipCpp->size() );
127 if ( idx < 0 )
128 sipIsErr = 1;
129 else
130 sipRes = new QgsSelectiveMaskSource( sipCpp->operator[]( idx ) );
131 % End
132#endif
133
137 int size() const;
138
142 bool isEmpty() const;
143
144#ifdef SIP_RUN
145 int __len__() const;
146 % MethodCode
147 sipRes = sipCpp->size();
148 % End
149#endif
150
151#ifdef SIP_RUN
152 SIP_PYOBJECT __repr__();
153 % MethodCode
154 if ( !sipCpp->isValid() )
155 {
156 sipRes = PyUnicode_FromString( "<QgsSelectiveMaskingSourceSet: invalid>" );
157 }
158 else if ( !sipCpp->name().isEmpty() )
159 {
160 const QString str = u"<QgsSelectiveMaskingSourceSet: %1 (%2)>"_s.arg(
161 sipCpp->id(),
162 sipCpp->name() );
163 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
164 }
165 else
166 {
167 const QString str = u"<QgsSelectiveMaskingSourceSet: %1>"_s.arg(
168 sipCpp->id() );
169 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
170 }
171 % End
172#endif
173
174 private:
175 bool mIsValid = false;
176 QString mId;
177 QString mName;
178 QVector< QgsSelectiveMaskSource > mSources;
179};
180
182
183#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:84
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)