59[[nodiscard]]
constexpr bool is_trail(uint8_t oc)
61 return (oc >> 6) == 0x2;
72 (cp !=
one_of(0xfffeu, 0xffffu));
79 }
else if ((lead >> 5) == 0x06) {
81 }
else if ((lead >> 4) == 0x0e) {
83 }
else if ((lead >> 3) == 0x1e) {
99template<
typename octet_iterator>
101 uint32_t* code_point)
103 uint32_t cp = narrow_cast<unsigned char>(*it);
130 cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f);
138 cp = ((cp << 12) & 0xffff) + ((*it << 6) & 0xfff);
152 cp = ((cp << 18) & 0x1fffff) + ((*it << 12) & 0x3ffff);
154 cp += (*it << 6) & 0xfff;
185 }
else if (cp < 0x800) {
190 }
else if (cp < 0x10000) {
201template<
typename octet_iterator>
210template<
typename octet_iterator>
211[[nodiscard]]
constexpr octet_iterator
find_invalid(octet_iterator start, octet_iterator
end)
214 while (result !=
end) {
223template<
typename octet_iterator>
224[[nodiscard]]
constexpr bool is_valid(octet_iterator start, octet_iterator
end)
229template<
typename octet_iterator>
230[[nodiscard]]
constexpr bool is_bom(octet_iterator it)
233 constexpr std::array<uint8_t, 3> bom = {0xef, 0xbb, 0xbf};
235 return ((*it++ == bom[0]) &&
240template<
typename octet_iterator>
247template<
typename octet_iterator>
256[[nodiscard]]
constexpr bool is_pua(uint32_t cp)
258 return ((0x00E000 <= cp) && (cp <= 0x00F8FF)) ||
259 ((0x0F0000 <= cp) && (cp <= 0x0FFFFD)) ||
260 ((0x100000 <= cp) && (cp <= 0x10FFFD));
T length(const vecN< N, T > &x)
constexpr bool is_code_point_valid(uint32_t cp)
constexpr uint16_t LEAD_SURROGATE_MAX
constexpr uint32_t SURROGATE_OFFSET
constexpr uint16_t TRAIL_SURROGATE_MAX
constexpr uint16_t TRAIL_SURROGATE_MIN
constexpr bool is_trail(uint8_t oc)
constexpr uint16_t LEAD_OFFSET
constexpr uint32_t CODE_POINT_MAX
constexpr uint16_t LEAD_SURROGATE_MIN
constexpr bool is_surrogate(uint32_t cp)
constexpr utf_error validate_next(octet_iterator &it, octet_iterator end, uint32_t *code_point)
constexpr unsigned sequence_length(uint8_t lead)
void advance(octet_iterator &it, distance_type n, octet_iterator end)
constexpr octet_iterator find_invalid(octet_iterator start, octet_iterator end)
The library API - functions intended to be called by the users.
constexpr bool is_valid(octet_iterator start, octet_iterator end)
constexpr octet_iterator sync_backward(octet_iterator it)
auto distance(octet_iterator first, octet_iterator last)
constexpr bool is_bom(octet_iterator it)
constexpr octet_iterator sync_forward(octet_iterator it)
constexpr bool is_pua(uint32_t cp)
constexpr void repeat(T n, Op op)
Repeat the given operation 'op' 'n' times.
constexpr auto end(const zstring_view &x)