paho-mqtt-cpp
MQTT C++ Client for POSIX and Windows
Loading...
Searching...
No Matches
Public Types | Public Member Functions
mqtt::message_ptr_builder Class Reference

#include <message.h>

Public Types

using self = message_ptr_builder
 

Public Member Functions

 message_ptr_builder ()
 
auto topic (string_ref topic) -> self &
 
auto payload (binary_ref payload) -> self &
 
auto payload (const void *payload, size_t n) -> self &
 
auto qos (int qos) -> self &
 
auto retained (bool on) -> self &
 
auto properties (mqtt::properties &&props) -> self &
 
auto properties (const mqtt::properties &props) -> self &
 
message_ptr finalize ()
 

Detailed Description

Class to build messages.

Member Typedef Documentation

◆ self

This class

Constructor & Destructor Documentation

◆ message_ptr_builder()

mqtt::message_ptr_builder::message_ptr_builder ( )
inline

Default constructor.

Member Function Documentation

◆ topic()

auto mqtt::message_ptr_builder::topic ( string_ref topic) -> self&
inline

Sets the topic string.

Parameters
topicThe topic on which the message is published.

◆ payload() [1/2]

auto mqtt::message_ptr_builder::payload ( binary_ref payload) -> self&
inline

Sets the payload of this message to be the specified buffer. Note that this accepts copy or move operations: set_payload(buf); set_payload(std::move(buf));

Parameters
payloadA buffer to use as the message payload.

◆ payload() [2/2]

auto mqtt::message_ptr_builder::payload ( const void * payload,
size_t n ) -> self&
inline

Sets the payload of this message to be the specified byte array.

Parameters
payloadthe bytes to use as the message payload
nthe number of bytes in the payload

◆ qos()

auto mqtt::message_ptr_builder::qos ( int qos) -> self&
inline

Sets the quality of service for this message.

Parameters
qosThe integer Quality of Service for the message

◆ retained()

auto mqtt::message_ptr_builder::retained ( bool on) -> self&
inline

Whether or not the publish message should be retained by the broker.

Parameters
ontrue if the message should be retained by the broker, false if not.

◆ properties() [1/2]

auto mqtt::message_ptr_builder::properties ( mqtt::properties && props) -> self&
inline

Sets the properties for the disconnect message.

Parameters
propsThe properties for the disconnect message.

◆ properties() [2/2]

auto mqtt::message_ptr_builder::properties ( const mqtt::properties & props) -> self&
inline

Sets the properties for the disconnect message.

Parameters
propsThe properties for the disconnect message.

◆ finalize()

message_ptr mqtt::message_ptr_builder::finalize ( )
inline

Finish building the options and return them.

Returns
The option struct as built.

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