frame_utils.h 826 B

123456789101112131415161718192021
  1. #pragma once
  2. #include "foundation/types.h"
  3. #include "nu/ByteReader.h"
  4. #include "nx/nxstring.h"
  5. /* updates str, data_len and str_cch */
  6. int ParseDescription(const char *&str, size_t &data_len, size_t &str_cch);
  7. int ParseDescription(const wchar_t *&str, size_t &data_len, size_t &str_cch, uint8_t &str_encoding);
  8. struct ParsedString
  9. {
  10. uint8_t encoding; // 0 - iso-8859-1, 1 - UTF16LE, 2 - UTF16BE, 3 - UTF8
  11. const void *data;
  12. size_t byte_length;
  13. };
  14. int ParseNullTerminatedString(bytereader_t reader, uint8_t encoding, ParsedString &parsed);
  15. int ParseFrameTerminatedString(bytereader_t reader, uint8_t encoding, ParsedString &parsed);
  16. int NXStringCreateFromParsedString(nx_string_t *value, ParsedString &parsed, int text_flags);
  17. bool DescriptionMatches(const ParsedString &parsed, const char *description, int text_flags);