Symbol
#include <tpau-cpp-kernal/Symbol.h>
class Symbol
A Symbol represents a string in a way that allows copying and comparison in constant time.
Even though it uses the global symbol table and C++ does not guarantee the order of initialization of global variables, it is safe to use the Symbol constructor in global initializers.
constructor Symbol
Create an empty symbol.
| Symbol | ( | ); |
constructor Symbol
Create a symbol from a string.
| Symbol | ( | const char * name | ); |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The string to create the symbol from. |
constructor Symbol
Create a symbol from a string.
| Symbol | ( | const std::string & name | ); |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The string to create the symbol from. |
constructor Symbol
Create a symbol from a string view.
| Symbol | ( | std::string_view name | ); |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The string to create the symbol from. |
method emptyconst
Check if the symbol is empty, i. e. it represents the empty string.
| bool empty | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method operator boolconst
Check if the symbol is valid (not empty).
| operator bool | ( | ) const; |
method operator!=const
Check if two symbols are not equal.
| bool operator!= | ( | const Symbol & other | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
other |
The symbol to compare with. |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method operator<const
Check if this symbol comes before another symbol in lexicographical order.
| bool operator< | ( | const Symbol & other | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
other |
The symbol to compare with. |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method operator<=const
Check if this symbol comes before or is equal to another symbol in lexicographical order.
| bool operator<= | ( | const Symbol & other | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
other |
The symbol to compare with. |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method operator=
Assign the symbol corresponding to a string.
| Symbol & operator= | ( | const char * name | ); |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The string to create the symbol from. |
| RETURNS | DESCRIPTION |
|---|---|
Symbol & |
The created symbol. |
method operator=
Assign the symbol corresponding to a string.
| Symbol & operator= | ( | const std::string & name | ); |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The string to create the symbol from. |
| RETURNS | DESCRIPTION |
|---|---|
Symbol & |
The created symbol. |
method operator=
Assign the symbol corresponding to a string view.
| Symbol & operator= | ( | std::string_view name | ); |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The string to create the symbol from. |
| RETURNS | DESCRIPTION |
|---|---|
Symbol & |
The created symbol. |
method operator==const
Check if two symbols are equal.
| bool operator== | ( | const Symbol & other | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
other |
The symbol to compare with. |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method operator>const
Check if this symbol comes after another symbol in lexicographical order.
| bool operator> | ( | const Symbol & other | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
other |
The symbol to compare with. |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method operator>=const
Check if this symbol comes after or is equal to another symbol in lexicographical order.
| bool operator>= | ( | const Symbol & other | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
other |
The symbol to compare with. |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method strconst
Get the string represented by the symbol.
| const std::string & str | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
const std::string & |
The string represented by the symbol. |
function operator<<
Output a symbol to a stream.
| std::ostream & operator<< | ( | std::ostream & stream, | |
| const Symbol & symbol | ); |
| PARAMETER | DESCRIPTION |
|---|---|
stream |
The stream to output to. |
symbol |
The symbol to output. |
| RETURNS | DESCRIPTION |
|---|---|
std::ostream & |
The stream that was output to. |