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

Class of objects in MessagePack. More...

#include <msgpack_light/object.h>

Inheritance diagram for msgpack_light::object< Allocator >:
Collaboration diagram for msgpack_light::object< Allocator >:

Public Types

using base_type
 Type of the base class.
Public Types inherited from msgpack_light::details::mutable_object_base< object< standard_allocator >, standard_allocator >
using allocator_type
 Type of the allocator.

Public Member Functions

Initialization and finalization
 object (allocator_type allocator=allocator_type())
 Constructor.
 object (const object &other)
 Copy constructor.
 object (object &&other) noexcept
 Move constructor.
objectoperator= (const object &other)
 Copy assignment operator.
objectoperator= (object &&other) noexcept
 Move assignment operator.
void swap (object &other) noexcept
 Swap this instance with another instance.
 ~object ()
 Destructor.
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.
details::allocator_wrapper< Allocator > & allocator () noexcept
 Get the allocator.
Public Member Functions inherited from msgpack_light::details::mutable_object_base< object< standard_allocator >, standard_allocator >
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< standard_allocatorset_array (std::size_t size=0U)
 Set this object to an array.
mutable_map_ref< standard_allocatorset_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.
mutable_array_ref< standard_allocatoras_array ()
 Get data as an array.
mutable_map_ref< standard_allocatoras_map ()
 Get data as a map.
details::object_datadata () noexcept
 Get the internal data.
allocator_wrapper< standard_allocator > & allocator () noexcept
 Get the allocator.
Public Member Functions inherited from msgpack_light::details::const_object_base< object< standard_allocator > >
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.

Private Attributes

details::allocator_wrapper< Allocator > allocator_
 Allocator.
details::object_data data_ {}
 Data.

Additional Inherited Members

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

Detailed Description

template<typename Allocator = standard_allocator>
class msgpack_light::object< Allocator >

Class of objects in MessagePack.

Template Parameters
AllocatorType of the allocator.

Definition at line 49 of file object.h.

Member Typedef Documentation

◆ base_type

template<typename Allocator = standard_allocator>
using msgpack_light::object< Allocator >::base_type
Initial value:
Base class of non-constant objects in MessagePack.

Type of the base class.

Definition at line 53 of file object.h.

Constructor & Destructor Documentation

◆ object() [1/3]

template<typename Allocator = standard_allocator>
msgpack_light::object< Allocator >::object ( allocator_type allocator = allocator_type())
inlineexplicit

Constructor.

Parameters
[in]allocatorAllocator.

Definition at line 71 of file object.h.

◆ object() [2/3]

template<typename Allocator = standard_allocator>
msgpack_light::object< Allocator >::object ( const object< Allocator > & other)
inline

Copy constructor.

Parameters
[in]otherAnother instance to copy from.

Definition at line 79 of file object.h.

◆ object() [3/3]

template<typename Allocator = standard_allocator>
msgpack_light::object< Allocator >::object ( object< Allocator > && other)
inlinenoexcept

Move constructor.

Parameters
[in,out]otherAnother instance to move from.

Definition at line 88 of file object.h.

◆ ~object()

template<typename Allocator = standard_allocator>
msgpack_light::object< Allocator >::~object ( )
inline

Destructor.

Definition at line 132 of file object.h.

Member Function Documentation

◆ allocator()

template<typename Allocator = standard_allocator>
details::allocator_wrapper< Allocator > & msgpack_light::object< Allocator >::allocator ( )
inlinenodiscardnoexcept

Get the allocator.

Returns
Allocator.

Definition at line 164 of file object.h.

◆ data() [1/2]

template<typename Allocator = standard_allocator>
const details::object_data & msgpack_light::object< Allocator >::data ( ) const
inlinenodiscardnoexcept

Get the internal data.

Returns
Internal data.

Definition at line 155 of file object.h.

◆ data() [2/2]

template<typename Allocator = standard_allocator>
details::object_data & msgpack_light::object< Allocator >::data ( )
inlinenodiscardnoexcept

Get the internal data.

Returns
Internal data.

Definition at line 148 of file object.h.

◆ operator=() [1/2]

template<typename Allocator = standard_allocator>
object & msgpack_light::object< Allocator >::operator= ( const object< Allocator > & other)
inline

Copy assignment operator.

Parameters
[in]otherAnother instance to copy from.
Returns
This instance after copy.

Definition at line 99 of file object.h.

◆ operator=() [2/2]

template<typename Allocator = standard_allocator>
object & msgpack_light::object< Allocator >::operator= ( object< Allocator > && other)
inlinenoexcept

Move assignment operator.

Parameters
[in,out]otherAnother instance to move from.
Returns
This instance after move.

Definition at line 114 of file object.h.

◆ swap()

template<typename Allocator = standard_allocator>
void msgpack_light::object< Allocator >::swap ( object< Allocator > & other)
inlinenoexcept

Swap this instance with another instance.

Parameters
[in,out]otherAnother instance to move with.

Definition at line 124 of file object.h.

Member Data Documentation

◆ allocator_

template<typename Allocator = standard_allocator>
details::allocator_wrapper<Allocator> msgpack_light::object< Allocator >::allocator_
private

Allocator.

Definition at line 175 of file object.h.

◆ data_

template<typename Allocator = standard_allocator>
details::object_data msgpack_light::object< Allocator >::data_ {}
private

Data.

Definition at line 172 of file object.h.


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