return static_cast<bool>(bt_clock_class_origin_is_unix_epoch(this->libObjPtr()));
}
- void name(const char * const name) const
+ void name(const bt2c::CStringView name) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstClockClass`.");
}
}
- void name(const std::string& name) const
- {
- this->name(name.data());
- }
-
bt2c::CStringView name() const noexcept
{
return bt_clock_class_get_name(this->libObjPtr());
}
- void description(const char * const description) const
+ void description(const bt2c::CStringView description) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstClockClass`.");
}
}
- void description(const std::string& description) const
- {
- this->description(description.data());
- }
-
bt2c::CStringView description() const noexcept
{
return bt_clock_class_get_description(this->libObjPtr());
}
Port operator[](std::uint64_t index) const noexcept;
- Port operator[](const char *name) const noexcept;
- Port operator[](const std::string& name) const noexcept;
+ Port operator[](bt2c::CStringView name) const noexcept;
Iterator begin() const noexcept;
Iterator end() const noexcept;
};
template <typename LibCompT, typename LibPortT>
typename ConstComponentPorts<LibCompT, LibPortT>::Port
-ConstComponentPorts<LibCompT, LibPortT>::operator[](const char * const name) const noexcept
+ConstComponentPorts<LibCompT, LibPortT>::operator[](const bt2c::CStringView name) const noexcept
{
return Port {_Spec::portByName(this->libObjPtr(), name)};
}
-template <typename LibCompT, typename LibPortT>
-typename ConstComponentPorts<LibCompT, LibPortT>::Port
-ConstComponentPorts<LibCompT, LibPortT>::operator[](const std::string& name) const noexcept
-{
- return (*this)[name.data()];
-}
-
template <typename LibCompT, typename LibPortT>
typename ConstComponentPorts<LibCompT, LibPortT>::Iterator
ConstComponentPorts<LibCompT, LibPortT>::begin() const noexcept
this->libObjPtr(), index)};
}
- OptionalBorrowedObject<Mapping> operator[](const char * const label) const noexcept
+ OptionalBorrowedObject<Mapping> operator[](const bt2c::CStringView label) const noexcept
{
return internal::CommonEnumerationFieldClassSpec<MappingT>::mappingByLabel(
this->libObjPtr(), label);
}
- OptionalBorrowedObject<Mapping> operator[](const std::string& label) const noexcept
- {
- return (*this)[label.data()];
- }
-
- void addMapping(const char * const label, const typename Mapping::RangeSet ranges) const
+ void addMapping(const bt2c::CStringView label, const typename Mapping::RangeSet ranges) const
{
const auto status = internal::CommonEnumerationFieldClassSpec<MappingT>::addMapping(
this->libObjPtr(), label, ranges.libObjPtr());
}
}
- void addMapping(const std::string& label, const typename Mapping::RangeSet ranges) const
- {
- this->addMapping(label.data(), ranges);
- }
-
Iterator begin() const noexcept
{
return Iterator {*this, 0};
return CommonStructureFieldClass<const bt_field_class> {*this};
}
- void appendMember(const char * const name, const FieldClass fc) const
+ void appendMember(const bt2c::CStringView name, const FieldClass fc) const
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstStructureFieldClass`.");
}
}
- void appendMember(const std::string& name, const FieldClass fc) const
- {
- this->appendMember(name.data(), fc);
- }
-
std::uint64_t length() const noexcept
{
return bt_field_class_structure_get_member_count(this->libObjPtr());
this->libObjPtr(), index)};
}
- OptionalBorrowedObject<Member> operator[](const char * const name) const noexcept
+ OptionalBorrowedObject<Member> operator[](const bt2c::CStringView name) const noexcept
{
return internal::CommonStructureFieldClassSpec<LibObjT>::memberByName(this->libObjPtr(),
name);
}
- OptionalBorrowedObject<Member> operator[](const std::string& name) const noexcept
- {
- return (*this)[name.data()];
- }
-
Shared shared() const noexcept
{
return Shared::createWithRef(*this);
this->libObjPtr(), index)};
}
- OptionalBorrowedObject<Option> operator[](const char * const name) const noexcept
+ OptionalBorrowedObject<Option> operator[](const bt2c::CStringView name) const noexcept
{
return internal::CommonVariantFieldClassSpec<LibObjT>::optionByName(this->libObjPtr(),
name);
}
- OptionalBorrowedObject<Option> operator[](const std::string& name) const noexcept
- {
- return (*this)[name.data()];
- }
-
Shared shared() const noexcept
{
return Shared::createWithRef(*this);
}
}
+ void appendOption(const bt2c::CStringView name, const FieldClass fc) const
+ {
+ return this->appendOption(name.data(), fc);
+ }
+
void appendOption(const bt2s::optional<std::string>& name, const FieldClass fc) const
{
this->appendOption(name ? name->data() : nullptr, fc);
return Option {_Spec::optionByIndex(this->libObjPtr(), index)};
}
- OptionalBorrowedObject<Option> operator[](const char * const name) const noexcept
+ OptionalBorrowedObject<Option> operator[](const bt2c::CStringView name) const noexcept
{
return _Spec::optionByName(this->libObjPtr(), name);
}
- OptionalBorrowedObject<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
{
}
}
+ void appendOption(const bt2c::CStringView name, const FieldClass fc,
+ const typename Option::RangeSet ranges) const
+ {
+ return this->appendOption(name.data(), fc, ranges);
+ }
+
void appendOption(const bt2s::optional<std::string>& name, const FieldClass fc,
const typename Option::RangeSet ranges) const
{
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`.");
}
}
- 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`.");
}
}
- void append(const char * const val) const
+ void append(const bt2c::CStringView val) const
{
this->append(val, std::strlen(val));
}
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>;
namespace bt2 {
namespace internal {
-constexpr const char *unhandledExcLogStr() noexcept
+constexpr bt2c::CStringView unhandledExcLogStr() noexcept
{
return "Unhandled exception.";
}
-constexpr const char *unhandledExcLogTag() noexcept
+constexpr bt2c::CStringView unhandledExcLogTag() noexcept
{
return "PLUGIN-DEV-HPP";
}
public:
static Value::Shared query(const SelfComponentClass selfCompCls,
- const PrivateQueryExecutor privQueryExec, const char * const obj,
- const ConstValue params)
+ const PrivateQueryExecutor privQueryExec,
+ const bt2c::CStringView obj, const ConstValue params)
{
return UserComponentT::_query(selfCompCls, privQueryExec, obj, params);
}
protected:
/* Overloadable */
- static Value::Shared _query(SelfComponentClass, PrivateQueryExecutor, const char *, ConstValue)
+ static Value::Shared _query(SelfComponentClass, PrivateQueryExecutor, bt2c::CStringView,
+ ConstValue)
{
throw UnknownObject {};
}
}
template <typename DataT>
- _OutputPorts::Port _addOutputPort(const char * const name, DataT * const data)
+ _OutputPorts::Port _addOutputPort(const bt2c::CStringView name, DataT * const data)
{
return this->_selfComp().addOutputPort(name, data);
}
- _OutputPorts::Port _addOutputPort(const char *name)
- {
- return this->_selfComp().addOutputPort(name);
- }
-
- template <typename DataT>
- _OutputPorts::Port _addOutputPort(const std::string& name, DataT * const data)
- {
- return this->_selfComp().addOutputPort(name, data);
- }
-
- _OutputPorts::Port _addOutputPort(const std::string& name)
+ _OutputPorts::Port _addOutputPort(const bt2c::CStringView name)
{
return this->_selfComp().addOutputPort(name);
}
public:
static Value::Shared query(const SelfComponentClass selfCompCls,
- const PrivateQueryExecutor privQueryExec, const char * const obj,
- const ConstValue params)
+ const PrivateQueryExecutor privQueryExec,
+ const bt2c::CStringView obj, const ConstValue params)
{
return UserComponentT::_query(selfCompCls, privQueryExec, obj, params);
}
protected:
/* Overloadable */
- static Value::Shared _query(SelfComponentClass, PrivateQueryExecutor, const char *, ConstValue)
+ static Value::Shared _query(SelfComponentClass, PrivateQueryExecutor, bt2c::CStringView,
+ ConstValue)
{
throw UnknownObject {};
}
}
template <typename DataT>
- _OutputPorts::Port _addInputPort(const char * const name, DataT * const data)
- {
- return this->_selfComp().addInputPort(name, data);
- }
-
- _InputPorts::Port _addInputPort(const char *name)
- {
- return this->_selfComp().addInputPort(name);
- }
-
- template <typename DataT>
- _InputPorts::Port _addInputPort(const std::string& name, DataT * const data)
+ _OutputPorts::Port _addInputPort(const bt2c::CStringView name, DataT * const data)
{
return this->_selfComp().addInputPort(name, data);
}
- _InputPorts::Port _addInputPort(const std::string& name)
+ _InputPorts::Port _addInputPort(const bt2c::CStringView name)
{
return this->_selfComp().addInputPort(name);
}
}
template <typename DataT>
- _OutputPorts::Port _addOutputPort(const char * const name, DataT * const data)
+ _OutputPorts::Port _addOutputPort(const bt2c::CStringView name, DataT * const data)
{
return this->_selfComp().addOutputPort(name, data);
}
- _OutputPorts::Port _addOutputPort(const char *name)
- {
- return this->_selfComp().addOutputPort(name);
- }
-
- template <typename DataT>
- _OutputPorts::Port _addOutputPort(const std::string& name, DataT * const data)
- {
- return this->_selfComp().addOutputPort(name, data);
- }
-
- _OutputPorts::Port _addOutputPort(const std::string& name)
+ _OutputPorts::Port _addOutputPort(const bt2c::CStringView name)
{
return this->_selfComp().addOutputPort(name);
}
public:
static Value::Shared query(const SelfComponentClass selfCompCls,
- const PrivateQueryExecutor privQueryExec, const char * const obj,
- const ConstValue params)
+ const PrivateQueryExecutor privQueryExec,
+ const bt2c::CStringView obj, const ConstValue params)
{
return UserComponentT::_query(selfCompCls, privQueryExec, obj, params);
}
protected:
/* Overloadable */
- static Value::Shared _query(SelfComponentClass, PrivateQueryExecutor, const char *, ConstValue)
+ static Value::Shared _query(SelfComponentClass, PrivateQueryExecutor, bt2c::CStringView,
+ ConstValue)
{
throw UnknownObject {};
}
}
template <typename DataT>
- _InputPorts::Port _addInputPort(const char * const name, DataT * const data)
- {
- return this->_selfComp().addInputPort(name, data);
- }
-
- _InputPorts::Port _addInputPort(const char *name)
- {
- return this->_selfComp().addInputPort(name);
- }
-
- template <typename DataT>
- _InputPorts::Port _addInputPort(const std::string& name, DataT * const data)
+ _InputPorts::Port _addInputPort(const bt2c::CStringView name, DataT * const data)
{
return this->_selfComp().addInputPort(name, data);
}
- _InputPorts::Port _addInputPort(const std::string& name)
+ _InputPorts::Port _addInputPort(const bt2c::CStringView name)
{
return this->_selfComp().addInputPort(name);
}
ObjT _mObj;
};
-template <typename ObjT>
-class RawStringValueProxy final : public RawValueProxy<ObjT>
-{
-public:
- explicit RawStringValueProxy(const ObjT obj) : RawValueProxy<ObjT> {obj}
- {
- }
-
- RawStringValueProxy& operator=(const char * const rawVal)
- {
- RawValueProxy<ObjT>::operator=(bt2c::CStringView {rawVal});
- return *this;
- }
-
- RawStringValueProxy& operator=(const std::string& rawVal)
- {
- RawValueProxy<ObjT>::operator=(bt2c::CStringView {rawVal.data()});
- return *this;
- }
-};
-
} /* namespace bt2 */
#endif /* BABELTRACE_CPP_COMMON_BT2_RAW_VALUE_PROXY_HPP */
}
Port operator[](std::uint64_t index) const noexcept;
- Port operator[](const char *name) const noexcept;
- Port operator[](const std::string& name) const noexcept;
+ Port operator[](bt2c::CStringView name) const noexcept;
Iterator begin() const noexcept;
Iterator end() const noexcept;
Port front() const noexcept;
}
template <typename DataT>
- OutputPorts::Port addOutputPort(const char *name, DataT& data) const;
+ OutputPorts::Port addOutputPort(bt2c::CStringView name, DataT& data) const;
- OutputPorts::Port addOutputPort(const char *name) const;
+ OutputPorts::Port addOutputPort(bt2c::CStringView name) const;
- template <typename DataT>
- OutputPorts::Port addOutputPort(const std::string& name, DataT& data) const;
-
- OutputPorts::Port addOutputPort(const std::string& name) const;
OutputPorts outputPorts() const noexcept;
private:
}
template <typename DataT>
- InputPorts::Port addInputPort(const char *name, DataT& data) const;
-
- InputPorts::Port addInputPort(const char *name) const;
+ InputPorts::Port addInputPort(bt2c::CStringView name, DataT& data) const;
- template <typename DataT>
- InputPorts::Port addInputPort(const std::string& name, DataT& data) const;
+ InputPorts::Port addInputPort(bt2c::CStringView name) const;
- InputPorts::Port addInputPort(const std::string& name) const;
InputPorts inputPorts() const noexcept;
template <typename DataT>
- OutputPorts::Port addOutputPort(const char *name, DataT& data) const;
-
- OutputPorts::Port addOutputPort(const char *name) const;
+ OutputPorts::Port addOutputPort(bt2c::CStringView name, DataT& data) const;
- template <typename DataT>
- OutputPorts::Port addOutputPort(const std::string& name, DataT& data) const;
+ OutputPorts::Port addOutputPort(bt2c::CStringView name) const;
- OutputPorts::Port addOutputPort(const std::string& name) const;
OutputPorts outputPorts() const noexcept;
private:
}
template <typename DataT>
- InputPorts::Port addInputPort(const char *name, DataT& data) const;
+ InputPorts::Port addInputPort(bt2c::CStringView name, DataT& data) const;
- InputPorts::Port addInputPort(const char *name) const;
+ InputPorts::Port addInputPort(bt2c::CStringView name) const;
- template <typename DataT>
- InputPorts::Port addInputPort(const std::string& name, DataT& data) const;
-
- InputPorts::Port addInputPort(const std::string& name) const;
InputPorts inputPorts() const noexcept;
private:
template <typename LibSelfCompT, typename LibSelfCompPortT, typename LibPortT>
typename SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::Port
SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::operator[](
- const char * const name) const noexcept
+ const bt2c::CStringView name) const noexcept
{
return Port {_Spec::portByName(this->libObjPtr(), name)};
}
-template <typename LibSelfCompT, typename LibSelfCompPortT, typename LibPortT>
-typename SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::Port
-SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::operator[](
- const std::string& name) const noexcept
-{
- return (*this)[name.data()];
-}
-
template <typename LibSelfCompT, typename LibSelfCompPortT, typename LibPortT>
typename SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::Iterator
SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::begin() const noexcept
}
template <typename DataT>
-SelfSourceComponent::OutputPorts::Port SelfSourceComponent::addOutputPort(const char * const name,
- DataT& data) const
+SelfSourceComponent::OutputPorts::Port
+SelfSourceComponent::addOutputPort(const bt2c::CStringView name, DataT& data) const
{
return this->_addOutputPort(name, &data);
}
inline SelfSourceComponent::OutputPorts::Port
-SelfSourceComponent::addOutputPort(const char * const name) const
+SelfSourceComponent::addOutputPort(const bt2c::CStringView name) const
{
return this->_addOutputPort<void>(name, nullptr);
}
-template <typename DataT>
-SelfSourceComponent::OutputPorts::Port SelfSourceComponent::addOutputPort(const std::string& name,
- DataT& data) const
-{
- return this->_addOutputPort(name.data(), &data);
-}
-
-inline SelfSourceComponent::OutputPorts::Port
-SelfSourceComponent::addOutputPort(const std::string& name) const
-{
- return this->_addOutputPort<void>(name.data(), nullptr);
-}
-
inline SelfSourceComponent::OutputPorts SelfSourceComponent::outputPorts() const noexcept
{
return OutputPorts {this->libObjPtr()};
}
template <typename DataT>
-SelfFilterComponent::OutputPorts::Port SelfFilterComponent::addOutputPort(const char * const name,
- DataT& data) const
+SelfFilterComponent::OutputPorts::Port
+SelfFilterComponent::addOutputPort(const bt2c::CStringView name, DataT& data) const
{
return this->_addOutputPort(name, &data);
}
inline SelfFilterComponent::OutputPorts::Port
-SelfFilterComponent::addOutputPort(const char * const name) const
+SelfFilterComponent::addOutputPort(const bt2c::CStringView name) const
{
return this->_addOutputPort<void>(name, nullptr);
}
-template <typename DataT>
-SelfFilterComponent::OutputPorts::Port SelfFilterComponent::addOutputPort(const std::string& name,
- DataT& data) const
-{
- return this->_addOutputPort(name.data(), &data);
-}
-
-inline SelfFilterComponent::OutputPorts::Port
-SelfFilterComponent::addOutputPort(const std::string& name) const
-{
- return this->_addOutputPort<void>(name.data(), nullptr);
-}
-
inline SelfFilterComponent::OutputPorts SelfFilterComponent::outputPorts() const noexcept
{
return OutputPorts {this->libObjPtr()};
}
template <typename DataT>
-SelfFilterComponent::InputPorts::Port SelfFilterComponent::addInputPort(const char * const name,
- DataT& data) const
+SelfFilterComponent::InputPorts::Port
+SelfFilterComponent::addInputPort(const bt2c::CStringView name, DataT& data) const
{
return this->_addInputPort(name, &data);
}
inline SelfFilterComponent::InputPorts::Port
-SelfFilterComponent::addInputPort(const char * const name) const
+SelfFilterComponent::addInputPort(const bt2c::CStringView name) const
{
return this->_addInputPort<void>(name, nullptr);
}
-template <typename DataT>
-SelfFilterComponent::InputPorts::Port SelfFilterComponent::addInputPort(const std::string& name,
- DataT& data) const
-{
- return this->_addInputPort(name.data(), &data);
-}
-
-inline SelfFilterComponent::InputPorts::Port
-SelfFilterComponent::addInputPort(const std::string& name) const
-{
- return this->_addInputPort<void>(name.data(), nullptr);
-}
-
inline SelfFilterComponent::InputPorts SelfFilterComponent::inputPorts() const noexcept
{
return InputPorts {this->libObjPtr()};
}
template <typename DataT>
-SelfSinkComponent::InputPorts::Port SelfSinkComponent::addInputPort(const char * const name,
+SelfSinkComponent::InputPorts::Port SelfSinkComponent::addInputPort(const bt2c::CStringView name,
DataT& data) const
{
return this->_addInputPort(name, &data);
}
inline SelfSinkComponent::InputPorts::Port
-SelfSinkComponent::addInputPort(const char * const name) const
+SelfSinkComponent::addInputPort(const bt2c::CStringView name) const
{
return this->_addInputPort<void>(name, nullptr);
}
-template <typename DataT>
-SelfSinkComponent::InputPorts::Port SelfSinkComponent::addInputPort(const std::string& name,
- DataT& data) const
-{
- return this->_addInputPort(name.data(), &data);
-}
-
-inline SelfSinkComponent::InputPorts::Port
-SelfSinkComponent::addInputPort(const std::string& name) const
-{
- return this->_addInputPort<void>(name.data(), nullptr);
-}
-
inline SelfSinkComponent::InputPorts SelfSinkComponent::inputPorts() const noexcept
{
return InputPorts {this->libObjPtr()};
return bt_stream_get_id(this->libObjPtr());
}
- void name(const char * const name) const
+ void name(const bt2c::CStringView name) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstStream`.");
}
}
- void name(const std::string& name) const
- {
- this->name(name.data());
- }
-
bt2c::CStringView name() const noexcept
{
return bt_stream_get_name(this->libObjPtr());
Class cls() const noexcept;
- void name(const char * const name) const
+ void name(const bt2c::CStringView name) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
}
}
- void name(const std::string& name) const
- {
- this->name(name.data());
- }
-
bt2c::CStringView name() const noexcept
{
return bt_trace_get_name(this->libObjPtr());
return _Spec::streamById(this->libObjPtr(), id);
}
- void environmentEntry(const char * const name, const std::int64_t val) const
+ void environmentEntry(const bt2c::CStringView name, const std::int64_t val) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
}
}
- void environmentEntry(const std::string& name, const std::int64_t val) const
- {
- this->environmentEntry(name.data(), val);
- }
-
- void environmentEntry(const char * const name, const char * const val) const
+ void environmentEntry(const bt2c::CStringView name, const bt2c::CStringView val) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
}
}
- void environmentEntry(const std::string& name, const char * const val) const
- {
- this->environmentEntry(name.data(), val);
- }
-
- void environmentEntry(const char * const name, const std::string& val) const
- {
- this->environmentEntry(name, val.data());
- }
-
- void environmentEntry(const std::string& name, const std::string& val) const
- {
- this->environmentEntry(name.data(), val.data());
- }
-
std::uint64_t environmentSize() const noexcept
{
return bt_trace_get_environment_entry_count(this->libObjPtr());
return ConstEnvironmentEntry {name, ConstValue {libObjPtr}};
}
- OptionalBorrowedObject<ConstValue> environmentEntry(const char * const name) const noexcept
+ OptionalBorrowedObject<ConstValue> environmentEntry(const bt2c::CStringView name) const noexcept
{
return bt_trace_borrow_environment_entry_value_by_name_const(this->libObjPtr(), name);
}
- OptionalBorrowedObject<ConstValue> environmentEntry(const std::string& name) const noexcept
- {
- return this->environmentEntry(name.data());
- }
-
template <typename LibValT>
void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
{
return bt_event_class_get_id(this->libObjPtr());
}
- void name(const char * const name) const
+ void name(const bt2c::CStringView name) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
}
}
- void name(const std::string& name) const
- {
- this->name(name.data());
- }
-
bt2c::CStringView name() const noexcept
{
return bt_event_class_get_name(this->libObjPtr());
return bt2s::nullopt;
}
- void emfUri(const char * const emfUri) const
+ void emfUri(const bt2c::CStringView emfUri) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
}
}
- void emfUri(const std::string& emfUri) const
- {
- this->emfUri(emfUri.data());
- }
-
bt2c::CStringView emfUri() const noexcept
{
return bt_event_class_get_emf_uri(this->libObjPtr());
return bt_stream_class_get_id(this->libObjPtr());
}
- void name(const char * const name) const
+ void name(const bt2c::CStringView name) const
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstStreamClass`.");
}
}
- void name(const std::string& name) const
- {
- this->name(name.data());
- }
-
bt2c::CStringView name() const noexcept
{
return bt_stream_class_get_name(this->libObjPtr());
CommonValueRawValueProxy& operator=(std::uint64_t rawVal) noexcept;
CommonValueRawValueProxy& operator=(double rawVal) noexcept;
CommonValueRawValueProxy& operator=(const char *rawVal);
- CommonValueRawValueProxy& operator=(const std::string& rawVal);
+ CommonValueRawValueProxy& operator=(bt2c::CStringView rawVal);
operator bool() const noexcept;
operator std::int64_t() const noexcept;
operator std::uint64_t() const noexcept;
operator double() const noexcept;
- operator const char *() const noexcept;
operator bt2c::CStringView() const noexcept;
private:
this->asMap().insert(std::forward<KeyT>(key), std::forward<ValT>(val));
}
- CommonArrayValue<bt_value> insertEmptyArray(const char *key) const;
- CommonArrayValue<bt_value> insertEmptyArray(const std::string& key) const;
- CommonMapValue<bt_value> insertEmptyMap(const char *key) const;
- CommonMapValue<bt_value> insertEmptyMap(const std::string& key) const;
+ CommonArrayValue<bt_value> insertEmptyArray(bt2c::CStringView key) const;
+ CommonMapValue<bt_value> insertEmptyMap(bt2c::CStringView key) const;
Shared shared() const noexcept
{
template <typename ValueObjT>
CommonValueRawValueProxy<ValueObjT>&
-CommonValueRawValueProxy<ValueObjT>::operator=(const std::string& rawVal)
+CommonValueRawValueProxy<ValueObjT>::operator=(const bt2c::CStringView rawVal)
{
_mObj.asString().value(rawVal);
return *this;
return _mObj.asReal().value();
}
-template <typename ValueObjT>
-CommonValueRawValueProxy<ValueObjT>::operator const char *() const noexcept
-{
- return _mObj.asString().value();
-}
-
template <typename ValueObjT>
CommonValueRawValueProxy<ValueObjT>::operator bt2c::CStringView() const noexcept
{
BT_ASSERT_DBG(this->isString());
}
- static Shared create(const char * const rawVal = "")
+ static Shared create(const bt2c::CStringView rawVal = "")
{
const auto libObjPtr = bt_value_string_create_init(rawVal);
return CommonStringValue::Shared::createWithoutRef(libObjPtr);
}
- static Shared create(const std::string& rawVal)
- {
- return CommonStringValue::create(rawVal.data());
- }
-
template <typename OtherLibObjT>
CommonStringValue(const CommonStringValue<OtherLibObjT> val) noexcept : _ThisCommonValue {val}
{
return CommonStringValue<const bt_value> {*this};
}
- RawStringValueProxy<CommonStringValue> operator*() const noexcept
+ RawValueProxy<CommonStringValue> operator*() const noexcept
{
- return RawStringValueProxy<CommonStringValue> {*this};
+ return RawValueProxy<CommonStringValue> {*this};
}
void value(const Value val) const
}
}
- 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()});
- }
-
Value value() const noexcept
{
return bt_value_string_get(this->libObjPtr());
this->_handleAppendLibStatus(status);
}
- void append(const std::string& rawVal) const
+ void append(const bt2c::CStringView rawVal) const
{
this->append(rawVal.data());
}
this->append(rawVal);
}
- void operator+=(const std::string& rawVal) const
+ void operator+=(const bt2c::CStringView rawVal) const
{
this->append(rawVal);
}
return this->length() == 0;
}
- OptionalBorrowedObject<CommonValue<LibObjT>> operator[](const char * const key) const noexcept
+ OptionalBorrowedObject<CommonValue<LibObjT>>
+ operator[](const bt2c::CStringView key) const noexcept
{
return internal::CommonMapValueSpec<LibObjT>::entryByKey(this->libObjPtr(), key);
}
- OptionalBorrowedObject<CommonValue<LibObjT>> operator[](const std::string& key) const noexcept
- {
- return (*this)[key.data()];
- }
-
- bool hasEntry(const char * const key) const noexcept
+ bool hasEntry(const bt2c::CStringView key) const noexcept
{
return static_cast<bool>(bt_value_map_has_entry(this->libObjPtr(), key));
}
- bool hasEntry(const std::string& key) const noexcept
- {
- return this->hasEntry(key.data());
- }
-
- void insert(const char * const key, const Value val) const
+ void insert(const bt2c::CStringView key, const Value val) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstMapValue`.");
this->_handleInsertLibStatus(status);
}
- void insert(const std::string& key, const Value val) const
- {
- this->insert(key.data(), val);
- }
-
- void insert(const char * const key, const bool rawVal) const
+ void insert(const bt2c::CStringView key, const bool rawVal) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstMapValue`.");
this->_handleInsertLibStatus(status);
}
- void insert(const std::string& key, const bool rawVal) const
- {
- this->insert(key.data(), rawVal);
- }
-
- void insert(const char * const key, const std::uint64_t rawVal) const
+ void insert(const bt2c::CStringView key, const std::uint64_t rawVal) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstMapValue`.");
this->_handleInsertLibStatus(status);
}
-
- void insert(const std::string& key, const std::uint64_t rawVal) const
- {
- this->insert(key.data(), rawVal);
- }
-
- void insert(const char * const key, const std::int64_t rawVal) const
+ void insert(const bt2c::CStringView key, const std::int64_t rawVal) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstMapValue`.");
this->_handleInsertLibStatus(status);
}
- void insert(const std::string& key, const std::int64_t rawVal) const
- {
- this->insert(key.data(), rawVal);
- }
-
- void insert(const char * const key, const double rawVal) const
+ void insert(const bt2c::CStringView key, const double rawVal) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstMapValue`.");
this->_handleInsertLibStatus(status);
}
- void insert(const std::string& key, const double rawVal) const
- {
- this->insert(key.data(), rawVal);
- }
-
- void insert(const char * const key, const char * const rawVal) const
+ void insert(const bt2c::CStringView key, const char *rawVal) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstMapValue`.");
this->_handleInsertLibStatus(status);
}
- void insert(const char * const key, const std::string& rawVal) const
+ void insert(const bt2c::CStringView key, const bt2c::CStringView rawVal) const
{
- this->insert(key, rawVal.data());
+ return this->insert(key, rawVal.data());
}
- void insert(const std::string& key, const char * const rawVal) const
- {
- this->insert(key.data(), rawVal);
- }
-
- void insert(const std::string& key, const std::string& rawVal) const
- {
- this->insert(key.data(), rawVal.data());
- }
-
- CommonArrayValue<bt_value> insertEmptyArray(const char *key) const;
- CommonArrayValue<bt_value> insertEmptyArray(const std::string& key) const;
- CommonMapValue<bt_value> insertEmptyMap(const char *key) const;
- CommonMapValue<bt_value> insertEmptyMap(const std::string& key) const;
+ CommonArrayValue<bt_value> insertEmptyArray(bt2c::CStringView key) const;
+ CommonMapValue<bt_value> insertEmptyMap(bt2c::CStringView key) const;
void forEach(const internal::CommonMapValueForEachUserFunc<CommonValue<LibObjT>>& func) const
{
}
template <typename LibObjT>
-ArrayValue CommonValue<LibObjT>::insertEmptyArray(const char * const key) const
-{
- return this->asMap().insertEmptyArray(key);
-}
-
-template <typename LibObjT>
-ArrayValue CommonValue<LibObjT>::insertEmptyArray(const std::string& key) const
+ArrayValue CommonValue<LibObjT>::insertEmptyArray(const bt2c::CStringView key) const
{
return this->asMap().insertEmptyArray(key);
}
template <typename LibObjT>
-MapValue CommonValue<LibObjT>::insertEmptyMap(const char * const key) const
-{
- return this->asMap().insertEmptyMap(key);
-}
-
-template <typename LibObjT>
-MapValue CommonValue<LibObjT>::insertEmptyMap(const std::string& key) const
+MapValue CommonValue<LibObjT>::insertEmptyMap(const bt2c::CStringView key) const
{
return this->asMap().insertEmptyMap(key);
}
}
template <typename LibObjT>
-ArrayValue CommonMapValue<LibObjT>::insertEmptyArray(const char * const key) const
+ArrayValue CommonMapValue<LibObjT>::insertEmptyArray(const bt2c::CStringView key) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstMapValue`.");
}
template <typename LibObjT>
-ArrayValue CommonMapValue<LibObjT>::insertEmptyArray(const std::string& key) const
-{
- return this->insertEmptyArray(key.data());
-}
-
-template <typename LibObjT>
-MapValue CommonMapValue<LibObjT>::insertEmptyMap(const char * const key) const
+MapValue CommonMapValue<LibObjT>::insertEmptyMap(const bt2c::CStringView key) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstMapValue`.");
return MapValue {libEntryPtr};
}
-template <typename LibObjT>
-MapValue CommonMapValue<LibObjT>::insertEmptyMap(const std::string& key) const
-{
- return this->insertEmptyMap(key.data());
-}
-
inline BoolValue::Shared createValue(const bool rawVal)
{
return BoolValue::create(rawVal);
return StringValue::create(rawVal);
}
-inline StringValue::Shared createValue(const std::string& rawVal)
+inline StringValue::Shared createValue(const bt2c::CStringView rawVal)
{
return StringValue::create(rawVal);
}