# URLSpec

from pandac.PandaModules import URLSpec

Class : URLSpec
Description : A container for a URL, e.g. "http://server:port/path".
The URLSpec object is similar to a Filename in that it contains logic to identify the various parts of a URL and return (or modify) them separately.

## Inheritance:

URLSpec:

## Methods of URLSpec:

URLSpec (Constructor)
compareTo
cStr
empty
getAuthority
getPath
getPathAndQuery
getPort
getPortStr
getQuery
getScheme
getServer
getServerAndPort
getUrl
getUsername
hasAuthority
hasPath
hasPort
hasQuery
hasScheme
hasServer
hasUsername
input
isSsl
length
operator !=
operator <
operator =
operator ==
operator []
output
quote
quotePlus
setAuthority
setPath
setPort
setQuery
setScheme
setServer
setServerAndPort
setUrl
setUsername
unquote
unquotePlus

URLSpec URLSpec::URLSpec(void); Description:

compareTo int URLSpec::compare_to(URLSpec const &other) const; Description: Returns a number less than zero if this URLSpec sorts before the other one, greater than zero if it sorts after, or zero if they are equivalent.

cStr char const *URLSpec::c_str(void) const; Description:

empty bool URLSpec::empty(void) const; Description:

getAuthority string URLSpec::get_authority(void) const; Description: Returns the authority specified by the URL (this includes username, server, and/or port), or empty string if no authority is specified.

getPath string URLSpec::get_path(void) const; Description: Returns the path specified by the URL, or "/" if no path is specified.

getPathAndQuery string URLSpec::get_path_and_query(void) const; Description: Returns the path (or "/" if no path is specified), followed by the query if it is specified.

getPort int URLSpec::get_port(void) const; Description: Returns the port number specified by the URL, or the default port if not specified.

getPortStr string URLSpec::get_port_str(void) const; Description: Returns the port specified by the URL as a string, or the empty string if no port is specified. Compare this with get_port(), which returns a default port number if no port is specified.

getQuery string URLSpec::get_query(void) const; Description: Returns the query specified by the URL, or empty string if no query is specified.

getScheme string URLSpec::get_scheme(void) const; Description: Returns the scheme specified by the URL, or empty string if no scheme is specified.

getServer string URLSpec::get_server(void) const; Description: Returns the server name specified by the URL, if any.

getServerAndPort string URLSpec::get_server_and_port(void) const; Description: Returns a string consisting of the server name, followed by a colon, followed by the port number. If the port number is not explicitly given in the URL, this string will include the implicit port number.

getUrl string const &URLSpec::get_url(void) const; Description: Returns the complete URL specification.

getUsername string URLSpec::get_username(void) const; Description: Returns the username specified by the URL, if any. This might also include a password, e.g. "username:password", although putting a password on the URL is probably a bad idea.

hasAuthority bool URLSpec::has_authority(void) const; Description: Returns true if the URL specifies an authority (this includes username, server, and/or port), false otherwise.

hasPath bool URLSpec::has_path(void) const; Description: Returns true if the URL includes a path specification (that is, the particular filename on the server to retrieve), false otherwise.

hasPort bool URLSpec::has_port(void) const; Description: Returns true if the URL specifies a port number, false otherwise.

hasQuery bool URLSpec::has_query(void) const; Description: Returns true if the URL includes a query specification, false otherwise.

hasScheme bool URLSpec::has_scheme(void) const; Description: Returns true if the URL specifies a scheme (e.g. "http:"), false otherwise.

hasServer bool URLSpec::has_server(void) const; Description: Returns true if the URL specifies a server name, false otherwise.

hasUsername bool URLSpec::has_username(void) const; Description: Returns true if the URL specifies a username (and/or password), false otherwise.

input bool URLSpec::input(istream &in); Description:

isSsl bool URLSpec::is_ssl(void) const; Description: Returns true if the URL's scheme specifies an SSL-secured protocol such as https, or false otherwise.

length unsigned int URLSpec::length(void) const; Description:

operator != bool URLSpec::operator !=(URLSpec const &other) const; Description:

operator < bool URLSpec::operator <(URLSpec const &other) const; Description:

operator = void URLSpec::operator =(string const &url); Description:

operator == bool URLSpec::operator ==(URLSpec const &other) const; Description:

operator [] char URLSpec::operator [](int n) const; Description:

output void URLSpec::output(ostream &out) const; Description:

quote static string URLSpec::quote(string const &source, string const &safe = ("/")); Description: Returns the source string with all "unsafe" characters quoted, making a string suitable for placing in a URL. Letters, digits, and the underscore, comma, period, and hyphen characters, as well as any included in the safe string, are left alone; all others are converted to hex representation.

quotePlus static string URLSpec::quote_plus(string const &source, string const &safe = ("/")); Description: Behaves like quote() with the additional behavior of replacing spaces with plus signs.

setAuthority void URLSpec::set_authority(string const &authority); Description: Replaces the authority part of the URL specification. This includes the username, server, and port.

setPath void URLSpec::set_path(string const &path); Description: Replaces the path part of the URL specification.

setPort void URLSpec::set_port(string const &port); Description: Replaces the port part of the URL specification. Description: Replaces the port part of the URL specification, given a numeric port number.

setQuery void URLSpec::set_query(string const &query); Description: Replaces the query part of the URL specification.

setScheme void URLSpec::set_scheme(string const &scheme); Description: Replaces the scheme part of the URL specification.

setServer void URLSpec::set_server(string const &server); Description: Replaces the server part of the URL specification.

setServerAndPort void URLSpec::set_server_and_port(string const &server_and_port); Description: Replaces the server and port parts of the URL specification simultaneously. The input string should be of the form "server:port", or just "server" to make the port number implicit.

setUrl void URLSpec::set_url(string const &url, bool server_name_expected = (0)); Description: Completely replaces the URL with the indicated string. If server_name_expected is true, it is a hint that an undecorated URL is probably a server name, not a local filename.

setUsername void URLSpec::set_username(string const &username); Description: Replaces the username part of the URL specification.

unquote static string URLSpec::unquote(string const &source); Description: Reverses the operation of quote(): converts escaped characters of the form "%xx" to their ascii equivalent.

unquotePlus static string URLSpec::unquote_plus(string const &source); Description: Reverses the operation of quote_plus(): converts escaped characters of the form "%xx" to their ascii equivalent, and also converts plus signs to spaces.