projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cpp-common/bt2: make setters return `*this`
[babeltrace.git]
/
src
/
cpp-common
/
bt2
/
field-class.hpp
diff --git
a/src/cpp-common/bt2/field-class.hpp
b/src/cpp-common/bt2/field-class.hpp
index 461321fb01fdb770cee0d85a6b4b55bf838d93a4..411cf6690a1798355b2bcc2341a5621f203acc01 100644
(file)
--- a/
src/cpp-common/bt2/field-class.hpp
+++ b/
src/cpp-common/bt2/field-class.hpp
@@
-13,15
+13,16
@@
#include <babeltrace2/babeltrace.h>
#include "common/assert.h"
#include <babeltrace2/babeltrace.h>
#include "common/assert.h"
-#include "cpp-common/
optional
.hpp"
-#include "cpp-common/
string_view
.hpp"
+#include "cpp-common/
bt2c/c-string-view
.hpp"
+#include "cpp-common/
bt2s/optional
.hpp"
+#include "borrowed-object-iterator.hpp"
#include "borrowed-object.hpp"
#include "borrowed-object.hpp"
-#include "common-iterator.hpp"
#include "exc.hpp"
#include "field-path.hpp"
#include "integer-range-set.hpp"
#include "internal/utils.hpp"
#include "exc.hpp"
#include "field-path.hpp"
#include "integer-range-set.hpp"
#include "internal/utils.hpp"
+#include "optional-borrowed-object.hpp"
#include "shared-object.hpp"
#include "value.hpp"
#include "shared-object.hpp"
#include "value.hpp"
@@
-167,16
+168,14
@@
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
protected:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
protected:
- using typename BorrowedObject<LibObjT>::_LibObjPtr;
using _ThisCommonFieldClass = CommonFieldClass<LibObjT>;
public:
using _ThisCommonFieldClass = CommonFieldClass<LibObjT>;
public:
+ using typename BorrowedObject<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<CommonFieldClass<LibObjT>, LibObjT>;
using Shared = SharedFieldClass<CommonFieldClass<LibObjT>, LibObjT>;
+ using UserAttributes = internal::DepUserAttrs<LibObjT>;
- using UserAttributes =
- typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
-
- explicit CommonFieldClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
+ explicit CommonFieldClass(const LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
{
}
{
}
@@
-186,7
+185,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonFieldClass
&
operator=(const CommonFieldClass<OtherLibObjT> fc) noexcept
+ CommonFieldClass operator=(const CommonFieldClass<OtherLibObjT> fc) noexcept
{
_ThisBorrowedObject::operator=(fc);
return *this;
{
_ThisBorrowedObject::operator=(fc);
return *this;
@@
-403,11
+402,12
@@
public:
asVariantWithSignedIntegerSelector() const noexcept;
template <typename LibValT>
asVariantWithSignedIntegerSelector() const noexcept;
template <typename LibValT>
-
void
userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
+
CommonFieldClass
userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstFieldClass`.");
bt_field_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstFieldClass`.");
bt_field_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
+ return *this;
}
UserAttributes userAttributes() const noexcept
}
UserAttributes userAttributes() const noexcept
@@
-455,13
+455,13
@@
template <typename LibObjT>
class CommonBitArrayFieldClass final : public CommonFieldClass<LibObjT>
{
private:
class CommonBitArrayFieldClass final : public CommonFieldClass<LibObjT>
{
private:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
using typename CommonFieldClass<LibObjT>::_ThisCommonFieldClass;
public:
using typename CommonFieldClass<LibObjT>::_ThisCommonFieldClass;
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<CommonBitArrayFieldClass<LibObjT>, LibObjT>;
using Shared = SharedFieldClass<CommonBitArrayFieldClass<LibObjT>, LibObjT>;
- explicit CommonBitArrayFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonBitArrayFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isBitArray());
_ThisCommonFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isBitArray());
@@
-474,7
+474,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonBitArrayFieldClass<LibObjT>
&
+ CommonBitArrayFieldClass<LibObjT>
operator=(const CommonBitArrayFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
operator=(const CommonBitArrayFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
@@
-535,13
+535,13
@@
private:
using typename CommonFieldClass<LibObjT>::_ThisCommonFieldClass;
protected:
using typename CommonFieldClass<LibObjT>::_ThisCommonFieldClass;
protected:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
using _ThisCommonIntegerFieldClass = CommonIntegerFieldClass<LibObjT>;
public:
using _ThisCommonIntegerFieldClass = CommonIntegerFieldClass<LibObjT>;
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<CommonIntegerFieldClass<LibObjT>, LibObjT>;
using Shared = SharedFieldClass<CommonIntegerFieldClass<LibObjT>, LibObjT>;
- explicit CommonIntegerFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonIntegerFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isInteger());
_ThisCommonFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isInteger());
@@
-554,7
+554,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonIntegerFieldClass
&
operator=(const CommonIntegerFieldClass<OtherLibObjT> fc) noexcept
+ CommonIntegerFieldClass operator=(const CommonIntegerFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
return *this;
{
_ThisCommonFieldClass::operator=(fc);
return *this;
@@
-565,12
+565,13
@@
public:
return CommonIntegerFieldClass<const bt_field_class> {*this};
}
return CommonIntegerFieldClass<const bt_field_class> {*this};
}
-
void
fieldValueRange(const std::uint64_t n) const noexcept
+
CommonIntegerFieldClass
fieldValueRange(const std::uint64_t n) const noexcept
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstIntegerFieldClass`.");
bt_field_class_integer_set_field_value_range(this->libObjPtr(), n);
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstIntegerFieldClass`.");
bt_field_class_integer_set_field_value_range(this->libObjPtr(), n);
+ return *this;
}
std::uint64_t fieldValueRange() const noexcept
}
std::uint64_t fieldValueRange() const noexcept
@@
-578,13
+579,14
@@
public:
return bt_field_class_integer_get_field_value_range(this->libObjPtr());
}
return bt_field_class_integer_get_field_value_range(this->libObjPtr());
}
-
void
preferredDisplayBase(const DisplayBase base) const noexcept
+
CommonIntegerFieldClass
preferredDisplayBase(const DisplayBase base) const noexcept
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstIntegerFieldClass`.");
bt_field_class_integer_set_preferred_display_base(
this->libObjPtr(), static_cast<bt_field_class_integer_preferred_display_base>(base));
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstIntegerFieldClass`.");
bt_field_class_integer_set_preferred_display_base(
this->libObjPtr(), static_cast<bt_field_class_integer_preferred_display_base>(base));
+ return *this;
}
DisplayBase preferredDisplayBase() const noexcept
}
DisplayBase preferredDisplayBase() const noexcept
@@
-620,10
+622,6
@@
struct TypeDescr<ConstIntegerFieldClass> : public IntegerFieldClassTypeDescr
{
};
{
};
-} /* namespace internal */
-
-namespace internal {
-
template <typename LibObjT>
struct ConstEnumerationFieldClassMappingSpec;
template <typename LibObjT>
struct ConstEnumerationFieldClassMappingSpec;
@@
-671,14
+669,15
@@
class ConstEnumerationFieldClassMapping final : public BorrowedObject<LibObjT>
{
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
{
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
- using typename BorrowedObject<LibObjT>::_LibObjPtr;
public:
public:
+ using typename BorrowedObject<LibObjT>::LibObjPtr;
+
using RangeSet = typename std::conditional<
std::is_same<LibObjT, const bt_field_class_enumeration_unsigned_mapping>::value,
ConstUnsignedIntegerRangeSet, ConstSignedIntegerRangeSet>::type;
using RangeSet = typename std::conditional<
std::is_same<LibObjT, const bt_field_class_enumeration_unsigned_mapping>::value,
ConstUnsignedIntegerRangeSet, ConstSignedIntegerRangeSet>::type;
- explicit ConstEnumerationFieldClassMapping(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit ConstEnumerationFieldClassMapping(const LibObjPtr libObjPtr) noexcept :
_ThisBorrowedObject {libObjPtr}
{
}
_ThisBorrowedObject {libObjPtr}
{
}
@@
-688,7
+687,7
@@
public:
{
}
{
}
- ConstEnumerationFieldClassMapping
&
+ ConstEnumerationFieldClassMapping
operator=(const ConstEnumerationFieldClassMapping& mapping) noexcept
{
_ThisBorrowedObject::operator=(mapping);
operator=(const ConstEnumerationFieldClassMapping& mapping) noexcept
{
_ThisBorrowedObject::operator=(mapping);
@@
-701,7
+700,7
@@
public:
internal::ConstEnumerationFieldClassMappingSpec<LibObjT>::ranges(this->libObjPtr())};
}
internal::ConstEnumerationFieldClassMappingSpec<LibObjT>::ranges(this->libObjPtr())};
}
- b
pstd::string_v
iew label() const noexcept
+ b
t2c::CStringV
iew label() const noexcept
{
return internal::ConstEnumerationFieldClassMappingSpec<LibObjT>::label(this->libObjPtr());
}
{
return internal::ConstEnumerationFieldClassMappingSpec<LibObjT>::label(this->libObjPtr());
}
@@
-775,13
+774,13
@@
private:
using typename CommonIntegerFieldClass<LibObjT>::_ThisCommonIntegerFieldClass;
protected:
using typename CommonIntegerFieldClass<LibObjT>::_ThisCommonIntegerFieldClass;
protected:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
using _ThisCommonBaseEnumerationFieldClass = CommonBaseEnumerationFieldClass<LibObjT>;
public:
using _ThisCommonBaseEnumerationFieldClass = CommonBaseEnumerationFieldClass<LibObjT>;
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<_ThisCommonBaseEnumerationFieldClass, LibObjT>;
using Shared = SharedFieldClass<_ThisCommonBaseEnumerationFieldClass, LibObjT>;
- explicit CommonBaseEnumerationFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonBaseEnumerationFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonIntegerFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isEnumeration());
_ThisCommonIntegerFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isEnumeration());
@@
-795,7
+794,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonBaseEnumerationFieldClass
&
+ CommonBaseEnumerationFieldClass
operator=(const CommonBaseEnumerationFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonIntegerFieldClass::operator=(fc);
operator=(const CommonBaseEnumerationFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonIntegerFieldClass::operator=(fc);
@@
-822,16
+821,15
@@
template <typename LibObjT, typename MappingT>
class CommonEnumerationFieldClass final : public CommonBaseEnumerationFieldClass<LibObjT>
{
private:
class CommonEnumerationFieldClass final : public CommonBaseEnumerationFieldClass<LibObjT>
{
private:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
using typename CommonBaseEnumerationFieldClass<LibObjT>::_ThisCommonBaseEnumerationFieldClass;
using typename CommonBaseEnumerationFieldClass<LibObjT>::_ThisCommonBaseEnumerationFieldClass;
- using _ThisCommonEnumerationFieldClass = CommonEnumerationFieldClass<LibObjT, MappingT>;
public:
public:
- using Shared = SharedFieldClass<_ThisCommonEnumerationFieldClass, LibObjT>;
- using Iterator = CommonIterator<CommonEnumerationFieldClass, MappingT>;
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
+ using Shared = SharedFieldClass<CommonEnumerationFieldClass, LibObjT>;
+ using Iterator = BorrowedObjectIterator<CommonEnumerationFieldClass>;
using Mapping = MappingT;
using Mapping = MappingT;
- explicit CommonEnumerationFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonEnumerationFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonBaseEnumerationFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isEnumeration());
_ThisCommonBaseEnumerationFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isEnumeration());
@@
-840,15
+838,15
@@
public:
template <typename OtherLibObjT>
CommonEnumerationFieldClass(
const CommonEnumerationFieldClass<OtherLibObjT, MappingT> fc) noexcept :
template <typename OtherLibObjT>
CommonEnumerationFieldClass(
const CommonEnumerationFieldClass<OtherLibObjT, MappingT> fc) noexcept :
-
_This
CommonEnumerationFieldClass {fc}
+ CommonEnumerationFieldClass {fc}
{
}
template <typename OtherLibObjT>
{
}
template <typename OtherLibObjT>
- CommonEnumerationFieldClass
&
+ CommonEnumerationFieldClass
operator=(const CommonEnumerationFieldClass<OtherLibObjT, MappingT> fc) noexcept
{
operator=(const CommonEnumerationFieldClass<OtherLibObjT, MappingT> fc) noexcept
{
-
_This
CommonEnumerationFieldClass::operator=(fc);
+ CommonEnumerationFieldClass::operator=(fc);
return *this;
}
return *this;
}
@@
-858,24
+856,14
@@
public:
this->libObjPtr(), index)};
}
this->libObjPtr(), index)};
}
-
nonstd::optional<Mapping> operator[](const char * const
label) const noexcept
+
OptionalBorrowedObject<Mapping> operator[](const bt2c::CStringView
label) const noexcept
{
{
-
const auto libObjPtr =
internal::CommonEnumerationFieldClassSpec<MappingT>::mappingByLabel(
+
return
internal::CommonEnumerationFieldClassSpec<MappingT>::mappingByLabel(
this->libObjPtr(), label);
this->libObjPtr(), label);
-
- if (libObjPtr) {
- return Mapping {libObjPtr};
- }
-
- return nonstd::nullopt;
}
}
- nonstd::optional<Mapping> operator[](const std::string& label) const noexcept
- {
- return (*this)[label.data()];
- }
-
- void addMapping(const char * const label, const typename Mapping::RangeSet ranges) const
+ CommonEnumerationFieldClass addMapping(const bt2c::CStringView label,
+ const typename Mapping::RangeSet ranges) const
{
const auto status = internal::CommonEnumerationFieldClassSpec<MappingT>::addMapping(
this->libObjPtr(), label, ranges.libObjPtr());
{
const auto status = internal::CommonEnumerationFieldClassSpec<MappingT>::addMapping(
this->libObjPtr(), label, ranges.libObjPtr());
@@
-883,11
+871,8
@@
public:
if (status == BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR) {
throw MemoryError {};
}
if (status == BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR) {
throw MemoryError {};
}
- }
- void addMapping(const std::string& label, const typename Mapping::RangeSet ranges) const
- {
- this->addMapping(label.data(), ranges);
+ return *this;
}
Iterator begin() const noexcept
}
Iterator begin() const noexcept
@@
-996,17
+981,14
@@
template <typename LibObjT>
class CommonStructureFieldClassMember final : public BorrowedObject<LibObjT>
{
private:
class CommonStructureFieldClassMember final : public BorrowedObject<LibObjT>
{
private:
- using typename BorrowedObject<LibObjT>::_LibObjPtr;
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
-
- using _FieldClass =
- typename std::conditional<std::is_const<LibObjT>::value, ConstFieldClass, FieldClass>::type;
+ using _FieldClass = internal::DepFc<LibObjT>;
public:
public:
- using
UserAttributes =
-
typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type
;
+ using
typename BorrowedObject<LibObjT>::LibObjPtr;
+
using UserAttributes = internal::DepUserAttrs<LibObjT>
;
- explicit CommonStructureFieldClassMember(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonStructureFieldClassMember(const LibObjPtr libObjPtr) noexcept :
_ThisBorrowedObject {libObjPtr}
{
}
_ThisBorrowedObject {libObjPtr}
{
}
@@
-1019,7
+1001,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonStructureFieldClassMember<LibObjT>
&
+ CommonStructureFieldClassMember<LibObjT>
operator=(const CommonStructureFieldClassMember<OtherLibObjT> fc) noexcept
{
_ThisBorrowedObject::operator=(fc);
operator=(const CommonStructureFieldClassMember<OtherLibObjT> fc) noexcept
{
_ThisBorrowedObject::operator=(fc);
@@
-1031,7
+1013,7
@@
public:
return CommonStructureFieldClassMember<const bt_field_class_structure_member> {*this};
}
return CommonStructureFieldClassMember<const bt_field_class_structure_member> {*this};
}
- b
pstd::string_v
iew name() const noexcept
+ b
t2c::CStringV
iew name() const noexcept
{
return bt_field_class_structure_member_get_name(this->libObjPtr());
}
{
return bt_field_class_structure_member_get_name(this->libObjPtr());
}
@@
-1043,13
+1025,15
@@
public:
}
template <typename LibValT>
}
template <typename LibValT>
- void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
+ CommonStructureFieldClassMember
+ userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstStructureFieldClassMember`.");
bt_field_class_structure_member_set_user_attributes(this->libObjPtr(),
userAttrs.libObjPtr());
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstStructureFieldClassMember`.");
bt_field_class_structure_member_set_user_attributes(this->libObjPtr(),
userAttrs.libObjPtr());
+ return *this;
}
UserAttributes userAttributes() const noexcept
}
UserAttributes userAttributes() const noexcept
@@
-1126,18
+1110,17
@@
template <typename LibObjT>
class CommonStructureFieldClass final : public CommonFieldClass<LibObjT>
{
private:
class CommonStructureFieldClass final : public CommonFieldClass<LibObjT>
{
private:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
using typename CommonFieldClass<LibObjT>::_ThisCommonFieldClass;
public:
using typename CommonFieldClass<LibObjT>::_ThisCommonFieldClass;
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<CommonStructureFieldClass<LibObjT>, LibObjT>;
using Shared = SharedFieldClass<CommonStructureFieldClass<LibObjT>, LibObjT>;
- using Member =
- typename std::conditional<std::is_const<LibObjT>::value, ConstStructureFieldClassMember,
- StructureFieldClassMember>::type;
+ using Iterator = BorrowedObjectIterator<CommonStructureFieldClass<LibObjT>>;
- using Iterator = CommonIterator<CommonStructureFieldClass<LibObjT>, Member>;
+ using Member =
+ internal::DepType<LibObjT, StructureFieldClassMember, ConstStructureFieldClassMember>;
- explicit CommonStructureFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonStructureFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isStructure());
_ThisCommonFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isStructure());
@@
-1150,7
+1133,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonStructureFieldClass
&
operator=(const CommonStructureFieldClass<OtherLibObjT> fc) noexcept
+ CommonStructureFieldClass operator=(const CommonStructureFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
return *this;
{
_ThisCommonFieldClass::operator=(fc);
return *this;
@@
-1161,7
+1144,7
@@
public:
return CommonStructureFieldClass<const bt_field_class> {*this};
}
return CommonStructureFieldClass<const bt_field_class> {*this};
}
-
void appendMember(const char * const
name, const FieldClass fc) const
+
CommonStructureFieldClass appendMember(const bt2c::CStringView
name, const FieldClass fc) const
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstStructureFieldClass`.");
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstStructureFieldClass`.");
@@
-1172,11
+1155,8
@@
public:
if (status == BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR) {
throw MemoryError {};
}
if (status == BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR) {
throw MemoryError {};
}
- }
- void appendMember(const std::string& name, const FieldClass fc) const
- {
- this->appendMember(name.data(), fc);
+ return *this;
}
std::uint64_t length() const noexcept
}
std::uint64_t length() const noexcept
@@
-1200,21
+1180,10
@@
public:
this->libObjPtr(), index)};
}
this->libObjPtr(), index)};
}
-
nonstd::optional<Member> operator[](const char * const
name) const noexcept
+
OptionalBorrowedObject<Member> operator[](const bt2c::CStringView
name) const noexcept
{
{
- const auto libObjPtr =
- internal::CommonStructureFieldClassSpec<LibObjT>::memberByName(this->libObjPtr(), name);
-
- if (libObjPtr) {
- return Member {libObjPtr};
- }
-
- return nonstd::nullopt;
- }
-
- nonstd::optional<Member> operator[](const std::string& name) const noexcept
- {
- return (*this)[name.data()];
+ return internal::CommonStructureFieldClassSpec<LibObjT>::memberByName(this->libObjPtr(),
+ name);
}
Shared shared() const noexcept
}
Shared shared() const noexcept
@@
-1274,18
+1243,16
@@
class CommonArrayFieldClass : public CommonFieldClass<LibObjT>
{
private:
using typename CommonFieldClass<LibObjT>::_ThisCommonFieldClass;
{
private:
using typename CommonFieldClass<LibObjT>::_ThisCommonFieldClass;
-
- using _FieldClass =
- typename std::conditional<std::is_const<LibObjT>::value, ConstFieldClass, FieldClass>::type;
+ using _FieldClass = internal::DepFc<LibObjT>;
protected:
protected:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
using _ThisCommonArrayFieldClass = CommonArrayFieldClass<LibObjT>;
public:
using _ThisCommonArrayFieldClass = CommonArrayFieldClass<LibObjT>;
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<CommonArrayFieldClass<LibObjT>, LibObjT>;
using Shared = SharedFieldClass<CommonArrayFieldClass<LibObjT>, LibObjT>;
- explicit CommonArrayFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonArrayFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isArray());
_ThisCommonFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isArray());
@@
-1298,7
+1265,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonArrayFieldClass
&
operator=(const CommonArrayFieldClass<OtherLibObjT> fc) noexcept
+ CommonArrayFieldClass operator=(const CommonArrayFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
return *this;
{
_ThisCommonFieldClass::operator=(fc);
return *this;
@@
-1349,12
+1316,12
@@
class CommonStaticArrayFieldClass final : public CommonArrayFieldClass<LibObjT>
{
private:
using typename CommonArrayFieldClass<LibObjT>::_ThisCommonArrayFieldClass;
{
private:
using typename CommonArrayFieldClass<LibObjT>::_ThisCommonArrayFieldClass;
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
public:
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<CommonStaticArrayFieldClass<LibObjT>, LibObjT>;
using Shared = SharedFieldClass<CommonStaticArrayFieldClass<LibObjT>, LibObjT>;
- explicit CommonStaticArrayFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonStaticArrayFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonArrayFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isStaticArray());
_ThisCommonArrayFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isStaticArray());
@@
-1367,7
+1334,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonStaticArrayFieldClass
&
+ CommonStaticArrayFieldClass
operator=(const CommonStaticArrayFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonArrayFieldClass::operator=(fc);
operator=(const CommonStaticArrayFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonArrayFieldClass::operator=(fc);
@@
-1418,12
+1385,12
@@
class CommonDynamicArrayWithLengthFieldClass final : public CommonArrayFieldClas
{
private:
using typename CommonArrayFieldClass<LibObjT>::_ThisCommonArrayFieldClass;
{
private:
using typename CommonArrayFieldClass<LibObjT>::_ThisCommonArrayFieldClass;
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
public:
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<CommonDynamicArrayWithLengthFieldClass<LibObjT>, LibObjT>;
using Shared = SharedFieldClass<CommonDynamicArrayWithLengthFieldClass<LibObjT>, LibObjT>;
- explicit CommonDynamicArrayWithLengthFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonDynamicArrayWithLengthFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonArrayFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isDynamicArrayWithLength());
_ThisCommonArrayFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isDynamicArrayWithLength());
@@
-1437,7
+1404,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonDynamicArrayWithLengthFieldClass
&
+ CommonDynamicArrayWithLengthFieldClass
operator=(const CommonDynamicArrayWithLengthFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonArrayFieldClass::operator=(fc);
operator=(const CommonDynamicArrayWithLengthFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonArrayFieldClass::operator=(fc);
@@
-1517,18
+1484,16
@@
class CommonOptionFieldClass : public CommonFieldClass<LibObjT>
{
private:
using typename CommonFieldClass<LibObjT>::_ThisCommonFieldClass;
{
private:
using typename CommonFieldClass<LibObjT>::_ThisCommonFieldClass;
-
- using _FieldClass =
- typename std::conditional<std::is_const<LibObjT>::value, ConstFieldClass, FieldClass>::type;
+ using _FieldClass = internal::DepFc<LibObjT>;
protected:
protected:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
using _ThisCommonOptionFieldClass = CommonOptionFieldClass<LibObjT>;
public:
using _ThisCommonOptionFieldClass = CommonOptionFieldClass<LibObjT>;
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<CommonOptionFieldClass<LibObjT>, LibObjT>;
using Shared = SharedFieldClass<CommonOptionFieldClass<LibObjT>, LibObjT>;
- explicit CommonOptionFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonOptionFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isOption());
_ThisCommonFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isOption());
@@
-1541,7
+1506,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonOptionFieldClass
&
operator=(const CommonOptionFieldClass<OtherLibObjT> fc) noexcept
+ CommonOptionFieldClass operator=(const CommonOptionFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
return *this;
{
_ThisCommonFieldClass::operator=(fc);
return *this;
@@
-1594,13
+1559,13
@@
private:
using typename CommonOptionFieldClass<LibObjT>::_ThisCommonOptionFieldClass;
protected:
using typename CommonOptionFieldClass<LibObjT>::_ThisCommonOptionFieldClass;
protected:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
using _ThisCommonOptionWithSelectorFieldClass = CommonOptionWithSelectorFieldClass<LibObjT>;
public:
using _ThisCommonOptionWithSelectorFieldClass = CommonOptionWithSelectorFieldClass<LibObjT>;
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<CommonOptionWithSelectorFieldClass<LibObjT>, LibObjT>;
using Shared = SharedFieldClass<CommonOptionWithSelectorFieldClass<LibObjT>, LibObjT>;
- explicit CommonOptionWithSelectorFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonOptionWithSelectorFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonOptionFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isOptionWithSelector());
_ThisCommonOptionFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isOptionWithSelector());
@@
-1614,7
+1579,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonOptionWithSelectorFieldClass
&
+ CommonOptionWithSelectorFieldClass
operator=(const CommonOptionWithSelectorFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonOptionFieldClass::operator=(fc);
operator=(const CommonOptionWithSelectorFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonOptionFieldClass::operator=(fc);
@@
-1666,15
+1631,14
@@
template <typename LibObjT>
class CommonOptionWithBoolSelectorFieldClass : public CommonOptionWithSelectorFieldClass<LibObjT>
{
private:
class CommonOptionWithBoolSelectorFieldClass : public CommonOptionWithSelectorFieldClass<LibObjT>
{
private:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
-
using typename CommonOptionWithSelectorFieldClass<
LibObjT>::_ThisCommonOptionWithSelectorFieldClass;
public:
using typename CommonOptionWithSelectorFieldClass<
LibObjT>::_ThisCommonOptionWithSelectorFieldClass;
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<CommonOptionWithBoolSelectorFieldClass<LibObjT>, LibObjT>;
using Shared = SharedFieldClass<CommonOptionWithBoolSelectorFieldClass<LibObjT>, LibObjT>;
- explicit CommonOptionWithBoolSelectorFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonOptionWithBoolSelectorFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonOptionWithSelectorFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isOptionWithBoolSelector());
_ThisCommonOptionWithSelectorFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isOptionWithBoolSelector());
@@
-1688,7
+1652,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonOptionWithBoolSelectorFieldClass
&
+ CommonOptionWithBoolSelectorFieldClass
operator=(const CommonOptionWithBoolSelectorFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonOptionWithSelectorFieldClass::operator=(fc);
operator=(const CommonOptionWithBoolSelectorFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonOptionWithSelectorFieldClass::operator=(fc);
@@
-1770,20
+1734,15
@@
template <typename LibObjT, typename RangeSetT>
class CommonOptionWithIntegerSelectorFieldClass : public CommonOptionWithSelectorFieldClass<LibObjT>
{
private:
class CommonOptionWithIntegerSelectorFieldClass : public CommonOptionWithSelectorFieldClass<LibObjT>
{
private:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
-
using typename CommonOptionWithSelectorFieldClass<
LibObjT>::_ThisCommonOptionWithSelectorFieldClass;
using typename CommonOptionWithSelectorFieldClass<
LibObjT>::_ThisCommonOptionWithSelectorFieldClass;
- using _ThisCommonOptionWithIntegerSelectorFieldClass =
- CommonOptionWithIntegerSelectorFieldClass<LibObjT, RangeSetT>;
-
public:
public:
- using
Shared = SharedFieldClass<_ThisCommonOptionWithIntegerSelectorFieldClass, LibObjT>
;
-
+ using
typename CommonFieldClass<LibObjT>::LibObjPtr
;
+ using Shared = SharedFieldClass<CommonOptionWithIntegerSelectorFieldClass, LibObjT>;
using RangeSet = RangeSetT;
using RangeSet = RangeSetT;
- explicit CommonOptionWithIntegerSelectorFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonOptionWithIntegerSelectorFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonOptionWithSelectorFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isOptionWithIntegerSelector());
_ThisCommonOptionWithSelectorFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isOptionWithIntegerSelector());
@@
-1797,7
+1756,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonOptionWithIntegerSelectorFieldClass
&
+ CommonOptionWithIntegerSelectorFieldClass
operator=(const CommonOptionWithIntegerSelectorFieldClass<OtherLibObjT, RangeSetT> fc) noexcept
{
_ThisCommonOptionWithSelectorFieldClass::operator=(fc);
operator=(const CommonOptionWithIntegerSelectorFieldClass<OtherLibObjT, RangeSetT> fc) noexcept
{
_ThisCommonOptionWithSelectorFieldClass::operator=(fc);
@@
-1908,16
+1867,13
@@
class CommonVariantFieldClassOption : public BorrowedObject<LibObjT>
{
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
{
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
- using typename BorrowedObject<LibObjT>::_LibObjPtr;
-
- using _FieldClass =
- typename std::conditional<std::is_const<LibObjT>::value, ConstFieldClass, FieldClass>::type;
+ using _FieldClass = internal::DepFc<LibObjT>;
public:
public:
- using
UserAttributes =
-
typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type
;
+ using
typename BorrowedObject<LibObjT>::LibObjPtr;
+
using UserAttributes = internal::DepUserAttrs<LibObjT>
;
- explicit CommonVariantFieldClassOption(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonVariantFieldClassOption(const LibObjPtr libObjPtr) noexcept :
_ThisBorrowedObject {libObjPtr}
{
}
_ThisBorrowedObject {libObjPtr}
{
}
@@
-1929,7
+1885,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonVariantFieldClassOption
&
+ CommonVariantFieldClassOption
operator=(const CommonVariantFieldClassOption<OtherLibObjT> fc) noexcept
{
_ThisBorrowedObject::operator=(fc);
operator=(const CommonVariantFieldClassOption<OtherLibObjT> fc) noexcept
{
_ThisBorrowedObject::operator=(fc);
@@
-1941,15
+1897,9
@@
public:
return CommonVariantFieldClassOption<const bt_field_class_variant_option> {*this};
}
return CommonVariantFieldClassOption<const bt_field_class_variant_option> {*this};
}
-
nonstd::optional<bpstd::string_view>
name() const noexcept
+
bt2c::CStringView
name() const noexcept
{
{
- const auto name = bt_field_class_variant_option_get_name(this->libObjPtr());
-
- if (name) {
- return name;
- }
-
- return nonstd::nullopt;
+ return bt_field_class_variant_option_get_name(this->libObjPtr());
}
_FieldClass fieldClass() const noexcept
}
_FieldClass fieldClass() const noexcept
@@
-1959,12
+1909,14
@@
public:
}
template <typename LibValT>
}
template <typename LibValT>
- void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
+ CommonVariantFieldClassOption
+ userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstVariantFieldClassOption`.");
bt_field_class_variant_option_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstVariantFieldClassOption`.");
bt_field_class_variant_option_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
+ return *this;
}
UserAttributes userAttributes() const noexcept
}
UserAttributes userAttributes() const noexcept
@@
-2053,17
+2005,18
@@
class ConstVariantWithIntegerSelectorFieldClassOption : public BorrowedObject<Li
{
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
{
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
- using typename BorrowedObject<LibObjT>::_LibObjPtr;
using _Spec = internal::ConstVariantWithIntegerSelectorFieldClassOptionSpec<LibObjT>;
public:
using _Spec = internal::ConstVariantWithIntegerSelectorFieldClassOptionSpec<LibObjT>;
public:
+ using typename BorrowedObject<LibObjT>::LibObjPtr;
+
using RangeSet = typename std::conditional<
std::is_same<
LibObjT,
const bt_field_class_variant_with_selector_field_integer_unsigned_option>::value,
ConstUnsignedIntegerRangeSet, ConstSignedIntegerRangeSet>::type;
using RangeSet = typename std::conditional<
std::is_same<
LibObjT,
const bt_field_class_variant_with_selector_field_integer_unsigned_option>::value,
ConstUnsignedIntegerRangeSet, ConstSignedIntegerRangeSet>::type;
- explicit ConstVariantWithIntegerSelectorFieldClassOption(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit ConstVariantWithIntegerSelectorFieldClassOption(const LibObjPtr libObjPtr) noexcept :
_ThisBorrowedObject {libObjPtr}
{
}
_ThisBorrowedObject {libObjPtr}
{
}
@@
-2076,7
+2029,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- ConstVariantWithIntegerSelectorFieldClassOption
&
+ ConstVariantWithIntegerSelectorFieldClassOption
operator=(const ConstVariantWithIntegerSelectorFieldClassOption<OtherLibObjT> fc) noexcept
{
_ThisBorrowedObject::operator=(fc);
operator=(const ConstVariantWithIntegerSelectorFieldClassOption<OtherLibObjT> fc) noexcept
{
_ThisBorrowedObject::operator=(fc);
@@
-2088,7
+2041,7
@@
public:
return ConstVariantFieldClassOption {_Spec::asBaseOption(this->libObjPtr())};
}
return ConstVariantFieldClassOption {_Spec::asBaseOption(this->libObjPtr())};
}
-
nonstd::optional<bpstd::string_view>
name() const noexcept
+
bt2c::CStringView
name() const noexcept
{
return this->asBaseOption().name();
}
{
return this->asBaseOption().name();
}
@@
-2160,19
+2113,17
@@
private:
using typename CommonFieldClass<LibObjT>::_ThisCommonFieldClass;
protected:
using typename CommonFieldClass<LibObjT>::_ThisCommonFieldClass;
protected:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
using _ThisCommonVariantFieldClass = CommonVariantFieldClass<LibObjT>;
public:
using _ThisCommonVariantFieldClass = CommonVariantFieldClass<LibObjT>;
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<CommonVariantFieldClass<LibObjT>, LibObjT>;
using Shared = SharedFieldClass<CommonVariantFieldClass<LibObjT>, LibObjT>;
+ using Iterator = BorrowedObjectIterator<CommonVariantFieldClass>;
using Option =
using Option =
- typename std::conditional<std::is_const<LibObjT>::value, ConstVariantFieldClassOption,
- VariantFieldClassOption>::type;
-
- using Iterator = CommonIterator<CommonVariantFieldClass, Option>;
+ internal::DepType<LibObjT, VariantFieldClassOption, ConstVariantFieldClassOption>;
- explicit CommonVariantFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonVariantFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isVariant());
_ThisCommonFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isVariant());
@@
-2185,7
+2136,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonVariantFieldClass
&
operator=(const CommonVariantFieldClass<OtherLibObjT> fc) noexcept
+ CommonVariantFieldClass operator=(const CommonVariantFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
return *this;
{
_ThisCommonFieldClass::operator=(fc);
return *this;
@@
-2217,21
+2168,10
@@
public:
this->libObjPtr(), index)};
}
this->libObjPtr(), index)};
}
-
nonstd::optional<Option> operator[](const char * const
name) const noexcept
+
OptionalBorrowedObject<Option> operator[](const bt2c::CStringView
name) const noexcept
{
{
- const auto libObjPtr =
- internal::CommonVariantFieldClassSpec<LibObjT>::optionByName(this->libObjPtr(), name);
-
- if (libObjPtr) {
- return Option {libObjPtr};
- }
-
- return nonstd::nullopt;
- }
-
- nonstd::optional<Option> operator[](const std::string& name) const noexcept
- {
- return (*this)[name.data()];
+ return internal::CommonVariantFieldClassSpec<LibObjT>::optionByName(this->libObjPtr(),
+ name);
}
Shared shared() const noexcept
}
Shared shared() const noexcept
@@
-2268,12
+2208,12
@@
class CommonVariantWithoutSelectorFieldClass : public CommonVariantFieldClass<Li
{
private:
using typename CommonVariantFieldClass<LibObjT>::_ThisCommonVariantFieldClass;
{
private:
using typename CommonVariantFieldClass<LibObjT>::_ThisCommonVariantFieldClass;
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
public:
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<CommonVariantWithoutSelectorFieldClass<LibObjT>, LibObjT>;
using Shared = SharedFieldClass<CommonVariantWithoutSelectorFieldClass<LibObjT>, LibObjT>;
- explicit CommonVariantWithoutSelectorFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonVariantWithoutSelectorFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonVariantFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isVariantWithoutSelector());
_ThisCommonVariantFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isVariantWithoutSelector());
@@
-2287,7
+2227,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonVariantWithoutSelectorFieldClass
&
+ CommonVariantWithoutSelectorFieldClass
operator=(const CommonVariantWithoutSelectorFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonVariantFieldClass::operator=(fc);
operator=(const CommonVariantWithoutSelectorFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonVariantFieldClass::operator=(fc);
@@
-2299,7
+2239,8
@@
public:
return CommonVariantWithoutSelectorFieldClass<const bt_field_class> {*this};
}
return CommonVariantWithoutSelectorFieldClass<const bt_field_class> {*this};
}
- void appendOption(const char * const name, const FieldClass fc) const
+ CommonVariantWithoutSelectorFieldClass appendOption(const char * const name,
+ const FieldClass fc) const
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstVariantWithoutSelectorFieldClass`.");
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstVariantWithoutSelectorFieldClass`.");
@@
-2311,11
+2252,20
@@
public:
BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR) {
throw MemoryError {};
}
BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR) {
throw MemoryError {};
}
+
+ return *this;
}
}
- void appendOption(const nonstd::optional<std::string>& name, const FieldClass fc) const
+ CommonVariantWithoutSelectorFieldClass appendOption(const bt2c::CStringView name,
+ const FieldClass fc) const
{
{
- this->appendOption(name ? name->data() : nullptr, fc);
+ return this->appendOption(name.data(), fc);
+ }
+
+ CommonVariantWithoutSelectorFieldClass appendOption(const bt2s::optional<std::string>& name,
+ const FieldClass fc) const
+ {
+ return this->appendOption(name ? name->data() : nullptr, fc);
}
Shared shared() const noexcept
}
Shared shared() const noexcept
@@
-2420,13
+2370,13
@@
private:
using typename CommonVariantFieldClass<LibObjT>::_ThisCommonVariantFieldClass;
protected:
using typename CommonVariantFieldClass<LibObjT>::_ThisCommonVariantFieldClass;
protected:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
using _ThisCommonVariantWithSelectorFieldClass = CommonVariantWithSelectorFieldClass<LibObjT>;
public:
using _ThisCommonVariantWithSelectorFieldClass = CommonVariantWithSelectorFieldClass<LibObjT>;
public:
+ using typename CommonFieldClass<LibObjT>::LibObjPtr;
using Shared = SharedFieldClass<_ThisCommonVariantWithSelectorFieldClass, LibObjT>;
using Shared = SharedFieldClass<_ThisCommonVariantWithSelectorFieldClass, LibObjT>;
- explicit CommonVariantWithSelectorFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonVariantWithSelectorFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonVariantFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isVariantWithSelector());
_ThisCommonVariantFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isVariantWithSelector());
@@
-2440,7
+2390,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonVariantWithSelectorFieldClass
&
+ CommonVariantWithSelectorFieldClass
operator=(const CommonVariantWithSelectorFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonVariantFieldClass::operator=(fc);
operator=(const CommonVariantWithSelectorFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonVariantFieldClass::operator=(fc);
@@
-2476,23
+2426,21
@@
class CommonVariantWithIntegerSelectorFieldClass :
private:
using typename CommonVariantWithSelectorFieldClass<
LibObjT>::_ThisCommonVariantWithSelectorFieldClass;
private:
using typename CommonVariantWithSelectorFieldClass<
LibObjT>::_ThisCommonVariantWithSelectorFieldClass;
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
- using _ThisCommonVariantWithIntegerSelectorFieldClass =
- CommonVariantWithIntegerSelectorFieldClass<LibObjT, OptionT>;
using _Spec = internal::CommonVariantWithIntegerSelectorFieldClassSpec<OptionT>;
public:
using _Spec = internal::CommonVariantWithIntegerSelectorFieldClassSpec<OptionT>;
public:
- using
Shared = SharedFieldClass<_ThisCommonVariantWithIntegerSelectorFieldClass, LibObjT>
;
-
+ using
typename CommonFieldClass<LibObjT>::LibObjPtr
;
+ using Shared = SharedFieldClass<CommonVariantWithIntegerSelectorFieldClass, LibObjT>;
using Option = OptionT;
using Option = OptionT;
+
using Iterator =
using Iterator =
-
CommonIterator<CommonVariantWithIntegerSelectorFieldClass<LibObjT, Option>, Option
>;
+
BorrowedObjectIterator<CommonVariantWithIntegerSelectorFieldClass<LibObjT, Option>
>;
- explicit CommonVariantWithIntegerSelectorFieldClass(const
_
LibObjPtr libObjPtr) noexcept :
+ explicit CommonVariantWithIntegerSelectorFieldClass(const LibObjPtr libObjPtr) noexcept :
_ThisCommonVariantWithSelectorFieldClass {libObjPtr}
{
_ThisCommonVariantWithSelectorFieldClass {libObjPtr}
{
- BT_ASSERT_DBG(this->isVariant());
+ BT_ASSERT_DBG(this->isVariant
WithIntegerSelector
());
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
@@
-2503,7
+2451,7
@@
public:
}
template <typename OtherLibObjT>
}
template <typename OtherLibObjT>
- CommonVariantWithIntegerSelectorFieldClass
&
+ CommonVariantWithIntegerSelectorFieldClass
operator=(const CommonVariantWithIntegerSelectorFieldClass<OtherLibObjT, OptionT> fc) noexcept
{
_ThisCommonVariantWithSelectorFieldClass::operator=(fc);
operator=(const CommonVariantWithIntegerSelectorFieldClass<OtherLibObjT, OptionT> fc) noexcept
{
_ThisCommonVariantWithSelectorFieldClass::operator=(fc);
@@
-2515,24
+2463,14
@@
public:
return Option {_Spec::optionByIndex(this->libObjPtr(), index)};
}
return Option {_Spec::optionByIndex(this->libObjPtr(), index)};
}
-
nonstd::optional<Option> operator[](const char * const
name) const noexcept
+
OptionalBorrowedObject<Option> operator[](const bt2c::CStringView
name) const noexcept
{
{
- const auto libObjPtr = _Spec::optionByName(this->libObjPtr(), name);
-
- if (libObjPtr) {
- return Option {libObjPtr};
- }
-
- return nonstd::nullopt;
+ return _Spec::optionByName(this->libObjPtr(), name);
}
}
- nonstd::optional<Option> operator[](const std::string& name) const noexcept
- {
- return (*this)[name.data()];
- }
-
- void appendOption(const char * const name, const FieldClass fc,
- const typename Option::RangeSet ranges) const
+ CommonVariantWithIntegerSelectorFieldClass
+ appendOption(const char * const name, const FieldClass fc,
+ const typename Option::RangeSet ranges) const
{
static_assert(
!std::is_const<LibObjT>::value,
{
static_assert(
!std::is_const<LibObjT>::value,
@@
-2545,12
+2483,22
@@
public:
BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR) {
throw MemoryError {};
}
BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR) {
throw MemoryError {};
}
+
+ return *this;
+ }
+
+ CommonVariantWithIntegerSelectorFieldClass
+ appendOption(const bt2c::CStringView name, const FieldClass fc,
+ const typename Option::RangeSet ranges) const
+ {
+ return this->appendOption(name.data(), fc, ranges);
}
}
- void appendOption(const nonstd::optional<std::string>& name, const FieldClass fc,
- const typename Option::RangeSet ranges) const
+ CommonVariantWithIntegerSelectorFieldClass
+ appendOption(const bt2s::optional<std::string>& name, const FieldClass fc,
+ const typename Option::RangeSet ranges) const
{
{
- this->appendOption(name ? name->data() : nullptr, fc, ranges);
+
return
this->appendOption(name ? name->data() : nullptr, fc, ranges);
}
Iterator begin() const noexcept
}
Iterator begin() const noexcept
@@
-2625,21
+2573,18
@@
struct TypeDescr<ConstVariantWithSignedIntegerSelectorFieldClass> :
template <typename LibObjT>
CommonBitArrayFieldClass<LibObjT> CommonFieldClass<LibObjT>::asBitArray() const noexcept
{
template <typename LibObjT>
CommonBitArrayFieldClass<LibObjT> CommonFieldClass<LibObjT>::asBitArray() const noexcept
{
- BT_ASSERT_DBG(this->isBitArray());
return CommonBitArrayFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonIntegerFieldClass<LibObjT> CommonFieldClass<LibObjT>::asInteger() const noexcept
{
return CommonBitArrayFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonIntegerFieldClass<LibObjT> CommonFieldClass<LibObjT>::asInteger() const noexcept
{
- BT_ASSERT_DBG(this->isInteger());
return CommonIntegerFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonBaseEnumerationFieldClass<LibObjT> CommonFieldClass<LibObjT>::asEnumeration() const noexcept
{
return CommonIntegerFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonBaseEnumerationFieldClass<LibObjT> CommonFieldClass<LibObjT>::asEnumeration() const noexcept
{
- BT_ASSERT_DBG(this->isEnumeration());
return CommonBaseEnumerationFieldClass<LibObjT> {this->libObjPtr()};
}
return CommonBaseEnumerationFieldClass<LibObjT> {this->libObjPtr()};
}
@@
-2664,21
+2609,18
@@
CommonFieldClass<LibObjT>::asSignedEnumeration() const noexcept
template <typename LibObjT>
CommonStructureFieldClass<LibObjT> CommonFieldClass<LibObjT>::asStructure() const noexcept
{
template <typename LibObjT>
CommonStructureFieldClass<LibObjT> CommonFieldClass<LibObjT>::asStructure() const noexcept
{
- BT_ASSERT_DBG(this->isStructure());
return CommonStructureFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonArrayFieldClass<LibObjT> CommonFieldClass<LibObjT>::asArray() const noexcept
{
return CommonStructureFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonArrayFieldClass<LibObjT> CommonFieldClass<LibObjT>::asArray() const noexcept
{
- BT_ASSERT_DBG(this->isArray());
return CommonArrayFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonStaticArrayFieldClass<LibObjT> CommonFieldClass<LibObjT>::asStaticArray() const noexcept
{
return CommonArrayFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonStaticArrayFieldClass<LibObjT> CommonFieldClass<LibObjT>::asStaticArray() const noexcept
{
- BT_ASSERT_DBG(this->isStaticArray());
return CommonStaticArrayFieldClass<LibObjT> {this->libObjPtr()};
}
return CommonStaticArrayFieldClass<LibObjT> {this->libObjPtr()};
}
@@
-2686,14
+2628,12
@@
template <typename LibObjT>
CommonDynamicArrayWithLengthFieldClass<LibObjT>
CommonFieldClass<LibObjT>::asDynamicArrayWithLength() const noexcept
{
CommonDynamicArrayWithLengthFieldClass<LibObjT>
CommonFieldClass<LibObjT>::asDynamicArrayWithLength() const noexcept
{
- BT_ASSERT_DBG(this->isDynamicArrayWithLength());
return CommonDynamicArrayWithLengthFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonOptionFieldClass<LibObjT> CommonFieldClass<LibObjT>::asOption() const noexcept
{
return CommonDynamicArrayWithLengthFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonOptionFieldClass<LibObjT> CommonFieldClass<LibObjT>::asOption() const noexcept
{
- BT_ASSERT_DBG(this->isOption());
return CommonOptionFieldClass<LibObjT> {this->libObjPtr()};
}
return CommonOptionFieldClass<LibObjT> {this->libObjPtr()};
}
@@
-2701,7
+2641,6
@@
template <typename LibObjT>
CommonOptionWithSelectorFieldClass<LibObjT>
CommonFieldClass<LibObjT>::asOptionWithSelector() const noexcept
{
CommonOptionWithSelectorFieldClass<LibObjT>
CommonFieldClass<LibObjT>::asOptionWithSelector() const noexcept
{
- BT_ASSERT_DBG(this->isOptionWithSelector());
return CommonOptionWithSelectorFieldClass<LibObjT> {this->libObjPtr()};
}
return CommonOptionWithSelectorFieldClass<LibObjT> {this->libObjPtr()};
}
@@
-2709,7
+2648,6
@@
template <typename LibObjT>
CommonOptionWithBoolSelectorFieldClass<LibObjT>
CommonFieldClass<LibObjT>::asOptionWithBoolSelector() const noexcept
{
CommonOptionWithBoolSelectorFieldClass<LibObjT>
CommonFieldClass<LibObjT>::asOptionWithBoolSelector() const noexcept
{
- BT_ASSERT_DBG(this->isOptionWithBoolSelector());
return CommonOptionWithBoolSelectorFieldClass<LibObjT> {this->libObjPtr()};
}
return CommonOptionWithBoolSelectorFieldClass<LibObjT> {this->libObjPtr()};
}
@@
-2734,7
+2672,6
@@
CommonFieldClass<LibObjT>::asOptionWithSignedIntegerSelector() const noexcept
template <typename LibObjT>
CommonVariantFieldClass<LibObjT> CommonFieldClass<LibObjT>::asVariant() const noexcept
{
template <typename LibObjT>
CommonVariantFieldClass<LibObjT> CommonFieldClass<LibObjT>::asVariant() const noexcept
{
- BT_ASSERT_DBG(this->isVariant());
return CommonVariantFieldClass<LibObjT> {this->libObjPtr()};
}
return CommonVariantFieldClass<LibObjT> {this->libObjPtr()};
}
@@
-2742,7
+2679,6
@@
template <typename LibObjT>
CommonVariantWithoutSelectorFieldClass<LibObjT>
CommonFieldClass<LibObjT>::asVariantWithoutSelector() const noexcept
{
CommonVariantWithoutSelectorFieldClass<LibObjT>
CommonFieldClass<LibObjT>::asVariantWithoutSelector() const noexcept
{
- BT_ASSERT_DBG(this->isVariantWithoutSelector());
return CommonVariantWithoutSelectorFieldClass<LibObjT> {this->libObjPtr()};
}
return CommonVariantWithoutSelectorFieldClass<LibObjT> {this->libObjPtr()};
}
@@
-2750,7
+2686,6
@@
template <typename LibObjT>
CommonVariantWithSelectorFieldClass<LibObjT>
CommonFieldClass<LibObjT>::asVariantWithSelector() const noexcept
{
CommonVariantWithSelectorFieldClass<LibObjT>
CommonFieldClass<LibObjT>::asVariantWithSelector() const noexcept
{
- BT_ASSERT_DBG(this->isVariantWithSelector());
return CommonVariantWithSelectorFieldClass<LibObjT> {this->libObjPtr()};
}
return CommonVariantWithSelectorFieldClass<LibObjT> {this->libObjPtr()};
}
This page took
0.039233 seconds
and
4
git commands to generate.