QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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_core.h"
22 #include "qgis.h"
23 
24 
26 
33 class CORE_EXPORT QgsProcessingModelChildDependency
34 {
35  public:
36 
40  QgsProcessingModelChildDependency( const QString &childId = QString(), const QString &conditionalBranch = QString() )
41  : childId( childId )
42  , conditionalBranch( conditionalBranch )
43  {
44  }
45 
47  QString childId;
48 
50  QString conditionalBranch;
51 
56  QVariant toVariant() const
57  {
58  QVariantMap res;
59  res.insert( QStringLiteral( "child_id" ), childId );
60  res.insert( QStringLiteral( "conditional_branch" ), conditionalBranch );
61  return res;
62  }
63 
68  bool loadVariant( const QVariantMap &map )
69  {
70  childId = map.value( QStringLiteral( "child_id" ) ).toString();
71  conditionalBranch = map.value( QStringLiteral( "conditional_branch" ) ).toString();
72  return true;
73  }
74 
75  // TODO c++20 - replace with = default
76  bool operator==( const QgsProcessingModelChildDependency &other ) const
77  {
78  return childId == other.childId && conditionalBranch == other.conditionalBranch;
79  }
80 
81  bool operator!=( const QgsProcessingModelChildDependency &other ) const
82  {
83  return !( *this == other );
84  }
85 
86  bool operator<( const QgsProcessingModelChildDependency &other ) const
87  {
88  return childId == other.childId ? conditionalBranch < other.conditionalBranch : childId < other.childId;
89  }
90 };
91 
92 Q_DECLARE_METATYPE( QgsProcessingModelChildDependency )
93 
94 
96 #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:1889
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Q_DECLARE_METATYPE(QgsMeshTimeSettings)