Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Marker types to indicate a literal string and a Symbol.
Instead of working just with pointers, which could represent pretty much anything, it is prudent to express the meaning at interfaces and for variables and members explicitly.
On concept level, while a string is just some sequence of characters and nothing can be said about mutability or lifetime, a Literal on the contrary is meant to be static. It is fixed and assumed to exist literally as is during the whole lifetime of the execution. The concept of a Symbol is related, yet slightly different: it is meant to be a distinguishable fixed, unique token. Identical sequence of characters means we have exactly the same Symbol.
These concepts can be fused by treating Symbol as a specialisation of Literal, additionally maintaining an automatically populated, static symbol table, and we close the circle by allowing Symbol instances to be created from strings at runtime.
Definition in file symbol.hpp.
Classes | |
class | Literal |
inline string literal This is a marker type to indicate that More... | |
class | Symbol |
Token or Atom with distinct identity. More... | |
Typedefs | |
using | CStr = const char * |
Functions | |
CStr | cStr (std::string const &rendered) |
convenience shortcut: forced conversion to c-String via string. More... | |
HashVal | hash_value (Literal literal) |
generate hash value based on the Literal's contents. More... | |
HashVal | hash_value (Symbol sym) |
hash value for Symbols is directly based on the symbol table entry | |
bool | operator!= (Literal const &s1, Literal const &s2) |
bool | operator!= (Symbol const &s1, Symbol const &s2) |
bool | operator!= (Literal s1, CStr s2) |
bool | operator!= (CStr s1, Literal s2) |
bool | operator!= (Symbol s1, CStr s2) |
bool | operator!= (CStr s1, Symbol s2) |
bool | operator!= (Literal s1, Symbol s2) |
bool | operator!= (Symbol s1, Literal s2) |
bool | operator!= (Literal s1, std::string s2) |
bool | operator!= (std::string s1, Literal s2) |
bool | operator!= (Symbol s1, std::string s2) |
bool | operator!= (std::string s1, Symbol s2) |
std::string | operator+ (std::string str, Literal const &sym) |
string concatenation | |
std::string | operator+ (Literal const &sym, std::string str) |
bool | operator== (Literal const &s1, Literal const &s2) |
bool | operator== (Symbol const &s1, Symbol const &s2) |
bool | operator== (CStr s1, Literal s2) |
bool | operator== (Symbol s1, CStr s2) |
bool | operator== (CStr s1, Symbol s2) |
bool | operator== (Literal s1, Symbol s2) |
bool | operator== (Symbol s1, Literal s2) |
bool | operator== (Literal s1, std::string s2) |
bool | operator== (std::string s1, Literal s2) |
bool | operator== (Symbol s1, std::string s2) |
bool | operator== (std::string s1, Symbol s2) |
Namespaces | |
lib | |
Implementation namespace for support and library code. | |
|
inline |
convenience shortcut: forced conversion to c-String via string.
usable for printf with objects providing to-string conversion.
Definition at line 59 of file symbol.hpp.
Referenced by AppState::abort(), Asset::Asset(), TreeDiffMutatorBinding::emu(), HandlingPattern::invoke(), lumiera::error::lumiera_unexpectedException(), AppState::maybeStart(), TreeDiffMutatorBinding::mut(), TestSource::nextResult(), DispatcherLoop::runSessionThread(), UiStyle::setTheme(), MockSys::start(), NotificationService::triggerGuiShutdown(), and MockSys::triggerShutdown().