Loading...
Searching...
No Matches
ObjectIdentifier.hpp
1#pragma once
2#include <score/model/Identifier.hpp>
3#include <score/serialization/VisitorInterface.hpp>
4
5#include <ossia/detail/config.hpp>
6
7#include <verdigris>
8
21{
22 friend bool operator==(const ObjectIdentifier& lhs, const ObjectIdentifier& rhs)
23 {
24 return (lhs.m_objectName == rhs.m_objectName) && (lhs.m_id == rhs.m_id);
25 }
26
27public:
28 ObjectIdentifier() = default;
29 explicit ObjectIdentifier(const char* name)
30 : m_objectName{name}
31 {
32 }
33
34 ObjectIdentifier(QString name, int32_t id)
35 : m_objectName{std::move(name)}
36 , m_id{id}
37 {
38 }
39
40 template <typename T>
41 ObjectIdentifier(QString name, Id<T> id)
42 : m_objectName{std::move(name)}
43 , m_id{id.val()}
44 {
45 }
46
47 const QString& objectName() const { return m_objectName; }
48
49 int32_t id() const { return m_id; }
50
51private:
52 QString m_objectName;
53 int32_t m_id{};
54};
55
56using ObjectIdentifierVector = std::vector<ObjectIdentifier>;
The ObjectIdentifier class.
Definition ObjectIdentifier.hpp:21
The id_base_t class.
Definition Identifier.hpp:57