Remove some unused includes in C++ files
[babeltrace.git] / src / cpp-common / bt2 / value.hpp
index a065af6c0c8715dec1c129847c6afde4c9d2ccb2..0dfe9dc614d42b8598b80365089700a3958d2ddf 100644 (file)
@@ -7,21 +7,22 @@
 #ifndef BABELTRACE_CPP_COMMON_BT2_VALUE_HPP
 #define BABELTRACE_CPP_COMMON_BT2_VALUE_HPP
 
-#include <type_traits>
 #include <cstdint>
 #include <functional>
-#include <iterator>
+#include <type_traits>
+
 #include <babeltrace2/babeltrace.h>
 
 #include "common/assert.h"
 #include "common/common.h"
+#include "cpp-common/optional.hpp"
+#include "cpp-common/string_view.hpp"
+
 #include "common-iter.hpp"
+#include "exc.hpp"
 #include "internal/borrowed-obj.hpp"
 #include "internal/shared-obj.hpp"
 #include "internal/utils.hpp"
-#include "cpp-common/optional.hpp"
-#include "cpp-common/string_view.hpp"
-#include "lib-error.hpp"
 
 namespace bt2 {
 namespace internal {
@@ -134,12 +135,12 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonValue(const CommonValue<OtherLibObjT>& val) noexcept : _ThisBorrowedObj {val}
+    CommonValue(const CommonValue<OtherLibObjT> val) noexcept : _ThisBorrowedObj {val}
     {
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonValue& operator=(const CommonValue<OtherLibObjT>& val) noexcept
+    _ThisCommonValue& operator=(const CommonValue<OtherLibObjT> val) noexcept
     {
         _ThisBorrowedObj::operator=(val);
         return *this;
@@ -196,13 +197,13 @@ public:
     }
 
     template <typename OtherLibObjT>
-    bool operator==(const CommonValue<OtherLibObjT>& other) const noexcept
+    bool operator==(const CommonValue<OtherLibObjT> other) const noexcept
     {
         return static_cast<bool>(bt_value_is_equal(this->libObjPtr(), other.libObjPtr()));
     }
 
     template <typename OtherLibObjT>
-    bool operator!=(const CommonValue<OtherLibObjT>& other) const noexcept
+    bool operator!=(const CommonValue<OtherLibObjT> other) const noexcept
     {
         return !(*this == other);
     }
@@ -271,12 +272,12 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonNullValue(const CommonNullValue<OtherLibObjT>& val) noexcept : _ThisCommonValue {val}
+    CommonNullValue(const CommonNullValue<OtherLibObjT> val) noexcept : _ThisCommonValue {val}
     {
     }
 
     template <typename OtherLibObjT>
-    CommonNullValue<LibObjT>& operator=(const CommonNullValue<OtherLibObjT>& val) noexcept
+    CommonNullValue<LibObjT>& operator=(const CommonNullValue<OtherLibObjT> val) noexcept
     {
         _ThisCommonValue::operator=(val);
         return *this;
@@ -328,7 +329,7 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonBoolValue(const CommonBoolValue<OtherLibObjT>& val) noexcept : _ThisCommonValue {val}
+    CommonBoolValue(const CommonBoolValue<OtherLibObjT> val) noexcept : _ThisCommonValue {val}
     {
     }
 
@@ -341,7 +342,7 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonBoolValue<LibObjT>& operator=(const CommonBoolValue<OtherLibObjT>& val) noexcept
+    CommonBoolValue<LibObjT>& operator=(const CommonBoolValue<OtherLibObjT> val) noexcept
     {
         _ThisCommonValue::operator=(val);
         return *this;
@@ -420,14 +421,14 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonUnsignedIntegerValue(const CommonUnsignedIntegerValue<OtherLibObjT>& val) noexcept :
+    CommonUnsignedIntegerValue(const CommonUnsignedIntegerValue<OtherLibObjT> val) noexcept :
         _ThisCommonValue {val}
     {
     }
 
     template <typename OtherLibObjT>
     CommonUnsignedIntegerValue<LibObjT>&
-    operator=(const CommonUnsignedIntegerValue<OtherLibObjT>& val) noexcept
+    operator=(const CommonUnsignedIntegerValue<OtherLibObjT> val) noexcept
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
@@ -506,14 +507,14 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonSignedIntegerValue(const CommonSignedIntegerValue<OtherLibObjT>& val) noexcept :
+    CommonSignedIntegerValue(const CommonSignedIntegerValue<OtherLibObjT> val) noexcept :
         _ThisCommonValue {val}
     {
     }
 
     template <typename OtherLibObjT>
     CommonSignedIntegerValue<LibObjT>&
-    operator=(const CommonSignedIntegerValue<OtherLibObjT>& val) noexcept
+    operator=(const CommonSignedIntegerValue<OtherLibObjT> val) noexcept
     {
         _ThisCommonValue::operator=(val);
         return *this;
@@ -591,12 +592,12 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonRealValue(const CommonRealValue<OtherLibObjT>& val) noexcept : _ThisCommonValue {val}
+    CommonRealValue(const CommonRealValue<OtherLibObjT> val) noexcept : _ThisCommonValue {val}
     {
     }
 
     template <typename OtherLibObjT>
-    CommonRealValue<LibObjT>& operator=(const CommonRealValue<OtherLibObjT>& val) noexcept
+    CommonRealValue<LibObjT>& operator=(const CommonRealValue<OtherLibObjT> val) noexcept
     {
         _ThisCommonValue::operator=(val);
         return *this;
@@ -678,12 +679,12 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonStringValue(const CommonStringValue<OtherLibObjT>& val) noexcept : _ThisCommonValue {val}
+    CommonStringValue(const CommonStringValue<OtherLibObjT> val) noexcept : _ThisCommonValue {val}
     {
     }
 
     template <typename OtherLibObjT>
-    CommonStringValue<LibObjT>& operator=(const CommonStringValue<OtherLibObjT>& val) noexcept
+    CommonStringValue<LibObjT>& operator=(const CommonStringValue<OtherLibObjT> val) noexcept
     {
         _ThisCommonValue::operator=(val);
         return *this;
@@ -696,7 +697,7 @@ public:
         const auto status = bt_value_string_set(this->libObjPtr(), rawVal);
 
         if (status == BT_VALUE_STRING_SET_STATUS_MEMORY_ERROR) {
-            throw LibMemoryError {};
+            throw MemoryError {};
         }
 
         return *this;
@@ -790,12 +791,12 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonArrayValue(const CommonArrayValue<OtherLibObjT>& val) noexcept : _ThisCommonValue {val}
+    CommonArrayValue(const CommonArrayValue<OtherLibObjT> val) noexcept : _ThisCommonValue {val}
     {
     }
 
     template <typename OtherLibObjT>
-    CommonArrayValue<LibObjT>& operator=(const CommonArrayValue<OtherLibObjT>& val) noexcept
+    CommonArrayValue<LibObjT>& operator=(const CommonArrayValue<OtherLibObjT> val) noexcept
     {
         _ThisCommonValue::operator=(val);
         return *this;
@@ -839,7 +840,7 @@ public:
             internal::CommonArrayValueSpec<LibObjT>::elementByIndex(this->libObjPtr(), index)};
     }
 
-    void append(const Value& val)
+    void append(const Value val)
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
@@ -903,7 +904,7 @@ public:
     CommonArrayValue<bt_value> appendEmptyArray();
     CommonMapValue<bt_value> appendEmptyMap();
 
-    void operator+=(const Value& val)
+    void operator+=(const Value val)
     {
         this->append(val);
     }
@@ -947,7 +948,7 @@ private:
     void _handleAppendLibStatus(const bt_value_array_append_element_status status) const
     {
         if (status == BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_MEMORY_ERROR) {
-            throw LibMemoryError {};
+            throw MemoryError {};
         }
     }
 };
@@ -1034,7 +1035,7 @@ struct CommonMapValueSpec<bt_value> final
             return;
         case BT_VALUE_MAP_FOREACH_ENTRY_STATUS_USER_ERROR:
         case BT_VALUE_MAP_FOREACH_ENTRY_STATUS_ERROR:
-            throw LibError {};
+            throw Error {};
         default:
             bt_common_abort();
         }
@@ -1067,7 +1068,7 @@ struct CommonMapValueSpec<const bt_value> final
             return;
         case BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_USER_ERROR:
         case BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_ERROR:
-            throw LibError {};
+            throw Error {};
         default:
             bt_common_abort();
         }
@@ -1100,12 +1101,12 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonMapValue(const CommonMapValue<OtherLibObjT>& val) noexcept : _ThisCommonValue {val}
+    CommonMapValue(const CommonMapValue<OtherLibObjT> val) noexcept : _ThisCommonValue {val}
     {
     }
 
     template <typename OtherLibObjT>
-    CommonMapValue<LibObjT>& operator=(const CommonMapValue<OtherLibObjT>& val) noexcept
+    CommonMapValue<LibObjT>& operator=(const CommonMapValue<OtherLibObjT> val) noexcept
     {
         _ThisCommonValue::operator=(val);
         return *this;
@@ -1165,7 +1166,7 @@ public:
         return this->hasEntry(key.data());
     }
 
-    void insert(const char * const key, const Value& val)
+    void insert(const char * const key, const Value val)
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
@@ -1174,7 +1175,7 @@ public:
         this->_handleInsertLibStatus(status);
     }
 
-    void insert(const std::string& key, const Value& val)
+    void insert(const std::string& key, const Value val)
     {
         this->insert(key.data(), val);
     }
@@ -1286,7 +1287,7 @@ private:
     void _handleInsertLibStatus(const bt_value_map_insert_entry_status status) const
     {
         if (status == BT_VALUE_MAP_INSERT_ENTRY_STATUS_MEMORY_ERROR) {
-            throw LibMemoryError {};
+            throw MemoryError {};
         }
     }
 };
This page took 0.026552 seconds and 4 git commands to generate.