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:
parent
e7995c0fc0
commit
f318a00dcf
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user