Type for a collection of topics.
More...
#include <string_collection.h>
|
static ptr_t | create (const string &str) |
| Create an empty string collection on the heap. More...
|
|
static ptr_t | create (string &&str) |
| Create a string collection on the heap, initially containing a single string. More...
|
|
static ptr_t | create (const collection_type &vec) |
| Creates a string collection on the heap by copying a vector of strings. More...
|
|
static ptr_t | create (collection_type &&vec) |
| Creates a string collection on the heap by copying a vector of strings. More...
|
|
static ptr_t | create (std::initializer_list< string > sl) |
| Create a string collection on the heap from an initialization list of strings. More...
|
|
static ptr_t | create (std::initializer_list< const char * > sl) |
| Create a string collection on the heap from an initialization list of C string pointers. More...
|
|
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.
mqtt::string_collection::string_collection |
( |
const string & |
str | ) |
|
Construct a collection initially containing a single string.
- Parameters
-
mqtt::string_collection::string_collection |
( |
string && |
str | ) |
|
Construct a collection initially containing a single string.
- Parameters
-
mqtt::string_collection::string_collection |
( |
const collection_type & |
vec | ) |
|
Constructs a string collection by copying a vector of strings.
- Parameters
-
mqtt::string_collection::string_collection |
( |
collection_type && |
vec | ) |
|
Constructs a string collection by moving a vector of strings.
- Parameters
-
Copy constructor.
- Parameters
-
coll | An existing string collection. |
Move constructor.
- Parameters
-
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.
- Parameters
-
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.
- Parameters
-
sl | An initialization list of C character arrays. |
char* const* mqtt::string_collection::c_arr |
( |
| ) |
const |
|
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.
- Returns
- pointer to an array of NUL-terminated C string pointers of the topics in the object.
static ptr_t mqtt::string_collection::create |
( |
const string & |
str | ) |
|
|
inlinestatic |
Create an empty string collection on the heap.
- Returns
- A smart/shared pointer to a string collection.
static ptr_t mqtt::string_collection::create |
( |
string && |
str | ) |
|
|
inlinestatic |
Create a string collection on the heap, initially containing a single string.
- Parameters
-
- Returns
- A smart/shared pointer to a string collection.
static ptr_t mqtt::string_collection::create |
( |
const collection_type & |
vec | ) |
|
|
inlinestatic |
Creates a string collection on the heap by copying a vector of strings.
- Parameters
-
static ptr_t mqtt::string_collection::create |
( |
collection_type && |
vec | ) |
|
|
inlinestatic |
Creates a string collection on the heap by copying a vector of strings.
- Parameters
-
- Returns
- A smart/shared pointer to a string collection.
static ptr_t mqtt::string_collection::create |
( |
std::initializer_list< string > |
sl | ) |
|
|
inlinestatic |
Create a string collection on the heap from an initialization list of strings.
- Parameters
-
sl | An initialization list of strings. |
- Returns
- A smart/shared pointer to a string collection.
static ptr_t mqtt::string_collection::create |
( |
std::initializer_list< const char * > |
sl | ) |
|
|
inlinestatic |
Create a string collection on the heap from an initialization list of C string pointers.
- Parameters
-
sl | An initialization list of C character arrays. |
- Returns
- A smart/shared pointer to a string collection.
bool mqtt::string_collection::empty |
( |
| ) |
const |
|
inline |
Determines if the collection is empty.
- Returns
- true if the collection is empty, false if not.
Copy assignment.
Copy another string collection to this one.
- Parameters
-
- Returns
- A reference to this collection.
Move assignment.
Move another string collection to this one.
- Parameters
-
- Returns
- A reference to this collection.
const string& mqtt::string_collection::operator[] |
( |
size_t |
i | ) |
const |
|
inline |
Gets the n'th string in the collection.
- Parameters
-
i | Index to the desired string. |
- Returns
- A const reference to the string.
void mqtt::string_collection::push_back |
( |
const string & |
str | ) |
|
Copies a string to the back of the collection.
- Parameters
-
void mqtt::string_collection::push_back |
( |
string && |
str | ) |
|
Moves a string to the back of the collection.
- Parameters
-
size_t mqtt::string_collection::size |
( |
| ) |
const |
|
inline |
Gets the number of strings in the collection.
- Returns
- The number of strings in the collection.
The documentation for this class was generated from the following file: