QGIS API Documentation 3.99.0-Master (8e76e220402)
Loading...
Searching...
No Matches
qgsprocessingmodelchilddependency.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingmodelchilddependency.h
3 -----------------------------
4 begin : April 2020
5 copyright : (C) 2020 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 QGSPROCESSINGMODELCHILDDEPENDENCY_H
19#define QGSPROCESSINGMODELCHILDDEPENDENCY_H
20
21#include "qgis.h"
22#include "qgis_core.h"
23
24#include <QString>
25
26using namespace Qt::StringLiterals;
27
29
36class CORE_EXPORT QgsProcessingModelChildDependency
37{
38 public:
39
43 QgsProcessingModelChildDependency( const QString &childId = QString(), const QString &conditionalBranch = QString() )
44 : childId( childId )
45 , conditionalBranch( conditionalBranch )
46 {
47 }
48
50 QString childId;
51
53 QString conditionalBranch;
54
59 QVariant toVariant() const
60 {
61 QVariantMap res;
62 res.insert( u"child_id"_s, childId );
63 res.insert( u"conditional_branch"_s, conditionalBranch );
64 return res;
65 }
66
71 bool loadVariant( const QVariantMap &map )
72 {
73 childId = map.value( u"child_id"_s ).toString();
74 conditionalBranch = map.value( u"conditional_branch"_s ).toString();
75 return true;
76 }
77
78 // TODO c++20 - replace with = default
79 bool operator==( const QgsProcessingModelChildDependency &other ) const
80 {
81 return childId == other.childId && conditionalBranch == other.conditionalBranch;
82 }
83
84 bool operator!=( const QgsProcessingModelChildDependency &other ) const
85 {
86 return !( *this == other );
87 }
88
89 bool operator<( const QgsProcessingModelChildDependency &other ) const
90 {
91 return childId == other.childId ? conditionalBranch < other.conditionalBranch : childId < other.childId;
92 }
93};
94
95Q_DECLARE_METATYPE( QgsProcessingModelChildDependency )
96
97
98
99#endif // QGSPROCESSINGMODELCHILDDEPENDENCY_H
bool operator<(const QVariant &v1, const QVariant &v2)
Compares two QVariant values and returns whether the first is less than the second.
Definition qgis.h:7365
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)