Monado OpenXR Runtime
|
A collection of strings (const char *), like a list of extensions to enable. More...
#include <util/u_string_list.hpp>
Public Member Functions | |
StringList ()=default | |
Construct a string list. More... | |
StringList (uint32_t capacity) | |
Construct a string list with the given capacity. More... | |
StringList (StringList &&)=default | |
StringList (StringList const &)=default | |
StringList & | operator= (StringList &&)=default |
StringList & | operator= (StringList const &)=default |
template<uint32_t N> | |
StringList (const char *(&arr)[N]) | |
Construct a string list with the given items. More... | |
uint32_t | size () const noexcept |
Get the size of the array (the number of strings) More... | |
const char *const * | data () const noexcept |
Get the data pointer of the array. More... | |
void | push_back (const char *str) |
Append a new string to the list. More... | |
template<uint32_t N> | |
void | push_back_all (const char *(&arr)[N]) |
Add all given items. More... | |
bool | contains (const char *str) |
Check if the string is in the list. More... | |
bool | push_back_unique (const char *str) |
Append a new string to the list if it doesn't match any existing string. More... | |
A collection of strings (const char *), like a list of extensions to enable.
This version is only for use with strings that will outlive this object, preferably string literals.
Size is limited to one less than the max value of uint32_t which shouldn't be a problem, the size really should be much smaller (especially if you use push_back_unique()).
|
default |
Construct a string list.
|
inline |
Construct a string list with the given capacity.
|
inline |
Construct a string list with the given items.
References push_back().
|
inline |
Check if the string is in the list.
(Comparing string contents, not pointers)
str | a non-null, null-terminated string. |
Referenced by u_string_list_contains().
|
inlinenoexcept |
Get the data pointer of the array.
Referenced by u_string_list::u_string_list_get_data().
|
inline |
Append a new string to the list.
str | a non-null, null-terminated string that must live at least as long as the list, preferably a string literal. |
std::out_of_range | if you have a ridiculous number of strings in your list already, std::invalid_argument if you pass a null pointer. |
Referenced by push_back_all(), StringList(), u_string_list::u_string_list_append(), and u_string_list::u_string_list_append_array().
|
inline |
|
inline |
Append a new string to the list if it doesn't match any existing string.
(Comparing string contents, not pointers)
This does a simple linear search, because it is assumed that the size of this list is fairly small.
str | a non-null, null-terminated string that must live at least as long as the list, preferably a string literal. |
std::out_of_range | if you have a ridiculous number of strings in your list already, std::invalid_argument if you pass a null pointer. |
Referenced by u_string_list::u_string_list_append_unique().
|
inlinenoexcept |
Get the size of the array (the number of strings)
Referenced by u_string_list::u_string_list_get_size().