Preset.hpp
1 #pragma once
2 #include <Process/ProcessMetadata.hpp>
3 
4 #include <optional>
5 #include <verdigris>
6 namespace Process
7 {
8 class ProcessFactoryList;
9 
11 {
13  QString effect;
14  friend bool
15  operator==(const ProcessIdentifier& lhs, const ProcessIdentifier& rhs) noexcept
16  {
17  return lhs.key == rhs.key && lhs.effect == rhs.effect;
18  }
19  friend bool
20  operator!=(const ProcessIdentifier& lhs, const ProcessIdentifier& rhs) noexcept
21  {
22  return !(lhs == rhs);
23  }
24  friend bool
25  operator<(const ProcessIdentifier& lhs, const ProcessIdentifier& rhs) noexcept
26  {
27  return lhs.key < rhs.key || (lhs.key == rhs.key && lhs.effect < rhs.effect);
28  }
29 };
30 
31 struct SCORE_LIB_PROCESS_EXPORT Preset
32 {
33  QString name;
35  QByteArray data;
36 
37  static std::shared_ptr<Process::Preset>
38  fromJson(const Process::ProcessFactoryList& procs, const QByteArray& obj) noexcept;
39 
40  QByteArray toJson() const noexcept;
41 
42  friend bool operator==(const Preset& lhs, const Preset& rhs) noexcept
43  {
44  return lhs.name == rhs.name && lhs.key == rhs.key && lhs.data == rhs.data;
45  }
46  friend bool operator!=(const Preset& lhs, const Preset& rhs) noexcept
47  {
48  return !(lhs == rhs);
49  }
50  friend bool operator<(const Preset& lhs, const Preset& rhs) noexcept
51  {
52  return lhs.key < rhs.key;
53  }
54 };
55 }
56 
57 Q_DECLARE_METATYPE(Process::Preset)
58 W_REGISTER_ARGTYPE(Process::Preset)
59 Q_DECLARE_METATYPE(std::optional<Process::Preset>)
60 W_REGISTER_ARGTYPE(std::optional<Process::Preset>)
Definition: ProcessList.hpp:10
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
Definition: Preset.hpp:32
Definition: Preset.hpp:11