status.h 682 B

12345678910111213141516171819202122232425262728293031323334
  1. // UTF-16 read status
  2. //
  3. // Platform: ISO C++ 98/11
  4. // $Id$
  5. //
  6. // (c) __vic 2017
  7. #ifndef __VIC_UTF16_STATUS_H
  8. #define __VIC_UTF16_STATUS_H
  9. #include<__vic/defs.h>
  10. namespace __vic { namespace utf16 {
  11. //////////////////////////////////////////////////////////////////////////////
  12. __VIC_SCOPED_ENUM_BEGIN(status)
  13. {
  14. ok = 0,
  15. eof,
  16. // Errors
  17. truncated_code_unit,
  18. truncated_code_point,
  19. invalid_sequence
  20. }
  21. __VIC_SCOPED_ENUM_END(status)
  22. //////////////////////////////////////////////////////////////////////////////
  23. __VIC_CONSTEXPR_FUNC bool is_error(status_t s) { return s > status::eof; }
  24. bool throw_if_error(status_t );
  25. }} // namespace
  26. #endif // header guard