🔨 basic_text_view (In Progress)
Warning
🔨 This isn’t finished yet! Come check back by the next major or minor version update.
The basic_text_view
class provides a one-by-one view of the stored range’s code points and other functionality in a more complete form that goes beyond just code point iteration or code unit iteration like ztd::text::decode_view or ztd::text::encode_view.
Base Template
-
template<typename _Encoding, typename _NormalizationForm = nfkc, typename _Range = ::std::basic_string_view<code_unit_t<_Encoding>>, typename _ErrorHandler = default_handler_t, typename _State = decode_state_t<remove_cvref_t<_Encoding>>>
class basic_text_view A view over a sequence of code units. The code units are expected to be of the given encoding and normalization form.
Remark
The default type for this is a basic_string_view templated on the code unit type from the encoding. The error handler is also the default careless error handler, meaning that any lossy conversions will automatically cause a compile time error.
- Template Parameters
_Encoding – The encoding to store any input and presented text as.
_NormalizationForm – The normalization form to impose on the stored text’s sequences.
_Range – The range type that will be stored within this ztd::text::basic_text_view and examined using the iterators, following the
_Encoding
type decoding procedure._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 encoding_type = _Encoding
The encoding type that this view is using to interpret the underlying sequence of code units.
-
using state_type = remove_cvref_t<_State>
The encoding type that this view is using to interpret the underlying sequence of code units.
-
using normalization_type = _NormalizationForm
The normalization form type this view is imposing on top of the encoded sequence.
-
using error_handler_type = _ErrorHandler
The error handling type used by default for any problems in conversions.
Public Functions
-
template<typename _ViewErrorHandler>
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.
Aliases
-
using ztd::text::text_view = u8text_view
A shortcut for u8text_view.
-
using ztd::text::ntext_view = basic_text_view<execution_t>
A view for examining text in the locale, runtime-based wide encoding.
-
using ztd::text::wtext_view = basic_text_view<wide_execution_t>
A view for examining text in the locale, runtime-based wide encoding.
-
using ztd::text::nltext_view = basic_text_view<literal_t>
A view for examining text in the string literal_t encoding.
-
using ztd::text::wltext_view = basic_text_view<wide_literal_t>
A view for examining text in the wide string literal_t encoding.
-
using ztd::text::u8text_view = basic_text_view<utf8_t>
A view for examining text in the UTF-8 encoding.
-
using ztd::text::u16text_view = basic_text_view<utf16_t>
A view for examining text in the UTF-16 encoding.
-
using ztd::text::u32text_view = basic_text_view<utf32_t>
A view for examining text in the UTF-32 encoding.