code_point.h 587 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include <string>
  3. #include <abnf/forward.h>
  4. namespace abnf {
  5. class code_point {
  6. public:
  7. code_point(int value = 0) : value_(value) {}
  8. explicit code_point(std::string_view str);
  9. size_t width() const;
  10. explicit operator int() const { return value_; }
  11. operator std::string() const;
  12. private:
  13. friend char_range parse_char_range(std::string_view token);
  14. friend bool operator==(code_point const &, code_point const &) = default;
  15. friend auto operator<=>(code_point const &, code_point const &) = default;
  16. private:
  17. int value_; // 0x00000000 - 0x0010FFFF
  18. };
  19. }