Ada 2.9.2
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
ada::url_base Struct Referenceabstract

Base class of URL implementations. More...

#include <url_base.h>

Inheritance diagram for ada::url_base:
ada::url ada::url ada::url_aggregator ada::url_aggregator

Public Member Functions

virtual ~url_base ()=default
ada_really_inline bool is_special () const noexcept
virtual std::string get_origin () const noexcept=0
virtual bool has_valid_domain () const noexcept=0
virtual ada_really_inline size_t parse_port (std::string_view view) noexcept
virtual std::string to_string () const =0
virtual ~url_base ()=default
ada_really_inline bool is_special () const noexcept
virtual std::string get_origin () const noexcept=0
virtual bool has_valid_domain () const noexcept=0
virtual ada_really_inline size_t parse_port (std::string_view view) noexcept
virtual std::string to_string () const =0

Public Attributes

bool is_valid {true}
bool has_opaque_path {false}
url_host_type host_type = url_host_type::DEFAULT

Detailed Description

Base class of URL implementations.

A url_base contains a few attributes: is_valid, has_opaque_path and type. All non-trivial implementation details are in derived classes such as ada::url and ada::url_aggregator.

It is an abstract class that cannot be instantiated directly.

Definition at line 44 of file url_base.h.

Constructor & Destructor Documentation

◆ ~url_base() [1/2]

virtual ada::url_base::~url_base ( )
virtualdefault

◆ ~url_base() [2/2]

virtual ada::url_base::~url_base ( )
virtualdefault

References is_valid.

Member Function Documentation

◆ get_origin() [1/2]

virtual std::string ada::url_base::get_origin ( ) const
nodiscardpure virtualnoexcept

The origin getter steps are to return the serialization of this's URL's origin. [HTML]

Returns
a newly allocated string.
See also
https://url.spec.whatwg.org/#concept-url-origin

Implemented in ada::url, ada::url, ada::url_aggregator, and ada::url_aggregator.

References get_origin().

Referenced by get_origin().

◆ get_origin() [2/2]

virtual std::string ada::url_base::get_origin ( ) const
nodiscardpure virtualnoexcept

The origin getter steps are to return the serialization of this's URL's origin. [HTML]

Returns
a newly allocated string.
See also
https://url.spec.whatwg.org/#concept-url-origin

Implemented in ada::url, ada::url, ada::url_aggregator, and ada::url_aggregator.

References get_origin().

◆ has_valid_domain() [1/2]

virtual bool ada::url_base::has_valid_domain ( ) const
nodiscardpure virtualnoexcept

Returns true if this URL has a valid domain as per RFC 1034 and corresponding specifications. Among other things, it requires that the domain string has fewer than 255 octets.

Implemented in ada::url, ada::url, ada::url_aggregator, and ada::url_aggregator.

References ada_really_inline, and has_valid_domain().

Referenced by has_valid_domain().

◆ has_valid_domain() [2/2]

virtual bool ada::url_base::has_valid_domain ( ) const
nodiscardpure virtualnoexcept

Returns true if this URL has a valid domain as per RFC 1034 and corresponding specifications. Among other things, it requires that the domain string has fewer than 255 octets.

Implemented in ada::url, ada::url, ada::url_aggregator, and ada::url_aggregator.

References ada_really_inline, and has_valid_domain().

◆ is_special() [1/2]

ada_really_inline bool ada::url_base::is_special ( ) const
nodiscardnoexcept

A URL is special if its scheme is a special scheme. A URL is not special if its scheme is not a special scheme.

Definition at line 24 of file url_base-inl.h.

References ada_really_inline, and ada::scheme::NOT_SPECIAL.

Referenced by ada::url::get_origin(), ada::url_aggregator::get_origin(), ada::url::get_protocol(), ada::parser::parse_url_impl(), ada::url::set_search(), ada::url_aggregator::set_search(), and to_string().

◆ is_special() [2/2]

ada_really_inline bool ada::url_base::is_special ( ) const
nodiscardnoexcept

A URL is special if its scheme is a special scheme. A URL is not special if its scheme is not a special scheme.

References ada_really_inline.

◆ parse_port() [1/2]

virtual ada_really_inline size_t ada::url_base::parse_port ( std::string_view view)
inlinevirtualnoexcept

Definition at line 117 of file url_base.h.

References ada_really_inline.

◆ parse_port() [2/2]

virtual ada_really_inline size_t ada::url_base::parse_port ( std::string_view view)
inlinevirtualnoexcept

Definition at line 1612 of file ada.h.

References ada_really_inline.

◆ to_string() [1/2]

virtual std::string ada::url_base::to_string ( ) const
nodiscardpure virtual

Returns a JSON string representation of this URL.

Implemented in ada::url, ada::url, ada::url_aggregator, and ada::url_aggregator.

◆ to_string() [2/2]

virtual std::string ada::url_base::to_string ( ) const
nodiscardpure virtual

Returns a JSON string representation of this URL.

Implemented in ada::url, ada::url, ada::url_aggregator, and ada::url_aggregator.

References ada_really_inline, and is_special().

Member Data Documentation

◆ has_opaque_path

◆ host_type

url_host_type ada::url_base::host_type = url_host_type::DEFAULT

URL hosts type

Definition at line 60 of file url_base.h.

◆ is_valid

bool ada::url_base::is_valid {true}

The documentation for this struct was generated from the following files: