Ada 4.1.1
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 <cstddef>
12#include <cstdint>
13#include <optional>
14#include <string>
15#include <string_view>
16
25namespace ada::unicode {
26
68bool to_ascii(std::optional<std::string>& out, std::string_view plain,
69 size_t first_percent);
70
78ada_really_inline bool has_tabs_or_newline(
79 std::string_view user_input) noexcept;
80
86ada_really_inline constexpr bool is_forbidden_host_code_point(char c) noexcept;
87
93ada_really_inline constexpr bool contains_forbidden_domain_code_point(
94 const char* input, size_t length) noexcept;
95
103ada_really_inline constexpr uint8_t
104contains_forbidden_domain_code_point_or_upper(const char* input,
105 size_t length) noexcept;
106
112ada_really_inline constexpr bool is_forbidden_domain_code_point(
113 char c) noexcept;
114
119ada_really_inline constexpr bool is_alnum_plus(char c) noexcept;
120
128ada_really_inline constexpr bool is_ascii_hex_digit(char c) noexcept;
129
135ada_really_inline constexpr bool is_ascii_digit(char c) noexcept;
136
142ada_really_inline constexpr bool is_ascii(char32_t c) noexcept;
143
152ada_really_inline constexpr bool is_c0_control_or_space(char c) noexcept;
153
160ada_really_inline constexpr bool is_ascii_tab_or_newline(char c) noexcept;
161
167ada_really_inline constexpr bool is_double_dot_path_segment(
168 std::string_view input) noexcept;
169
175ada_really_inline constexpr bool is_single_dot_path_segment(
176 std::string_view input) noexcept;
177
182ada_really_inline constexpr bool is_lowercase_hex(char c) noexcept;
183
189ada_really_inline unsigned constexpr convert_hex_to_binary(char c) noexcept;
190
200std::string percent_decode(std::string_view input, size_t first_percent);
201
210std::string form_urlencoded_decode(std::string_view input);
211
217std::string percent_encode(std::string_view input,
218 const uint8_t character_set[]);
225std::string percent_encode(std::string_view input,
226 const uint8_t character_set[], size_t index);
235template <bool append>
236bool percent_encode(std::string_view input, const uint8_t character_set[],
237 std::string& out);
243ada_really_inline size_t percent_encode_index(std::string_view input,
244 const uint8_t character_set[]);
250constexpr bool to_lower_ascii(char* input, size_t length) noexcept;
251} // namespace ada::unicode
252
253#endif // ADA_UNICODE_H
Cross-platform compiler macros and common definitions.
#define ada_really_inline
Definition common_defs.h:85
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:24
std::string form_urlencoded_decode(std::string_view input)
Definition unicode.cpp:538