|
MTMS main
Modern Turing Machine Simulator
|
Represents a single symbol on the Turing Machine's tape. More...
#include <symbol.hpp>
Public Member Functions | |
| char | get_char () const noexcept |
| Getter for the underlying raw character. | |
| auto | operator<=> (const Symbol &other) const noexcept=default |
| Defaulted three-way comparison operator (C++20 spaceship operator). | |
| Symbol & | operator= (const Symbol &other) noexcept=default |
| Defaulted copy assignment operator. | |
| void | print (std::ostream &os=std::cout) const noexcept |
| Prints the symbol's character representation to the specified output stream. | |
| Symbol () noexcept | |
| Default constructor. | |
| Symbol (char symbol) noexcept | |
| Explicit constructor to create a Symbol from a raw character. | |
Private Attributes | |
| char | char_ |
| The primitive character backing this Symbol. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Symbol &symbol) noexcept |
| Overloaded stream insertion operator for native stream integration. | |
Represents a single symbol on the Turing Machine's tape.
This class acts as a lightweight wrapper around a primitive char. It provides safe comparison mechanics through the C++20 spaceship operator and integrates natively with C++ standard output streams.
Definition at line 29 of file symbol.hpp.
|
inlinenoexcept |
Default constructor.
Initializes the symbol as a blank/white space.
Definition at line 35 of file symbol.hpp.
|
inlineexplicitnoexcept |
Explicit constructor to create a Symbol from a raw character.
| symbol | The raw character representation to be stored. |
Definition at line 41 of file symbol.hpp.
|
inlinenoexcept |
Getter for the underlying raw character.
Definition at line 47 of file symbol.hpp.
References char_.
Referenced by Project::parse_alphabets().
|
defaultnoexcept |
Defaulted three-way comparison operator (C++20 spaceship operator).
Instructs the compiler to automatically generate standard relational operators (<, <=, >, >=, ==, !=) based on the underlying char_ member.
| other | The other Symbol instance to compare against. |
|
inlinenoexcept |
Prints the symbol's character representation to the specified output stream.
| os | The output stream target (defaults to std::cout). |
Definition at line 72 of file symbol.hpp.
References char_.
|
friend |
Overloaded stream insertion operator for native stream integration.
Allows syntax like std::cout << my_symbol; by forwarding to the print method.
| os | The target output stream. |
| symbol | The Symbol instance to be printed. |
Definition at line 92 of file symbol.hpp.
|
private |
The primitive character backing this Symbol.
Definition at line 85 of file symbol.hpp.
Referenced by get_char(), and print().