paho-mqtt-cpp
MQTT C++ Client for POSIX and Windows
Public Types | Public Member Functions
mqtt::name_value_collection Class Reference

#include <string_collection.h>

Public Types

using ptr_t = std::shared_ptr< name_value_collection >
 
using const_ptr_t = std::shared_ptr< const name_value_collection >
 
using value_type = collection_type::value_type
 

Public Member Functions

 name_value_collection ()=default
 
 name_value_collection (const collection_type &map)
 
 name_value_collection (collection_type &&map)
 
 name_value_collection (const name_value_collection &other)
 
 name_value_collection (name_value_collection &&other)=default
 
 name_value_collection (std::initializer_list< value_type > init)
 
name_value_collectionoperator= (const name_value_collection &other)
 
name_value_collectionoperator= (name_value_collection &&other)=default
 
bool empty () const
 
size_t size () const
 
void clear ()
 
bool insert (const value_type &nvpair)
 
const MQTTAsync_nameValue * c_arr () const
 

Detailed Description

A colleciton of name/value string pairs.

Member Typedef Documentation

◆ ptr_t

Smart/shared pointer to an object of this type

◆ const_ptr_t

Smart/shared pointer to a const object of this type

◆ value_type

using mqtt::name_value_collection::value_type = collection_type::value_type

The type of the string/string pair of values

Constructor & Destructor Documentation

◆ name_value_collection() [1/6]

mqtt::name_value_collection::name_value_collection ( )
default

Default constructor for an empty collection.

◆ name_value_collection() [2/6]

mqtt::name_value_collection::name_value_collection ( const collection_type &  map)
inline

Creates a name/value collection from an underlying STL collection.

Parameters
mapThe collection of name/value pairs.

◆ name_value_collection() [3/6]

mqtt::name_value_collection::name_value_collection ( collection_type &&  map)
inline

Creates a name/value collection from an underlying STL collection.

Parameters
mapThe collection of name/value pairs.

◆ name_value_collection() [4/6]

mqtt::name_value_collection::name_value_collection ( const name_value_collection other)
inline

Copy constructor.

Parameters
otherAnother collection of name/value pairs.

◆ name_value_collection() [5/6]

mqtt::name_value_collection::name_value_collection ( name_value_collection &&  other)
default

Move constructor.

Parameters
otherAnother collection of name/value pairs

◆ name_value_collection() [6/6]

mqtt::name_value_collection::name_value_collection ( std::initializer_list< value_type init)
inline

Constructs the collection with an initializer list.

This works identically to initializing a std::map<> with string/tring pairs.

Parameters
initInitializer list to construct the members of the collection.

Member Function Documentation

◆ operator=() [1/2]

name_value_collection& mqtt::name_value_collection::operator= ( const name_value_collection other)
inline

Copy assignment.

Parameters
otherAnother collection of name/value pairs.

◆ operator=() [2/2]

name_value_collection& mqtt::name_value_collection::operator= ( name_value_collection &&  other)
default

Move constructor.

Parameters
otherAnother collection of name/value pairs

◆ empty()

bool mqtt::name_value_collection::empty ( ) const
inline

Determines if the collection is empty.

Returns
true if the container is empty, false if it contains one or more items.

◆ size()

size_t mqtt::name_value_collection::size ( ) const
inline

Gets the number of name/value pairs in the collection.

Returns
The number of name/value pairs in the collection.

◆ clear()

void mqtt::name_value_collection::clear ( )
inline

Removes all items from the collection.

◆ insert()

bool mqtt::name_value_collection::insert ( const value_type nvpair)
inline

Inserts a name/value pair into the collection.

Parameters
nvpairThe name/value string pair.
Returns
true if the inert happened, false if not.

◆ c_arr()

const MQTTAsync_nameValue* mqtt::name_value_collection::c_arr ( ) const
inline

Gets a pointer to an array of NUL-terminated C string pointer pairs. This is a collection type supported by the underlying Paho C library. The returned pointer is guaranteed valid so long as the object is not updated. The return value may change if the object is modified, so the application should not cache the return value, but rather request the value when needed.

Returns
pointer to an array of NUL-terminated C string pointer pairs for name/values. The array is terminated by a NULL/NULL pair.

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