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 <ahson_ahmedk@yahoo.com>

* Update sdk/core/azure-core/inc/azure/core/uuid.hpp

Co-authored-by: Ahson Khan <ahson_ahmedk@yahoo.com>

* Renamed methods as per Anton's suggestion

* Renamed FromArray to CreateFromArray as per Ahson's suggestion

---------

Co-authored-by: Ahson Khan <ahson_ahmedk@yahoo.com>
This commit is contained in:
Larry Osterman 2023-04-11 12:54:16 -07:00 committed by GitHub
parent e7995c0fc0
commit f318a00dcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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<uint8_t, UuidSize> 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<uint8_t, UuidSize> const& uuid);
static Uuid CreateFromArray(std::array<uint8_t, UuidSize> const& uuid);
};
}} // namespace Azure::Core

View File

@ -77,7 +77,7 @@ namespace Azure { namespace Core {
return Uuid(uuid);
}
Uuid Uuid::FromArray(std::array<uint8_t, UuidSize> const& uuid)
Uuid Uuid::CreateFromArray(std::array<uint8_t, UuidSize> const& uuid)
{
Uuid rv{uuid.data()};
return rv;

View File

@ -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());
}