23namespace xrt::auxiliary::util {
55 for (
auto &&elt : arr) {
66 return static_cast<uint32_t
>(vec.size());
91 if (vec.size() > (std::numeric_limits<uint32_t>::max)() - 1) {
92 throw std::out_of_range(
"Size limit reached");
95 throw std::invalid_argument(
"Cannot pass a null pointer");
102 template <u
int32_t N>
106 for (
auto &&elt : arr) {
123 if (str ==
nullptr) {
124 throw std::invalid_argument(
"Cannot pass a null pointer");
126 std::string needle{str};
127 auto it = std::find_if(vec.begin(), vec.end(), [needle](
const char *elt) { return needle == elt; });
128 return it != vec.end();
149 if (vec.size() > (std::numeric_limits<uint32_t>::max)() - 1) {
150 throw std::out_of_range(
"Size limit reached");
152 if (str ==
nullptr) {
153 throw std::invalid_argument(
"Cannot pass a null pointer");
155 std::string needle{str};
156 auto it = std::find_if(vec.begin(), vec.end(), [needle](
const char *elt) { return needle == elt; });
157 if (it != vec.end()) {
166 std::vector<const char *> vec;
A collection of strings (const char *), like a list of extensions to enable.
Definition: u_string_list.hpp:34
void push_back_all(const char *(&arr)[N])
Add all given items.
Definition: u_string_list.hpp:104
StringList()=default
Construct a string list.
void push_back(const char *str)
Append a new string to the list.
Definition: u_string_list.hpp:88
StringList(const char *(&arr)[N])
Construct a string list with the given items.
Definition: u_string_list.hpp:53
bool push_back_unique(const char *str)
Append a new string to the list if it doesn't match any existing string.
Definition: u_string_list.hpp:147
const char *const * data() const noexcept
Get the data pointer of the array.
Definition: u_string_list.hpp:73
bool contains(const char *str)
Check if the string is in the list.
Definition: u_string_list.hpp:121
StringList(uint32_t capacity)
Construct a string list with the given capacity.
Definition: u_string_list.hpp:39
uint32_t size() const noexcept
Get the size of the array (the number of strings)
Definition: u_string_list.hpp:64
A collection of strings, like a list of extensions to enable.