xentara-utils v2.0.4
The Xentara Utility Library
|
A convert that allows conversion from one string type to another. More...
#include <xentara/utils/string/convert.hpp>
Public Types | |
using | InputChar = std::iter_value_t< InputIterator > |
The input character type. | |
using | OutputChar = std::remove_cv_t< OutputCharT > |
Public Member Functions | |
Converter (InputIterator begin, InputSentinel end) | |
Constructor. | |
Converter (std::basic_string_view< InputChar > input) | |
Constructor for converting a string view. | |
Converter (InputIterator begin, InputSentinel end, std::in_place_type_t< OutputChar >) | |
Constructor with a type marker for the output type. | |
Converter (std::basic_string_view< InputChar > input, std::in_place_type_t< OutputChar >) | |
Constructor for converting a string view with a type marker for the output type. | |
template<std::output_iterator< OutputCharT > OutputIterator, std::sentinel_for< OutputIterator > OutputSentinel = std::unreachable_sentinel_t> | |
auto | convert (OutputIterator output, OutputSentinel outputEnd=std::unreachable_sentinel) -> OutputIterator |
Converts a chunk of a string using an output iterator. | |
auto | isDone () const -> bool |
Determines whether the input sequence has been converted completely. | |
Static Public Member Functions | |
static auto | convertedSize (InputIterator begin, InputSentinel end) -> std::size_t |
Calculates the size of a converted character sequence. | |
static constexpr auto | isNoop () -> bool |
Determines whether the conversion is a NOOP. | |
A convert that allows conversion from one string type to another.
This converter preserves state across calls of convert() to allow you to allocate more output data
using xentara::utils::string::Converter< OutputCharT, InputIterator, InputSentinel >::InputChar = std::iter_value_t<InputIterator> |
The input character type.
using xentara::utils::string::Converter< OutputCharT, InputIterator, InputSentinel >::OutputChar = std::remove_cv_t<OutputCharT> |
xentara::utils::string::Converter< OutputCharT, InputIterator, InputSentinel >::Converter | ( | InputIterator | begin, |
InputSentinel | end | ||
) |
Constructor.
begin | The beginning of the input sequence |
end | The end of the input sequence |
xentara::utils::string::Converter< OutputCharT, InputIterator, InputSentinel >::Converter | ( | std::basic_string_view< InputChar > | input | ) |
Constructor for converting a string view.
input | The input sequence |
xentara::utils::string::Converter< OutputCharT, InputIterator, InputSentinel >::Converter | ( | InputIterator | begin, |
InputSentinel | end, | ||
std::in_place_type_t< OutputChar > | |||
) |
Constructor with a type marker for the output type.
begin | The beginning of the input sequence |
end | The end of the input sequence |
xentara::utils::string::Converter< OutputCharT, InputIterator, InputSentinel >::Converter | ( | std::basic_string_view< InputChar > | input, |
std::in_place_type_t< OutputChar > | |||
) |
Constructor for converting a string view with a type marker for the output type.
input | The input sequence |
auto xentara::utils::string::Converter< OutputCharT, InputIterator, InputSentinel >::convert | ( | OutputIterator | output, |
OutputSentinel | outputEnd = std::unreachable_sentinel |
||
) | -> OutputIterator |
Converts a chunk of a string using an output iterator.
This function converts as many characters from the input sequence as can be written to an output iterator. Illegal code points (high and low surrogates, and code points higher than U+10FFFF) and non-decodable input values are replaced by the replacement character.
You can check whether the conversion has completed by calling isDone().
output | An output iterator for the output sequence |
outputEnd | A sentinel to mark the end of the output sequence |
|
static |
Calculates the size of a converted character sequence.
auto xentara::utils::string::Converter< OutputCharT, InputIterator, InputSentinel >::isDone | ( | ) | const -> bool |
Determines whether the input sequence has been converted completely.
true
if all characters in the input sequence have been converted an written to the output sequence. Returns false
if convert() needs to be called again with more buffer space.
|
staticconstexpr |
Determines whether the conversion is a NOOP.