6#include "TTauri/Foundation/os_detect.hpp"
14constexpr char native_path_seperator = (OperatingSystem::current == OperatingSystem::Windows) ?
'\\' :
'/';
16constexpr bool is_urlchar_alpha(
char c) {
17 return (c >=
'a' && c <=
'z') || (c >=
'A' && c <=
'Z');
20constexpr bool is_urlchar_digit(
char c) {
21 return (c >=
'0' && c <=
'9');
24constexpr bool is_urlchar_gen_delims(
char c) {
25 return c ==
':' || c ==
'/' || c ==
'?' || c ==
'#' || c ==
'[' || c ==
']' || c ==
'@';
28constexpr bool is_urlchar_sub_delims(
char c) {
30 c ==
'!' || c ==
'$' || c ==
'&' || c ==
'\'' || c ==
'(' || c ==
')' ||
31 c ==
'*' || c ==
'+' || c ==
',' || c ==
';' || c ==
'=';
34constexpr bool is_urlchar_unreserved(
char c) {
35 return is_urlchar_alpha(c) || is_urlchar_digit(c) || c ==
'-' || c ==
'.' || c ==
'_' || c ==
'~';
38constexpr bool is_urlchar_reserved(
char c) {
39 return is_urlchar_gen_delims(c) || is_urlchar_sub_delims(c);
42constexpr bool is_urlchar_pchar(
char c) {
43 return is_urlchar_unreserved(c) || is_urlchar_sub_delims(c) || c ==
':' || c ==
'@';
46constexpr bool is_urlchar_pchar_forward(
char c) {
47 return is_urlchar_pchar(c) || c ==
'/';
50constexpr bool is_urlchar_pchar_backward(
char c) {
51 return is_urlchar_pchar(c) || c ==
'\\';
62inline std::string url_encode(std::string_view input)
noexcept {
63 return url_encode_part(input, is_urlchar_unreserved);
76std::string url_decode(std::string_view input,
bool plus_to_space=
false) noexcept;
82 std::string_view scheme;
83 std::string_view authority;
84 std::string_view drive;
87 std::string_view query;
88 std::string_view fragment;
96url_parts parse_url(std::string_view url)
noexcept;
116std::
string generate_native_path(
url_parts const &parts) noexcept;
120void normalize_url_parts(
url_parts &parts) noexcept;
124std::
string normalize_url(
std::string_view url) noexcept;
132std::
string concatenate_url(
std::string_view const lhs,
std::string_view const rhs) noexcept;
136std::
string filename_from_path(
std::string_view path) noexcept;
Definition url_parser.hpp:81