Ada 2.7.8
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
url_base.h
Go to the documentation of this file.
1
5#ifndef ADA_URL_BASE_H
6#define ADA_URL_BASE_H
7
8#include "ada/common_defs.h"
10#include "ada/scheme.h"
11
12#include <string_view>
13
14namespace ada {
15
27 IPV4 = 1,
32 IPV6 = 2,
33};
34
44struct url_base {
45 virtual ~url_base() = default;
46
50 bool is_valid{true};
51
55 bool has_opaque_path{false};
56
61
66
72
80
87
94 [[nodiscard]] inline uint16_t get_special_port() const noexcept;
95
101 [[nodiscard]] ada_really_inline uint16_t scheme_default_port() const noexcept;
102
114 virtual size_t parse_port(std::string_view view,
116
118 return this->parse_port(view, false);
119 }
120
124 [[nodiscard]] virtual std::string to_string() const = 0;
125
127 virtual inline void clear_pathname() = 0;
128
130 virtual inline void clear_search() = 0;
131
133 [[nodiscard]] virtual inline bool has_hash() const noexcept = 0;
134
136 [[nodiscard]] virtual inline bool has_search() const noexcept = 0;
137
138}; // url_base
139
140} // namespace ada
141
142#endif
Common definitions for cross-platform compiler support.
#define ada_really_inline
Definition common_defs.h:84
@ NOT_SPECIAL
Definition scheme.h:32
Definition ada_idna.h:13
url_host_type
Definition url_base.h:19
@ IPV6
Definition url_base.h:32
@ IPV4
Definition url_base.h:27
@ DEFAULT
Definition url_base.h:23
ada_warn_unused ada::result< result_type > parse(std::string_view input, const result_type *base_url=nullptr)
Declarations for the URL scheme.
Base class of URL implementations.
Definition url_base.h:44
virtual ~url_base()=default
ada_really_inline bool is_special() const noexcept
url_host_type host_type
Definition url_base.h:60
virtual bool has_valid_domain() const noexcept=0
bool is_valid
Definition url_base.h:50
virtual std::string get_origin() const noexcept=0
bool has_opaque_path
Definition url_base.h:55
virtual std::string to_string() const =0
Declaration for the URL Components.