Ada
3.4.3
Fast spec-compliant URL parser
Toggle main menu visibility
Loading...
Searching...
No Matches
ada_idna.h
Go to the documentation of this file.
1
/* auto-generated on 2026-01-30 12:00:02 -0500. Do not edit! */
2
/* begin file include/idna.h */
3
#ifndef ADA_IDNA_H
4
#define ADA_IDNA_H
5
6
/* begin file include/ada/idna/unicode_transcoding.h */
7
#ifndef ADA_IDNA_UNICODE_TRANSCODING_H
8
#define ADA_IDNA_UNICODE_TRANSCODING_H
9
10
#include <string>
11
#include <string_view>
12
13
namespace
ada::idna
{
14
15
size_t
utf8_to_utf32
(
const
char
* buf,
size_t
len,
char32_t
* utf32_output);
16
17
size_t
utf8_length_from_utf32
(
const
char32_t
* buf,
size_t
len);
18
19
size_t
utf32_length_from_utf8
(
const
char
* buf,
size_t
len);
20
21
size_t
utf32_to_utf8
(
const
char32_t
* buf,
size_t
len,
char
* utf8_output);
22
23
}
// namespace ada::idna
24
25
#endif
// ADA_IDNA_UNICODE_TRANSCODING_H
26
/* end file include/ada/idna/unicode_transcoding.h */
27
/* begin file include/ada/idna/mapping.h */
28
#ifndef ADA_IDNA_MAPPING_H
29
#define ADA_IDNA_MAPPING_H
30
31
#include <string>
32
#include <string_view>
33
34
namespace
ada::idna
{
35
36
// If the input is ascii, then the mapping is just -> lower case.
37
void
ascii_map
(
char
* input,
size_t
length);
38
// Map the characters according to IDNA, returning the empty string on error.
39
std::u32string
map
(std::u32string_view input);
40
41
}
// namespace ada::idna
42
43
#endif
44
/* end file include/ada/idna/mapping.h */
45
/* begin file include/ada/idna/normalization.h */
46
#ifndef ADA_IDNA_NORMALIZATION_H
47
#define ADA_IDNA_NORMALIZATION_H
48
49
#include <string>
50
#include <string_view>
51
52
namespace
ada::idna
{
53
54
// Normalize the characters according to IDNA (Unicode Normalization Form C).
55
void
normalize
(std::u32string& input);
56
57
}
// namespace ada::idna
58
#endif
59
/* end file include/ada/idna/normalization.h */
60
/* begin file include/ada/idna/punycode.h */
61
#ifndef ADA_IDNA_PUNYCODE_H
62
#define ADA_IDNA_PUNYCODE_H
63
64
#include <string>
65
#include <string_view>
66
67
namespace
ada::idna
{
68
69
bool
punycode_to_utf32
(std::string_view input, std::u32string& out);
70
bool
verify_punycode
(std::string_view input);
71
bool
utf32_to_punycode
(std::u32string_view input, std::string& out);
72
73
}
// namespace ada::idna
74
75
#endif
// ADA_IDNA_PUNYCODE_H
76
/* end file include/ada/idna/punycode.h */
77
/* begin file include/ada/idna/validity.h */
78
#ifndef ADA_IDNA_VALIDITY_H
79
#define ADA_IDNA_VALIDITY_H
80
81
#include <string>
82
#include <string_view>
83
84
namespace
ada::idna
{
85
89
bool
is_label_valid
(std::u32string_view label);
90
91
}
// namespace ada::idna
92
93
#endif
// ADA_IDNA_VALIDITY_H
94
/* end file include/ada/idna/validity.h */
95
/* begin file include/ada/idna/to_ascii.h */
96
#ifndef ADA_IDNA_TO_ASCII_H
97
#define ADA_IDNA_TO_ASCII_H
98
99
#include <string>
100
#include <string_view>
101
102
namespace
ada::idna
{
103
104
// Converts a domain (e.g., www.google.com) possibly containing international
105
// characters to an ascii domain (with punycode). It will not do percent
106
// decoding: percent decoding should be done prior to calling this function. We
107
// do not remove tabs and spaces, they should have been removed prior to calling
108
// this function. We also do not trim control characters. We also assume that
109
// the input is not empty. We return "" on error.
110
//
111
//
112
// This function may accept or even produce invalid domains.
113
std::string
to_ascii
(std::string_view ut8_string);
114
115
// Returns true if the string contains a forbidden code point according to the
116
// WHATGL URL specification:
117
// https://url.spec.whatwg.org/#forbidden-domain-code-point
118
bool
contains_forbidden_domain_code_point
(std::string_view ascii_string);
119
120
bool
constexpr
is_ascii
(std::u32string_view view);
121
bool
constexpr
is_ascii
(std::string_view view);
122
123
}
// namespace ada::idna
124
125
#endif
// ADA_IDNA_TO_ASCII_H
126
/* end file include/ada/idna/to_ascii.h */
127
/* begin file include/ada/idna/to_unicode.h */
128
129
#ifndef ADA_IDNA_TO_UNICODE_H
130
#define ADA_IDNA_TO_UNICODE_H
131
132
#include <string_view>
133
134
namespace
ada::idna
{
135
136
std::string
to_unicode
(std::string_view input);
137
138
}
// namespace ada::idna
139
140
#endif
// ADA_IDNA_TO_UNICODE_H
141
/* end file include/ada/idna/to_unicode.h */
142
/* begin file include/ada/idna/identifier.h */
143
#ifndef ADA_IDNA_IDENTIFIER_H
144
#define ADA_IDNA_IDENTIFIER_H
145
146
#include <string>
147
#include <string_view>
148
149
namespace
ada::idna
{
150
151
// Verify if it is valid name code point given a Unicode code point and a
152
// boolean first: If first is true return the result of checking if code point
153
// is contained in the IdentifierStart set of code points. Otherwise return the
154
// result of checking if code point is contained in the IdentifierPart set of
155
// code points. Returns false if the input is empty or the code point is not
156
// valid. There is minimal Unicode error handling: the input should be valid
157
// UTF-8. https://urlpattern.spec.whatwg.org/#is-a-valid-name-code-point
158
bool
valid_name_code_point
(
char32_t
code_point,
bool
first);
159
160
}
// namespace ada::idna
161
162
#endif
163
/* end file include/ada/idna/identifier.h */
164
165
#endif
166
/* end file include/idna.h */
ada::idna
Definition
ada_idna.h:13
ada::idna::ascii_map
void ascii_map(char *input, size_t length)
Definition
ada_idna.cpp:2678
ada::idna::punycode_to_utf32
bool punycode_to_utf32(std::string_view input, std::u32string &out)
Definition
ada_idna.cpp:7902
ada::idna::utf32_length_from_utf8
size_t utf32_length_from_utf8(const char *buf, size_t len)
Definition
ada_idna.cpp:122
ada::idna::utf32_to_utf8
size_t utf32_to_utf8(const char32_t *buf, size_t len, char *utf8_output)
Definition
ada_idna.cpp:131
ada::idna::is_ascii
bool constexpr is_ascii(std::u32string_view view)
Definition
ada_idna.cpp:9435
ada::idna::normalize
void normalize(std::u32string &input)
Definition
ada_idna.cpp:7852
ada::idna::utf32_to_punycode
bool utf32_to_punycode(std::u32string_view input, std::string &out)
Definition
ada_idna.cpp:8027
ada::idna::to_ascii
std::string to_ascii(std::string_view ut8_string)
Definition
ada_idna.cpp:9539
ada::idna::to_unicode
std::string to_unicode(std::string_view input)
Definition
ada_idna.cpp:9655
ada::idna::valid_name_code_point
bool valid_name_code_point(char32_t code_point, bool first)
Definition
ada_idna.cpp:10297
ada::idna::utf8_length_from_utf32
size_t utf8_length_from_utf32(const char32_t *buf, size_t len)
Definition
ada_idna.cpp:109
ada::idna::is_label_valid
bool is_label_valid(std::u32string_view label)
Definition
ada_idna.cpp:8895
ada::idna::contains_forbidden_domain_code_point
bool contains_forbidden_domain_code_point(std::string_view ascii_string)
Definition
ada_idna.cpp:9472
ada::idna::map
std::u32string map(std::u32string_view input)
Definition
ada_idna.cpp:2704
ada::idna::utf8_to_utf32
size_t utf8_to_utf32(const char *buf, size_t len, char32_t *utf32_output)
Definition
ada_idna.cpp:12
ada::idna::verify_punycode
bool verify_punycode(std::string_view input)
Definition
ada_idna.cpp:7966