diff options
Diffstat (limited to 'src/common/uuid.h')
| -rw-r--r-- | src/common/uuid.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/common/uuid.h b/src/common/uuid.h index 4d3af8cec..4ab9a25f0 100644 --- a/src/common/uuid.h +++ b/src/common/uuid.h | |||
| @@ -19,21 +19,21 @@ struct UUID { | |||
| 19 | constexpr explicit UUID(const u128& id) : uuid{id} {} | 19 | constexpr explicit UUID(const u128& id) : uuid{id} {} |
| 20 | constexpr explicit UUID(const u64 lo, const u64 hi) : uuid{{lo, hi}} {} | 20 | constexpr explicit UUID(const u64 lo, const u64 hi) : uuid{{lo, hi}} {} |
| 21 | 21 | ||
| 22 | constexpr explicit operator bool() const { | 22 | [[nodiscard]] constexpr explicit operator bool() const { |
| 23 | return uuid[0] != INVALID_UUID[0] && uuid[1] != INVALID_UUID[1]; | 23 | return uuid[0] != INVALID_UUID[0] && uuid[1] != INVALID_UUID[1]; |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | constexpr bool operator==(const UUID& rhs) const { | 26 | [[nodiscard]] constexpr bool operator==(const UUID& rhs) const { |
| 27 | // TODO(DarkLordZach): Replace with uuid == rhs.uuid with C++20 | 27 | // TODO(DarkLordZach): Replace with uuid == rhs.uuid with C++20 |
| 28 | return uuid[0] == rhs.uuid[0] && uuid[1] == rhs.uuid[1]; | 28 | return uuid[0] == rhs.uuid[0] && uuid[1] == rhs.uuid[1]; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | constexpr bool operator!=(const UUID& rhs) const { | 31 | [[nodiscard]] constexpr bool operator!=(const UUID& rhs) const { |
| 32 | return !operator==(rhs); | 32 | return !operator==(rhs); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | // TODO(ogniK): Properly generate uuids based on RFC-4122 | 35 | // TODO(ogniK): Properly generate uuids based on RFC-4122 |
| 36 | static UUID Generate(); | 36 | [[nodiscard]] static UUID Generate(); |
| 37 | 37 | ||
| 38 | // Set the UUID to {0,0} to be considered an invalid user | 38 | // Set the UUID to {0,0} to be considered an invalid user |
| 39 | constexpr void Invalidate() { | 39 | constexpr void Invalidate() { |
| @@ -41,12 +41,12 @@ struct UUID { | |||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | // TODO(ogniK): Properly generate a Nintendo ID | 43 | // TODO(ogniK): Properly generate a Nintendo ID |
| 44 | constexpr u64 GetNintendoID() const { | 44 | [[nodiscard]] constexpr u64 GetNintendoID() const { |
| 45 | return uuid[0]; | 45 | return uuid[0]; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | std::string Format() const; | 48 | [[nodiscard]] std::string Format() const; |
| 49 | std::string FormatSwitch() const; | 49 | [[nodiscard]] std::string FormatSwitch() const; |
| 50 | }; | 50 | }; |
| 51 | static_assert(sizeof(UUID) == 16, "UUID is an invalid size!"); | 51 | static_assert(sizeof(UUID) == 16, "UUID is an invalid size!"); |
| 52 | 52 | ||