54 using CStr =
const char*;
59 cStr (std::string
const& rendered)
61 return rendered.c_str();
84 Literal (
const char* literal) noexcept
92 operator CStr()
const {
return str_; }
93 const char* c()
const {
return str_; }
98 return !str_ || 0 == std::strlen(str_);
127 :
Symbol{std::string(lit? lit : BOTTOM.c())}
131 Symbol (std::string&& definition);
133 Symbol (std::string
const& str)
134 :
Symbol{std::string(str)}
138 :
Symbol{std::string(base)+
"."+ext}
142 :
Symbol{base, std::string(ext)}
151 explicit operator bool()
const {
return not empty(); }
152 bool empty()
const {
return *
this == BOTTOM or *
this == EMPTY; }
157 return std::strlen(c());
189 inline bool operator== (
Literal s1, std::string s2) {
return s1.operator== (s2.c_str()); }
190 inline bool operator== (std::string s1,
Literal s2) {
return s2.operator== (s1.c_str()); }
191 inline bool operator== (
Symbol s1, std::string s2) {
return s1.operator== (s2.c_str()); }
192 inline bool operator== (std::string s1,
Symbol s2) {
return s2.operator== (s1.c_str()); }
196 inline bool operator!= (
Literal const& s1,
Literal const& s2) {
return not s1.operator== (s2.c()); }
197 inline bool operator!= (
Symbol const& s1,
Symbol const& s2) {
return not (s1.c() == s2.c()); }
198 inline bool operator!= (
Literal s1, CStr s2) {
return not s1.operator== (s2); }
199 inline bool operator!= (CStr s1,
Literal s2) {
return not s2.operator== (s1); }
200 inline bool operator!= (
Symbol s1, CStr s2) {
return not s1.operator== (s2); }
201 inline bool operator!= (CStr s1,
Symbol s2) {
return not s2.operator== (s1); }
202 inline bool operator!= (
Literal s1,
Symbol s2) {
return not s1.operator== (s2.c()); }
203 inline bool operator!= (
Symbol s1,
Literal s2) {
return not s2.operator== (s1.c()); }
204 inline bool operator!= (
Literal s1, std::string s2) {
return not s1.operator== (s2.c_str()); }
205 inline bool operator!= (std::string s1,
Literal s2) {
return not s2.operator== (s1.c_str()); }
206 inline bool operator!= (
Symbol s1, std::string s2) {
return not s1.operator== (s2.c_str()); }
207 inline bool operator!= (std::string s1,
Symbol s2) {
return not s2.operator== (s1.c_str()); }
CStr cStr(std::string const &rendered)
convenience shortcut: forced conversion to c-String via string.
inline string literal This is a marker type to indicate that
bool operator==(CStr cString) const
equality on Literal and Symbol values is defined based on the content, not the address.
const size_t STRING_MAX_RELEVANT
safety guard: maximum number of chars to process.
Implementation namespace for support and library code.
std::string operator+(std::string str, Literal const &sym)
string concatenation
Token or Atom with distinct identity.
Helper to use a single extension point for specialised hash functions.
Literal() noexcept
empty string by default
HashVal hash_value(QueryText const &entry)
support using queries in hashtables.
Literal & operator=(CStr newStr) noexcept
Assignment generally prohibited.
size_t HashVal
a STL compatible hash value