🔨 basic_text (In Progress)

Warning

🔨 This isn’t finished yet! Come check back by the next major or minor version update.

The basic_text class provides functionality similar to std::string but for performing it on encoded, normalized text.

template<typename _Encoding, typename _NormalizationForm = nfkc, typename _Container = ::std::basic_string<code_unit_t<_Encoding>>, typename _ErrorHandler = default_handler_t>
class ztd::text::basic_text : private basic_text_view<_Encoding, _NormalizationForm, _Container, _ErrorHandler>

A wrapper (container adapter) that takes the given _Encoding type and _NormalizationForm type and imposes it over the given chosen _Container storage for the purposes of allowing users to examine the text.

tparam _Encoding

The encoding to store any input and presented text as.

tparam _NormalizationForm

The normalization form to impose on the stored text’s sequences.

tparam _Container

The container type that will be stored within this ztd::text::basic_text using the code units from the _Encoding type.

tparam _ErrorHandler

The default error handler to use for any and all operations on text. Generally, most operations will provide room to override this.

Public Types

using range_type = typename __base_t::range_type

The type that this view is wrapping.

using encoding_type = typename __base_t::encoding_type

The encoding type that this view is using to interpret the underlying sequence of code units.

using state_type = typename __base_t::state_type

The encoding type that this view is using to interpret the underlying sequence of code units.

using normalization_type = typename __base_t::normalization_type

The normalization form type this view is imposing on top of the encoded sequence.

using error_handler_type = typename __base_t::error_handler_type

The error handling type used by default for any problems in conversions.

Private Functions

inline constexpr _CodePointView<_ViewErrorHandler> code_points(state_type __state, _ViewErrorHandler &&__error_handler) const noexcept

Returns a view over the code points of this type, decoding “on the fly”/”lazily”.

Remark

Moves the provided __state in as the “starting point”.

Template Parameters

_ViewErrorHandler – The type of the passed-in error handler to use for these operations.

Parameters
  • __state[in] The state to use for this code point view.

  • __error_handler[in] The error handler to look at the code points for this code point view.

inline constexpr _CodePointView code_points(state_type __state) const noexcept

Returns a view over the code points of this type, decoding “on the fly”/”lazily”.

Remark

Moves the provided __state in as the “starting point”.

Parameters

__state[in] The state to use for this code point view.

inline constexpr _CodePointView code_points() const noexcept

Returns a view over the code points of this type, decoding “on the fly”/”lazily”.

Remark

Copies the stored state within the ztd::text::basic_text_view to perform the code point iteration process.

inline constexpr range_type &&base() && noexcept

Access the storage as an r-value reference.

inline constexpr const range_type &base() const & noexcept

Access the storage as a const-qualified l-value reference.

inline constexpr range_type &base() & noexcept

Access the storage as an l-value reference.

using ztd::text::text = basic_text<execution_t>

A container for storing text in the locale, runtime-based encoding.

using ztd::text::wtext = basic_text<wide_execution_t>

A container for storing text in the locale, runtime-based wide encoding.

using ztd::text::ltext = basic_text<literal_t>

A container for storing text in the string literal_t encoding.

using ztd::text::wltext = basic_text<wide_literal_t>

A container for storing text in the wide string literal_t encoding.

using ztd::text::u8text = basic_text<utf8_t>

A container for storing text in the UTF-8 encoding.

using ztd::text::u16text = basic_text<utf16_t>

A container for storing text in the UTF-16 encoding.

using ztd::text::u32text = basic_text<utf32_t>

A container for storing text in the UTF-32 encoding.