From f318a00dcfc5000da64cd02a0ba6bad652cc8979 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Tue, 11 Apr 2023 12:54:16 -0700 Subject: [PATCH] Transparent Uuid part 2. (#4540) * Created transparent form of Azure::Core::Uuid * clang-format * clang-format * Made constructor and operator std::array explicit * Pull request feedback * Update sdk/core/azure-core/CHANGELOG.md Co-authored-by: Ahson Khan * Update sdk/core/azure-core/inc/azure/core/uuid.hpp Co-authored-by: Ahson Khan * Renamed methods as per Anton's suggestion * Renamed FromArray to CreateFromArray as per Ahson's suggestion --------- Co-authored-by: Ahson Khan --- sdk/core/azure-core/CHANGELOG.md | 2 +- sdk/core/azure-core/inc/azure/core/uuid.hpp | 4 ++-- sdk/core/azure-core/src/uuid.cpp | 2 +- sdk/core/azure-core/test/ut/uuid_test.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 8e7d96c07..a5636b849 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -4,7 +4,7 @@ ### Features Added -- Added `Azure::Core::Uuid::AsArray()` and `Azure::Core::Uuid::FromArray()` to enable reading or writing from an existing UUID. +- Added `Azure::Core::Uuid::AsArray()` and `Azure::Core::Uuid::CreateFromArray()` to enable reading or writing from an existing UUID. This is useful when the UUID was generated outside the Azure SDK, or needs to be used from a component outside the Azure SDK. ### Breaking Changes diff --git a/sdk/core/azure-core/inc/azure/core/uuid.hpp b/sdk/core/azure-core/inc/azure/core/uuid.hpp index aca80c3d8..7dacecb1d 100644 --- a/sdk/core/azure-core/inc/azure/core/uuid.hpp +++ b/sdk/core/azure-core/inc/azure/core/uuid.hpp @@ -42,7 +42,7 @@ namespace Azure { namespace Core { /** * @brief Returns the binary value of the Uuid for consumption by clients who need non-string - * representation of the Uuid + * representation of the Uuid. * @returns An array with the binary representation of the Uuid. */ std::array const& AsArray() const { return m_uuid; } @@ -57,6 +57,6 @@ namespace Azure { namespace Core { * @brief Construct a Uuid from an existing UUID represented as an array of bytes. * @details Creates a Uuid from a UUID created in an external scope. */ - static Uuid FromArray(std::array const& uuid); + static Uuid CreateFromArray(std::array const& uuid); }; }} // namespace Azure::Core diff --git a/sdk/core/azure-core/src/uuid.cpp b/sdk/core/azure-core/src/uuid.cpp index f474f24a5..9eb36b3d0 100644 --- a/sdk/core/azure-core/src/uuid.cpp +++ b/sdk/core/azure-core/src/uuid.cpp @@ -77,7 +77,7 @@ namespace Azure { namespace Core { return Uuid(uuid); } - Uuid Uuid::FromArray(std::array const& uuid) + Uuid Uuid::CreateFromArray(std::array const& uuid) { Uuid rv{uuid.data()}; return rv; diff --git a/sdk/core/azure-core/test/ut/uuid_test.cpp b/sdk/core/azure-core/test/ut/uuid_test.cpp index ab89466a5..157b4b453 100644 --- a/sdk/core/azure-core/test/ut/uuid_test.cpp +++ b/sdk/core/azure-core/test/ut/uuid_test.cpp @@ -18,7 +18,7 @@ TEST(Uuid, Transparent) { auto uuid1 = Uuid::CreateUuid(); auto arrayUuid1(uuid1.AsArray()); - auto uuid2 = Azure::Core::Uuid::FromArray(arrayUuid1); + auto uuid2 = Azure::Core::Uuid::CreateFromArray(arrayUuid1); EXPECT_EQ(uuid1.ToString(), uuid2.ToString()); }