aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/lex/rust-codepoint.h
blob: d95bfdf17bf2596b486747bd60098b27b58d75aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef RUST_CODEPOINT_H
#define RUST_CODEPOINT_H

#include <string>

namespace Rust {
struct Codepoint
{
  uint32_t value;

  // Creates a zero codepoint.
  Codepoint () : value (0) {}

  // Creates a codepoint from an encoded UTF-8 value.
  Codepoint (uint32_t value) : value (value) {}

  // Returns a C++ string containing string value of codepoint.
  std::string as_string ();

  bool operator== (Codepoint other) const
  {
    return value == other.value;
  }

  bool operator!= (Codepoint other) const
  {
    return !operator== (other);
  }
};
} // namespace Rust

#endif