63 using CStr =
const char*;
68 cStr (std::string
const& rendered)
70 return rendered.c_str();
93 Literal (
const char* literal) noexcept
101 operator CStr()
const {
return str_; }
102 const char* c()
const {
return str_; }
107 return !str_ || 0 == std::strlen(str_);
136 :
Symbol{std::string(lit? lit : BOTTOM.c())}
140 Symbol (std::string&& definition);
142 Symbol (std::string
const& str)
143 :
Symbol{std::string(str)}
147 :
Symbol{std::string(base)+
"."+ext}
151 :
Symbol{base, std::string(ext)}
160 explicit operator bool()
const {
return not empty(); }
161 bool empty()
const {
return *
this == BOTTOM or *
this == EMPTY; }
166 return std::strlen(c());
198 inline bool operator== (
Literal s1, std::string s2) {
return s1.operator== (s2.c_str()); }
199 inline bool operator== (std::string s1,
Literal s2) {
return s2.operator== (s1.c_str()); }
200 inline bool operator== (
Symbol s1, std::string s2) {
return s1.operator== (s2.c_str()); }
201 inline bool operator== (std::string s1,
Symbol s2) {
return s2.operator== (s1.c_str()); }
205 inline bool operator!= (
Literal const& s1,
Literal const& s2) {
return not s1.operator== (s2.c()); }
206 inline bool operator!= (
Symbol const& s1,
Symbol const& s2) {
return not (s1.c() == s2.c()); }
207 inline bool operator!= (
Literal s1, CStr s2) {
return not s1.operator== (s2); }
208 inline bool operator!= (CStr s1,
Literal s2) {
return not s2.operator== (s1); }
209 inline bool operator!= (
Symbol s1, CStr s2) {
return not s1.operator== (s2); }
210 inline bool operator!= (CStr s1,
Symbol s2) {
return not s2.operator== (s1); }
211 inline bool operator!= (
Literal s1,
Symbol s2) {
return not s1.operator== (s2.c()); }
212 inline bool operator!= (
Symbol s1,
Literal s2) {
return not s2.operator== (s1.c()); }
213 inline bool operator!= (
Literal s1, std::string s2) {
return not s1.operator== (s2.c_str()); }
214 inline bool operator!= (std::string s1,
Literal s2) {
return not s2.operator== (s1.c_str()); }
215 inline bool operator!= (
Symbol s1, std::string s2) {
return not s1.operator== (s2.c_str()); }
216 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.