Ada 2.8.0
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
unicode.h
Go to the documentation of this file.
1
5#ifndef ADA_UNICODE_H
6#define ADA_UNICODE_H
7
8#include "ada/common_defs.h"
9#include "ada/ada_idna.h"
10
11#include <string>
12#include <optional>
13
22namespace ada::unicode {
23
65bool to_ascii(std::optional<std::string>& out, std::string_view plain,
66 size_t first_percent);
67
72std::string to_unicode(std::string_view input);
73
81ada_really_inline bool has_tabs_or_newline(
82 std::string_view user_input) noexcept;
83
89ada_really_inline constexpr bool is_forbidden_host_code_point(char c) noexcept;
90
97 const char* input, size_t length) noexcept;
98
106ada_really_inline constexpr uint8_t
107contains_forbidden_domain_code_point_or_upper(const char* input,
108 size_t length) noexcept;
109
115ada_really_inline constexpr bool is_forbidden_domain_code_point(
116 char c) noexcept;
117
122ada_really_inline constexpr bool is_alnum_plus(char c) noexcept;
123
131ada_really_inline constexpr bool is_ascii_hex_digit(char c) noexcept;
132
141ada_really_inline constexpr bool is_c0_control_or_space(char c) noexcept;
142
149ada_really_inline constexpr bool is_ascii_tab_or_newline(char c) noexcept;
150
156ada_really_inline ada_constexpr bool is_double_dot_path_segment(
157 std::string_view input) noexcept;
158
164ada_really_inline constexpr bool is_single_dot_path_segment(
165 std::string_view input) noexcept;
166
171ada_really_inline constexpr bool is_lowercase_hex(char c) noexcept;
172
178ada_really_inline unsigned constexpr convert_hex_to_binary(char c) noexcept;
179
189std::string percent_decode(std::string_view input, size_t first_percent);
190
196std::string percent_encode(std::string_view input,
197 const uint8_t character_set[]);
204std::string percent_encode(std::string_view input,
205 const uint8_t character_set[], size_t index);
214template <bool append>
215bool percent_encode(std::string_view input, const uint8_t character_set[],
216 std::string& out);
222ada_really_inline size_t percent_encode_index(std::string_view input,
223 const uint8_t character_set[]);
229constexpr bool to_lower_ascii(char* input, size_t length) noexcept;
230} // namespace ada::unicode
231
232#endif // ADA_UNICODE_H
Common definitions for cross-platform compiler support.
#define ada_constexpr
#define ada_really_inline
Definition common_defs.h:84
std::string to_ascii(std::string_view ut8_string)
std::string to_unicode(std::string_view input)
bool contains_forbidden_domain_code_point(std::string_view ascii_string)
Includes the declarations for unicode operations.
ada_really_inline size_t percent_encode_index(const std::string_view input, const uint8_t character_set[])
Definition unicode-inl.h:19