18 #ifndef RAUL_SYMBOL_HPP
19 #define RAUL_SYMBOL_HPP
50 Symbol(
const std::basic_string<char>& symbol)
51 : _str(g_intern_string(symbol.c_str()))
53 assert(is_valid(symbol));
63 : _str(g_intern_string(csymbol))
65 assert(is_valid(csymbol));
68 inline const char* c_str()
const {
return _str; }
70 inline bool operator==(
const Symbol& other)
const {
71 return _str == other._str;
74 inline bool operator!=(
const Symbol& other)
const {
75 return _str != other._str;
78 inline bool operator<(
const Symbol& other)
const {
79 return strcmp(_str, other._str) < 0;
82 static bool is_valid(
const std::basic_string<char>& symbol);
84 static std::string
symbolify(
const std::basic_string<char>& str);
93 static inline std::ostream& operator<<(std::ostream& os,
const Raul::Symbol& symbol)
95 return (os << symbol.c_str());
98 #endif // RAUL_SYMBOL_HPP
Symbol(const char *csymbol)
Construct a Symbol from a C string.
Definition: Symbol.hpp:62
Symbol(const std::basic_string< char > &symbol)
Construct a Symbol from an std::string.
Definition: Symbol.hpp:50
A restricted string (C identifier, which is a component of a Path).
Definition: Symbol.hpp:43
static std::string symbolify(const std::basic_string< char > &str)
Convert a string to a valid symbol.
Definition: Symbol.cpp:60