From 40314cc58646e9e91e961e0d82b7d1b53bd839a0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 22 Sep 2021 17:52:37 -0400 Subject: common/uuid: Add validity checking functions to interface Given we have a function to invalidate, we should also have ones to query the validity. Also makes the code more straightforward to read. --- src/common/uuid.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/common/uuid.h') diff --git a/src/common/uuid.h b/src/common/uuid.h index 2353179d8..8ea01f8da 100644 --- a/src/common/uuid.h +++ b/src/common/uuid.h @@ -58,6 +58,13 @@ struct UUID { uuid = INVALID_UUID; } + [[nodiscard]] constexpr bool IsInvalid() const { + return uuid == INVALID_UUID; + } + [[nodiscard]] constexpr bool IsValid() const { + return !IsInvalid(); + } + // TODO(ogniK): Properly generate a Nintendo ID [[nodiscard]] constexpr u64 GetNintendoID() const { return uuid[0]; -- cgit v1.2.3