2 #include <score/model/IdentifiedObjectAbstract.hpp>
3 #include <score/model/Identifier.hpp>
4 #include <score/model/path/Path.hpp>
17 template <
typename model>
21 static const constexpr
bool identified_object_tag =
true;
22 using model_type = model;
33 template <
typename Visitor>
37 using vis_type =
typename std::remove_reference_t<Visitor>::type;
44 const id_type& id()
const noexcept {
return m_id; }
46 int32_t id_val()
const noexcept
final override {
return m_id.val(); }
48 void setId(
const id_type&
id) noexcept
51 m_path_cache.unsafePath().vec().clear();
55 void setId(
id_type&&
id) noexcept
58 m_path_cache.unsafePath().vec().clear();
62 void resetCache()
const noexcept
override { m_path_cache.unsafePath().vec().clear(); }
72 template <
typename model>
73 std::size_t hash_value(
const Id<model>&
id) noexcept
78 template <
typename T,
typename U>
79 bool operator==(
const T* obj,
const Id<U>&
id) noexcept
81 return obj->id() == id;
84 template <typename T, typename U, typename = decltype(std::declval<T>().id())>
85 bool operator==(
const T& obj,
const Id<U>&
id) noexcept
87 return obj.id() == id;
103 template <
typename T>
106 static_assert(!std::is_pointer<T>::value,
"Don't pass a pointer to path");
107 if(obj.m_path_cache.valid())
108 return obj.m_path_cache;
111 =
Path<T>{score::IDocument::unsafe_path(safe_cast<const QObject&>(obj)), {}};
112 return obj.m_path_cache;
Base class for IdentifiedObject.
Definition: IdentifiedObjectAbstract.hpp:16
The IdentifiedObject class.
Definition: IdentifiedObject.hpp:19
The id_base_t class.
Definition: Identifier.hpp:57
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: VisitorInterface.hpp:13