Ada 4.1.1
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 <cstdint>
15#include <optional>
16#include <span>
17#include <string>
18#include <string_view>
19#include <variant>
20
21#include "ada/url.h"
22#include "ada/common_defs.h"
23#include "ada/errors.h"
25
26namespace ada {
27
46template <class result_type = ada::url_aggregator>
47using result = tl::expected<result_type, ada::errors>;
48
98template <class result_type = ada::url_aggregator>
100 std::string_view input, const result_type* base_url = nullptr);
101
102extern template ada::result<url> parse<url>(std::string_view input,
103 const url* base_url);
105 std::string_view input, const url_aggregator* base_url);
106
118bool can_parse(std::string_view input,
119 const std::string_view* base_input = nullptr);
120
121#if ADA_INCLUDE_URL_PATTERN
142template <url_pattern_regex::regex_concept regex_provider>
143ada_warn_unused tl::expected<url_pattern<regex_provider>, errors>
144parse_url_pattern(std::variant<std::string_view, url_pattern_init>&& input,
145 const std::string_view* base_url = nullptr,
146 const url_pattern_options* options = nullptr);
147
148template <url_pattern_regex::regex_concept regex_provider>
149class url_pattern_list;
150
176template <url_pattern_regex::regex_concept regex_provider>
177ada_warn_unused tl::expected<url_pattern_list<regex_provider>, errors>
178parse_url_pattern_list(std::span<const std::string_view> pathname_patterns,
179 const std::string_view* base_url = nullptr,
180 const url_pattern_options* options = nullptr);
181
190template <url_pattern_regex::regex_concept regex_provider>
191ada_warn_unused tl::expected<url_pattern_list<regex_provider>, errors>
192parse_url_pattern_list(std::span<const url_pattern<regex_provider>> patterns);
193#endif // ADA_INCLUDE_URL_PATTERN
194
209std::string href_from_file(std::string_view path);
210
223void set_max_input_length(uint32_t length);
224
230uint32_t get_max_input_length();
231
232} // namespace ada
233
234#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.
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)
void set_max_input_length(uint32_t length)
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)
uint32_t get_max_input_length()
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:64
Declaration for the ada::url class.
Declaration for the url_pattern_init implementation.