ark::core::Url

Defined in header “ark/core/url.hh”.


A URL represents a string that conforms to the whatwg’s URL representation. It can store a scheme, username, password, hostname, path, and fragment.

Methods

  • Url()
    Default constructor.

  • Url(const std::string_view & string)
    Constructs a URL from an existing string. This is parsed immediately.

  • std::string str()
    Returns a string form of the URL, based on which components are populated.

  • std::optional< std::string > filepath()
    If the URL is a “file://” scheme (or no scheme), then this returns the rest of the URL as if it was a path. Otherwise, returns an empty optional.

  • bool empty()
    Returns true if this URL is “empty” (unset), or false otherwise.

  • bool operator==(const Url & other)
    Default comparison.

  • Url copy()
    Returns a copy of this object.

  • const std::string & scheme()
    Returns the scheme of the URL.

  • Url & set_scheme(const std::string_view & scheme)
    Sets the scheme of the URL.

  • const std::string & username()
    Returns the username of the URL.

  • const std::string & password()
    Returns the password of the URL.

  • Url & set_host(const std::string_view & host)
    Sets the host of this URL.

  • Url set_host(const std::string_view & host)
    Sets the host of this URL.

  • const std::string & host()
    Returns the host of the URL.

  • Url & set_port(uint16_t port)
    Sets the port of the URL.

  • uint16_t port()
    Returns the port of the URL.

  • const std::string & path()
    Returns the path of the URL.

  • Url & set_path(const std::string_view & path)
    Sets the path of the URL.

  • Url set_path(const std::string_view & path)
    Sets the path of the URL.

  • const std::string & query()
    Returns the query string of the URL.

  • Url & set_query(const std::string_view & query)
    Sets the query of the URL.

  • const std::string & fragment()
    Returns the fragment of the URL.

  • Url & set_fragment(const std::string_view & fragment)
    Sets the fragment of the URL.

  • auto operator()
    Operator for comparisons.