Ada 3.4.0
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
parser.h
Go to the documentation of this file.
1
11#ifndef ADA_PARSER_H
12#define ADA_PARSER_H
13
14#include <string_view>
15#include <variant>
16
17#include "ada/expected.h"
18
21
23namespace ada {
24struct url_aggregator;
25struct url;
26#if ADA_INCLUDE_URL_PATTERN
27template <url_pattern_regex::regex_concept regex_provider>
28class url_pattern;
29struct url_pattern_options;
30#endif // ADA_INCLUDE_URL_PATTERN
31enum class errors : uint8_t;
32} // namespace ada
33
41namespace ada::parser {
55template <typename result_type = url_aggregator>
56result_type parse_url(std::string_view user_input,
57 const result_type* base_url = nullptr);
58
60 std::string_view user_input, const url_aggregator* base_url);
61extern template url parse_url<url>(std::string_view user_input,
62 const url* base_url);
63
64template <typename result_type = url_aggregator, bool store_values = true>
65result_type parse_url_impl(std::string_view user_input,
66 const result_type* base_url = nullptr);
67
69 std::string_view user_input, const url_aggregator* base_url);
70extern template url parse_url_impl<url>(std::string_view user_input,
71 const url* base_url);
72
73#if ADA_INCLUDE_URL_PATTERN
74template <url_pattern_regex::regex_concept regex_provider>
75tl::expected<url_pattern<regex_provider>, errors> parse_url_pattern_impl(
76 std::variant<std::string_view, url_pattern_init>&& input,
77 const std::string_view* base_url, const url_pattern_options* options);
78#endif // ADA_INCLUDE_URL_PATTERN
79
80} // namespace ada::parser
81
82#endif // ADA_PARSER_H
Internal URL parsing implementation.
Definition parser-inl.h:16
template url parse_url< url >(std::string_view user_input, const url *base_url)
result_type parse_url(std::string_view user_input, const result_type *base_url=nullptr)
Definition parser.cpp:917
template url parse_url_impl< url >(std::string_view user_input, const url *base_url)
template url_aggregator parse_url_impl< url_aggregator >(std::string_view user_input, const url_aggregator *base_url)
template url_aggregator parse_url< url_aggregator >(std::string_view user_input, const url_aggregator *base_url)
result_type parse_url_impl(std::string_view user_input, const result_type *base_url=nullptr)
Definition parser.cpp:14
Definition ada_idna.h:13
errors
Error codes for URL parsing operations.
Definition errors.h:17
Memory-efficient URL representation using a single buffer.
Represents a parsed URL with individual string components.
Definition url.h:62
Declaration for the url_pattern_init implementation.