5#ifndef ADA_URL_PATTERN_H 
    6#define ADA_URL_PATTERN_H 
    9#include "ada/expected.h" 
   16#include <unordered_map> 
   62                   std::string&& _prefix, std::string&& _suffix)
 
   64        value(std::move(_value)),
 
   66        name(std::move(_name)),
 
   67        prefix(std::move(_prefix)),
 
   68        suffix(std::move(_suffix)) {}
 
 
 
   90      std::optional<char> new_delimiter = std::nullopt,
 
   91      std::optional<char> new_prefix = std::nullopt)
 
   92      : delimiter(new_delimiter), prefix(new_prefix) {}
 
 
  108  std::optional<char> 
prefix{};
 
 
  113inline url_pattern_compile_component_options
 
  118inline url_pattern_compile_component_options
 
  123inline url_pattern_compile_component_options
 
  133  std::unordered_map<std::string, std::optional<std::string>> 
groups;
 
  140    *os << 
"input: '" << 
result.input << 
"', group: ";
 
  141    for (
const auto& group : 
result.groups) {
 
  142      *os << 
"(" << group.first << 
", " << group.second.value_or(
"undefined")
 
 
  149template <url_pattern_regex::regex_concept regex_prov
ider>
 
  157                        typename regex_provider::regex_type&& new_regexp,
 
  158                        std::vector<std::string>&& new_group_name_list,
 
  159                        bool new_has_regexp_groups)
 
  160      : 
regexp(std::move(new_regexp)),
 
  161        pattern(std::move(new_pattern)),
 
 
  166  template <url_pattern_encoding_callback F>
 
  167  static tl::expected<url_pattern_component, errors> 
compile(
 
  168      std::string_view input, F& encoding_callback,
 
  174      std::vector<std::optional<std::string>>&& exec_result);
 
  179    *os << 
"pattern: '" << component.
pattern 
  181        << 
"group_name_list: ";
 
  188  typename regex_provider::regex_type 
regexp{};
 
 
  231template <url_pattern_regex::regex_concept regex_prov
ider>
 
  242      const std::string_view* base_url = 
nullptr);
 
  249                    const std::string_view* base_url = 
nullptr);
 
  257      const std::string_view* base_url_string = 
nullptr);
 
  284  friend void PrintTo(
const url_pattern& c, std::ostream* os) {
 
  285    *os << 
"protocol_component: '" << c.
get_protocol() << 
", ";
 
  286    *os << 
"username_component: '" << c.
get_username() << 
", ";
 
  287    *os << 
"password_component: '" << c.
get_password() << 
", ";
 
  288    *os << 
"hostname_component: '" << c.
get_hostname() << 
", ";
 
  289    *os << 
"port_component: '" << c.
get_port() << 
", ";
 
  290    *os << 
"pathname_component: '" << c.
get_pathname() << 
", ";
 
  291    *os << 
"search_component: '" << c.
get_search() << 
", ";
 
  292    *os << 
"hash_component: '" << c.
get_hash();
 
  296  template <url_pattern_regex::regex_concept P>
 
  297  friend tl::expected<url_pattern<P>, 
errors> parser::parse_url_pattern_impl(
 
  298      std::variant<std::string_view, url_pattern_init>&& input,
 
  318  url_pattern_component<regex_provider> password_component{};
 
  324  url_pattern_component<regex_provider> hostname_component{};
 
  330  url_pattern_component<regex_provider> port_component{};
 
  336  url_pattern_component<regex_provider> pathname_component{};
 
  342  url_pattern_component<regex_provider> search_component{};
 
  348  url_pattern_component<regex_provider> hash_component{};
 
  354  bool ignore_case_ = 
false;
 
 
url_pattern_component_result create_component_match_result(std::string &&input, std::vector< std::optional< std::string > > &&exec_result)
 
url_pattern_component(std::string &&new_pattern, typename regex_provider::regex_type &&new_regexp, std::vector< std::string > &&new_group_name_list, bool new_has_regexp_groups)
 
url_pattern_component()=default
 
static tl::expected< url_pattern_component, errors > compile(std::string_view input, F &encoding_callback, url_pattern_compile_component_options &options)
 
regex_provider::regex_type regexp
 
std::vector< std::string > group_name_list
 
url_pattern_part(url_pattern_part_type _type, std::string &&_value, url_pattern_part_modifier _modifier)
 
url_pattern_part(url_pattern_part_type _type, std::string &&_value, url_pattern_part_modifier _modifier, std::string &&_name, std::string &&_prefix, std::string &&_suffix)
 
url_pattern_part_modifier modifier
 
bool is_regexp() const noexcept
 
url_pattern_part_type type
 
bool has_regexp_groups() const
 
std::string_view get_hostname() const ada_lifetime_bound
 
std::string_view get_port() const ada_lifetime_bound
 
result< bool > test(const url_pattern_input &input, const std::string_view *base_url=nullptr)
 
result< std::optional< url_pattern_result > > match(const url_pattern_input &input, const std::string_view *base_url_string=nullptr)
 
std::string_view get_password() const ada_lifetime_bound
 
std::string_view get_protocol() const ada_lifetime_bound
 
std::string_view get_hash() const ada_lifetime_bound
 
std::string_view get_username() const ada_lifetime_bound
 
std::string_view get_pathname() const ada_lifetime_bound
 
std::string_view get_search() const ada_lifetime_bound
 
result< std::optional< url_pattern_result > > exec(const url_pattern_input &input, const std::string_view *base_url=nullptr)
 
#define ada_lifetime_bound
 
Definitions for user facing functions for parsing URL and it's components.
 
url_pattern_part_modifier
 
tl::expected< result_type, ada::errors > result
 
std::variant< std::string_view, url_pattern_init > url_pattern_input
 
Definitions for the parser.
 
url_pattern_compile_component_options(std::optional< char > new_delimiter=std::nullopt, std::optional< char > new_prefix=std::nullopt)
 
static url_pattern_compile_component_options HOSTNAME
 
url_pattern_compile_component_options()=default
 
static url_pattern_compile_component_options PATHNAME
 
static url_pattern_compile_component_options DEFAULT
 
bool operator==(const url_pattern_component_result &) const
 
std::unordered_map< std::string, std::optional< std::string > > groups
 
std::vector< url_pattern_input > inputs
 
url_pattern_component_result hostname
 
url_pattern_component_result password
 
url_pattern_component_result hash
 
url_pattern_component_result port
 
url_pattern_component_result protocol
 
url_pattern_component_result pathname
 
url_pattern_component_result username
 
url_pattern_component_result search
 
Declaration for the url_pattern_init implementation.