Kanzi Connect 3.9.10
kanzi::connect::message_builder Namespace Reference

Classes

struct  MessageBuilderDeleter
 

Typedefs

using MessageBuilderPtr = unique_ptr<MessageBuilder, MessageBuilderDeleter>
 

Functions

KANZI_CONNECT_MESSAGES_API void addItem (MessageBuilder &builder, const char *name, uint32_t hash, int32_t type) noexcept
 Adds a new item node.
 
KANZI_CONNECT_MESSAGES_API MessageBuilderPtr create () noexcept
 Create a message builder instance.
 
KANZI_CONNECT_MESSAGES_API void popNode (MessageBuilder &builder) noexcept
 Sets the current node to the previous (parent) node.
 
KANZI_CONNECT_MESSAGES_API void pushNode (MessageBuilder &builder, const char *name, uint32_t hash) noexcept
 Adds a new child object node and sets it as the current node.
 
KANZI_CONNECT_MESSAGES_API bool serialize (const MessageBuilder &builder, string &output) noexcept
 Serialize the contents of the message builder to the supplied output string.
 
KANZI_CONNECT_MESSAGES_API void setItemBool (MessageBuilder &builder, bool value) noexcept
 Sets the current item (added using addItem) to a boolean value.
 
KANZI_CONNECT_MESSAGES_API void setItemFloat (MessageBuilder &builder, float value) noexcept
 Sets the current item (added using addItem) to a float value.
 
KANZI_CONNECT_MESSAGES_API void setItemInt (MessageBuilder &builder, int32_t value) noexcept
 Sets the current item (added using addItem) to an interger value.
 
KANZI_CONNECT_MESSAGES_API void setItemString (MessageBuilder &builder, const char *value) noexcept
 Sets the current item (added using addItem) to a string value.
 

Typedef Documentation

◆ MessageBuilderPtr

Function Documentation

◆ addItem()

KANZI_CONNECT_MESSAGES_API void kanzi::connect::message_builder::addItem ( MessageBuilder & builder,
const char * name,
uint32_t hash,
int32_t type )
noexcept

Adds a new item node.

The node is initialized with a name, hash and type.

Parameters
builderThe builder instance.
nameThe name given to the new item node.
hashThe hash given to the new item node.
typeThe type given to the new item node.

◆ create()

KANZI_CONNECT_MESSAGES_API MessageBuilderPtr kanzi::connect::message_builder::create ( )
noexcept

Create a message builder instance.

Returns
a MessageBuilderPtr holding a message builder instance.

◆ popNode()

KANZI_CONNECT_MESSAGES_API void kanzi::connect::message_builder::popNode ( MessageBuilder & builder)
noexcept

Sets the current node to the previous (parent) node.

It is the responsibility of the caller to ensure that every call popNode follows a matching call to pushNode.

Parameters
builderThe builder instance.

◆ pushNode()

KANZI_CONNECT_MESSAGES_API void kanzi::connect::message_builder::pushNode ( MessageBuilder & builder,
const char * name,
uint32_t hash )
noexcept

Adds a new child object node and sets it as the current node.

Parameters
builderThe builder instance.
nameThe name given to the new object node.
hashThe hash given to the new object node.

◆ serialize()

KANZI_CONNECT_MESSAGES_API bool kanzi::connect::message_builder::serialize ( const MessageBuilder & builder,
string & output )
noexcept

Serialize the contents of the message builder to the supplied output string.

Parameters
builderThe builder instance to serialize.
outputThe string to receive the serialized content.
Returns
true if successfully serialized to the supplied output string.

◆ setItemBool()

KANZI_CONNECT_MESSAGES_API void kanzi::connect::message_builder::setItemBool ( MessageBuilder & builder,
bool value )
noexcept

Sets the current item (added using addItem) to a boolean value.

It is the responsibility of the caller to ensure that this function is called only after a call to addItem to create the current item instance.

Parameters
builderThe builder instance.
valueThe boolean value to set on the current item.

◆ setItemFloat()

KANZI_CONNECT_MESSAGES_API void kanzi::connect::message_builder::setItemFloat ( MessageBuilder & builder,
float value )
noexcept

Sets the current item (added using addItem) to a float value.

It is the responsibility of the caller to ensure that this function is called only after a call to addItem to create the current item instance.

Parameters
builderThe builder instance.
valueThe float value to set on the current item.

◆ setItemInt()

KANZI_CONNECT_MESSAGES_API void kanzi::connect::message_builder::setItemInt ( MessageBuilder & builder,
int32_t value )
noexcept

Sets the current item (added using addItem) to an interger value.

It is the responsibility of the caller to ensure that this function is called only after a call to addItem to create the current item instance.

Parameters
builderThe builder instance.
valueThe integer value to set on the current item.

◆ setItemString()

KANZI_CONNECT_MESSAGES_API void kanzi::connect::message_builder::setItemString ( MessageBuilder & builder,
const char * value )
noexcept

Sets the current item (added using addItem) to a string value.

It is the responsibility of the caller to ensure that this function is called only after a call to addItem to create the current item instance.

Parameters
builderThe builder instance.
valueThe string value to set on the current item.