zypp::Url Class Reference

Url manipulation class. More...

#include <Url.h>

List of all members.

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

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 URL's 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 83 of file Url.h.


Member Typedef Documentation

Encoding flags.

Definition at line 89 of file Url.h.

View options.

Definition at line 94 of file Url.h.


Constructor & Destructor Documentation

zypp::Url::~Url (  ) 

Definition at line 278 of file Url.cc.

zypp::Url::Url (  ) 

Definition at line 284 of file Url.cc.

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:
url The Url object to make a copy of.
Exceptions:
url::UrlException if copy fails (should not happen).

Definition at line 291 of file Url.cc.

References _, m_impl, and ZYPP_THROW.

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:
url The URL implementation reference to make a copy of.
Exceptions:
url::UrlException if reference is empty.

Definition at line 304 of file Url.cc.

References _, m_impl, and ZYPP_THROW.

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 assings the result to the new created object.

Parameters:
encodedUrl A percent-encoded URL string.
Exceptions:
url::UrlParsingException if parsing of the url fails.
url::UrlNotAllowedException if one of the components is not allowed for the scheme.
url::UrlBadComponentException if one of the components contains an invalid character.

Definition at line 317 of file Url.cc.

References _, m_impl, and ZYPP_THROW.


Member Function Documentation

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

Parse a percent-encoded URL string.

Trys to parses the given string into generic URL components and created a clone of a scheme-specialized object or a new UrlBase object.

Parameters:
encodedUrl A 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::UrlNotAllowedException if one of the components is not allowed for the scheme.
url::UrlBadComponentException if one of the components contains an invalid character.

Definition at line 367 of file Url.cc.

References zypp::str::regex_match(), zypp::RWCOW_pointer< _D, _Traits >::reset(), RX_SPLIT_URL, zypp::str::smatch::size(), and url.

Referenced by operator=().

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:
encodedUrl A percent-encoded URL string.
Returns:
A reference to this Url object.
Exceptions:
url::UrlParsingException if parsing of the url fails.
url::UrlNotAllowedException if one of the components is not allowed for the scheme.
url::UrlBadComponentException if one of the components contains an invalid character.

Definition at line 331 of file Url.cc.

References _, m_impl, parseUrl(), url, and ZYPP_THROW.

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

Assign 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 object is modified.

Parameters:
url The Url object to make a copy of.
Returns:
A reference to this Url object.

Definition at line 347 of file Url.cc.

References m_impl.

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

Register a scheme-specific implementation.

Parameters:
scheme A name of a scheme.
urlImpl A UrlBase object specialized for this scheme.
Returns:
True, if the object claims to implement the scheme.

Definition at line 357 of file Url.cc.

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

Returns all registered scheme names.

Returns:
A vector with registered URL scheme names.

Definition at line 411 of file Url.cc.

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 420 of file Url.cc.

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 428 of file Url.cc.

References m_impl.

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

Verifies 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 436 of file Url.cc.

References m_impl.

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

hd cd dvd dir file iso

Definition at line 453 of file Url.cc.

References arrayBegin, and arrayEnd.

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 253 of file Url.h.

References getScheme(), and schemeIsLocal().

Referenced by schemeIsLocal().

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

nfs nfs4 smb cifs http https ftp sftp

Definition at line 459 of file Url.cc.

References arrayBegin, and arrayEnd.

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 258 of file Url.h.

References getScheme(), and schemeIsRemote().

Referenced by schemeIsRemote().

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

cd dvd

Definition at line 465 of file Url.cc.

References arrayBegin, and arrayEnd.

Referenced by zypp::media::MediaAccess::canBeVolatile().

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 263 of file Url.h.

References getScheme(), and schemeIsVolatile().

Referenced by schemeIsVolatile().

bool zypp::Url::schemeIsDownloading ( const std::string &  scheme_r  )  [static]
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 268 of file Url.h.

References getScheme(), and schemeIsDownloading().

Referenced by schemeIsDownloading().

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 480 of file Url.cc.

References m_impl.

Referenced by zypp::assert_url(), zypp::media::MediaCurl::attachTo(), zypp::media::CredentialFileReader::CredentialFileReader(), zypp::media::MediaCurl::doGetDoesFileExist(), zypp::media::MediaCurl::doGetFileCopy(), zypp::media::AuthData::dumpAsIniOn(), zypp::media::MediaISO::MediaISO(), and zypp::media::MediaAccess::open().

std::string zypp::Url::asString (  )  const
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:

Parameters:
opts A combination of view options.
Returns:
A string representation of the Url object.

Definition at line 516 of file Url.cc.

References m_impl.

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 an string with all URL components included.

Returns:
A complete string representation of the Url object.

Definition at line 496 of file Url.cc.

References getViewOptions(), m_impl, zypp::url::ViewOption::WITH_FRAGMENT, zypp::url::ViewOption::WITH_HOST, zypp::url::ViewOption::WITH_PASSWORD, zypp::url::ViewOption::WITH_PATH_NAME, zypp::url::ViewOption::WITH_PATH_PARAMS, zypp::url::ViewOption::WITH_PORT, zypp::url::ViewOption::WITH_QUERY_STR, zypp::url::ViewOption::WITH_SCHEME, and zypp::url::ViewOption::WITH_USERNAME.

Referenced by zypp::media::MediaAria2c::getFileCopy(), and zypp::RepoManager::makeStupidAlias().

std::string zypp::Url::getScheme (  )  const
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 532 of file Url.cc.

References m_impl.

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

Returns the username from the URL authority.

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

Definition at line 563 of file Url.cc.

References m_impl.

Referenced by zypp::media::MediaCIFS::attachTo(), zypp::media::AuthData::AuthData(), zypp::media::MediaCIFS::authenticate(), zypp::media::fillSettingsFromUrl(), zypp::media::findIn(), and hasCredentialsInAuthority().

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

Returns the password from the URL authority.

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

Definition at line 571 of file Url.cc.

References m_impl.

Referenced by zypp::media::MediaCIFS::attachTo(), zypp::media::AuthData::AuthData(), zypp::media::fillSettingsFromUrl(), and hasCredentialsInAuthority().

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

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

Definition at line 367 of file Url.h.

References getPassword(), and getUsername().

Referenced by zypp::RepoManager::addService().

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:
eflag Flag if the host should be percent-decoded or not.
Returns:
The host sub-component from the URL authority.
Exceptions:
url::UrlDecodingException if the decoded result string would contain a '\0' character.

Definition at line 579 of file Url.cc.

References m_impl.

Referenced by zypp::media::MediaNFS::attachTo(), zypp::media::MediaCIFS::attachTo(), zypp::media::MediaCurl::doGetDoesFileExist(), zypp::media::MediaCurl::doGetFileCopy(), zypp::RepoManager::makeStupidAlias(), zypp::media::MediaDIR::MediaDIR(), and zypp::media::ProxyInfo::Impl::useProxyFor().

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 587 of file Url.cc.

References m_impl.

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 539 of file Url.cc.

References m_impl.

Referenced by zypp::media::MediaAccess::getFile(), and zypp::repo::RepoVariablesUrlReplacer::operator()().

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

Returns the path name from the URL.

Parameters:
eflag Flag 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::UrlDecodingException if the decoded result string would contain a '\0' character.

Definition at line 595 of file Url.cc.

References m_impl.

Referenced by zypp::RepoManager::addRepositories(), zypp::media::MediaNFS::attachTo(), zypp::media::MediaCIFS::attachTo(), zypp::media::MediaCurl::doGetFileCopy(), zypp::media::getFileUrl(), zypp::RepoManager::probe(), zypp::RepoManager::refreshService(), and zypp::MediaSetAccess::rewriteUrl().

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

Returns the path parameters from the URL.

Returns:
The encoded path parameters from the URL.

Definition at line 603 of file Url.cc.

References m_impl.

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 611 of file Url.cc.

References m_impl.

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:
eflag Flag 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::UrlNotSupportedException if parameter parsing is not supported for a URL (scheme).
url::UrlDecodingException if the decoded result string would contain a '\0' character.

Definition at line 619 of file Url.cc.

References m_impl.

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:
param The path parameter key.
eflag Flag 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::UrlNotSupportedException if parameter parsing is not supported for a URL (scheme).
url::UrlDecodingException if the decoded result string would contain a '\0' character.

Definition at line 627 of file Url.cc.

References m_impl.

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 URL's remains in the returned string.

Returns:
The encoded query string component of the URL.

Definition at line 547 of file Url.cc.

References m_impl.

Referenced by zypp::repo::RepoVariablesUrlReplacer::operator()().

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 635 of file Url.cc.

References m_impl.

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:
eflag Flag if the query string keys and values should be decoded or not.
Returns:
The query string as a key/value string map.
Exceptions:
url::UrlNotSupportedException if parameter parsing is not supported for a URL (scheme).
url::UrlDecodingException if the decoded result string would contain a '\0' character.

Definition at line 643 of file Url.cc.

References m_impl.

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:
param The query parameter key.
eflag Flag 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::UrlNotSupportedException if parameter parsing is not supported for a URL (scheme).
url::UrlDecodingException if the decoded result string would contain a '\0' character.

Definition at line 651 of file Url.cc.

References m_impl.

Referenced by zypp::media::CredentialManager::addCred(), zypp::media::MediaNFS::attachTo(), zypp::media::MediaDISK::attachTo(), zypp::media::MediaCurl::attachTo(), zypp::media::MediaCIFS::attachTo(), zypp::media::MediaCD::attachTo(), zypp::media::fillSettingsFromUrl(), zypp::media::CredentialManager::getCred(), zypp::media::MediaCD::MediaCD(), zypp::media::MediaDISK::MediaDISK(), zypp::media::MediaISO::MediaISO(), and zypp::MediaSetAccess::rewriteUrl().

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

Returns the encoded fragment component of the URL.

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

Definition at line 555 of file Url.cc.

References m_impl.

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

Set the scheme name in the URL.

Parameters:
scheme The new scheme name.
Exceptions:
url::UrlBadComponentException if the scheme contains an invalid character or is empty.

Definition at line 659 of file Url.cc.

References zypp::url::E_ENCODED, m_impl, zypp::RWCOW_pointer< _D, _Traits >::reset(), and url.

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:
authority The encoded authority component string.
Exceptions:
url::UrlNotAllowedException if the authority has to be empty in for the current scheme.
url::UrlBadComponentException if the authority contains an invalid character.
url::UrlParsingException if authority parsing fails.

Definition at line 689 of file Url.cc.

References m_impl.

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

Set the username in the URL authority.

Parameters:
user The new username.
eflag If the username is encoded or not.
Exceptions:
url::UrlNotAllowedException if the user has to be empty in for the current scheme
url::UrlBadComponentException if the user contains an invalid character.

Definition at line 721 of file Url.cc.

References m_impl.

Referenced by zypp::media::MediaCurl::doGetDoesFileExist(), and zypp::media::MediaCurl::doGetFileCopy().

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

Set the password in the URL authority.

Parameters:
pass The new password.
eflag If the password is encoded or not.
Exceptions:
url::UrlNotAllowedException if the pass has to be empty in for the current scheme.
url::UrlBadComponentException if the pass contains an invalid character.

Definition at line 730 of file Url.cc.

References m_impl.

Referenced by zypp::media::MediaCurl::doGetDoesFileExist(), and zypp::media::MediaCurl::doGetFileCopy().

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:
host The new hostname or IP address.
Exceptions:
url::UrlNotAllowedException if the host (authority) has to be empty in for the current scheme.
url::UrlBadComponentException if the host is invalid.

Definition at line 739 of file Url.cc.

References m_impl.

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

Set the port number in the URL authority.

Parameters:
port The new port number.
Exceptions:
url::UrlNotAllowedException if the port (authority) has to be empty in for the current scheme.
url::UrlBadComponentException if the port is invalid.

Definition at line 747 of file Url.cc.

References m_impl.

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:
pathdata The encoded path data component string.
Exceptions:
url::UrlBadComponentException if the pathdata contains an invalid character.

Definition at line 697 of file Url.cc.

References m_impl.

Referenced by zypp::media::MediaAccess::getFile(), and zypp::repo::RepoVariablesUrlReplacer::operator()().

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

Set the path name.

Parameters:
path The new path name.
eflag If the path name is encoded or not.
Exceptions:
url::UrlBadComponentException if the path name contains an invalid character.

Definition at line 755 of file Url.cc.

References m_impl.

Referenced by zypp::filesystem::Pathname::asUrl(), zypp::media::getFileUrl(), zypp::media::MediaISO::MediaISO(), zypp::RepoManager::refreshService(), and zypp::MediaSetAccess::rewriteUrl().

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

Set the path parameters.

Parameters:
params The new encoded path parameter string.
Exceptions:
url::UrlBadComponentException if the path params contains an invalid character.

Definition at line 764 of file Url.cc.

References m_impl.

Referenced by zypp::media::MediaCurl::doGetDoesFileExist(), and zypp::media::MediaCurl::doGetFileCopy().

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

Set the path parameters.

Parameters:
pvec The vector with encoded path parameters.
Exceptions:
url::UrlBadComponentException if the pvec contains an invalid character.

Definition at line 772 of file Url.cc.

References m_impl.

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

Set the path parameters.

Parameters:
pmap The map with decoded path parameters.
Exceptions:
url::UrlNotSupportedException if parameter parsing is not supported for a URL (scheme).

Definition at line 780 of file Url.cc.

References m_impl.

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

Set or add value for the specified path parameter.

Parameters:
param The decoded path parameter name.
value The decoded path parameter value.
Exceptions:
url::UrlNotSupportedException if parameter parsing is not supported for a URL (scheme).
url::UrlDecodingException if the decoded result string would contain a '\0' character.

Definition at line 788 of file Url.cc.

References m_impl.

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

Set the query string in the URL.

Parameters:
querystr The new encoded query string.
Exceptions:
url::UrlBadComponentException if the querystr contains an invalid character.

Definition at line 705 of file Url.cc.

References m_impl.

Referenced by zypp::media::MediaCurl::doGetDoesFileExist(), zypp::media::MediaCurl::doGetFileCopy(), and zypp::repo::RepoVariablesUrlReplacer::operator()().

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

Set the query parameters.

Parameters:
qvec The vector with encoded query parameters.
Exceptions:
url::UrlBadComponentException if the qvec contains an invalid character.

Definition at line 796 of file Url.cc.

References m_impl.

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

Set the query parameters.

Parameters:
qmap The map with decoded query parameters.
Exceptions:
url::UrlNotSupportedException if parameter parsing is not supported for a URL (scheme).

Definition at line 804 of file Url.cc.

References m_impl.

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

Set or add value for the specified query parameter.

Parameters:
param The decoded query parameter name.
value The decoded query parameter value.
Exceptions:
url::UrlNotSupportedException if parameter parsing is not supported for a URL (scheme).
url::UrlDecodingException if the decoded result string would contain a '\0' character.

Definition at line 811 of file Url.cc.

References m_impl.

Referenced by zypp::MediaSetAccess::rewriteUrl().

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

Set the fragment string in the URL.

Parameters:
fragment The new fragment string.
eflag If the fragment is encoded or not.
Exceptions:
url::UrlBadComponentException if the fragment contains an invalid character.

Definition at line 713 of file Url.cc.

References m_impl.

Referenced by zypp::media::MediaCurl::doGetDoesFileExist(), and zypp::media::MediaCurl::doGetFileCopy().

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 818 of file Url.cc.

References m_impl.

Referenced by asCompleteString(), and zypp::media::fillAriaCmdLine().

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:
vopts New view options combination.

Definition at line 825 of file Url.cc.

References m_impl.


Member Data Documentation


The documentation for this class was generated from the following files:
Generated on Fri Mar 2 09:46:12 2012 for libzypp by  doxygen 1.6.3