Ada 2.9.2
Fast spec-compliant URL parser
|
Namespaces | |
namespace | character_sets |
Includes the definitions for unicode character sets. | |
namespace | checkers |
Includes the definitions for validation functions. | |
namespace | helpers |
Includes the definitions for helper functions. | |
namespace | idna |
namespace | parser |
Includes the definitions for supported parsers. | |
namespace | scheme |
Includes the scheme declarations. | |
namespace | serializers |
Includes the definitions for URL serializers. | |
namespace | unicode |
Includes the declarations for unicode operations. | |
Classes | |
struct | url |
Generic URL struct reliant on std::string instantiation. More... | |
struct | url_aggregator |
Lightweight URL struct. More... | |
struct | url_base |
Base class of URL implementations. More... | |
struct | url_components |
URL Component representations using offsets. More... | |
struct | url_search_params |
struct | url_search_params_iter |
Typedefs | |
template<class result_type = ada::url_aggregator> | |
using | result = tl::expected<result_type, ada::errors> |
typedef std::pair< std::string_view, std::string_view > | key_value_view_pair |
using | url_search_params_keys_iter |
using | url_search_params_values_iter |
using | url_search_params_entries_iter |
Enumerations | |
enum | { ADA_VERSION_MAJOR = 2 , ADA_VERSION_MINOR = 9 , ADA_VERSION_REVISION = 2 } |
enum class | encoding_type { UTF8 , UTF_16LE , UTF_16BE } |
enum class | errors { generic_error } |
enum class | state { AUTHORITY , SCHEME_START , SCHEME , HOST , NO_SCHEME , FRAGMENT , RELATIVE_SCHEME , RELATIVE_SLASH , FILE , FILE_HOST , FILE_SLASH , PATH_OR_AUTHORITY , SPECIAL_AUTHORITY_IGNORE_SLASHES , SPECIAL_AUTHORITY_SLASHES , SPECIAL_RELATIVE_OR_AUTHORITY , QUERY , PATH , PATH_START , OPAQUE_PATH , PORT } |
enum | url_host_type : uint8_t { DEFAULT = 0 , IPV4 = 1 , IPV6 = 2 } |
enum class | url_search_params_iter_type { KEYS , VALUES , ENTRIES } |
Functions | |
void | unreachable () |
ada_warn_unused std::string | to_string (encoding_type type) |
template<class result_type = ada::url_aggregator> | |
ada_warn_unused ada::result< result_type > | parse (std::string_view input, const result_type *base_url=nullptr) |
template ada::result< url > | parse< url > (std::string_view input, const url *base_url) |
template ada::result< url_aggregator > | parse< url_aggregator > (std::string_view input, const url_aggregator *base_url) |
bool | can_parse (std::string_view input, const std::string_view *base_input=nullptr) |
std::string | href_from_file (std::string_view path) |
ada_warn_unused std::string | to_string (ada::state s) |
std::ostream & | operator<< (std::ostream &out, const ada::url &u) |
std::ostream & | operator<< (std::ostream &out, const ada::url_aggregator &u) |
template<class result_type > | |
ada_warn_unused tl::expected< result_type, ada::errors > | parse (std::string_view input, const result_type *base_url) |
typedef std::pair<std::string_view, std::string_view> ada::key_value_view_pair |
Definition at line 24 of file url_search_params.h.
using ada::result = tl::expected<result_type, ada::errors> |
Definition at line 23 of file implementation.h.
Definition at line 31 of file url_search_params.h.
Definition at line 26 of file url_search_params.h.
Definition at line 28 of file url_search_params.h.
anonymous enum |
Enumerator | |
---|---|
ADA_VERSION_MAJOR | |
ADA_VERSION_MINOR | |
ADA_VERSION_REVISION |
Definition at line 12 of file ada_version.h.
|
strong |
This specification defines three encodings with the same names as encoding schemes defined in the Unicode standard: UTF-8, UTF-16LE, and UTF-16BE.
Enumerator | |
---|---|
UTF8 | |
UTF_16LE | |
UTF_16BE |
Definition at line 19 of file encoding_type.h.
|
strong |
Enumerator | |
---|---|
generic_error |
Definition at line 20 of file implementation.h.
|
strong |
enum ada::url_host_type : uint8_t |
Type of URL host as an enum.
Definition at line 19 of file url_base.h.
|
strong |
Enumerator | |
---|---|
KEYS | |
VALUES | |
ENTRIES |
Definition at line 15 of file url_search_params.h.
bool ada::can_parse | ( | std::string_view | input, |
const std::string_view * | base_input = nullptr ) |
Verifies whether the URL strings can be parsed. The function assumes that the inputs are valid ASCII or UTF-8 strings.
Definition at line 50 of file implementation.cpp.
References ada::url_base::is_valid, and ada::parser::parse_url_impl().
Referenced by ada_can_parse(), ada_can_parse_with_base(), and LLVMFuzzerTestOneInput().
std::string ada::href_from_file | ( | std::string_view | path | ) |
Computes a href string from a file path. The function assumes that the input is a valid ASCII or UTF-8 string.
Definition at line 27 of file implementation.cpp.
References ada::scheme::FILE.
Referenced by LLVMFuzzerTestOneInput().
|
inline |
Definition at line 38 of file url-inl.h.
References ada::url::to_string().
|
inline |
Definition at line 1108 of file url_aggregator-inl.h.
References ada::url_aggregator::to_string().
ada_warn_unused tl::expected< result_type, ada::errors > ada::parse | ( | std::string_view | input, |
const result_type * | base_url = nullptr ) |
The URL parser takes a scalar value string input, with an optional null or base URL base (default null). The parser assumes the input is a valid ASCII or UTF-8 string.
input | the string input to analyze (must be valid ASCII or UTF-8) |
base_url | the optional URL input to use as a base url. |
Definition at line 12 of file implementation.cpp.
References generic_error, and ada::parser::parse_url_impl().
Referenced by ada_parse(), ada_parse_with_base(), ada::url::get_origin(), ada::url_aggregator::get_origin(), LLVMFuzzerTestOneInput(), and ada::url::set_href().
ada_warn_unused ada::result< result_type > ada::parse | ( | std::string_view | input, |
const result_type * | base_url = nullptr ) |
The URL parser takes a scalar value string input, with an optional null or base URL base (default null). The parser assumes the input is a valid ASCII or UTF-8 string.
input | the string input to analyze (must be valid ASCII or UTF-8) |
base_url | the optional URL input to use as a base url. |
Definition at line 12 of file implementation.cpp.
References generic_error, and ada::parser::parse_url_impl().
Referenced by ada_parse(), ada_parse_with_base(), ada::url::get_origin(), ada::url_aggregator::get_origin(), LLVMFuzzerTestOneInput(), and ada::url::set_href().
|
extern |
|
extern |
Referenced by ada::url_aggregator::set_href().
ada_warn_unused std::string ada::to_string | ( | ada::state | s | ) |
Stringify a URL state machine state.
Definition at line 789 of file helpers.cpp.
References ada::helpers::get_state().
ada_warn_unused std::string ada::to_string | ( | ada::encoding_type | type | ) |
Convert a encoding_type to string.
Definition at line 69 of file implementation.cpp.
References unreachable(), UTF8, UTF_16BE, and UTF_16LE.
Referenced by ada::parser::parse_url_impl().
|
inline |
Definition at line 166 of file common_defs.h.
Referenced by ada::parser::parse_url_impl(), and to_string().