cpp-common: add `bt2s::optional`, alias of `nonstd::optional`
[babeltrace.git] / src / cpp-common / bt2 / clock-class.hpp
index bd127dfa673a0e58cde6f43597111884520d13a6..6d99ed1f1fc0a8cdba7883d5d7f9ce0b195e0239 100644 (file)
@@ -13,9 +13,8 @@
 
 #include <babeltrace2/babeltrace.h>
 
-#include "cpp-common/optional.hpp"
-#include "cpp-common/string_view.hpp"
-#include "cpp-common/uuid-view.hpp"
+#include "cpp-common/bt2c/uuid-view.hpp"
+#include "cpp-common/bt2s/optional.hpp"
 
 #include "borrowed-object.hpp"
 #include "exc.hpp"
@@ -189,15 +188,9 @@ public:
         this->name(name.data());
     }
 
-    nonstd::optional<bpstd::string_view> name() const noexcept
+    const char *name() const noexcept
     {
-        const auto name = bt_clock_class_get_name(this->libObjPtr());
-
-        if (name) {
-            return name;
-        }
-
-        return nonstd::nullopt;
+        return bt_clock_class_get_name(this->libObjPtr());
     }
 
     void description(const char * const description) const
@@ -216,15 +209,9 @@ public:
         this->description(description.data());
     }
 
-    nonstd::optional<bpstd::string_view> description() const noexcept
+    const char *description() const noexcept
     {
-        const auto description = bt_clock_class_get_description(this->libObjPtr());
-
-        if (description) {
-            return description;
-        }
-
-        return nonstd::nullopt;
+        return bt_clock_class_get_description(this->libObjPtr());
     }
 
     void uuid(const std::uint8_t * const uuid) const noexcept
@@ -232,15 +219,15 @@ public:
         bt_clock_class_set_uuid(this->libObjPtr(), uuid);
     }
 
-    nonstd::optional<bt2_common::UuidView> uuid() const noexcept
+    bt2s::optional<bt2c::UuidView> uuid() const noexcept
     {
         const auto uuid = bt_clock_class_get_uuid(this->libObjPtr());
 
         if (uuid) {
-            return bt2_common::UuidView {uuid};
+            return bt2c::UuidView {uuid};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     template <typename LibValT>
This page took 0.023168 seconds and 4 git commands to generate.