Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
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 118 of file symbol.hpp.

Static Public Attributes

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

Public Member Functions

 Symbol (CStr lit=NULL)
 
 Symbol (std::string &&definition)
 create Symbol by symbol table lookup.
 
 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
 
Symboloperator= (Symbol const &)=default
 
Symboloperator= (Symbol &&)=default
 
 operator bool () const
 
bool empty () const
 
- Public Member Functions inherited from Literal
constexpr Literal () noexcept
 empty string by default
 
constexpr Literal (CStr literal) noexcept
 
constexpr Literal (Literal const &) noexcept=default
 
constexpr Literaloperator= (Literal const &) noexcept=default
 
constexpr operator CStr () const
 
constexpr const char * c () const
 
constexpr bool empty () const
 
constexpr bool operator== (CStr cString) const
 equality on Literal and Symbol values is defined based on the content, not the address.
 
constexpr size_t length () const
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ Symbol() [1/7]

Symbol ( CStr  lit = NULL)
inline

Definition at line 127 of file symbol.hpp.

◆ Symbol() [2/7]

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 61 of file symbol-impl.cpp.

◆ Symbol() [3/7]

Symbol ( std::string const &  str)
inline

Definition at line 134 of file symbol.hpp.

◆ Symbol() [4/7]

Symbol ( Literal const &  base,
std::string const &  ext 
)
inline

Definition at line 138 of file symbol.hpp.

◆ Symbol() [5/7]

Symbol ( Literal const &  base,
CStr  ext 
)
inline

Definition at line 142 of file symbol.hpp.

◆ Symbol() [6/7]

Symbol ( Symbol const &  )
default

◆ Symbol() [7/7]

Symbol ( Symbol &&  )
default

Member Function Documentation

◆ operator=() [1/2]

Symbol & operator= ( Symbol const &  )
default

◆ operator=() [2/2]

Symbol & operator= ( Symbol &&  )
default

◆ operator bool()

operator bool ( ) const
inlineexplicit

Definition at line 152 of file symbol.hpp.

References Symbol::empty().

+ Here is the call graph for this function:

◆ empty()

bool empty ( ) const
inline

Definition at line 153 of file symbol.hpp.

References Symbol::BOTTOM, Literal::c(), and Symbol::EMPTY.

Referenced by Symbol::operator bool().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ ANY

◆ EMPTY

◆ BOTTOM

◆ FAILURE

Symbol FAILURE = "↯"
static

Definition at line 125 of file symbol.hpp.

Referenced by Symbol_test::checkSymbolCreation(), and Command::getID().

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

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