status.h 699 B

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