![]() |
Lumiera 0.pre.04~rc.1
»edit your freedom«
|
Marker types to indicate a literal string and a Symbol. More...
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 conceptual level, while a string is just some sequence of characters and nothing can be said about its mutability or lifetime, a Literal is explicitly meant to be static. It is a fixed sequence of characters placed in a stable memory location and assumed to exist during the whole lifetime of the execution. The concept of a Symbol is slightly different: it is meant to be a distinguishable, fixed, unique token. An 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.
Namespaces | |
| namespace | lib |
| Implementation namespace for support and library code. | |
| namespace | lib::anonymous_namespace{symbol.hpp} |
Typedefs | |
| using | CStr = const char * |
Classes | |
| class | Literal |
| Inline string literal. More... | |
| class | Symbol |
| Token or Atom with distinct identity. More... | |
Functions | |
| CStr | cStr (std::string const &rendered) |
| convenience shortcut: forced conversion to c-String via string. | |
| constexpr int | strNcmp (CStr a, CStr b, size_t len) |
| HashVal | hash_value (Literal literal) |
| generate hash value based on the Literal's contents. | |
| HashVal | hash_value (Symbol sym) |
| hash value for Symbols is directly based on the symbol table entry | |
| constexpr bool | operator== (Literal const &s1, Literal const &s2) |
| constexpr bool | operator== (Symbol const &s1, Symbol const &s2) |
| constexpr bool | operator== (CStr s1, Literal s2) |
| constexpr bool | operator== (Symbol s1, CStr s2) |
| constexpr bool | operator== (Literal s1, Symbol s2) |
| constexpr bool | operator== (Literal s1, std::string const &s2) |
| constexpr bool | operator== (Symbol s1, std::string const &s2) |
| std::string | operator+ (std::string str, Literal const &sym) |
| string concatenation | |
| std::string | operator+ (Literal const &sym, std::string str) |
| using CStr = const char* |
Definition at line 55 of file symbol.hpp.
|
inline |
convenience shortcut: forced conversion to c-String via string.
usable for printf with objects providing to-string conversion.
Definition at line 60 of file symbol.hpp.
Referenced by Asset::Asset(), CompletedDefinition< SIG >::CompletedDefinition(), Config::Config(), TestSource::TestSource(), AppState::abort(), Command::activate(), UiStyle::addStockIconFromPath(), DiffLanguage< I, E >::DiffStep::applyTo(), Proxy< IHandle >::cycle(), Proxy< IHandle >::displayInfo(), TreeDiffMutatorBinding::emu(), HandlingPattern::invoke(), test::anonymous_namespace{suite.cpp}::invokeTestCase(), lumiera_get_plugin_path_default(), lumiera::error::lumiera_unexpectedException(), Proxy< IHandle >::markError(), Proxy< IHandle >::markNote(), AppState::maybeStart(), TreeDiffMutatorBinding::mut(), SessionCommandFunction_test::perform_massivelyParallel(), DispatcherLoop::processCommands(), steam::asset::meta::anonymous_namespace{time-grid.cpp}::publishWrapped(), lib::resolveModulePath(), SessionElementQuery_test::run(), MockSys::run(), UiStyle::setTheme(), PrintfFormatter< NUM, len >::show(), SubsystemRunner::sigTerm(), util::sNum(), MockSys::start(), Proxy< IHandle >::triggerGuiShutdown(), NotificationService::triggerGuiShutdown(), MockSys::triggerShutdown(), SubsystemRunner::triggerStartup(), and util::uNum().
Here is the caller graph for this function: