Ada 3.4.0
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
/github/workspace/include/ada/implementation.h

Result type for URL parsing operations.

Uses tl::expected to represent either a successfully parsed URL or an error. This allows for exception-free error handling.

Template Parameters
result_typeThe URL type to return (default: ada::url_aggregator)
ada::result<ada::url_aggregator> result = ada::parse("https://example.com");
if (result) {
// Success: use result.value() or *result
} else {
// Error: handle result.error()
}
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)
#ifndef ADA_IMPLEMENTATION_H
#define ADA_IMPLEMENTATION_H
#include <string>
#include <string_view>
#include <optional>
#include "ada/url.h"
#include "ada/errors.h"
namespace ada {
template <class result_type = ada::url_aggregator>
using result = tl::expected<result_type, ada::errors>;
template <class result_type = ada::url_aggregator>
std::string_view input, const result_type* base_url = nullptr);
extern template ada::result<url> parse<url>(std::string_view input,
const url* base_url);
std::string_view input, const url_aggregator* base_url);
bool can_parse(std::string_view input,
const std::string_view* base_input = nullptr);
#if ADA_INCLUDE_URL_PATTERN
template <url_pattern_regex::regex_concept regex_provider>
ada_warn_unused tl::expected<url_pattern<regex_provider>, errors>
parse_url_pattern(std::variant<std::string_view, url_pattern_init>&& input,
const std::string_view* base_url = nullptr,
const url_pattern_options* options = nullptr);
#endif // ADA_INCLUDE_URL_PATTERN
std::string href_from_file(std::string_view path);
} // namespace ada
#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)
Declaration for the ada::url class.
Declaration for the url_pattern_init implementation.