cpp-msgpack-light 0.3.0
A light library to serialize MessagePack.
Loading...
Searching...
No Matches
msgpack_light::details::mutable_object_base< Derived, Allocator > Class Template Reference

Base class of non-constant objects in MessagePack. More...

#include <msgpack_light/details/object_base.h>

Inheritance diagram for msgpack_light::details::mutable_object_base< Derived, Allocator >:
Collaboration diagram for msgpack_light::details::mutable_object_base< Derived, Allocator >:

Public Types

using allocator_type = Allocator
 Type of the allocator.

Public Member Functions

Set data
void set_unsigned_integer (std::uint64_t value) noexcept
 Set this object to an unsigned integer.
void set_signed_integer (std::int64_t value) noexcept
 Set this object to a signed integer.
void set_boolean (bool value) noexcept
 Set this object to a boolean value.
void set_float32 (float value) noexcept
 Set this object to a 32-bit floating-point number.
void set_float64 (double value) noexcept
 Set this object to a 64-bit floating-point number.
void set_string (std::string_view value)
 Set this object to a string.
void set_binary (binary_view value)
 Set this object to a binary.
mutable_array_ref< Allocator > set_array (std::size_t size=0U)
 Set this object to an array.
mutable_map_ref< Allocator > set_map (std::size_t size=0U)
 Set this object to a map.
void set_extension (std::int8_t type, binary_view value_data)
 Set this object to a extension value.
void clear () noexcept
 Clear the data.
Access to data
mutable_array_ref< Allocator > as_array ()
 Get data as an array.
mutable_map_ref< Allocator > as_map ()
 Get data as a map.
Internal data
Warning
These functions are for internal implementation of this library.
details::object_datadata () noexcept
 Get the internal data.
const details::object_datadata () const noexcept
 Get the internal data.
allocator_wrapper< Allocator > & allocator () noexcept
 Get the allocator.
Public Member Functions inherited from msgpack_light::details::const_object_base< Derived >
object_data_type type () const noexcept
 Get the type of this object.
std::uint64_t as_unsigned_integer () const
 Get data as an unsigned integer.
std::int64_t as_signed_integer () const
 Get data as a signed integer.
bool as_boolean () const
 Get data as a boolean.
float as_float32 () const
 Get data as a 32-bit floating-pointe number.
double as_float64 () const
 Get data as a 64-bit floating-pointe number.
std::string_view as_string () const
 Get data as a string.
binary_view as_binary () const
 Get data as a binary.
const_array_ref as_array () const
 Get data as an array.
const_map_ref as_map () const
 Get data as a map.
const_extension_ref as_extension () const
 Get data as an extension.
const details::object_datadata () const noexcept
 Get the internal data.

Protected Member Functions

 mutable_object_base ()=default
 Constructor.
const Derived & derived () const noexcept
 Access the derived class.
Derived & derived () noexcept
 Access the derived class.
Protected Member Functions inherited from msgpack_light::details::const_object_base< Derived >
 const_object_base ()=default
 Constructor.
const Derived & derived () const noexcept
 Access the derived class.

Detailed Description

template<typename Derived, typename Allocator>
class msgpack_light::details::mutable_object_base< Derived, Allocator >

Base class of non-constant objects in MessagePack.

Template Parameters
DerivedType of the derived class.
AllocatorType of the allocator.
Warning
This class cannot be instantiated directly. Instantiate msgpack_light::object classes.

Definition at line 230 of file object_base.h.

Member Typedef Documentation

◆ allocator_type

template<typename Derived, typename Allocator>
using msgpack_light::details::mutable_object_base< Derived, Allocator >::allocator_type = Allocator

Type of the allocator.

Definition at line 233 of file object_base.h.

Member Function Documentation

◆ allocator()

template<typename Derived, typename Allocator>
allocator_wrapper< Allocator > & msgpack_light::details::mutable_object_base< Derived, Allocator >::allocator ( )
inlinenodiscardnoexcept

Get the allocator.

Returns
Allocator.

Definition at line 445 of file object_base.h.

◆ as_array()

template<typename Derived, typename Allocator>
mutable_array_ref< Allocator > msgpack_light::details::mutable_object_base< Derived, Allocator >::as_array ( )
inlinenodiscard

Get data as an array.

Returns
Value.

Definition at line 393 of file object_base.h.

◆ as_map()

template<typename Derived, typename Allocator>
mutable_map_ref< Allocator > msgpack_light::details::mutable_object_base< Derived, Allocator >::as_map ( )
inlinenodiscard

Get data as a map.

Returns
Value.

Definition at line 406 of file object_base.h.

◆ clear()

template<typename Derived, typename Allocator>
void msgpack_light::details::mutable_object_base< Derived, Allocator >::clear ( )
inlinenoexcept

Clear the data.

Definition at line 376 of file object_base.h.

◆ data() [1/2]

template<typename Derived, typename Allocator>
const details::object_data & msgpack_light::details::mutable_object_base< Derived, Allocator >::data ( ) const
inlinenodiscardnoexcept

Get the internal data.

Returns
Internal data.

Definition at line 436 of file object_base.h.

◆ data() [2/2]

template<typename Derived, typename Allocator>
details::object_data & msgpack_light::details::mutable_object_base< Derived, Allocator >::data ( )
inlinenodiscardnoexcept

Get the internal data.

Returns
Internal data.

Definition at line 427 of file object_base.h.

◆ derived() [1/2]

template<typename Derived, typename Allocator>
const Derived & msgpack_light::details::mutable_object_base< Derived, Allocator >::derived ( ) const
inlinenodiscardprotectednoexcept

Access the derived class.

Returns
Reference to the derived class.

Definition at line 469 of file object_base.h.

◆ derived() [2/2]

template<typename Derived, typename Allocator>
Derived & msgpack_light::details::mutable_object_base< Derived, Allocator >::derived ( )
inlinenodiscardprotectednoexcept

Access the derived class.

Returns
Reference to the derived class.

Definition at line 460 of file object_base.h.

◆ set_array()

template<typename Derived, typename Allocator>
mutable_array_ref< Allocator > msgpack_light::details::mutable_object_base< Derived, Allocator >::set_array ( std::size_t size = 0U)
inline

Set this object to an array.

Parameters
[in]sizeNumber of elements.
Returns
Object to access the array.

Definition at line 329 of file object_base.h.

◆ set_binary()

template<typename Derived, typename Allocator>
void msgpack_light::details::mutable_object_base< Derived, Allocator >::set_binary ( binary_view value)
inline

Set this object to a binary.

Parameters
[in]valueValue.

Definition at line 314 of file object_base.h.

◆ set_boolean()

template<typename Derived, typename Allocator>
void msgpack_light::details::mutable_object_base< Derived, Allocator >::set_boolean ( bool value)
inlinenoexcept

Set this object to a boolean value.

Parameters
[in]valueValue.

Definition at line 267 of file object_base.h.

◆ set_extension()

template<typename Derived, typename Allocator>
void msgpack_light::details::mutable_object_base< Derived, Allocator >::set_extension ( std::int8_t type,
binary_view value_data )
inline

Set this object to a extension value.

Parameters
[in]typeType.
[in]value_dataData of the value.

Definition at line 363 of file object_base.h.

◆ set_float32()

template<typename Derived, typename Allocator>
void msgpack_light::details::mutable_object_base< Derived, Allocator >::set_float32 ( float value)
inlinenoexcept

Set this object to a 32-bit floating-point number.

Parameters
[in]valueValue.

Definition at line 278 of file object_base.h.

◆ set_float64()

template<typename Derived, typename Allocator>
void msgpack_light::details::mutable_object_base< Derived, Allocator >::set_float64 ( double value)
inlinenoexcept

Set this object to a 64-bit floating-point number.

Parameters
[in]valueValue.

Definition at line 289 of file object_base.h.

◆ set_map()

template<typename Derived, typename Allocator>
mutable_map_ref< Allocator > msgpack_light::details::mutable_object_base< Derived, Allocator >::set_map ( std::size_t size = 0U)
inline

Set this object to a map.

Parameters
[in]sizeNumber of key-value pairs.
Returns
Object to access the map.

Definition at line 346 of file object_base.h.

◆ set_signed_integer()

template<typename Derived, typename Allocator>
void msgpack_light::details::mutable_object_base< Derived, Allocator >::set_signed_integer ( std::int64_t value)
inlinenoexcept

Set this object to a signed integer.

Parameters
[in]valueValue.

Definition at line 256 of file object_base.h.

◆ set_string()

template<typename Derived, typename Allocator>
void msgpack_light::details::mutable_object_base< Derived, Allocator >::set_string ( std::string_view value)
inline

Set this object to a string.

Parameters
[in]valueValue.

Definition at line 300 of file object_base.h.

◆ set_unsigned_integer()

template<typename Derived, typename Allocator>
void msgpack_light::details::mutable_object_base< Derived, Allocator >::set_unsigned_integer ( std::uint64_t value)
inlinenoexcept

Set this object to an unsigned integer.

Parameters
[in]valueValue.

Definition at line 245 of file object_base.h.


The documentation for this class was generated from the following file: