Lumiera  0.pre.03
»edit your freedom«
Symbol Class Reference

#include "lib/symbol.hpp"

Description

Token or Atom with distinct identity.

It can be created from arbitrary strings, yet not altered

Note
same literal string==same pointer representation

Definition at line 126 of file symbol.hpp.

Public Member Functions

 Symbol (CStr lit=NULL)
 
 Symbol (std::string &&definition)
 create Symbol by symbol table lookup. More...
 
 Symbol (std::string const &str)
 
 Symbol (Literal const &base, std::string const &ext)
 
 Symbol (Literal const &base, CStr ext)
 
 Symbol (Symbol const &)=default
 
 Symbol (Symbol &&)=default
 
bool empty () const
 
size_t length () const
 
 operator bool () const
 
Symboloperator= (Symbol const &)=default
 
Symboloperator= (Symbol &&)=default
 
- Public Member Functions inherited from Literal
 Literal () noexcept
 empty string by default More...
 
 Literal (const char *literal) noexcept
 
 Literal (Literal const &o) noexcept
 
const char * c () const
 
bool empty () const
 
 operator CStr () const
 
bool operator== (CStr cString) const
 equality on Literal and Symbol values is defined based on the content, not the address. More...
 

Static Public Attributes

static Symbol ANY = "*"
 
static Symbol BOTTOM = "⟂"
 
static Symbol EMPTY = ""
 
static Symbol FAILURE = "↯"
 

Additional Inherited Members

- Protected Member Functions inherited from Literal
Literaloperator= (CStr newStr) noexcept
 Assignment generally prohibited.
 

Constructor & Destructor Documentation

◆ Symbol()

Symbol ( std::string &&  definition)
explicit

create Symbol by symbol table lookup.

Note
identical strings will be mapped to the same Symbol (embedded pointer)
Warning
potential lock contention, since each ctor call needs to do a lookup
Remarks
since lumiera::LifecycleHook entries use a Symbol, the symbol table is implemented as Meyer's singleton and pulled up early, way before main()

Definition at line 82 of file symbol-impl.cpp.

+ Inheritance diagram for Symbol:
+ Collaboration diagram for Symbol:

The documentation for this class was generated from the following files: