QGIS API Documentation 3.99.0-Master (26c88405ac0)
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
25
32class CORE_EXPORT QgsProcessingModelChildDependency
33{
34 public:
35
39 QgsProcessingModelChildDependency( const QString &childId = QString(), const QString &conditionalBranch = QString() )
40 : childId( childId )
41 , conditionalBranch( conditionalBranch )
42 {
43 }
44
46 QString childId;
47
49 QString conditionalBranch;
50
55 QVariant toVariant() const
56 {
57 QVariantMap res;
58 res.insert( QStringLiteral( "child_id" ), childId );
59 res.insert( QStringLiteral( "conditional_branch" ), conditionalBranch );
60 return res;
61 }
62
67 bool loadVariant( const QVariantMap &map )
68 {
69 childId = map.value( QStringLiteral( "child_id" ) ).toString();
70 conditionalBranch = map.value( QStringLiteral( "conditional_branch" ) ).toString();
71 return true;
72 }
73
74 // TODO c++20 - replace with = default
75 bool operator==( const QgsProcessingModelChildDependency &other ) const
76 {
77 return childId == other.childId && conditionalBranch == other.conditionalBranch;
78 }
79
80 bool operator!=( const QgsProcessingModelChildDependency &other ) const
81 {
82 return !( *this == other );
83 }
84
85 bool operator<( const QgsProcessingModelChildDependency &other ) const
86 {
87 return childId == other.childId ? conditionalBranch < other.conditionalBranch : childId < other.childId;
88 }
89};
90
91Q_DECLARE_METATYPE( QgsProcessingModelChildDependency )
92
93
94
95#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:7039
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)