Ada 3.4.0
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
implementation.h
Go to the documentation of this file.
1
11#ifndef ADA_IMPLEMENTATION_H
12#define ADA_IMPLEMENTATION_H
13
14#include <string>
15#include <string_view>
16#include <optional>
17
18#include "ada/url.h"
19#include "ada/common_defs.h"
20#include "ada/errors.h"
22
23namespace ada {
24
43template <class result_type = ada::url_aggregator>
44using result = tl::expected<result_type, ada::errors>;
45
90template <class result_type = ada::url_aggregator>
92 std::string_view input, const result_type* base_url = nullptr);
93
94extern template ada::result<url> parse<url>(std::string_view input,
95 const url* base_url);
97 std::string_view input, const url_aggregator* base_url);
98
127bool can_parse(std::string_view input,
128 const std::string_view* base_input = nullptr);
129
130#if ADA_INCLUDE_URL_PATTERN
151template <url_pattern_regex::regex_concept regex_provider>
152ada_warn_unused tl::expected<url_pattern<regex_provider>, errors>
153parse_url_pattern(std::variant<std::string_view, url_pattern_init>&& input,
154 const std::string_view* base_url = nullptr,
155 const url_pattern_options* options = nullptr);
156#endif // ADA_INCLUDE_URL_PATTERN
157
168std::string href_from_file(std::string_view path);
169} // namespace ada
170
171#endif // ADA_IMPLEMENTATION_H
Cross-platform compiler macros and common definitions.
#define ada_warn_unused
Definition common_defs.h:89
Error type definitions for URL parsing.
Definition ada_idna.h:13
bool can_parse(std::string_view input, const std::string_view *base_input=nullptr)
template ada::result< url > parse< url >(std::string_view input, const url *base_url)
std::string href_from_file(std::string_view path)
errors
Error codes for URL parsing operations.
Definition errors.h:17
template ada::result< url_aggregator > parse< url_aggregator >(std::string_view input, const url_aggregator *base_url)
tl::expected< result_type, ada::errors > result
ada_warn_unused ada::result< result_type > parse(std::string_view input, const result_type *base_url=nullptr)
Memory-efficient URL representation using a single buffer.
Represents a parsed URL with individual string components.
Definition url.h:62
Declaration for the ada::url class.
Declaration for the url_pattern_init implementation.