|
Upa URL C++ library
A WHATWG URL Standard implementation
|
Namespaces | |
| namespace | idna |
Classes | |
| class | url |
| URL class. More... | |
| class | host_output |
| class | host_parser |
| class | url_host |
| class | url_error |
| URL exception class. More... | |
| class | url_search_params |
| URLSearchParams class. More... | |
| class | code_point_set |
| Represents code point set. More... | |
| struct | urlpattern_init |
| URLPatternInit struct. More... | |
| struct | urlpattern_options |
| class | urlpattern_inputs |
| struct | urlpattern_component_result |
| URLPatternComponentResult struct. More... | |
| struct | urlpattern_result |
| The result of executing the URL pattern when there is a match. More... | |
| struct | urlpattern_result_and_inputs |
| The result of executing the URL pattern when there is a match. More... | |
| class | urlpattern |
| URL pattern class template. More... | |
| class | urlpattern_error |
| urlpattern exception class More... | |
| class | public_suffix_list |
| The Public Suffix List class. More... | |
| class | regex_engine_srell |
| Regex engine class based on SRELL library. More... | |
| class | regex_engine_std |
| Regex engine class based on std::regex. More... | |
Typedefs | |
| using | urlpattern_input |
Functions | |
| bool | equals (const url &lhs, const url &rhs, bool exclude_fragments=false) |
| URL equivalence. | |
| bool | operator== (const url &lhs, const url &rhs) |
| Lexicographically compares two URL's. | |
| std::ostream & | operator<< (std::ostream &os, const url &url) |
| Performs stream output on URL. | |
| void | swap (url &lhs, url &rhs) noexcept |
| Swaps the contents of two URLs. | |
| template<class StrT, enable_if_str_arg_t< StrT > = 0> | |
| url | url_from_file_path (const StrT &str, file_path_format format=file_path_format::native) |
| Make URL from OS file path. | |
| url | url_from_file_path (const std::filesystem::path &path) |
| Make URL from OS file path. | |
| std::string | path_from_file_url (const url &file_url, file_path_format format=file_path_format::native) |
| Get OS path from file URL. | |
| std::filesystem::path | fs_path_from_file_url (const url &file_url) |
| Get OS path as std::filesystem::path from file URL. | |
| UPA_API std::uint32_t | version_num () |
| Get library version encoded to one number. | |
| bool | check_version () |
| Check used library version. | |
| template<class StrT, enable_if_str_arg_t< StrT > = 0> | |
| validation_errc | domain_parser (std::string &output, const StrT &input, bool be_strict) |
| Implements the domain parser algorithm. | |
| template<class CharT, class StrT, enable_if_str_arg_t< StrT > = 0> | |
| bool | domain_to_unicode (std::basic_string< CharT > &output, const StrT &input, bool be_strict=false, bool is_input_ascii=false) |
| Implements the domain to Unicode algorithm. | |
| constexpr bool | success (validation_errc res) noexcept |
| Check validation error code indicates success. | |
| std::ostream & | operator<< (std::ostream &os, const url_search_params &usp) |
| Performs stream output on URL search parameters. | |
| void | swap (url_search_params &lhs, url_search_params &rhs) noexcept |
| Swaps the contents of two url_search_params. | |
| template<class StrT, enable_if_str_arg_t< StrT > = 0> | |
| std::string | percent_decode (StrT &&str) |
| Percent decode input string. | |
| template<class StrT, enable_if_str_arg_t< StrT > = 0> | |
| std::string | percent_encode (StrT &&str, const code_point_set &no_encode_set) |
| UTF-8 percent encode input string using specified percent encode set. | |
| template<class StrT, enable_if_str_arg_t< StrT > = 0> | |
| std::string | encode_url_component (StrT &&str) |
| UTF-8 percent encode input string using component percent encode set. | |
| template<class StrT, enable_if_str_arg_t< StrT > = 0> | |
| constexpr std::size_t | get_label_pos_by_index (const StrT &str_host, std::size_t index) |
| Get label position in hostname by it's index. | |
Variables | |
| constexpr code_point_set | fragment_no_encode_set |
| constexpr code_point_set | query_no_encode_set |
| constexpr code_point_set | special_query_no_encode_set |
| constexpr code_point_set | path_no_encode_set |
| constexpr code_point_set | raw_path_no_encode_set |
| constexpr code_point_set | posix_path_no_encode_set |
| constexpr code_point_set | userinfo_no_encode_set |
| constexpr code_point_set | component_no_encode_set |
| template<class T> | |
| constexpr bool | is_regex_engine_v |
| using upa::urlpattern_input |
Definition at line 462 of file urlpattern.h.
|
strong |
|
strong |
Host representation.
See: https://url.spec.whatwg.org/#host-representation
Definition at line 33 of file url_host.h.
|
strong |
URL validation and other error codes.
See: https://url.spec.whatwg.org/#validation-error
Definition at line 22 of file url_result.h.
|
inline |
|
inline |
Implements the domain parser algorithm.
See: https://url.spec.whatwg.org/#concept-domain-to-ascii The output is valid only if the function returns upa::validation_errc::ok.
| [out] | output | string to store result |
| [in] | input | source domain string |
| [in] | be_strict | whether to enforce strict parsing rules |
Definition at line 189 of file url_host.h.
|
inline |
Implements the domain to Unicode algorithm.
It runs the Unicode ToUnicode algorithm on the input string. The result is appended to the output, and the function returns true if ToUnicode records no errors. Otherwise, the input is appended to the output, and the function returns false.
See: https://url.spec.whatwg.org/#concept-domain-to-unicode
| [out] | output | string to store result |
| [in] | input | source domain string |
| [in] | be_strict | whether to enforce strict parsing rules |
| [in] | is_input_ascii | whether the input is ASCII |
Definition at line 228 of file url_host.h.
|
inlinenodiscard |
UTF-8 percent encode input string using component percent encode set.
Invalid code points are replaced with UTF-8 percent encoded U+FFFD characters.
More info:
| [in] | str | string input |
Definition at line 563 of file url_percent_encode.h.
|
inlinenodiscard |
URL equivalence.
Determines if lhs equals to rhs, optionally with an exclude_fragments flag. More info: https://url.spec.whatwg.org/#concept-url-equals
| [in] | lhs,rhs | URLs to compare |
| [in] | exclude_fragments | exclude fragments when comparing |
|
inlinenodiscard |
|
nodiscardconstexpr |
Get label position in hostname by it's index.
The label separator can be any of the following characters: U+002E (.), U+3002, U+FF0E, U+FF61 (they are mapped to U+002E (.) by IDNA).
| [in] | str_host | hostname string |
| [in] | index | zero-based label index starting from the leftmost label |
str_host string Definition at line 37 of file public_suffix_list.h.
|
inline |
Performs stream output on URL.
Outputs URL serialized to ASCII string
|
inline |
Performs stream output on URL search parameters.
Outputs URL search parameters serialized to application/x-www-form-urlencoded
| [in] | os | the output stream to write to |
| [in] | usp | the url_search_params object to serialize and output |
Definition at line 771 of file url_search_params.h.
|
inlinenodiscard |
Get OS path from file URL.
Throws url_error exception on error.
| [in] | file_url | file URL |
| [in] | format | file path format, one of upa::file_path_format::posix, upa::file_path_format::windows, upa::file_path_format::native |
|
inlinenodiscard |
Percent decode input string.
Invalid code points are replaced with U+FFFD characters.
More info: https://url.spec.whatwg.org/#string-percent-decode
| [in] | str | string input |
Definition at line 526 of file url_percent_encode.h.
|
inlinenodiscard |
UTF-8 percent encode input string using specified percent encode set.
Invalid code points are replaced with UTF-8 percent encoded U+FFFD characters.
More info: https://url.spec.whatwg.org/#string-utf-8-percent-encode
| [in] | str | string input |
| [in] | no_encode_set | percent no encode set, contains code points which must not be percent encoded |
Definition at line 544 of file url_percent_encode.h.
|
nodiscardconstexprnoexcept |
Check validation error code indicates success.
Definition at line 98 of file url_result.h.
|
inlinenoexcept |
Swaps the contents of two url_search_params.
Swaps the contents of the lhs and rhs url_search_params
NOTE: It is undefined behavior to use this function to swap the contents of references returned by url::search_params().
| [in,out] | lhs | |
| [in,out] | rhs |
Definition at line 784 of file url_search_params.h.
|
inlinenodiscard |
|
inlinenodiscard |
Make URL from OS file path.
The file path must be absolute and must not contain any dot-dot (..) segments.
There is a difference in how paths with dot-dot segments are normalized in the OS and in the WHATWG URL standard. For example, in POSIX the path /a//../b is normalized to /b, while the URL parser normalizes this path to /a/b. This library does not implement OS specific path normalization, which is the main reason why it does not accept paths with dot-dot segments. Therefore, if there are such segments in the path, it should be normalized by OS tools before being submitted to this function. Normalization can be done using the POSIX realpath function, the Windows GetFullPathName function, or, if you are using C++17, the std::filesystem::canonical function.
Throws url_error exception on error.
| [in] | str | absolute file path string |
| [in] | format | file path format, one of upa::file_path_format::posix, upa::file_path_format::windows, upa::file_path_format::native |
| UPA_API std::uint32_t upa::version_num | ( | ) |
Get library version encoded to one number.
For example, for the 2.1.0 version, it returns 0x00020100.
|
inlineconstexpr |
Definition at line 165 of file url_percent_encode.h.
|
inlineconstexpr |
Definition at line 116 of file url_percent_encode.h.
|
constexpr |
Definition at line 140 of file urlpattern.h.
|
inlineconstexpr |
Definition at line 137 of file url_percent_encode.h.
|
inlineconstexpr |
Definition at line 151 of file url_percent_encode.h.
|
inlineconstexpr |
Definition at line 123 of file url_percent_encode.h.
|
inlineconstexpr |
Definition at line 143 of file url_percent_encode.h.
|
inlineconstexpr |
Definition at line 130 of file url_percent_encode.h.
|
inlineconstexpr |
Definition at line 158 of file url_percent_encode.h.