netLink C++ 11
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Friends | List of all members
MsgPack::String Class Reference

MsgPack::Data to represent strings. More...

#include <Data.h>

Inheritance diagram for MsgPack::String:
MsgPack::Data MsgPack::Header MsgPack::Element

Public Member Functions

 String (uint32_t len, const void *str)
 Initialize from raw c string and length in bytes.
 
 String (const char *str)
 Initialize from nullterminated c string.
 
 String (const std::string &str)
 Initialize from std::string.
 
std::unique_ptr< Elementcopy () const
 Creates a deep copy of this element.
 
void toJSON (std::ostream &stream) const
 Writes a human readable JSON-like string into the given stream.
 
char * getData () const
 Returns a pointer to the binary data.
 
std::string stdString () const
 Returns a std::string represenation of the content.
 
- Public Member Functions inherited from MsgPack::Header
Type getType () const
 Returns the MsgPack::Type.
 
uint32_t getSizeInBytes () const
 Returns the size in bytes this MsgPack::Element takes if completely serialized.
 
virtual uint32_t getLength () const
 Returns the content length in bytes.
 
virtual std::unique_ptr< Elementcopy () const =0
 Creates a deep copy of this element.
 
virtual void toJSON (std::ostream &stream) const =0
 Writes a human readable JSON-like string into the given stream.
 
virtual Type getType () const =0
 Returns the MsgPack::Type.
 
virtual uint32_t getSizeInBytes () const
 Returns the size in bytes this MsgPack::Element takes if completely serialized.
 

Protected Member Functions

int64_t getEndPos () const
 Returns the first invalid (de)serializer position.
 
int64_t getHeaderLength () const
 Returns the size of the header in bytes.
 
- Protected Member Functions inherited from MsgPack::Data
std::streamsize serialize (int64_t &pos, std::basic_streambuf< char > *streamBuffer, std::streamsize bytes)
 Serializes bytes at the given serializer position pos into streamBuffer.
 
std::streamsize deserialize (int64_t &pos, std::basic_streambuf< char > *streamBuffer, std::streamsize bytes)
 Deserializes bytes at the given deserializer position pos from streamBuffer.
 
- Protected Member Functions inherited from MsgPack::Header
int64_t startSerialize ()
 Returns the initial serializer position in bytes (negative value if there is a header)
 
int64_t startDeserialize (uint8_t firstByte)
 Reads in one byte and returns the initial deserializer position in bytes (negative value if there is a header)
 
std::streamsize serialize (int64_t &pos, std::basic_streambuf< char > *streamBuffer, std::streamsize bytes)
 Serializes bytes at the given serializer position pos into streamBuffer.
 
std::streamsize deserialize (int64_t &pos, std::basic_streambuf< char > *streamBuffer, std::streamsize bytes)
 Deserializes bytes at the given deserializer position pos from streamBuffer.
 
int64_t getEndPos () const
 Returns the first invalid (de)serializer position.
 
virtual int64_t getHeaderLength () const =0
 Returns the size of the header in bytes.
 
- Protected Member Functions inherited from MsgPack::Element
virtual int64_t startSerialize ()
 Returns the initial serializer position in bytes (negative value if there is a header)
 
virtual int64_t startDeserialize (uint8_t firstByte)=0
 Reads in one byte and returns the initial deserializer position in bytes (negative value if there is a header)
 
virtual std::streamsize serialize (int64_t &pos, std::basic_streambuf< char > *streamBuffer, std::streamsize bytes)=0
 Serializes bytes at the given serializer position pos into streamBuffer.
 
virtual std::streamsize deserialize (int64_t &pos, std::basic_streambuf< char > *streamBuffer, std::streamsize bytes)
 Deserializes bytes at the given deserializer position pos from streamBuffer.
 
virtual bool containerDeserialized ()
 Returns true if the header of a container is deserialized and reserves the necessary space for its element vector.
 
virtual std::vector< std::unique_ptr< Element > > * getElementsVector ()
 Returns a raw pointer to the element vector of a container.
 
virtual int64_t getEndPos () const =0
 Returns the first invalid (de)serializer position.
 

Friends

class Serializer
 
class Deserializer
 

Additional Inherited Members

- Protected Attributes inherited from MsgPack::Data
std::unique_ptr< char[]> data
 The raw data buffer.
 
- Protected Attributes inherited from MsgPack::Header
char header [5]
 Internal buffer of the header.
 

Detailed Description

MsgPack::Data to represent strings.

Member Function Documentation

◆ copy()

std::unique_ptr< Element > MsgPack::String::copy ( ) const
virtual

Creates a deep copy of this element.

Implements MsgPack::Element.

◆ getEndPos()

int64_t MsgPack::String::getEndPos ( ) const
protectedvirtual

Returns the first invalid (de)serializer position.

Reimplemented from MsgPack::Header.

◆ getHeaderLength()

int64_t MsgPack::String::getHeaderLength ( ) const
protectedvirtual

Returns the size of the header in bytes.

Implements MsgPack::Header.

◆ toJSON()

void MsgPack::String::toJSON ( std::ostream &  stream) const
virtual

Writes a human readable JSON-like string into the given stream.

Implements MsgPack::Element.


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