Ada 4.1.1
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
ada_idna.cpp File Reference
#include <string>
#include <string_view>
#include <algorithm>
#include <cstdint>
#include <cstring>
#include <array>
#include <cstddef>
#include <atomic>
#include <bit>
#include <new>
#include <span>
#include <ranges>

Go to the source code of this file.

Classes

struct  ada::idna::deflate::BitReader
struct  ada::idna::deflate::Huff

Namespaces

namespace  ada
namespace  ada::idna
namespace  ada::idna::deflate
namespace  ada::idna::table_blob
namespace  ada::idna::detail

Macros

#define ADA_IDNA_UNICODE_TRANSCODING_H
#define ADA_IDNA_MAPPING_H
#define ADA_IDNA_TABLE_BLOB_H
#define ADA_IDNA_SECTION_IN_BOUNDS(off, count, width)
#define ADA_IDNA_MAPPING_TABLE_H
#define ADA_IDNA_NORMALIZATION_H
#define ADA_IDNA_NORMALIZATION_TABLES_H
#define ADA_IDNA_PUNYCODE_H
#define ADA_IDNA_TO_ASCII_H
#define ADA_IDNA_LIMITS_H
#define ADA_IDNA_VALIDITY_H
#define ADA_IDNA_TO_UNICODE_H
#define ADA_IDNA_H
#define ADA_IDNA_IDENTIFIER_H
#define ADA_IDNA_IDENTIFIER_TABLES_H

Enumerations

enum  ada::idna::direction : uint8_t {
  ada::idna::NONE , ada::idna::BN , ada::idna::CS , ada::idna::ES ,
  ada::idna::ON , ada::idna::EN , ada::idna::L , ada::idna::R ,
  ada::idna::NSM , ada::idna::AL , ada::idna::AN , ada::idna::ET ,
  ada::idna::WS , ada::idna::RLO , ada::idna::LRO , ada::idna::PDF ,
  ada::idna::RLE , ada::idna::RLI , ada::idna::FSI , ada::idna::PDI ,
  ada::idna::LRI , ada::idna::B , ada::idna::S , ada::idna::LRE ,
  ada::idna::NONE , ada::idna::BN , ada::idna::CS , ada::idna::ES ,
  ada::idna::ON , ada::idna::EN , ada::idna::L , ada::idna::R ,
  ada::idna::NSM , ada::idna::AL , ada::idna::AN , ada::idna::ET ,
  ada::idna::WS , ada::idna::RLO , ada::idna::LRO , ada::idna::PDF ,
  ada::idna::RLE , ada::idna::RLI , ada::idna::FSI , ada::idna::PDI ,
  ada::idna::LRI , ada::idna::B , ada::idna::S , ada::idna::LRE ,
  ada::idna::NONE , ada::idna::BN , ada::idna::CS , ada::idna::ES ,
  ada::idna::ON , ada::idna::EN , ada::idna::L , ada::idna::R ,
  ada::idna::NSM , ada::idna::AL , ada::idna::AN , ada::idna::ET ,
  ada::idna::WS , ada::idna::RLO , ada::idna::LRO , ada::idna::PDF ,
  ada::idna::RLE , ada::idna::RLI , ada::idna::FSI , ada::idna::PDI ,
  ada::idna::LRI , ada::idna::B , ada::idna::S , ada::idna::LRE
}
enum class  ada::idna::joining_type : uint8_t {
  ada::idna::U , ada::idna::C , ada::idna::D , ada::idna::L ,
  ada::idna::R , ada::idna::T , ada::idna::U , ada::idna::C ,
  ada::idna::D , ada::idna::L , ada::idna::R , ada::idna::T ,
  ada::idna::U , ada::idna::C , ada::idna::D , ada::idna::L ,
  ada::idna::R , ada::idna::T
}

Functions

size_t ada::idna::utf8_to_utf32 (const char *buf, size_t len, char32_t *utf32_output)
size_t ada::idna::utf8_length_from_utf32 (const char32_t *buf, size_t len)
size_t ada::idna::utf32_length_from_utf8 (const char *buf, size_t len)
size_t ada::idna::utf32_to_utf8 (const char32_t *buf, size_t len, char *utf8_output)
void ada::idna::ascii_map (char *input, size_t length)
std::u32string ada::idna::map (std::u32string_view input)
bool ada::idna::map (std::u32string_view input, std::u32string &out)
Huff ada::idna::deflate::make_fixed_litlen_huff ()
Huff ada::idna::deflate::make_fixed_dist_huff ()
int ada::idna::deflate::fixed_litlen (BitReader &br)
int ada::idna::deflate::fixed_dist (BitReader &br)
size_t ada::idna::deflate::inflate_raw (const uint8_t *src, size_t src_len, uint8_t *dst, size_t dst_cap)
template<typename T>
void ada::idna::detail::bswap_inplace (T *data, size_t count) noexcept
void ada::idna::detail::convert_table_blob_to_host_endian (uint8_t *buffer) noexcept
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_idna_stage1, table_blob::count_idna_stage1, 2)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_idna_stage2, table_blob::count_idna_stage2, 2)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_idna_bool_blocks, table_blob::count_idna_bool_blocks, 8)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_idna_utf8_mappings, table_blob::count_idna_utf8_mappings, 1)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_decomposition_index, table_blob::count_decomposition_index, 1)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_decomposition_block, table_blob::count_decomposition_block, 2)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_decomposition_data, table_blob::count_decomposition_data, 4)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_ccc_index, table_blob::count_ccc_index, 1)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_ccc_block, table_blob::count_ccc_block, 1)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_composition_index, table_blob::count_composition_index, 1)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_composition_block, table_blob::count_composition_block, 2)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_composition_data, table_blob::count_composition_data, 4)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_id_continue_flat, table_blob::count_id_continue_flat, 4)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_id_start_flat, table_blob::count_id_start_flat, 4)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_dir_start, table_blob::count_dir_start, 4)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_dir_final, table_blob::count_dir_final, 4)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_dir_value, table_blob::count_dir_value, 1)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_combining_flat, table_blob::count_combining_flat, 4)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_joining_start, table_blob::count_joining_start, 4)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_joining_final, table_blob::count_joining_final, 4)
 ada::idna::ADA_IDNA_SECTION_IN_BOUNDS (table_blob::off_joining_value, table_blob::count_joining_value, 1)
uint32_t ada::idna::crc32_ieee (const uint8_t *data, size_t len) noexcept
bool ada::idna::tables_are_ready () noexcept
bool ada::idna::ensure_tables () noexcept
const uint16_t * ada::idna::decomposition_block_row (uint8_t bi) noexcept
const uint8_t * ada::idna::ccc_block_row (uint8_t bi) noexcept
const uint16_t * ada::idna::composition_block_row (uint8_t bi) noexcept
static uint16_t ada::idna::idna_lookup (uint32_t cp) noexcept
static char32_t ada::idna::utf8_next (const uint8_t *&ptr) noexcept
static size_t ada::idna::utf8_count_codepoints (const uint8_t *ptr) noexcept
bool ada::idna::is_already_nfc (std::u32string_view input) noexcept
bool ada::idna::normalize (std::u32string &input)
static size_t ada::idna::canonical_decomp_length (char32_t current_character) noexcept
std::pair< bool, size_t > ada::idna::compute_decomposition_length (const std::u32string_view input) noexcept
void ada::idna::decompose (std::u32string &input, size_t additional_elements)
uint8_t ada::idna::get_ccc (char32_t c) noexcept
void ada::idna::sort_marks (std::u32string &input)
void ada::idna::decompose_nfc (std::u32string &input)
static bool ada::idna::has_composition (const uint16_t *composition, char32_t second) noexcept
static bool ada::idna::would_compose (std::u32string_view input) noexcept
static uint8_t ada::idna::trailing_ccc (char32_t c) noexcept
void ada::idna::compose (std::u32string &input)
static bool ada::idna::decomposition_is_not_nfc (char32_t previous, char32_t c) noexcept
bool ada::idna::punycode_to_utf32 (std::string_view input, std::u32string &out)
bool ada::idna::verify_punycode (std::string_view input)
bool ada::idna::utf32_to_punycode (std::u32string_view input, std::string &out)
static constexpr int32_t ada::idna::char_to_digit_value (char value)
static constexpr char ada::idna::digit_to_char (int32_t digit)
static constexpr int32_t ada::idna::adapt (int32_t d, int32_t n, bool firsttime)
static size_t ada::idna::find_range (const uint32_t *start, const uint32_t *last, size_t count, uint32_t code_point) noexcept
static direction ada::idna::find_direction (uint32_t code_point) noexcept
static joining_type ada::idna::find_joining_type (uint32_t code_point) noexcept
static bool ada::idna::is_contextj_valid (std::u32string_view label) noexcept
static size_t ada::idna::find_last_not_of_nsm (const std::u32string_view label) noexcept
static bool ada::idna::is_rtl_label (const std::u32string_view label) noexcept
static bool ada::idna::label_contains_rtl (std::u32string_view label) noexcept
static bool ada::idna::check_label (const std::u32string_view label, bool bidi_domain)
bool ada::idna::is_label_valid (std::u32string_view label)
std::string ada::idna::to_ascii (std::string_view ut8_string)
bool ada::idna::to_ascii (std::string_view ut8_string, std::string &out)
bool ada::idna::contains_forbidden_domain_code_point (std::string_view ascii_string)
bool constexpr ada::idna::is_ascii (std::u32string_view view)
bool constexpr ada::idna::is_ascii (std::string_view view)
bool ada::idna::is_forbidden_domain_code_point (const char c) noexcept
static void ada::idna::from_ascii_to_ascii (std::string_view ut8_string, std::string &out)
static void ada::idna::append_ascii_label (std::string &out, std::u32string_view label)
static bool ada::idna::is_ace_prefix (std::u32string_view label) noexcept
static bool ada::idna::mapped_domain_is_bidi (std::u32string_view mapped)
std::string ada::idna::to_unicode (std::string_view input)
bool ada::idna::to_unicode (std::string_view input, std::string &out)
bool ada::idna::valid_name_code_point (char32_t code_point, bool first)
static bool ada::idna::ascii_label_fails_bidi_domain (std::string_view label)
static bool ada::idna::utf8_domain_is_bidi (std::string_view input)
constexpr bool ada::idna::is_ascii_letter (char32_t c) noexcept
constexpr bool ada::idna::is_ascii_letter_or_digit (char32_t c) noexcept

Variables

static const uint16_t ada::idna::deflate::len_base [29]
static const uint8_t ada::idna::deflate::len_extra [29]
static const uint16_t ada::idna::deflate::dist_base [30]
static const uint8_t ada::idna::deflate::dist_extra [30]
static constexpr uint8_t ada::idna::is_forbidden_domain_code_point_table []

Macro Definition Documentation

◆ ADA_IDNA_H

#define ADA_IDNA_H

Definition at line 6735 of file ada_idna.cpp.

◆ ADA_IDNA_IDENTIFIER_H

#define ADA_IDNA_IDENTIFIER_H

Definition at line 6739 of file ada_idna.cpp.

◆ ADA_IDNA_IDENTIFIER_TABLES_H

#define ADA_IDNA_IDENTIFIER_TABLES_H

Definition at line 6951 of file ada_idna.cpp.

◆ ADA_IDNA_LIMITS_H

#define ADA_IDNA_LIMITS_H

Definition at line 6366 of file ada_idna.cpp.

◆ ADA_IDNA_MAPPING_H

#define ADA_IDNA_MAPPING_H

Definition at line 210 of file ada_idna.cpp.

◆ ADA_IDNA_MAPPING_TABLE_H

#define ADA_IDNA_MAPPING_TABLE_H

Definition at line 5112 of file ada_idna.cpp.

◆ ADA_IDNA_NORMALIZATION_H

#define ADA_IDNA_NORMALIZATION_H

Definition at line 5301 of file ada_idna.cpp.

◆ ADA_IDNA_NORMALIZATION_TABLES_H

#define ADA_IDNA_NORMALIZATION_TABLES_H

Definition at line 5327 of file ada_idna.cpp.

◆ ADA_IDNA_PUNYCODE_H

#define ADA_IDNA_PUNYCODE_H

Definition at line 5766 of file ada_idna.cpp.

◆ ADA_IDNA_SECTION_IN_BOUNDS

#define ADA_IDNA_SECTION_IN_BOUNDS ( off,
count,
width )
Value:
static_assert((off) + (count) * (width) <= table_blob::uncompressed_size, \
#off " overflows uncompressed buffer")

Definition at line 4820 of file ada_idna.cpp.

◆ ADA_IDNA_TABLE_BLOB_H

#define ADA_IDNA_TABLE_BLOB_H

Definition at line 529 of file ada_idna.cpp.

◆ ADA_IDNA_TO_ASCII_H

#define ADA_IDNA_TO_ASCII_H

Definition at line 6359 of file ada_idna.cpp.

◆ ADA_IDNA_TO_UNICODE_H

#define ADA_IDNA_TO_UNICODE_H

Definition at line 6707 of file ada_idna.cpp.

◆ ADA_IDNA_UNICODE_TRANSCODING_H

#define ADA_IDNA_UNICODE_TRANSCODING_H

Definition at line 6 of file ada_idna.cpp.

◆ ADA_IDNA_VALIDITY_H

#define ADA_IDNA_VALIDITY_H

Definition at line 6421 of file ada_idna.cpp.