diff options
Diffstat (limited to 'gcc/rust/lex/rust-codepoint.h')
-rw-r--r-- | gcc/rust/lex/rust-codepoint.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/gcc/rust/lex/rust-codepoint.h b/gcc/rust/lex/rust-codepoint.h index 0f2e5bd..d95bfdf 100644 --- a/gcc/rust/lex/rust-codepoint.h +++ b/gcc/rust/lex/rust-codepoint.h @@ -1,11 +1,6 @@ #ifndef RUST_CODEPOINT_H #define RUST_CODEPOINT_H -#include "config.h" -#include "system.h" -#include "coretypes.h" -// config, system, coretypes - TODO: ensure all are needed - #include <string> namespace Rust { @@ -16,11 +11,21 @@ struct Codepoint // Creates a zero codepoint. Codepoint () : value (0) {} - // Creates a codepoint from UTF-8 value. - Codepoint (uint32_t value_) : value (value_) {} + // 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; + } - // Returns a C++ string containing value of codepoint. - ::std::string as_string (); + bool operator!= (Codepoint other) const + { + return !operator== (other); + } }; } // namespace Rust |