diff options
author | Sven Gothel <[email protected]> | 2021-09-03 01:39:27 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-09-03 01:39:27 +0200 |
commit | 897cf8fa26812f5587efc01a7223219fb0594dce (patch) | |
tree | 044fd8d55706fb78f34bd7f0f85513351fc5aaee /api/direct_bt | |
parent | e0e469b3bd3f4332488b75334b1326a0a452dce8 (diff) |
uuid_t: Add ctor(string) for all specialisations and add uuid_t::create(const string&) for convenience
Diffstat (limited to 'api/direct_bt')
-rw-r--r-- | api/direct_bt/UUID.hpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/api/direct_bt/UUID.hpp b/api/direct_bt/UUID.hpp index 81b55e5e..9ab1f578 100644 --- a/api/direct_bt/UUID.hpp +++ b/api/direct_bt/UUID.hpp @@ -68,6 +68,7 @@ protected: public: static TypeSize toTypeSize(const jau::nsize_t size); static std::unique_ptr<const uuid_t> create(TypeSize const t, uint8_t const * const buffer, jau::nsize_t const byte_offset, bool const littleEndian); + static std::unique_ptr<const uuid_t> create(const std::string& str); virtual ~uuid_t() noexcept {} @@ -102,6 +103,8 @@ public: uuid16_t(uint16_t const v) noexcept : uuid_t(TypeSize::UUID16_SZ), value(v) { } + uuid16_t(const std::string& str); + uuid16_t(uint8_t const * const buffer, jau::nsize_t const byte_offset, bool const littleEndian) noexcept : uuid_t(TypeSize::UUID16_SZ), value(jau::get_uint16(buffer, byte_offset, littleEndian)) { } @@ -129,6 +132,8 @@ public: uuid32_t(uint32_t const v) noexcept : uuid_t(TypeSize::UUID32_SZ), value(v) {} + uuid32_t(const std::string& str); + uuid32_t(uint8_t const * const buffer, jau::nsize_t const byte_offset, bool const littleEndian) noexcept : uuid_t(TypeSize::UUID32_SZ), value(jau::get_uint32(buffer, byte_offset, littleEndian)) { } @@ -158,7 +163,7 @@ public: uuid128_t(jau::uint128_t const v) noexcept : uuid_t(TypeSize::UUID128_SZ), value(v) {} - uuid128_t(const std::string str); + uuid128_t(const std::string& str); uuid128_t(uint8_t const * const buffer, jau::nsize_t const byte_offset, bool const littleEndian) noexcept : uuid_t(TypeSize::UUID128_SZ), value(jau::get_uint128(buffer, byte_offset, littleEndian)) { } |