载入中...
搜索中...
未找到
Identity.h
浏览该文件的文档.
66[[nodiscard]] EVENGINE_API std::optional<UuidBytes> parseUuidText(std::string_view text) noexcept;
72[[nodiscard]] EVENGINE_API UuidBytes childUuidBytes(const UuidBytes& parent, std::string_view role) noexcept;
222 friend constexpr auto operator<=>(const Id128& lhs, const Id128& rhs) noexcept { return lhs.bytes_ <=> rhs.bytes_; }
326 explicit UuidIdAdapter(const char* value) : UuidIdAdapter(std::string_view(value ? value : "")) {}
374 [[nodiscard]] std::string canonicalFormat() const { return detail::formatUuidBytes(state_.uuid); }
380 [[nodiscard]] bool isNil() const noexcept { return state_.spelling.empty() || Uuid(state_.uuid).isNil(); }
433 [[nodiscard]] static std::optional<LogicalId> fromParts(std::string_view namespaceName, std::string_view name);
Human-readable, scoped identifier in the form namespace:name.
Definition Identity.h:414
const std::string & format() const noexcept
Returns the canonical namespace:name representation.
Definition Identity.h:439
bool isValid() const noexcept
Returns whether this value contains a valid namespace and name.
Definition Identity.h:436
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:313
bool isNil() const noexcept
True when the value is an empty or UUID nil identity.
Definition Identity.h:380
friend bool operator==(const UuidIdAdapter &lhs, const UuidIdAdapter &rhs) noexcept
Operator ==.
Definition Identity.h:392
static UuidIdAdapter fromUuid(Uuid value)
Builds an adapter from an explicit canonical UUID.
Definition Identity.h:346
bool isCanonicalUuid() const noexcept
True when the input was canonical UUID text rather than legacy text.
Definition Identity.h:383
UuidIdAdapter(std::string value)
Constructs from a legacy spelling or canonical UUID text.
Definition Identity.h:329
UuidIdAdapter(const UuidIdAdapter &)=default
const std::string & value() const noexcept
Returns the exact legacy or canonical compatibility spelling.
Definition Identity.h:365
friend auto operator<=>(const UuidIdAdapter &lhs, const UuidIdAdapter &rhs) noexcept
Orders adapter values by their canonical UUID projection.
Definition Identity.h:397
std::string canonicalFormat() const
Returns the canonical UUID projection as lower-case UUID text.
Definition Identity.h:374
UuidIdAdapter(UuidIdAdapter &&) noexcept=default
bool empty() const noexcept
True when no compatibility spelling has been assigned.
Definition Identity.h:377
UuidIdAdapter(std::string_view value)
Constructs from a legacy spelling or canonical UUID text.
Definition Identity.h:332
std::uint64_t hash() const noexcept
Stable hash of the canonical UUID projection.
Definition Identity.h:386
static std::optional< UuidIdAdapter > parse(std::string_view value)
Parses canonical UUID text or a non-empty legacy spelling.
Definition Identity.h:339
UuidIdAdapter & operator=(const UuidIdAdapter &)=default
const std::string & format() const noexcept
Returns the compatibility spelling; use canonicalFormat at persistence boundaries.
Definition Identity.h:368
static UuidIdAdapter fromLegacy(std::string value)
Builds an adapter while explicitly retaining a legacy spelling.
Definition Identity.h:355
UuidIdAdapter()=default
Constructs an empty compatibility identifier.
std::string format() const
Formats the ID in lower-case canonical UUID text.
Definition Identity.h:172
friend constexpr bool operator==(const Id128 &, const Id128 &) noexcept=default
Operator ==.
static std::optional< Id128 > fromBytes(std::span< const std::uint8_t > bytes) noexcept
Constructs an ID from exactly 16 bytes.
Definition Identity.h:160
constexpr bool isNil() const noexcept
Returns whether this value is the all-zero nil ID.
Definition Identity.h:175
static std::optional< Id128 > parse(std::string_view text) noexcept
Parses canonical UUID text.
Definition Identity.h:150
friend constexpr auto operator<=>(const Id128 &lhs, const Id128 &rhs) noexcept
Orders UUID bytes in network order for ordered containers.
Definition Identity.h:222
Id128 child(std::string_view role) const noexcept
Derives a deterministic child UUID for a hierarchical identity.
Definition Identity.h:191
static constexpr Id128 fromUuid(const Id128< OtherTag > &value) noexcept
Re-tags an existing UUID at an explicit domain boundary.
Definition Identity.h:135
constexpr std::uint64_t hash() const noexcept
Returns a stable non-cryptographic hash for hash tables.
Definition Identity.h:209
constexpr Bytes bytes() const noexcept
Returns the UUID bytes in network order.
Definition Identity.h:201
Tag-free state of a compatibility-aware UUID identity adapter.
Definition Identity.h:86
void assign(std::string_view text)
Assigns from canonical UUID text or from a legacy spelling.
Definition Identity.cpp:188
static UuidBytes projectLegacy(std::string_view text) noexcept
Builds the deterministic UUID projection of a legacy spelling.
Definition Identity.cpp:201
std::array< std::uint8_t, 16 > UuidBytes
Byte representation shared by every tagged 128-bit identity.
Definition Identity.h:53
std::string formatUuidBytes(const UuidBytes &bytes)
Formats UUID bytes as lower-case canonical 8-4-4-4-12 text.
Definition Identity.cpp:161
UuidBytes childUuidBytes(const UuidBytes &parent, std::string_view role) noexcept
Derives a deterministic child UUID from a parent and a role.
Definition Identity.cpp:173
std::optional< UuidBytes > parseUuidText(std::string_view text) noexcept
Parses canonical UUID text without knowing the domain tag.
Definition Identity.cpp:135
Definition Container.h:602