libzypp  17.8.0
zypp::Url Class Reference

Url manipulation class. More...

#include <Url.h>

Public Types

typedef zypp::url::EEncoding EEncoding
 Encoding flags. More...
 
typedef zypp::url::ViewOptions ViewOptions
 View options. More...
 

Public Member Functions

 ~Url ()
 
 Url ()
 
 Url (const Url &url)
 Create a new Url object as shared copy of the given one. More...
 
 Url (const zypp::url::UrlRef &url)
 Create a new Url object as shared copy of the given reference. More...
 
 Url (const std::string &encodedUrl)
 Construct a Url object from percent-encoded URL string. More...
 
Urloperator= (const std::string &encodedUrl)
 Assigns parsed percent-encoded URL string to the object. More...
 
Urloperator= (const Url &url)
 Assign a shared copy of url to the current object. More...
 
zypp::url::UrlSchemes getKnownSchemes () const
 Returns scheme names known to this object. More...
 
bool isValidScheme (const std::string &scheme) const
 Verifies the specified scheme name. More...
 
bool schemeIsLocal () const
 
bool schemeIsRemote () const
 
bool schemeIsVolatile () const
 
bool schemeIsDownloading () const
 
bool isValid () const
 Verifies the Url. More...
 
std::string asString () const
 Returns a default string representation of the Url object. More...
 
std::string asString (const ViewOptions &opts) const
 Returns a string representation of the Url object. More...
 
std::string asCompleteString () const
 Returns a complete string representation of the Url object. More...
 
std::string getScheme () const
 Returns the scheme name of the URL. More...
 
std::string getAuthority () const
 Returns the encoded authority component of the URL. More...
 
std::string getUsername (EEncoding eflag=zypp::url::E_DECODED) const
 Returns the username from the URL authority. More...
 
std::string getPassword (EEncoding eflag=zypp::url::E_DECODED) const
 Returns the password from the URL authority. More...
 
bool hasCredentialsInAuthority () const
 Returns true if username and password are encoded in the authority component. More...
 
std::string getHost (EEncoding eflag=zypp::url::E_DECODED) const
 Returns the hostname or IP from the URL authority. More...
 
std::string getPort () const
 Returns the port from the URL authority. More...
 
std::string getPathData () const
 Returns the encoded path component of the URL. More...
 
std::string getPathName (EEncoding eflag=zypp::url::E_DECODED) const
 Returns the path name from the URL. More...
 
std::string getPathParams () const
 Returns the path parameters from the URL. More...
 
zypp::url::ParamVec getPathParamsVec () const
 Returns a vector with path parameter substrings. More...
 
zypp::url::ParamMap getPathParamsMap (EEncoding eflag=zypp::url::E_DECODED) const
 Returns a string map with path parameter keys and values. More...
 
std::string getPathParam (const std::string &param, EEncoding eflag=zypp::url::E_DECODED) const
 Return the value for the specified path parameter. More...
 
std::string getQueryString () const
 Returns the encoded query string component of the URL. More...
 
zypp::url::ParamVec getQueryStringVec () const
 Returns a vector with query string parameter substrings. More...
 
zypp::url::ParamMap getQueryStringMap (EEncoding eflag=zypp::url::E_DECODED) const
 Returns a string map with query parameter and their values. More...
 
std::string getQueryParam (const std::string &param, EEncoding eflag=zypp::url::E_DECODED) const
 Return the value for the specified query parameter. More...
 
std::string getFragment (EEncoding eflag=zypp::url::E_DECODED) const
 Returns the encoded fragment component of the URL. More...
 
void setScheme (const std::string &scheme)
 Set the scheme name in the URL. More...
 
void setAuthority (const std::string &authority)
 Set the authority component in the URL. More...
 
void setUsername (const std::string &user, EEncoding eflag=zypp::url::E_DECODED)
 Set the username in the URL authority. More...
 
void setPassword (const std::string &pass, EEncoding eflag=zypp::url::E_DECODED)
 Set the password in the URL authority. More...
 
void setHost (const std::string &host)
 Set the hostname or IP in the URL authority. More...
 
void setPort (const std::string &port)
 Set the port number in the URL authority. More...
 
void setPathData (const std::string &pathdata)
 Set the path data component in the URL. More...
 
void setPathName (const std::string &path, EEncoding eflag=zypp::url::E_DECODED)
 Set the path name. More...
 
void setPathName (const Pathname &path, EEncoding eflag=zypp::url::E_DECODED)
 
void setPathName (const char *path, EEncoding eflag=zypp::url::E_DECODED)
 
void appendPathName (const Pathname &path_r, EEncoding eflag_r=zypp::url::E_DECODED)
 Extend the path name. More...
 
void setPathParams (const std::string &params)
 Set the path parameters. More...
 
void setPathParamsVec (const zypp::url::ParamVec &pvec)
 Set the path parameters. More...
 
void setPathParamsMap (const zypp::url::ParamMap &pmap)
 Set the path parameters. More...
 
void setPathParam (const std::string &param, const std::string &value)
 Set or add value for the specified path parameter. More...
 
void setQueryString (const std::string &querystr)
 Set the query string in the URL. More...
 
void setQueryStringVec (const zypp::url::ParamVec &qvec)
 Set the query parameters. More...
 
void setQueryStringMap (const zypp::url::ParamMap &qmap)
 Set the query parameters. More...
 
void setQueryParam (const std::string &param, const std::string &value)
 Set or add value for the specified query parameter. More...
 
void delQueryParam (const std::string &param)
 remove the specified query parameter. More...
 
void setFragment (const std::string &fragment, EEncoding eflag=zypp::url::E_DECODED)
 Set the fragment string in the URL. More...
 
ViewOptions getViewOptions () const
 Return the view options of the current object. More...
 
void setViewOptions (const ViewOptions &vopts)
 Change the view options of the current object. More...
 

Static Public Member Functions

static url::UrlRef parseUrl (const std::string &encodedUrl)
 Parse a percent-encoded URL string. More...
 
static bool registerScheme (const std::string &scheme, url::UrlRef urlImpl)
 Register a scheme-specific implementation. More...
 
static zypp::url::UrlSchemes getRegisteredSchemes ()
 Returns all registered scheme names. More...
 
static bool isRegisteredScheme (const std::string &scheme)
 Returns if scheme name is registered. More...
 
static bool schemeIsLocal (const std::string &scheme_r)
 hd cd dvd dir file iso More...
 
static bool schemeIsRemote (const std::string &scheme_r)
 nfs nfs4 smb cifs http https ftp sftp tftp More...
 
static bool schemeIsVolatile (const std::string &scheme_r)
 cd dvd More...
 
static bool schemeIsDownloading (const std::string &scheme_r)
 http https ftp sftp tftp More...
 

Private Attributes

url::UrlRef m_impl
 

Detailed Description

Url manipulation class.

The generic URL (URI) syntax and its main components are defined in RFC3986 (http://rfc.net/rfc3986.html) Section 3, "Syntax Components". The scheme specific URL syntax and semantics is defined in the specification of the particular scheme. See also RFC1738 (http://rfc.net/rfc1738.html), that defines specific syntax for several URL schemes.

This class provides methods to access and manipulate generic and common scheme-specific URL components (or using the more general term, URI components). To consider the scheme-specifics of a URL, the Url class contains a reference object pointing to a UrlBase or derived object, that implements the scheme specifics.

Using the Url::registerScheme() method, it is possible to register a preconfigured or derived UrlBase object for a specific scheme name. The registered object will be cloned to handle all URLs containing the specified scheme name.

RFC3986, Syntax Components:

The generic URI syntax consists of a hierarchical sequence of components referred to as the scheme, authority, path, query, and fragment.

URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty

The scheme and path components are required, though the path may be empty (no characters). When authority is present, the path must either be empty or begin with a slash ("/") character. When authority is not present, the path cannot begin with two slash characters ("//"). These restrictions result in five different ABNF rules for a path (Section 3.3), only one of which will match any given URI reference.

The following are two example URIs and their component parts:

foo://example.com:8042/over/there?name=ferret#nose
\_/ \______________/\_________/ \_________/ \__/
| | | | |
scheme authority path query fragment
| _____________________|__
/ \ / \
urn:example:animal:ferret:nose

Definition at line 87 of file Url.h.

Member Typedef Documentation

◆ EEncoding

Encoding flags.

Definition at line 93 of file Url.h.

◆ ViewOptions

View options.

Definition at line 98 of file Url.h.

Constructor & Destructor Documentation

◆ ~Url()

zypp::Url::~Url ( )

Definition at line 281 of file Url.cc.

◆ Url() [1/4]

zypp::Url::Url ( )

Definition at line 287 of file Url.cc.

◆ Url() [2/4]

zypp::Url::Url ( const Url url)

Create a new Url object as shared copy of the given one.

Upon return, both objects will point to the same underlying object. This state will remain until one of the object is modified.

Parameters
urlThe Url object to make a copy of.
Exceptions
url::UrlExceptionif copy fails (should not happen).

Definition at line 294 of file Url.cc.

◆ Url() [3/4]

zypp::Url::Url ( const zypp::url::UrlRef url)

Create a new Url object as shared copy of the given reference.

Upon return, both objects will point to the same underlying object. This state will remain until one of the object is modified.

Parameters
urlThe URL implementation reference to make a copy of.
Exceptions
url::UrlExceptionif reference is empty.

Definition at line 307 of file Url.cc.

◆ Url() [4/4]

zypp::Url::Url ( const std::string &  encodedUrl)

Construct a Url object from percent-encoded URL string.

Parses the encodedUrl string using the parseUrl() method and assigns the result to the newly created object.

Parameters
encodedUrlA percent-encoded URL string.
Exceptions
url::UrlParsingExceptionif parsing of the url fails.
url::UrlNotAllowedExceptionif one of the components is not allowed for the scheme.
url::UrlBadComponentExceptionif one of the components contains an invalid character.

Definition at line 320 of file Url.cc.

Member Function Documentation

◆ parseUrl()

UrlRef zypp::Url::parseUrl ( const std::string &  encodedUrl)
static

Parse a percent-encoded URL string.

Tries to parse the given string into generic URL components and creates a clone of a scheme-specialized object or a new UrlBase object.

Parameters
encodedUrlA percent-encoded URL string.
Returns
A reference to a (derived) UrlBase object or empty reference if the encodedUrl string does not match the generic URL syntax.
Exceptions
url::UrlNotAllowedExceptionif one of the components is not allowed for the scheme.
url::UrlBadComponentExceptionif one of the components contains an invalid character.

Definition at line 370 of file Url.cc.

◆ operator=() [1/2]

Url & zypp::Url::operator= ( const std::string &  encodedUrl)

Assigns parsed percent-encoded URL string to the object.

Parses encodedUrl string using the parseUrl() method and assigns the result to the current object.

Parameters
encodedUrlA percent-encoded URL string.
Returns
A reference to this Url object.
Exceptions
url::UrlParsingExceptionif parsing of the url fails.
url::UrlNotAllowedExceptionif one of the components is not allowed for the scheme.
url::UrlBadComponentExceptionif one of the components contains an invalid character.

Definition at line 334 of file Url.cc.

◆ operator=() [2/2]

Url & zypp::Url::operator= ( const Url url)

Assign a shared copy of url to the current object.

Upon return, both objects will point to the same underlying object. This state will remain until one of the objects is modified.

Parameters
urlThe Url object to make a copy of.
Returns
A reference to this Url object.

Definition at line 350 of file Url.cc.

◆ registerScheme()

bool zypp::Url::registerScheme ( const std::string &  scheme,
url::UrlRef  urlImpl 
)
static

Register a scheme-specific implementation.

Parameters
schemeA name of a scheme.
urlImplA UrlBase object specialized for this scheme.
Returns
True, if the object claims to implement the scheme.

Definition at line 360 of file Url.cc.

◆ getRegisteredSchemes()

zypp::url::UrlSchemes zypp::Url::getRegisteredSchemes ( )
static

Returns all registered scheme names.

Returns
A vector with registered URL scheme names.

Definition at line 414 of file Url.cc.

◆ isRegisteredScheme()

bool zypp::Url::isRegisteredScheme ( const std::string &  scheme)
static

Returns if scheme name is registered.

Returns
True, if scheme name is registered.

Definition at line 423 of file Url.cc.

◆ getKnownSchemes()

zypp::url::UrlSchemes zypp::Url::getKnownSchemes ( ) const

Returns scheme names known to this object.

Returns
A vector with scheme names known by this object.

Definition at line 431 of file Url.cc.

◆ isValidScheme()

bool zypp::Url::isValidScheme ( const std::string &  scheme) const

Verifies the specified scheme name.

Verifies the generic syntax of the specified scheme name and if it is contained in the current object's list of known schemes (see getKnownSchemes()) if the list is not empty.

The default implementation in the UrlBase class returns an emtpy list of known schemes, causing a check of the generic syntax only.

Returns
True, if generic scheme name syntax is valid and the scheme name is known to the current object.

Definition at line 439 of file Url.cc.

◆ schemeIsLocal() [1/2]

bool zypp::Url::schemeIsLocal ( const std::string &  scheme_r)
static

hd cd dvd dir file iso

Definition at line 456 of file Url.cc.

◆ schemeIsLocal() [2/2]

bool zypp::Url::schemeIsLocal ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 257 of file Url.h.

◆ schemeIsRemote() [1/2]

bool zypp::Url::schemeIsRemote ( const std::string &  scheme_r)
static

nfs nfs4 smb cifs http https ftp sftp tftp

Definition at line 462 of file Url.cc.

◆ schemeIsRemote() [2/2]

bool zypp::Url::schemeIsRemote ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 262 of file Url.h.

◆ schemeIsVolatile() [1/2]

bool zypp::Url::schemeIsVolatile ( const std::string &  scheme_r)
static

cd dvd

Definition at line 468 of file Url.cc.

◆ schemeIsVolatile() [2/2]

bool zypp::Url::schemeIsVolatile ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 267 of file Url.h.

◆ schemeIsDownloading() [1/2]

bool zypp::Url::schemeIsDownloading ( const std::string &  scheme_r)
static

http https ftp sftp tftp

Definition at line 474 of file Url.cc.

◆ schemeIsDownloading() [2/2]

bool zypp::Url::schemeIsDownloading ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 272 of file Url.h.

◆ isValid()

bool zypp::Url::isValid ( ) const

Verifies the Url.

Verifies if the current object contains a non-empty scheme name. Additional semantical URL checks may be performed by derived UrlBase objects.

Returns
True, if the Url seems to be valid.

Definition at line 483 of file Url.cc.

◆ asString() [1/2]

std::string zypp::Url::asString ( ) const

Returns a default string representation of the Url object.

By default, a password in the URL will be hidden.

Returns
A default string representation of the Url object.

Definition at line 491 of file Url.cc.

◆ asString() [2/2]

std::string zypp::Url::asString ( const ViewOptions opts) const

Returns a string representation of the Url object.

To include a password in the resulting Url string, use:

url.asString(url.getViewOptions() +
Parameters
optsA combination of view options.
Returns
A string representation of the Url object.

Definition at line 519 of file Url.cc.

◆ asCompleteString()

std::string zypp::Url::asCompleteString ( ) const

Returns a complete string representation of the Url object.

This function ignores the configuration of the view options in the current object (see setViewOption()) and forces to return a string with all URL components included.

Returns
A complete string representation of the Url object.

Definition at line 499 of file Url.cc.

◆ getScheme()

std::string zypp::Url::getScheme ( ) const

Returns the scheme name of the URL.

Returns
Scheme name of the current Url object.

Definition at line 527 of file Url.cc.

◆ getAuthority()

std::string zypp::Url::getAuthority ( ) const

Returns the encoded authority component of the URL.

The returned authority string does not contain the leading "//" separator characters, but just its "user:pass@host:port" content only.

Returns
The encoded authority component string.

Definition at line 535 of file Url.cc.

◆ getUsername()

std::string zypp::Url::getUsername ( EEncoding  eflag = zypp::url::E_DECODED) const

Returns the username from the URL authority.

Parameters
eflagFlag if the usename should be percent-decoded or not.
Returns
The username sub-component from the URL authority.
Exceptions
url::UrlDecodingExceptionif the decoded result string would contain a '\0' character.

Definition at line 566 of file Url.cc.

◆ getPassword()

std::string zypp::Url::getPassword ( EEncoding  eflag = zypp::url::E_DECODED) const

Returns the password from the URL authority.

Parameters
eflagFlag if the password should be percent-decoded or not.
Returns
The password sub-component from the URL authority.
Exceptions
url::UrlDecodingExceptionif the decoded result string would contain a '\0' character.

Definition at line 574 of file Url.cc.

◆ hasCredentialsInAuthority()

bool zypp::Url::hasCredentialsInAuthority ( ) const
inline

Returns true if username and password are encoded in the authority component.

Definition at line 371 of file Url.h.

◆ getHost()

std::string zypp::Url::getHost ( EEncoding  eflag = zypp::url::E_DECODED) const

Returns the hostname or IP from the URL authority.

In case the Url contains an IP number, it may be surrounded by "[" and "]" characters, for example "[::1]" for an IPv6 localhost address.

Parameters
eflagFlag if the host should be percent-decoded or not.
Returns
The host sub-component from the URL authority.
Exceptions
url::UrlDecodingExceptionif the decoded result string would contain a '\0' character.

Definition at line 582 of file Url.cc.

◆ getPort()

std::string zypp::Url::getPort ( ) const

Returns the port from the URL authority.

Returns
The port sub-component from the URL authority.

Definition at line 590 of file Url.cc.

◆ getPathData()

std::string zypp::Url::getPathData ( ) const

Returns the encoded path component of the URL.

The path data contains the path name, optionally followed by path parameters separated with a ";" character, for example "/foo/bar;version=1.1".

Returns
The encoded path component of the URL.

Definition at line 542 of file Url.cc.

◆ getPathName()

std::string zypp::Url::getPathName ( EEncoding  eflag = zypp::url::E_DECODED) const

Returns the path name from the URL.

Parameters
eflagFlag if the path should be decoded or not.
Returns
The path name sub-component without path parameters from Path-Data component of the URL.
Exceptions
url::UrlDecodingExceptionif the decoded result string would contain a '\0' character.

Definition at line 598 of file Url.cc.

◆ getPathParams()

std::string zypp::Url::getPathParams ( ) const

Returns the path parameters from the URL.

Returns
The encoded path parameters from the URL.

Definition at line 606 of file Url.cc.

◆ getPathParamsVec()

zypp::url::ParamVec zypp::Url::getPathParamsVec ( ) const

Returns a vector with path parameter substrings.

The default path parameter separator is the ',' character. A schema specific object may overide the default separators.

For example, the path parameters string "foo=1,bar=2" is splited by default into a vector containing the substrings "foo=1" and "bar=2".

Returns
The path parameters splited into a vector of substrings.

Definition at line 614 of file Url.cc.

◆ getPathParamsMap()

zypp::url::ParamMap zypp::Url::getPathParamsMap ( EEncoding  eflag = zypp::url::E_DECODED) const

Returns a string map with path parameter keys and values.

The default path parameter separator is the ',' character, the default key/value separator for the path parameters is the '=' character. A schema specific object may overide the default separators.

For example, the path parameters string "foo=1,bar=2" is splited into a map containing "foo" = "1" and "bar" = "2" by default.

Parameters
eflagFlag if the path parameter keys and values should be decoded or not.
Returns
The path parameters key and values as a string map.
Exceptions
url::UrlNotSupportedExceptionif parameter parsing is not supported for a URL (scheme).
url::UrlDecodingExceptionif the decoded result string would contain a '\0' character.

Definition at line 622 of file Url.cc.

◆ getPathParam()

std::string zypp::Url::getPathParam ( const std::string &  param,
EEncoding  eflag = zypp::url::E_DECODED 
) const

Return the value for the specified path parameter.

For example, if the path parameters string is "foo=1,bar=2" the method will return the substring "1" for the param key "foo" and "2" for the param key "bar".

Parameters
paramThe path parameter key.
eflagFlag if the path parameter keys and values should be decoded or not.
Returns
The value for the path parameter key or empty string.
Exceptions
url::UrlNotSupportedExceptionif parameter parsing is not supported for a URL (scheme).
url::UrlDecodingExceptionif the decoded result string would contain a '\0' character.

Definition at line 630 of file Url.cc.

◆ getQueryString()

std::string zypp::Url::getQueryString ( ) const

Returns the encoded query string component of the URL.

The query string is returned without first "?" (separator) character. Further "?" characters as in e.g. LDAP URLs remain in the returned string.

Returns
The encoded query string component of the URL.

Definition at line 550 of file Url.cc.

◆ getQueryStringVec()

zypp::url::ParamVec zypp::Url::getQueryStringVec ( ) const

Returns a vector with query string parameter substrings.

The default query string parameter separator is the '&' character. A schema specific object may overide the default separators.

For example, the query string "foo=1&bar=2" is splited by default into a vector containing the substrings "foo=1" and "bar=2".

Returns
The query string splited into a vector of substrings.

Definition at line 638 of file Url.cc.

◆ getQueryStringMap()

zypp::url::ParamMap zypp::Url::getQueryStringMap ( EEncoding  eflag = zypp::url::E_DECODED) const

Returns a string map with query parameter and their values.

The default query string parameter separator is the ',' character, the default key/value separator the '=' character. A schema specific object may overide the default separators.

For example, the query string "foo=1&bar=2" is splited by default into a map containing "foo" = "1" and "bar" = "2".

Parameters
eflagFlag if the query string keys and values should be decoded or not.
Returns
The query string as a key/value string map.
Exceptions
url::UrlNotSupportedExceptionif parameter parsing is not supported for a URL (scheme).
url::UrlDecodingExceptionif the decoded result string would contain a '\0' character.

Definition at line 646 of file Url.cc.

◆ getQueryParam()

std::string zypp::Url::getQueryParam ( const std::string &  param,
EEncoding  eflag = zypp::url::E_DECODED 
) const

Return the value for the specified query parameter.

For example, if the query string is "foo=1,bar=2" the method will return the substring "1" for the param key "foo" and "2" for the param key "bar".

Parameters
paramThe query parameter key.
eflagFlag if the query parameter keys and values should be decoded or not.
Returns
The value for the query parameter key or empty string.
Exceptions
url::UrlNotSupportedExceptionif parameter parsing is not supported for a URL (scheme).
url::UrlDecodingExceptionif the decoded result string would contain a '\0' character.

Definition at line 654 of file Url.cc.

◆ getFragment()

std::string zypp::Url::getFragment ( EEncoding  eflag = zypp::url::E_DECODED) const

Returns the encoded fragment component of the URL.

Parameters
eflagFlag if the fragment should be percent-decoded or not.
Returns
The encoded fragment component of the URL.
Exceptions
url::UrlDecodingExceptionif the decoded result string would contain a '\0' character.

Definition at line 558 of file Url.cc.

◆ setScheme()

void zypp::Url::setScheme ( const std::string &  scheme)

Set the scheme name in the URL.

Parameters
schemeThe new scheme name.
Exceptions
url::UrlBadComponentExceptionif the scheme contains an invalid character or is empty.

Definition at line 662 of file Url.cc.

◆ setAuthority()

void zypp::Url::setAuthority ( const std::string &  authority)

Set the authority component in the URL.

The authority string shoud contain the "user:pass@host:port" sub-components without any leading "//" separator characters.

Parameters
authorityThe encoded authority component string.
Exceptions
url::UrlNotAllowedExceptionif the authority has to be empty in for the current scheme.
url::UrlBadComponentExceptionif the authority contains an invalid character.
url::UrlParsingExceptionif authority parsing fails.

Definition at line 692 of file Url.cc.

◆ setUsername()

void zypp::Url::setUsername ( const std::string &  user,
EEncoding  eflag = zypp::url::E_DECODED 
)

Set the username in the URL authority.

Parameters
userThe new username.
eflagIf the username is encoded or not.
Exceptions
url::UrlNotAllowedExceptionif the user has to be empty in for the current scheme
url::UrlBadComponentExceptionif the user contains an invalid character.

Definition at line 724 of file Url.cc.

◆ setPassword()

void zypp::Url::setPassword ( const std::string &  pass,
EEncoding  eflag = zypp::url::E_DECODED 
)

Set the password in the URL authority.

Parameters
passThe new password.
eflagIf the password is encoded or not.
Exceptions
url::UrlNotAllowedExceptionif the pass has to be empty in for the current scheme.
url::UrlBadComponentExceptionif the pass contains an invalid character.

Definition at line 733 of file Url.cc.

◆ setHost()

void zypp::Url::setHost ( const std::string &  host)

Set the hostname or IP in the URL authority.

The host parameter may contain a hostname, an IPv4 address in dotted-decimal form or an IPv6 address literal encapsulated within square brackets (RFC3513, Sect. 2.2).

A hostname may contain national alphanumeric UTF8 characters (letters other than ASCII a-z0-9), that will be encoded. This function allows to specify both, a encoded or decoded hostname.

Other IP literals in "[v ... ]" square bracket format are not supported by the implementation in UrlBase class.

Parameters
hostThe new hostname or IP address.
Exceptions
url::UrlNotAllowedExceptionif the host (authority) has to be empty in for the current scheme.
url::UrlBadComponentExceptionif the host is invalid.

Definition at line 742 of file Url.cc.

◆ setPort()

void zypp::Url::setPort ( const std::string &  port)

Set the port number in the URL authority.

Parameters
portThe new port number.
Exceptions
url::UrlNotAllowedExceptionif the port (authority) has to be empty in for the current scheme.
url::UrlBadComponentExceptionif the port is invalid.

Definition at line 750 of file Url.cc.

◆ setPathData()

void zypp::Url::setPathData ( const std::string &  pathdata)

Set the path data component in the URL.

By default, the pathdata string may include path parameters separated by the ";" separator character.

Parameters
pathdataThe encoded path data component string.
Exceptions
url::UrlBadComponentExceptionif the pathdata contains an invalid character.

Definition at line 700 of file Url.cc.

◆ setPathName() [1/3]

void zypp::Url::setPathName ( const std::string &  path,
EEncoding  eflag = zypp::url::E_DECODED 
)

Set the path name.

Parameters
pathThe new path name.
eflagIf the path name is encoded or not.
Exceptions
url::UrlBadComponentExceptionif the path name contains an invalid character.

Definition at line 758 of file Url.cc.

◆ setPathName() [2/3]

void zypp::Url::setPathName ( const Pathname path,
EEncoding  eflag = zypp::url::E_DECODED 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 765 of file Url.cc.

◆ setPathName() [3/3]

void zypp::Url::setPathName ( const char *  path,
EEncoding  eflag = zypp::url::E_DECODED 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 772 of file Url.cc.

◆ appendPathName()

void zypp::Url::appendPathName ( const Pathname path_r,
EEncoding  eflag_r = zypp::url::E_DECODED 
)

Extend the path name.

Definition at line 780 of file Url.cc.

◆ setPathParams()

void zypp::Url::setPathParams ( const std::string &  params)

Set the path parameters.

Parameters
paramsThe new encoded path parameter string.
Exceptions
url::UrlBadComponentExceptionif the path params contains an invalid character.

Definition at line 785 of file Url.cc.

◆ setPathParamsVec()

void zypp::Url::setPathParamsVec ( const zypp::url::ParamVec pvec)

Set the path parameters.

Parameters
pvecThe vector with encoded path parameters.
Exceptions
url::UrlBadComponentExceptionif the pvec contains an invalid character.

Definition at line 793 of file Url.cc.

◆ setPathParamsMap()

void zypp::Url::setPathParamsMap ( const zypp::url::ParamMap pmap)

Set the path parameters.

Parameters
pmapThe map with decoded path parameters.
Exceptions
url::UrlNotSupportedExceptionif parameter parsing is not supported for a URL (scheme).

Definition at line 801 of file Url.cc.

◆ setPathParam()

void zypp::Url::setPathParam ( const std::string &  param,
const std::string &  value 
)

Set or add value for the specified path parameter.

Parameters
paramThe decoded path parameter name.
valueThe decoded path parameter value.
Exceptions
url::UrlNotSupportedExceptionif parameter parsing is not supported for a URL (scheme).
url::UrlDecodingExceptionif the decoded result string would contain a '\0' character.

Definition at line 809 of file Url.cc.

◆ setQueryString()

void zypp::Url::setQueryString ( const std::string &  querystr)

Set the query string in the URL.

Parameters
querystrThe new encoded query string.
Exceptions
url::UrlBadComponentExceptionif the querystr contains an invalid character.

Definition at line 708 of file Url.cc.

◆ setQueryStringVec()

void zypp::Url::setQueryStringVec ( const zypp::url::ParamVec qvec)

Set the query parameters.

Parameters
qvecThe vector with encoded query parameters.
Exceptions
url::UrlBadComponentExceptionif the qvec contains an invalid character.

Definition at line 817 of file Url.cc.

◆ setQueryStringMap()

void zypp::Url::setQueryStringMap ( const zypp::url::ParamMap qmap)

Set the query parameters.

Parameters
qmapThe map with decoded query parameters.
Exceptions
url::UrlNotSupportedExceptionif parameter parsing is not supported for a URL (scheme).

Definition at line 825 of file Url.cc.

◆ setQueryParam()

void zypp::Url::setQueryParam ( const std::string &  param,
const std::string &  value 
)

Set or add value for the specified query parameter.

Parameters
paramThe decoded query parameter name.
valueThe decoded query parameter value.
Exceptions
url::UrlNotSupportedExceptionif parameter parsing is not supported for a URL (scheme).
url::UrlDecodingExceptionif the decoded result string would contain a '\0' character.

Definition at line 832 of file Url.cc.

◆ delQueryParam()

void zypp::Url::delQueryParam ( const std::string &  param)

remove the specified query parameter.

Parameters
paramThe decoded query parameter name.
Exceptions
url::UrlNotSupportedExceptionif parameter parsing is not supported for a URL (scheme).
url::UrlDecodingExceptionif the decoded result string would contain a '\0' character.

Definition at line 839 of file Url.cc.

◆ setFragment()

void zypp::Url::setFragment ( const std::string &  fragment,
EEncoding  eflag = zypp::url::E_DECODED 
)

Set the fragment string in the URL.

Parameters
fragmentThe new fragment string.
eflagIf the fragment is encoded or not.
Exceptions
url::UrlBadComponentExceptionif the fragment contains an invalid character.

Definition at line 716 of file Url.cc.

◆ getViewOptions()

ViewOptions zypp::Url::getViewOptions ( ) const

Return the view options of the current object.

This method is used to query the view options used by the asString() method.

Returns
The current view option combination.

Definition at line 846 of file Url.cc.

◆ setViewOptions()

void zypp::Url::setViewOptions ( const ViewOptions vopts)

Change the view options of the current object.

This method is used to change the view options used by the asString() method.

Parameters
voptsNew view options combination.

Definition at line 853 of file Url.cc.

Member Data Documentation

◆ m_impl

url::UrlRef zypp::Url::m_impl
private

Definition at line 824 of file Url.h.


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