cpp-common/bt2: use bt2c::CStringView in parameters and return values throughout
[babeltrace.git] / src / cpp-common / bt2 / field.hpp
index 40fe3f02f400080ed7d3ab9303ac305fee8ef1ef..0efd7e74659caf0b821e08a2f2b16b62dda1e8b1 100644 (file)
@@ -957,12 +957,12 @@ public:
         return CommonStringField<const bt_field> {*this};
     }
 
-    RawStringValueProxy<CommonStringField> operator*() const noexcept
+    RawValueProxy<CommonStringField> operator*() const noexcept
     {
-        return RawStringValueProxy<CommonStringField> {*this};
+        return RawValueProxy<CommonStringField> {*this};
     }
 
-    void value(const Value& val) const
+    void value(const Value val) const
     {
         static_assert(!std::is_const<LibObjT>::value,
                       "Not available with `bt2::ConstStringField`.");
@@ -974,17 +974,7 @@ public:
         }
     }
 
-    void value(const char * const val) const
-    {
-        this->value(bt2c::CStringView {val});
-    }
-
-    void value(const std::string& val) const
-    {
-        this->value(bt2c::CStringView {val.data()});
-    }
-
-    void append(const char * const begin, const std::uint64_t len) const
+    void append(const bt2c::CStringView begin, const std::uint64_t len) const
     {
         static_assert(!std::is_const<LibObjT>::value,
                       "Not available with `bt2::ConstStringField`.");
@@ -996,7 +986,7 @@ public:
         }
     }
 
-    void append(const char * const val) const
+    void append(const bt2c::CStringView val) const
     {
         this->append(val, std::strlen(val));
     }
@@ -1128,15 +1118,11 @@ public:
         return CommonField<LibObjT> {_Spec::memberFieldByIndex(this->libObjPtr(), index)};
     }
 
-    OptionalBorrowedObject<CommonField<LibObjT>> operator[](const char * const name) const noexcept
+    OptionalBorrowedObject<CommonField<LibObjT>>
+    operator[](const bt2c::CStringView name) const noexcept
     {
         return _Spec::memberFieldByName(this->libObjPtr(), name);
     }
-
-    OptionalBorrowedObject<CommonField<LibObjT>> operator[](const std::string& name) const noexcept
-    {
-        return (*this)[name.data()];
-    }
 };
 
 using StructureField = CommonStructureField<bt_field>;
This page took 0.023715 seconds and 4 git commands to generate.