Add a `Uuid` constructor that takes `bt2c::CStringView` and remove those
that take a `const char *` and `const std::string &`. The implicit
conversions to `bt2c::CStringView` should be able to handle all those
types.
Change-Id: I1714fd2aa38c18a047b097908af7b52afebeab72
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11953
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
#include "common/assert.h"
#include "common/uuid.h"
+#include "cpp-common/bt2c/c-string-view.hpp"
namespace bt2c {
this->_setFromPtr(uuid);
}
- explicit Uuid(const char * const str) noexcept
+ explicit Uuid(const bt2c::CStringView str) noexcept
{
- const auto ret = bt_uuid_from_str(str, _mUuid.data());
+ const auto ret = bt_uuid_from_str(str.data(), _mUuid.data());
BT_ASSERT(ret == 0);
}
- explicit Uuid(const std::string& str) noexcept : Uuid {str.c_str()}
- {
- }
-
explicit Uuid(const UuidView& view) noexcept : Uuid {view.data()}
{
}