kmMqtt 0.0.1
MQTT Client Library
Loading...
Searching...
No Matches
kmMqtt::mqtt::Properties Class Reference

Public Member Functions

template<PropertyType T>
std::enable_if< std::is_same< std::uint8_t, typenametype_of< T >::type >::value, bool >::type tryAddProperty (const std::uint8_t &value, bool conditionalCheck=true)
 Specialise for each property type to ensure correct data type is used.
std::uint32_t encodingSize () const
 Get the size in bytes required to encode the properties data into bytes (including the length prefix).
std::size_t count () const
 Get the amount of properties stored.
std::uint32_t size () const
 Get the size in bytes of all properties combined (excluding the length prefix).

Protected Member Functions

template<PropertyType T, typename DataT>
std::enable_if<!std::is_base_of< MqttDataType, DataT >::value, bool >::type tryAddPropertyImpl (const DataT &value, bool conditionalCheck=true)
 Implementation for adding property when the data type is NOT derived from MqttDataType and is a primitive type.
template<PropertyType T, typename DataT>
std::enable_if< std::is_base_of< MqttDataType, DataT >::value, bool >::type tryAddPropertyImpl (DataT &&value, bool conditionalCheck=true)
 Implementation for adding property when the data type is derived from MqttDataType.

Member Function Documentation

◆ count()

std::size_t kmMqtt::mqtt::Properties::count ( ) const
inline

Get the amount of properties stored.

Returns
std::size_t Number of properties stored.

◆ encodingSize()

std::uint32_t kmMqtt::mqtt::Properties::encodingSize ( ) const
inline

Get the size in bytes required to encode the properties data into bytes (including the length prefix).

Returns
std::uint32_t Size in bytes required to encode the properties data into bytes.

◆ size()

std::uint32_t kmMqtt::mqtt::Properties::size ( ) const
inline

Get the size in bytes of all properties combined (excluding the length prefix).

Returns
std::uint32_t Size in bytes of all properties combined.

◆ tryAddProperty()

template<PropertyType T>
std::enable_if< std::is_same< std::uint8_t, typenametype_of< T >::type >::value, bool >::type kmMqtt::mqtt::Properties::tryAddProperty ( const std::uint8_t & value,
bool conditionalCheck = true )
inline

Specialise for each property type to ensure correct data type is used.

Ran into problems where I would pass a value in but would not get a compile error until runtime because the data type did not match the property type expected data type (e.g. passing in a uint8_t for a property that expects a uint32_t).


The documentation for this class was generated from the following file:
  • D:/Dev/Repos/kmMqtt/include/public/kmMqtt/Mqtt/Packets/Properties.h