Symbol
class Symbol
A Symbol represents a string in a way that allows comparison in constant time.
constructor Symbol()
Create an empty symbol.
constructor Symbol(const std::string &name)
Create a symbol from a string.
| Parameter | Description |
|---|---|
name |
The string to create the symbol from. TYPE: |
method const char *c_str()
Get the C string represented by the symbol.
| Returns | Description |
|---|---|
const char * |
The C string represented by the symbol. |
method bool empty()
Check if the symbol is empty.
| Returns | Description |
|---|---|
bool |
|
method operator bool()
Check if the symbol is valid (not empty).
method bool operator!=(const Symbol &other)
Check if two symbols are not equal.
| Parameter | Description |
|---|---|
other |
The symbol to compare with. TYPE: |
| Returns | Description |
|---|---|
bool |
|
method bool operator<(const Symbol &other)
Check if this symbol is less than another symbol.
| Parameter | Description |
|---|---|
other |
The symbol to compare with. TYPE: |
| Returns | Description |
|---|---|
bool |
|
method bool operator<=(const Symbol &other)
Check if this symbol is less than or equal to another symbol.
| Parameter | Description |
|---|---|
other |
The symbol to compare with. TYPE: |
| Returns | Description |
|---|---|
bool |
|
method Symbol &operator=(const std::string &name)
Assign a symbol the symbol corresponding to a string.
| Parameter | Description |
|---|---|
name |
The string to create the symbol from. TYPE: |
| Returns | Description |
|---|---|
Symbol & |
The created symbol. |
method bool operator==(const Symbol &other)
Check if two symbols are equal.
| Parameter | Description |
|---|---|
other |
The symbol to compare with. TYPE: |
| Returns | Description |
|---|---|
bool |
|
method bool operator>(const Symbol &other)
Check if this symbol is greater than another symbol.
| Parameter | Description |
|---|---|
other |
The symbol to compare with. TYPE: |
| Returns | Description |
|---|---|
bool |
|
method bool operator>=(const Symbol &other)
Check if this symbol is greater than or equal to another symbol.
| Parameter | Description |
|---|---|
other |
The symbol to compare with. TYPE: |
| Returns | Description |
|---|---|
bool |
|
method const std::string &str()
Get the string represented by the symbol.
| Returns | Description |
|---|---|
const std::string & |
The string represented by the symbol. |
function std::ostream &operator<<(std::ostream &stream, const Symbol &symbol)
Output a symbol to a stream.
| Parameter | Description |
|---|---|
stream |
The stream to output to. TYPE: |
symbol |
The symbol to output. TYPE: |
| Returns | Description |
|---|---|
std::ostream & |
The stream that was output to. |