libfilezilla
Public Member Functions | Public Attributes | List of all members
uri Class Referencefinal

The uri class is used to decompose URIs into their individual components. More...

#include <uri.hpp>

Public Member Functions

 uri (std::string_view const &in)
 
void clear ()
 
bool parse (std::string_view in)
 Splits uri into components. More...
 
std::string to_string (bool with_query=true) const
 Assembles components into string. More...
 
std::string get_request (bool with_query=true) const
 Returns path and query, separated by question mark.
 
std::string get_authority (bool with_userinfo) const
 Returns [user[:pass]@]host[:port].
 
bool empty () const
 
 operator bool () const
 
bool is_absolute () const
 Checks that the URI is absolute, that is the path starting with a slash.
 
void resolve (uri const &base)
 Resolve a relative URI reference into an absolute URI given a base URL. More...
 
bool operator== (uri const &arg) const
 
bool operator!= (uri const &arg) const
 

Public Attributes

std::string scheme_
 Often referred to as the protocol prefix, e.g. ftp://.
 
std::string user_
 Optional user part of the authority.
 
std::string pass_
 Optional password part of the authority.
 
std::string host_
 Hostname, or IP address literal.
 
unsigned short port_ {}
 Optional Port if non-zero.
 
std::string path_
 Optional path, must start with a slash if set.
 
std::string query_
 The part of a URI after ? but before #. More...
 
std::string fragment_
 The part of a URI after #. More...
 

Detailed Description

The uri class is used to decompose URIs into their individual components.

Implements Uniform Resource Identifiers as described in RFC 3986

Examples
https.cpp.

Member Function Documentation

◆ parse()

bool parse ( std::string_view  in)

Splits uri into components.

Percent-decodes username, pass, host and path Does not decode query and fragment.

◆ resolve()

void resolve ( uri const &  base)

Resolve a relative URI reference into an absolute URI given a base URL.

If the URI is not relative or from a different scheme, it is not changed.

◆ to_string()

std::string to_string ( bool  with_query = true) const

Assembles components into string.

Percent-encodes username, pass, host and path Does not encode query and fragment.

Member Data Documentation

◆ fragment_

std::string fragment_

The part of a URI after #.

The fragment is not encoded when building the URI, neither is it decoded when parsing a URI.

◆ query_

std::string query_

The part of a URI after ? but before #.

The query string is not encoded when building the URI, neither is it decoded when parsing a URI.

See also
fz::query_string

The documentation for this class was generated from the following file: