diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-09-23 18:55:43 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-09-23 18:58:20 +0300 |
commit | bd63944a739b4dcd49e8a65294ffb1b8a0a7b20b (patch) | |
tree | 583d81aa9a9257ef96e69b20d18e760f42ffa839 /source/blender/blenlib/BLI_uuid.h | |
parent | 942fc9f467c104150a474eb61a82957b5c9715f7 (diff) |
UUID: place C++ code in correct namespace
Put the `bUUID` class in the `blender` namespace, instead of the
`blender::bke` namespace.
As a result, some C++ code now correctly uses the C++ class, where
previously it would use the C struct and use implicit casting where
necessary. As a result, support for initializer lists had to be
explicitly coded and in another place an explicit `::bUUID` was
necessary to avoid ambiguity.
Diffstat (limited to 'source/blender/blenlib/BLI_uuid.h')
-rw-r--r-- | source/blender/blenlib/BLI_uuid.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_uuid.h b/source/blender/blenlib/BLI_uuid.h index 72d95b41329..d21ccd450cc 100644 --- a/source/blender/blenlib/BLI_uuid.h +++ b/source/blender/blenlib/BLI_uuid.h @@ -68,19 +68,24 @@ bool BLI_uuid_parse_string(bUUID *uuid, const char *buffer) ATTR_NONNULL(); #ifdef __cplusplus } +# include <initializer_list> # include <ostream> /** Output the UUID as formatted ASCII string, see #BLI_uuid_format(). */ std::ostream &operator<<(std::ostream &stream, bUUID uuid); -namespace blender::bke { +namespace blender { class bUUID : public ::bUUID { public: bUUID() = default; + /** Initialise from the bUUID DNA struct. */ bUUID(const ::bUUID &struct_uuid); + /** Initialise from 11 integers, 5 for the regular fields and 6 for the `node` array. */ + bUUID(std::initializer_list<uint> field_values); + /** Initialise by parsing the string; undefined behaviour when the string is invalid. */ explicit bUUID(const std::string &string_formatted_uuid); @@ -89,6 +94,6 @@ class bUUID : public ::bUUID { bool operator==(bUUID uuid1, bUUID uuid2); -} // namespace blender::bke +} // namespace blender #endif |