u/string_list: Add constructor from existing list

This commit is contained in:
Christoph Haag 2021-12-06 20:43:31 +01:00
parent ee366e16e5
commit 171a3830b9
2 changed files with 19 additions and 0 deletions

View file

@ -47,6 +47,17 @@ u_string_list_create_with_capacity(uint32_t capacity)
}
}
struct u_string_list *
u_string_list_create_from_list(struct u_string_list *usl)
{
try {
auto ret = std::make_unique<u_string_list>(xrt::auxiliary::util::StringList{usl->list});
return ret.release();
} catch (std::exception const &) {
return nullptr;
}
}
uint32_t
u_string_list_get_size(const struct u_string_list *usl)

View file

@ -40,6 +40,14 @@ u_string_list_create(void);
struct u_string_list *
u_string_list_create_with_capacity(uint32_t capacity);
/*!
* @brief Create a new string list from an existing string list.
*
* @public @memberof u_string_list
*/
struct u_string_list *
u_string_list_create_from_list(struct u_string_list *usl);
/*!
* @brief Retrieve the number of elements in the list
*