载入中...
搜索中...
未找到
EditingIds.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Identity.h"
4
5#include <cstddef>
6#include <functional>
7#include <string>
8#include <string_view>
9#include <utility>
10
11namespace eve::editing {
12
17template <class Tag>
19
21template <class Id>
25 [[nodiscard]] std::size_t operator()(const Id& id) const noexcept { return static_cast<std::size_t>(id.hash()); }
26};
27
34template <class Tag>
36[[nodiscard]] eve::StrongUuid<Tag> canonicalUuid(const StrongId<Tag>& id) noexcept {
37 return id.uuid();
38}
39
40struct SessionIdTag;
41struct TargetIdTag;
42struct CommandIdTag;
43struct ToolIdTag;
44struct RuleIdTag;
45struct CapabilityIdTag;
46struct TransactionIdTag;
47struct PlanIdTag;
48struct StableIdTag;
49struct ObjectIdTag;
50struct AssetGuidTag;
51struct DocumentIdTag;
52struct GraphNodeIdTag;
53struct GraphPinIdTag;
54struct TaskIdTag;
55
71
79public:
81 PropertyPath() = default;
83 explicit PropertyPath(const char* value) : value_(value ? value : "") {}
85 explicit PropertyPath(std::string value) : value_(std::move(value)) {}
87 explicit PropertyPath(std::string_view value) : value_(value) {}
88
90 [[nodiscard]] const std::string& value() const noexcept { return value_; }
92 [[nodiscard]] bool empty() const noexcept { return value_.empty(); }
94 [[nodiscard]] explicit operator bool() const noexcept { return !empty(); }
95
97 friend bool operator==(const PropertyPath&, const PropertyPath&) = default;
99 friend auto operator<=>(const PropertyPath&, const PropertyPath&) = default;
100
101private:
102 std::string value_;
103};
104
108 [[nodiscard]] std::size_t operator()(const PropertyPath& path) const noexcept {
109 return std::hash<std::string>{}(path.value());
110 }
111};
112
113} // namespace eve::editing
Strong identity values shared by persistence, content and logical-name APIs.
std::string path
Definition PlayHost.cpp:110
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:314
Id128 public API.
Definition Identity.h:112
Dotted property path (layout.size) compared and persisted as text.
Definition EditingIds.h:78
PropertyPath(std::string value)
Constructs a PropertyPath.
Definition EditingIds.h:85
const std::string & value() const noexcept
Value.
Definition EditingIds.h:90
PropertyPath(const char *value)
Constructs a PropertyPath.
Definition EditingIds.h:83
bool empty() const noexcept
Empty.
Definition EditingIds.h:92
PropertyPath(std::string_view value)
Constructs a PropertyPath.
Definition EditingIds.h:87
PropertyPath()=default
Constructs a PropertyPath.
friend bool operator==(const PropertyPath &, const PropertyPath &)=default
Operator ==.
friend auto operator<=>(const PropertyPath &, const PropertyPath &)=default
Operator <=>.
eve::StrongUuid< Tag > canonicalUuid(const StrongId< Tag > &id) noexcept
Project an authoring identifier to its canonical UUID value.
Definition EditingIds.h:36
Hash functor for a dotted property path.
Definition EditingIds.h:106
std::size_t operator()(const PropertyPath &path) const noexcept
Operator .
Definition EditingIds.h:108
Hash functor for a strong authoring identifier.
Definition EditingIds.h:23
std::size_t operator()(const Id &id) const noexcept
Operator .
Definition EditingIds.h:25