Ada 2.8.0
Fast spec-compliant URL parser
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_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

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()

virtual ada::url_base::~url_base ( )

Member Function Documentation

◆ get_origin()

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]

a newly allocated string.
See also

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

◆ has_valid_domain()

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, and ada::url_aggregator.

◆ is_special()

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

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::scheme::NOT_SPECIAL.

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

◆ parse_port()

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

Definition at line 117 of file url_base.h.

◆ to_string()

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

Returns a JSON string representation of this URL.

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

Member Data Documentation

◆ has_opaque_path

bool ada::url_base::has_opaque_path {false}

◆ 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}

Used for returning the validity from the result of the URL parser.

Definition at line 50 of file url_base.h.

Referenced by ada::parser::parse_url(), ada::url::set_port(), ada::url_aggregator::set_port(), ada::url_aggregator::to_diagram(), ada::url::to_string(), and ada::url_aggregator::validate().

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