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.
This commit is contained in:
2021-09-23 17:55:43 +02:00
parent 942fc9f467
commit bd63944a73
4 changed files with 35 additions and 10 deletions

View File

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