Ada 3.1.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 <string_view>
13#include <optional>
14
23namespace ada::unicode {
24
66bool to_ascii(std::optional<std::string>& out, std::string_view plain,
67 size_t first_percent);
68
76ada_really_inline bool has_tabs_or_newline(
77 std::string_view user_input) noexcept;
78
84ada_really_inline constexpr bool is_forbidden_host_code_point(char c) noexcept;
85
91ada_really_inline constexpr bool contains_forbidden_domain_code_point(
92 const char* input, size_t length) noexcept;
93
101ada_really_inline constexpr uint8_t
102contains_forbidden_domain_code_point_or_upper(const char* input,
103 size_t length) noexcept;
104
110ada_really_inline constexpr bool is_forbidden_domain_code_point(
111 char c) noexcept;
112
117ada_really_inline constexpr bool is_alnum_plus(char c) noexcept;
118
126ada_really_inline constexpr bool is_ascii_hex_digit(char c) noexcept;
127
133ada_really_inline constexpr bool is_ascii_digit(char c) noexcept;
134
140ada_really_inline constexpr bool is_ascii(char32_t c) noexcept;
141
150ada_really_inline constexpr bool is_c0_control_or_space(char c) noexcept;
151
158ada_really_inline constexpr bool is_ascii_tab_or_newline(char c) noexcept;
159
165ada_really_inline constexpr bool is_double_dot_path_segment(
166 std::string_view input) noexcept;
167
173ada_really_inline constexpr bool is_single_dot_path_segment(
174 std::string_view input) noexcept;
175
180ada_really_inline constexpr bool is_lowercase_hex(char c) noexcept;
181
187ada_really_inline unsigned constexpr convert_hex_to_binary(char c) noexcept;
188
198std::string percent_decode(std::string_view input, size_t first_percent);
199
205std::string percent_encode(std::string_view input,
206 const uint8_t character_set[]);
213std::string percent_encode(std::string_view input,
214 const uint8_t character_set[], size_t index);
223template <bool append>
224bool percent_encode(std::string_view input, const uint8_t character_set[],
225 std::string& out);
231ada_really_inline size_t percent_encode_index(std::string_view input,
232 const uint8_t character_set[]);
238constexpr bool to_lower_ascii(char* input, size_t length) noexcept;
239} // namespace ada::unicode
240
241#endif // ADA_UNICODE_H
Common definitions for cross-platform compiler support.
#define ada_really_inline
Definition common_defs.h:81
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