Ada 3.0.1
Fast spec-compliant URL parser
|
Namespaces | |
namespace | anonymous_namespace{url_pattern_helpers.cpp} |
Classes | |
struct | constructor_string_parser |
class | token |
class | Tokenizer |
class | url_pattern_parser |
Enumerations | |
enum class | token_type : uint8_t { INVALID_CHAR , OPEN , CLOSE , REGEXP , NAME , CHAR , ESCAPED_CHAR , OTHER_MODIFIER , ASTERISK , END } |
enum class | token_policy { strict , lenient } |
Functions | |
std::string | to_string (token_type type) |
template<url_pattern_encoding_callback F> | |
tl::expected< std::vector< url_pattern_part >, errors > | parse_pattern_string (std::string_view input, url_pattern_compile_component_options &options, F &encoding_callback) |
template<url_pattern_regex::regex_concept regex_provider> | |
bool | protocol_component_matches_special_scheme (url_pattern_component< regex_provider > &component) |
tl::expected< std::string, errors > | canonicalize_protocol (std::string_view input) |
tl::expected< std::string, errors > | canonicalize_username (std::string_view input) |
tl::expected< std::string, errors > | canonicalize_password (std::string_view input) |
tl::expected< std::string, errors > | canonicalize_hostname (std::string_view input) |
tl::expected< std::string, errors > | canonicalize_ipv6_hostname (std::string_view input) |
tl::expected< std::string, errors > | canonicalize_port (std::string_view input) |
tl::expected< std::string, errors > | canonicalize_port_with_protocol (std::string_view input, std::string_view protocol) |
tl::expected< std::string, errors > | canonicalize_pathname (std::string_view input) |
tl::expected< std::string, errors > | canonicalize_opaque_pathname (std::string_view input) |
tl::expected< std::string, errors > | canonicalize_search (std::string_view input) |
tl::expected< std::string, errors > | canonicalize_hash (std::string_view input) |
tl::expected< std::vector< token >, errors > | tokenize (std::string_view input, token_policy policy) |
std::string | process_base_url_string (std::string_view input, std::string_view type) |
std::string | escape_pattern_string (std::string_view input) |
std::string | escape_regexp_string (std::string_view input) |
constexpr bool | is_absolute_pathname (std::string_view input, std::string_view type) noexcept |
std::string | generate_pattern_string (std::vector< url_pattern_part > &part_list, url_pattern_compile_component_options &options) |
std::tuple< std::string, std::vector< std::string > > | generate_regular_expression_and_name_list (const std::vector< url_pattern_part > &part_list, url_pattern_compile_component_options options) |
bool | is_ipv6_address (std::string_view input) noexcept |
std::string | convert_modifier_to_string (url_pattern_part_modifier modifier) |
std::string | generate_segment_wildcard_regexp (url_pattern_compile_component_options options) |
|
strong |
Enumerator | |
---|---|
strict | |
lenient |
Definition at line 39 of file url_pattern_helpers.h.
|
strong |
Enumerator | |
---|---|
INVALID_CHAR | |
OPEN | |
CLOSE | |
REGEXP | |
NAME | |
CHAR | |
ESCAPED_CHAR | |
OTHER_MODIFIER | |
ASTERISK | |
END |
Definition at line 23 of file url_pattern_helpers.h.
tl::expected< std::string, errors > ada::url_pattern_helpers::canonicalize_hash | ( | std::string_view | input | ) |
Definition at line 418 of file url_pattern_helpers.cpp.
References ADA_ASSERT_TRUE, ada::url::get_hash(), ada::url::has_hash(), ada::parse< url_aggregator >(), ada::url::set_hash(), and ada::type_error.
Referenced by ada::url_aggregator::parse_url_pattern_impl, and ada::url_pattern_init::process_hash().
tl::expected< std::string, errors > ada::url_pattern_helpers::canonicalize_hostname | ( | std::string_view | input | ) |
Definition at line 256 of file url_pattern_helpers.cpp.
References ADA_ASSERT_TRUE, ada::url::get_hostname(), ada::parse< url_aggregator >(), ada::url::set_hostname(), and ada::type_error.
Referenced by ada::url_aggregator::parse_url_pattern_impl, and ada::url_pattern_init::process_hostname().
tl::expected< std::string, errors > ada::url_pattern_helpers::canonicalize_ipv6_hostname | ( | std::string_view | input | ) |
Definition at line 280 of file url_pattern_helpers.cpp.
References ada::type_error.
Referenced by ada::url_aggregator::parse_url_pattern_impl.
tl::expected< std::string, errors > ada::url_pattern_helpers::canonicalize_opaque_pathname | ( | std::string_view | input | ) |
Definition at line 380 of file url_pattern_helpers.cpp.
References ada::url::get_pathname(), ada::parse(), and ada::type_error.
Referenced by ada::url_aggregator::parse_url_pattern_impl, and ada::url_pattern_init::process_pathname().
tl::expected< std::string, errors > ada::url_pattern_helpers::canonicalize_password | ( | std::string_view | input | ) |
Definition at line 238 of file url_pattern_helpers.cpp.
References ADA_ASSERT_TRUE, ada::url::get_password(), ada::parse< url_aggregator >(), ada::url::set_password(), and ada::type_error.
Referenced by ada::url_aggregator::parse_url_pattern_impl, and ada::url_pattern_init::process_password().
tl::expected< std::string, errors > ada::url_pattern_helpers::canonicalize_pathname | ( | std::string_view | input | ) |
Definition at line 355 of file url_pattern_helpers.cpp.
References ada::url::get_pathname(), ada::parse(), and ada::type_error.
Referenced by ada::url_aggregator::parse_url_pattern_impl, and ada::url_pattern_init::process_pathname().
tl::expected< std::string, errors > ada::url_pattern_helpers::canonicalize_port | ( | std::string_view | input | ) |
Definition at line 297 of file url_pattern_helpers.cpp.
References ADA_ASSERT_TRUE, ada::url::get_port(), ada::parse< url_aggregator >(), ada::url::set_port(), and ada::type_error.
Referenced by ada::url_aggregator::parse_url_pattern_impl.
tl::expected< std::string, errors > ada::url_pattern_helpers::canonicalize_port_with_protocol | ( | std::string_view | input, |
std::string_view | protocol ) |
Definition at line 317 of file url_pattern_helpers.cpp.
References ada::url::get_port(), ada::url::has_port(), ada::parse< url_aggregator >(), ada::url::set_port(), and ada::type_error.
Referenced by ada::url_pattern_init::process_port().
tl::expected< std::string, errors > ada::url_pattern_helpers::canonicalize_protocol | ( | std::string_view | input | ) |
Definition at line 193 of file url_pattern_helpers.cpp.
References ada::parse(), and ada::type_error.
Referenced by ada::url_pattern_helpers::constructor_string_parser< regex_provider >::compute_protocol_matches_special_scheme_flag(), ada::url_aggregator::parse_url_pattern_impl, and ada::url_pattern_init::process_protocol().
tl::expected< std::string, errors > ada::url_pattern_helpers::canonicalize_search | ( | std::string_view | input | ) |
Definition at line 399 of file url_pattern_helpers.cpp.
References ADA_ASSERT_TRUE, ada::url::get_search(), ada::url::has_search(), ada::parse< url_aggregator >(), ada::url::set_search(), and ada::type_error.
Referenced by ada::url_aggregator::parse_url_pattern_impl, and ada::url_pattern_init::process_search().
tl::expected< std::string, errors > ada::url_pattern_helpers::canonicalize_username | ( | std::string_view | input | ) |
Definition at line 221 of file url_pattern_helpers.cpp.
References ADA_ASSERT_TRUE, ada::url::get_username(), ada::parse< url_aggregator >(), ada::url::set_username(), and ada::type_error.
Referenced by ada::url_aggregator::parse_url_pattern_impl, and ada::url_pattern_init::process_username().
std::string ada::url_pattern_helpers::convert_modifier_to_string | ( | url_pattern_part_modifier | modifier | ) |
Definition at line 161 of file url_pattern_helpers.cpp.
References ada::one_or_more, ada::optional, and ada::zero_or_more.
Referenced by generate_pattern_string(), and generate_regular_expression_and_name_list().
std::string ada::url_pattern_helpers::escape_pattern_string | ( | std::string_view | input | ) |
Definition at line 742 of file url_pattern_helpers.cpp.
References ADA_ASSERT_TRUE, and ada::idna::is_ascii().
Referenced by generate_pattern_string(), and process_base_url_string().
std::string ada::url_pattern_helpers::escape_regexp_string | ( | std::string_view | input | ) |
Definition at line 788 of file url_pattern_helpers.cpp.
References ADA_ASSERT_TRUE, and ada::idna::is_ascii().
Referenced by generate_regular_expression_and_name_list(), and generate_segment_wildcard_regexp().
std::string ada::url_pattern_helpers::generate_pattern_string | ( | std::vector< url_pattern_part > & | part_list, |
url_pattern_compile_component_options & | options ) |
Definition at line 835 of file url_pattern_helpers.cpp.
References ADA_ASSERT_TRUE, convert_modifier_to_string(), escape_pattern_string(), ada::FIXED_TEXT, ada::FULL_WILDCARD, generate_segment_wildcard_regexp(), ada::url_pattern_compile_component_options::get_prefix(), ada::none, ada::REGEXP, ada::SEGMENT_WILDCARD, and ada::idna::valid_name_code_point().
Referenced by ada::url_pattern_component< regex_provider >::compile().
std::tuple< std::string, std::vector< std::string > > ada::url_pattern_helpers::generate_regular_expression_and_name_list | ( | const std::vector< url_pattern_part > & | part_list, |
url_pattern_compile_component_options | options ) |
Definition at line 10 of file url_pattern_helpers.cpp.
References ADA_ASSERT_TRUE, convert_modifier_to_string(), escape_regexp_string(), ada::FIXED_TEXT, ada::FULL_WILDCARD, generate_segment_wildcard_regexp(), ada::none, ada::one_or_more, ada::optional, ada::SEGMENT_WILDCARD, and ada::zero_or_more.
Referenced by ada::url_pattern_component< regex_provider >::compile().
std::string ada::url_pattern_helpers::generate_segment_wildcard_regexp | ( | url_pattern_compile_component_options | options | ) |
Definition at line 179 of file url_pattern_helpers.cpp.
References escape_regexp_string(), and ada::url_pattern_compile_component_options::get_delimiter().
Referenced by generate_pattern_string(), generate_regular_expression_and_name_list(), and parse_pattern_string().
|
constexprnoexcept |
Definition at line 815 of file url_pattern_helpers.cpp.
Referenced by ada::url_pattern_init::process().
|
noexcept |
Definition at line 146 of file url_pattern_helpers.cpp.
Referenced by ada::url_aggregator::parse_url_pattern_impl.
tl::expected< std::vector< url_pattern_part >, errors > ada::url_pattern_helpers::parse_pattern_string | ( | std::string_view | input, |
url_pattern_compile_component_options & | options, | ||
F & | encoding_callback ) |
Definition at line 660 of file url_pattern_helpers-inl.h.
References CHAR, CLOSE, END, ESCAPED_CHAR, generate_segment_wildcard_regexp(), ada::url_pattern_compile_component_options::get_prefix(), NAME, OPEN, strict, tokenize(), and ada::type_error.
Referenced by ada::url_pattern_component< regex_provider >::compile().
std::string ada::url_pattern_helpers::process_base_url_string | ( | std::string_view | input, |
std::string_view | type ) |
Definition at line 805 of file url_pattern_helpers.cpp.
References escape_pattern_string().
Referenced by ada::url_pattern_init::process().
bool ada::url_pattern_helpers::protocol_component_matches_special_scheme | ( | url_pattern_component< regex_provider > & | component | ) |
Definition at line 786 of file url_pattern_helpers-inl.h.
References ada::url_pattern_component< regex_provider >::regexp.
Referenced by ada::url_pattern_helpers::constructor_string_parser< regex_provider >::compute_protocol_matches_special_scheme_flag(), and ada::url_aggregator::parse_url_pattern_impl.
|
inline |
Definition at line 17 of file url_pattern_helpers-inl.h.
References ASTERISK, CHAR, CLOSE, END, ESCAPED_CHAR, INVALID_CHAR, NAME, OPEN, OTHER_MODIFIER, REGEXP, and ada::unreachable().
Referenced by ada::url_pattern_helpers::Tokenizer::add_token(), ada::url_pattern_helpers::Tokenizer::add_token_with_defaults(), ada::url_pattern_helpers::url_pattern_parser< F >::consume_required_token(), and ada::url_pattern_helpers::url_pattern_parser< F >::try_consume_token().
tl::expected< std::vector< token >, errors > ada::url_pattern_helpers::tokenize | ( | std::string_view | input, |
token_policy | policy ) |
Definition at line 438 of file url_pattern_helpers.cpp.
Referenced by ada::url_pattern_helpers::constructor_string_parser< regex_provider >::parse(), and parse_pattern_string().