* Load parsed string-values into an integer-array (intlist) * @param str the string that contains the values (and will be parsed) * @param array pointer to the integer-arrays that will be filled * @param nelems the number of elements the array holds. * @param type the type of elements the array holds (eg INT8, UINT16, etc.) * @return return true on success and false on error */
| 280 | * @return return true on success and false on error |
| 281 | */ |
| 282 | static bool LoadIntList(std::optional<std::string_view> str, void *array, int nelems, VarType type) |
| 283 | { |
| 284 | size_t elem_size = SlVarSize(type); |
| 285 | std::byte *p = static_cast<std::byte *>(array); |
| 286 | if (!str.has_value()) { |
| 287 | std::fill_n(p, nelems * elem_size, static_cast<std::byte>(0)); |
| 288 | return true; |
| 289 | } |
| 290 | |
| 291 | auto opt_items = ParseIntList(*str); |
| 292 | if (!opt_items.has_value() || opt_items->size() != (size_t)nelems) return false; |
| 293 | |
| 294 | for (auto item : *opt_items) { |
| 295 | WriteValue(p, type, item); |
| 296 | p += elem_size; |
| 297 | } |
| 298 | return true; |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | * Convert an integer-array (intlist) to a string representation. Each value |
no test coverage detected