Loading...
Searching...
No Matches
mqtt::properties Class Reference

`#include <properties.h>`

## Data Structures

class | const_iterator

## Public Member Functions

| properties ()
| properties (const properties &other)
| properties (properties &&other)
| properties (const MQTTProperties &cprops)
| properties (std::initializer_list< property > props)
| ~properties ()
const MQTTProperties & | c_struct () const
properties & | operator= (const properties &rhs)
properties & | operator= (properties &&rhs)
bool | empty () const
const property | operator[] (size_t i) const
const property | at (size_t i) const
size_t | size () const
const_iterator | begin () const
const_iterator | cbegin () const
const_iterator | end () const
const_iterator | cend () const
void | add (const property &prop)
void | clear ()
bool | contains (property::code propid) const
size_t | count (property::code propid) const
property | get (property::code propid, size_t idx=0) const

## Friends

template<typename T>
T | get (const properties &props, property::code propid, size_t idx)
template<typename T>
T | get (const properties &props, property::code propid)

## Detailed Description

MQTT v5 property list.

A collection of properties that can be added to outgoing packets or retrieved from incoming packets.

## Constructor & Destructor Documentation

## properties() [1/5]

mqtt::properties::properties | ( |  | ) |

inline

Default constructor. Creates an empty properties list.

## properties() [2/5]

mqtt::properties::properties | ( | const properties & | other | ) |

inline

Copy constructor.

Parameters

  other | The property list to copy.

## properties() [3/5]

mqtt::properties::properties | ( | properties && | other | ) |

inline

Move constructor.

Parameters

  other | The property list to move to this one.

## properties() [4/5]

mqtt::properties::properties | ( | const MQTTProperties & | cprops | ) |

inline

Creates a list of properties from a C struct.

Parameters

  cprops | The c struct of properties

## properties() [5/5]

mqtt::properties::properties | ( | std::initializer_list< property > | props | ) |

Constructs from a list of property objects.

Parameters

  props | An initializer list of property objects.

## ~properties()

mqtt::properties::~properties | ( |  | ) |

inline

Destructor.

## Member Function Documentation

## c_struct()

const MQTTProperties & mqtt::properties::c_struct | ( |  | ) | const

inline

Gets a reference to the underlying C properties structure.

Returns
  A const reference to the underlying C properties structure.

## operator=() [1/2]

properties & mqtt::properties::operator= | ( | const properties & | rhs | ) |

Copy assignment.

Parameters

  rhs | The other property list to copy into this one

Returns
  A reference to this object.

## operator=() [2/2]

properties & mqtt::properties::operator= | ( | properties && | rhs | ) |

Move assignment.

Parameters

  rhs | The property list to move to this one.

Returns
  A reference to this object.

## empty()

bool mqtt::properties::empty | ( |  | ) | const

inline

Determines if the property list is empty.

Returns
  true if there are no properties in the list, false if the list contains any items.

## operator[]()

const property mqtt::properties::operator[] | ( | size_t | i | ) | const

inline

Gets the property at the specified index in the collection.

Parameters

  i | The index

Returns
  The property at the specified index.

## at()

const property mqtt::properties::at | ( | size_t | i | ) | const

inline

Gets the property at the specified index in the collection.

Parameters

  i | The index

Returns
  The property at the specified index.

## size()

size_t mqtt::properties::size | ( |  | ) | const

inline

Gets the numbers of property items in the list.

Returns
  The number of property items in the list.

## begin()

const_iterator mqtt::properties::begin | ( |  | ) | const

inline

Gets a const iterator to the full collection of properties.

Returns
  A const iterator to the full collection of properties.

## cbegin()

const_iterator mqtt::properties::cbegin | ( |  | ) | const

inline

Gets a const iterator to the full collection of properties.

Returns
  A const iterator to the full collection of properties.

## end()

const_iterator mqtt::properties::end | ( |  | ) | const

inline

Gets a const iterator to the end of the collection of properties.

Returns
  A const iterator to the end of collection of properties.

## cend()

const_iterator mqtt::properties::cend | ( |  | ) | const

inline

Gets a const iterator to the end of the collection of properties.

Returns
  A const iterator to the end of collection of properties.

## add()

void mqtt::properties::add | ( | const property & | prop | ) |

inline

Adds a property to the list.

Parameters

  prop | The property to add to the list.

## clear()

void mqtt::properties::clear | ( |  | ) |

inline

Removes all the items from the property list.

## contains()

bool mqtt::properties::contains | ( | property::code | propid | ) | const

inline

Determines if the list contains a specific property.

Parameters

  propid | The property ID (code).

Returns
  true if the list contains the property, false if not.

## count()

size_t mqtt::properties::count | ( | property::code | propid | ) | const

inline

Get the number of properties in the list with the specified property ID.

Most properties can exist only once. User properties and subscription ID's can exist more than once.

Parameters

  propid | The property ID (code).

Returns
  The number of properties in the list with the specified ID.

## get()

property mqtt::properties::get | ( | property::code | propid,
|  | size_t | idx = 0 ) const

Gets the property with the specified ID.

Parameters

  propid | The property ID (code).
  idx | Which instance of the property to retrieve, if there are more than one.

Returns
  The requested property

## Friends And Related Symbol Documentation

## get [1/2]

template<typename T>

T get | ( | const properties & | props,
|  | property::code | propid,
|  | size_t | idx )

friend

Retrieves a single value from a property list for when there may be multiple identical property ID's.

Template Parameters

  T | The type of the value to retrieve

Parameters

  props | The property list
  propid | The property ID code for the desired value.
  idx | Index of the desired property ID

Returns
  The requested value of type T

## get [2/2]

template<typename T>

T get | ( | const properties & | props,
|  | property::code | propid )

friend

Retrieves a single value from a property list.

Template Parameters

  T | The type of the value to retrieve

Parameters

  props | The property list
  propid | The property ID code for the desired value.

Returns
  The requested value of type T

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

- properties.h