|
MTMS main
Modern Turing Machine Simulator
|
Represents the formal alphabet ( 

#include <alphabet.hpp>
Public Member Functions | |
| Alphabet () noexcept=default | |
| Default constructor. | |
| Alphabet (const std::set< Symbol > &symbols) noexcept(false) | |
| Explicit constructor to build an Alphabet from an existing set of Symbols. | |
| Alphabet (std::string_view str) noexcept(false) | |
| Explicit constructor to build an Alphabet from a string view. | |
| auto | begin () const noexcept |
| Returns an iterator to the beginning of the alphabet set. | |
| bool | contains (const Symbol &symbol) const noexcept |
| Checks if a specific Symbol belongs to this alphabet. | |
| auto | end () const noexcept |
| Returns an iterator to the end of the alphabet set. | |
| const std::set< Symbol > & | get_set () const noexcept |
| Getter for the underlying standard set of symbols. | |
| void | print (std::ostream &os=std::cout) const noexcept |
| Prints the alphabet in mathematical set notation format (e.g., "{0, 1}"). | |
| std::size_t | size () const noexcept |
| Retrieves the total number of unique symbols currently in the alphabet. | |
Private Member Functions | |
| template<class T > | |
| void | insert (const T &data) noexcept(false) |
| Private helper template to genericly process and insert elements into the alphabet. | |
Private Attributes | |
| std::set< Symbol > | set_ |
| The unique, sorted collection of symbols composing the alphabet. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Alphabet &alphabet) noexcept |
| Overloaded stream insertion operator to print the Alphabet object. | |
Represents the formal alphabet ( 

It stores a unique, ordered set of Symbol instances.
Definition at line 26 of file alphabet.hpp.
|
defaultnoexcept |
Default constructor.
Initializes an empty alphabet.
|
inlineexplicit |
Explicit constructor to build an Alphabet from a string view.
Iterates through the provided string and inserts each unique character as a Symbol.
| str | The sequence of characters representing the alphabet symbols. |
Definition at line 40 of file alphabet.hpp.
References insert().
|
inlineexplicit |
Explicit constructor to build an Alphabet from an existing set of Symbols.
| symbols | A standard set containing the initial Symbols. |
Definition at line 46 of file alphabet.hpp.
References insert().
|
inlinenoexcept |
Returns an iterator to the beginning of the alphabet set.
Definition at line 73 of file alphabet.hpp.
References set_.
|
inlinenoexcept |
Checks if a specific Symbol belongs to this alphabet.
| symbol | The Symbol instance to look up. |
Definition at line 65 of file alphabet.hpp.
References set_.
Referenced by Project::load_project().
|
inlinenoexcept |
Returns an iterator to the end of the alphabet set.
Definition at line 78 of file alphabet.hpp.
References set_.
|
inlinenoexcept |
Getter for the underlying standard set of symbols.
Definition at line 52 of file alphabet.hpp.
References set_.
|
private |
Private helper template to genericly process and insert elements into the alphabet.
| T | A collection type that supports range-based loops (e.g., string_view, std::set). |
| data | The iterable dataset containing potential symbols. |
Definition at line 106 of file alphabet.hpp.
Referenced by Alphabet(), and Alphabet().
|
noexcept |
Prints the alphabet in mathematical set notation format (e.g., "{0, 1}").
Serializes the sorted collection layout using mathematical format markers.
| os | The target output stream (defaults to std::cout). |
Leverages C++20/C++23 structural views pipelines to enforce precise delimiter spacing.
Definition at line 20 of file alphabet.cpp.
|
inlinenoexcept |
Retrieves the total number of unique symbols currently in the alphabet.
Definition at line 58 of file alphabet.hpp.
References set_.
|
friend |
Overloaded stream insertion operator to print the Alphabet object.
| os | The target output stream. |
| alphabet | The Alphabet instance to be streamed. |
Definition at line 37 of file alphabet.cpp.
|
private |
The unique, sorted collection of symbols composing the alphabet.
Definition at line 95 of file alphabet.hpp.
Referenced by begin(), contains(), end(), get_set(), and size().