Defined in word-range.hpp
.
An instance of this class is used to convert from word_type to std::string. The letters in the word are converted to characters according to their position in alphabet used to construct a ToString instance if one is provided, or using human_readable_letter otherwise.
- Example
tostring(
word_type({0, 1, 1, 0, 1, 1, 0, 2}));
tostring.init();
ToString()
Default constructor.
Definition word-range.hpp:1140
std::vector< letter_type > word_type
Type for a word over the generators of a semigroup.
Definition types.hpp:101
◆ ToString() [1/4]
Constructs an empty object with no alphabet set.
◆ ToString() [2/4]
Default copy constructor.
◆ ToString() [3/4]
Default move constructor.
◆ ToString() [4/4]
Construct a ToString object with the given alphabet.
- Parameters
-
- Exceptions
-
◆ alphabet()
This function returns a std::string corresponding to the ordered-set alphabet \(\{a_0, a_1, \dots a_{n-1}\}\) that the initialised ToString object will use to convert from a word_type to a std::string. Specifically, \(i\mapsto a_i\) where \(i\) will correspond to a letter in a word_type, and \(a_i\) is a char
.
If this function returns the empty string, then conversion will be performed using human_readable_index.
- Returns
- A value of type std::string.
- Exceptions
- This function guarantees not to throw a LibsemigroupsException..
◆ call_no_checks() [1/2]
This function converts its second argument input
into a std::string and stores the result in the first argument output
. The characters of input
are converted using the alphabet used to construct the object or set via init(), or with human_readable_letter if empty returns true
.
The contents of the first argument output
, if any, is removed.
- Parameters
-
- Warning
- This functions performs no checks on its arguments. In particular, if the alphabet used to define an instance of ToString is not empty, and
input
contains letters that do not correspond to letters of the alphabet, then bad things will happen.
- See also
-
◆ call_no_checks() [2/2]
This function converts its argument input
into a std::string. The characters of input
are converted using the alphabet used to construct the object or set via init(), or with human_readable_letter if empty returns true
.
- Parameters
-
- Warning
- This functions performs no checks on its arguments. In particular, if the alphabet used to define an instance of ToString is not empty, and
input
contains letters that do not correspond to letters of the alphabet, then bad things will happen.
- See also
-
◆ can_convert_letter()
Check if the current ToString instance can convert a specified letter.
This function returns true
if l
can can be converted to a char
using this ToString instance, and false
otherwise.
- Parameters
-
l | the letter to check the convertibility of. |
- Returns
- A value of type bool.
- Exceptions
- This function guarantees not to throw a LibsemigroupsException.
◆ empty()
This function return true
if no alphabet has been defined, and false
otherwise.
- Returns
- A value of type
bool
.
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
◆ init() [1/2]
This function puts a ToString object back into the same state as if it had been newly default constructed.
- Returns
- A reference to
*this
.
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
- See also
- ToString()
◆ init() [2/2]
◆ operator()() [1/4]
template<typename InputRange, typename = std::enable_if_t<rx::is_input_or_sink_v<InputRange>>>
auto operator() |
( |
InputRange && | input | ) |
const |
|
inlinenodiscardconstexpr |
A custom combinator for rx::ranges to convert the output of a WordRange object into std::string, that can be combined with other combinators using operator|
.
- Example
words.alphabet_size(1).min(0).max(10);
Class for generating words in a given range and in a particular order.
Definition word-range.hpp:318
Namespace containing some operators for creating words.
Definition word-range.hpp:2072
◆ operator()() [2/4]
This function converts its argument input
into a std::string, by first converting it to a word_type. The characters of input
are converted using the alphabet used to construct the object or set via init(), or with human_readable_letter if empty returns true
.
- Parameters
-
input | the initializer list to convert. |
- Exceptions
-
LibsemigroupsException | if the alphabet used to define an instance of ToString is not empty and input contains letters that do not correspond to letters of the alphabet. |
- See also
-
◆ operator()() [3/4]
This function converts its second argument input
into a std::string and stores the result in the first argument output
. The characters of input
are converted using the alphabet used to construct the object or set via init(), or with human_readable_letter if empty returns true
.
The contents of the first argument output
, if any, is removed.
- Parameters
-
output | word to hold the result. |
input | the string to convert. |
- Exceptions
-
LibsemigroupsException | if the alphabet used to define an instance of ToString is not empty and input contains letters that do not correspond to letters of the alphabet. |
- See also
-
◆ operator()() [4/4]
This function converts its argument input
into a std::string. The characters of input
are converted using the alphabet used to construct the object or set via init(), or with human_readable_letter if empty returns true
.
- Parameters
-
input | the string to convert. |
- Exceptions
-
LibsemigroupsException | if the alphabet used to define an instance of ToString is not empty and input contains letters that do not correspond to letters of the alphabet. |
- See also
-
◆ operator=() [1/2]
◆ operator=() [2/2]
The documentation for this class was generated from the following file: