![]() |
paho-mqtt-cpp
MQTT C++ Client for POSIX and Windows
|
#include <string_collection.h>
Public Types | |
using | ptr_t = std::shared_ptr<string_collection> |
using | const_ptr_t = std::shared_ptr<const string_collection> |
Public Member Functions | |
string_collection ()=default | |
string_collection (const string &str) | |
string_collection (string &&str) | |
string_collection (const collection_type &vec) | |
string_collection (collection_type &&vec) | |
string_collection (const string_collection &coll) | |
string_collection (string_collection &&coll)=default | |
string_collection (std::initializer_list< string > sl) | |
string_collection (std::initializer_list< const char * > sl) | |
string_collection & | operator= (const string_collection &coll) |
string_collection & | operator= (string_collection &&coll)=default |
bool | empty () const |
size_t | size () const |
void | push_back (const string &str) |
void | push_back (string &&str) |
void | clear () |
const string & | operator[] (size_t i) const |
char *const * | c_arr () const |
Static Public Member Functions | |
static ptr_t | create (const string &str) |
static ptr_t | create (string &&str) |
static ptr_t | create (const collection_type &vec) |
static ptr_t | create (collection_type &&vec) |
static ptr_t | create (std::initializer_list< string > sl) |
static ptr_t | create (std::initializer_list< const char * > sl) |
Type for a collection of topics. This acts like a collection of strings but carries an array of pointers to the C strings for easy interactions with the Paho C library.
using mqtt::string_collection::ptr_t = std::shared_ptr<string_collection> |
Smart/shared pointer to an object of this type
using mqtt::string_collection::const_ptr_t = std::shared_ptr<const string_collection> |
Smart/shared pointer to a const object of this type
|
default |
Construct an empty string collection.
mqtt::string_collection::string_collection | ( | const string & | str | ) |
Construct a collection initially containing a single string.
str | The string |
mqtt::string_collection::string_collection | ( | string && | str | ) |
Construct a collection initially containing a single string.
str | The string |
mqtt::string_collection::string_collection | ( | const collection_type & | vec | ) |
Constructs a string collection by copying a vector of strings.
vec | A vector of strings. |
mqtt::string_collection::string_collection | ( | collection_type && | vec | ) |
Constructs a string collection by moving a vector of strings.
vec | A vector of strings. |
mqtt::string_collection::string_collection | ( | const string_collection & | coll | ) |
Copy constructor.
coll | An existing string collection. |
|
default |
Move constructor.
coll | An existing string collection. |
mqtt::string_collection::string_collection | ( | std::initializer_list< string > | sl | ) |
Construct a string collection from an initialization list of strings.
sl | An initialization list of strings. |
mqtt::string_collection::string_collection | ( | std::initializer_list< const char * > | sl | ) |
Construct a string collection from an initialization list of C string pointers.
sl | An initialization list of C character arrays. |
Create an empty string collection on the heap.
Create a string collection on the heap, initially containing a single string.
str | The string |
|
inlinestatic |
Creates a string collection on the heap by copying a vector of strings.
vec | A vector of strings. |
|
inlinestatic |
Creates a string collection on the heap by copying a vector of strings.
vec | A vector of strings. |
Create a string collection on the heap from an initialization list of strings.
sl | An initialization list of strings. |
|
inlinestatic |
Create a string collection on the heap from an initialization list of C string pointers.
sl | An initialization list of C character arrays. |
string_collection & mqtt::string_collection::operator= | ( | const string_collection & | coll | ) |
Copy assignment. Copy another string collection to this one.
coll | A string collection |
|
default |
Move assignment. Move another string collection to this one.
coll | A string collection |
|
inline |
Determines if the collection is empty.
|
inline |
Gets the number of strings in the collection.
void mqtt::string_collection::push_back | ( | const string & | str | ) |
Copies a string to the back of the collection.
str | A string. |
void mqtt::string_collection::push_back | ( | string && | str | ) |
Moves a string to the back of the collection.
str | A string. |
void mqtt::string_collection::clear | ( | ) |
Removes all the strings from the collection.
|
inline |
Gets the n'th string in the collection.
i | Index to the desired string. |
|
inline |
Gets a pointer to an array of NUL-terminated C string pointers. This is the 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.