! @brief reads a UBJSON string This function is either called after reading the 'S' byte explicitly indicating a string, or in case of an object key where the 'S' byte can be left out. @param[out] result created string @param[in] get_char whether a new character should be retrieved from the input (true, default) or whether the last read
| 10925 | @return whether string creation completed |
| 10926 | */ |
| 10927 | bool get_ubjson_string(string_t& result, const bool get_char = true) |
| 10928 | { |
| 10929 | if (get_char) |
| 10930 | { |
| 10931 | get(); // TODO(niels): may we ignore N here? |
| 10932 | } |
| 10933 | |
| 10934 | if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format, "value"))) |
| 10935 | { |
| 10936 | return false; |
| 10937 | } |
| 10938 | |
| 10939 | switch (current) |
| 10940 | { |
| 10941 | case 'U': |
| 10942 | { |
| 10943 | std::uint8_t len{}; |
| 10944 | return get_number(input_format, len) && get_string(input_format, len, result); |
| 10945 | } |
| 10946 | |
| 10947 | case 'i': |
| 10948 | { |
| 10949 | std::int8_t len{}; |
| 10950 | return get_number(input_format, len) && get_string(input_format, len, result); |
| 10951 | } |
| 10952 | |
| 10953 | case 'I': |
| 10954 | { |
| 10955 | std::int16_t len{}; |
| 10956 | return get_number(input_format, len) && get_string(input_format, len, result); |
| 10957 | } |
| 10958 | |
| 10959 | case 'l': |
| 10960 | { |
| 10961 | std::int32_t len{}; |
| 10962 | return get_number(input_format, len) && get_string(input_format, len, result); |
| 10963 | } |
| 10964 | |
| 10965 | case 'L': |
| 10966 | { |
| 10967 | std::int64_t len{}; |
| 10968 | return get_number(input_format, len) && get_string(input_format, len, result); |
| 10969 | } |
| 10970 | |
| 10971 | case 'u': |
| 10972 | { |
| 10973 | if (input_format != input_format_t::bjdata) |
| 10974 | { |
| 10975 | break; |
| 10976 | } |
| 10977 | std::uint16_t len{}; |
| 10978 | return get_number(input_format, len) && get_string(input_format, len, result); |
| 10979 | } |
| 10980 | |
| 10981 | case 'm': |
| 10982 | { |
| 10983 | if (input_format != input_format_t::bjdata) |
| 10984 | { |
nothing calls this directly
no test coverage detected