Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
text_utf8.hpp File Reference
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <string>

Go to the source code of this file.

Classes

struct  pulp::canvas::detail::Utf8ScalarForOffsets

Namespaces

namespace  pulp
namespace  pulp::canvas
namespace  pulp::canvas::detail

Functions

std::size_t pulp::canvas::cluster_step (const std::string &text, std::size_t byte_offset, bool forward=true)
 Grapheme-aware cursor step for TextEditor.
std::size_t pulp::canvas::safe_utf8_prefix_size (const std::string &text, std::size_t byte_index) noexcept
 Return the largest prefix length <= byte_index that ends on a valid UTF-8 scalar boundary.
bool pulp::canvas::detail::utf8_continuation (unsigned char b) noexcept
Utf8ScalarForOffsets pulp::canvas::detail::decode_utf8_scalar_for_offsets (const std::string &text, std::size_t i) noexcept
std::size_t pulp::canvas::detail::utf16_units_for_codepoint (std::uint32_t cp) noexcept
std::size_t pulp::canvas::utf8_offset_for_utf16_offset (const std::string &text, std::size_t utf16_offset) noexcept
 Convert a UTF-16 code-unit offset into the nearest safe UTF-8 byte offset.
std::size_t pulp::canvas::utf16_offset_for_utf8_offset (const std::string &text, std::size_t byte_offset) noexcept
 Convert a UTF-8 byte offset into a UTF-16 code-unit offset.
bool pulp::canvas::is_utf16_scalar_boundary (const std::string &text, std::size_t utf16_offset) noexcept
 True when a UTF-16 code-unit offset falls between Unicode scalars rather than between the two code units of a surrogate pair.
bool pulp::canvas::is_valid_utf16_scalar_range (const std::string &text, std::int64_t start, std::int64_t length, std::int64_t minimum_start=0) noexcept
 Validate one positive, non-overlapping UTF-16 range against UTF-8 text.