| Alexander Hansen | d6a9574 | 2025-01-06 15:06:25 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <expected> |
| 4 | #include <libpldm/base.h> |
| 5 | #include <libpldm/pldm_types.h> |
| 6 | |
| 7 | #include <string> |
| 8 | |
| 9 | namespace pldm |
| 10 | { |
| 11 | namespace utils |
| 12 | { |
| 13 | /** @brief Convert the buffer to std::string |
| 14 | * |
| 15 | * In case the string encoding is not ASCII, an error string is returned. |
| 16 | * |
| 17 | * @param[in] pldm_string_type - DSP0267, Table 20 |
| 18 | * @param[in] var - pointer to data and length of the data |
| 19 | * |
| 20 | * @return[expected] std::string equivalent of variable field |
| 21 | * @return[unexpected] error message string |
| 22 | */ |
| 23 | std::expected<std::string, std::string> |
| 24 | toString(uint8_t pldm_string_type, const struct variable_field &var); |
| 25 | |
| 26 | } // namespace utils |
| 27 | } // namespace pldm |