Go to the documentation of this file.
12 #ifndef ZYPP_URL_URLBASE_H
13 #define ZYPP_URL_URLBASE_H
218 opt = o.
opt;
return *
this;
298 UrlBase(
const std::string &scheme,
299 const std::string &authority,
300 const std::string &pathdata,
301 const std::string &querystr,
302 const std::string &fragment);
340 init(
const std::string &scheme,
341 const std::string &authority,
342 const std::string &pathdata,
343 const std::string &querystr,
344 const std::string &fragment);
741 setHost(
const std::string &host);
751 setPort(
const std::string &port);
816 setPathParam(
const std::string ¶m,
const std::string &value);
863 setQueryParam(
const std::string ¶m,
const std::string &value);
961 config(
const std::string &opt)
const;
973 config(
const std::string &opt,
const std::string &val);
virtual std::string getPassword(EEncoding eflag) const
Returns the password from the URL authority.
std::string config(const std::string &opt) const
Get the value of a UrlBase configuration variable.
virtual void setQueryString(const std::string &querystr)
Set the query string in the URL.
virtual void setPathName(const std::string &path, EEncoding eflag)
Set the path name.
virtual void setPathParam(const std::string ¶m, const std::string &value)
Set or add value for the specified path parameter.
virtual UrlBase * clone() const
Returns pointer to a copy of the current object.
virtual bool isValid() const
Verifies the Url.
virtual std::string getPathParam(const std::string ¶m, EEncoding eflag) const
Return the value for the specified path parameter.
virtual std::string getQueryParam(const std::string ¶m, EEncoding eflag) const
Return the value for the specified query parameter.
virtual void setPathParamsVec(const zypp::url::ParamVec &pvec)
Set the path parameters.
virtual std::string getPathParams() const
Returns the encoded path parameters from the URL.
virtual void setQueryStringMap(const zypp::url::ParamMap &qmap)
Set the query parameters.
Internal data used by UrlBase.
ViewOption & operator=(const ViewOption &o)
Assign specified option combination o to the current object.
std::vector< std::string > UrlSchemes
Vector of URL scheme names.
virtual void setAuthority(const std::string &authority)
Set the authority component in the URL.
static const ViewOption EMPTY_PATH_NAME
Explicitely include the "/" path character.
virtual std::string getPort() const
Returns the port number from the URL authority.
virtual void clear()
Clears all data in the object.
ViewOption ViewOptions
ViewOptions is just an alias for ViewOption.
static const ViewOption WITH_USERNAME
Option to include username in the URL string.
virtual UrlSchemes getKnownSchemes() const
Returns scheme names known by this object.
static const ViewOption WITH_FRAGMENT
Option to include fragment string in the URL string.
virtual std::string getPathData() const
Returns the encoded path component of the URL.
static const ViewOption WITH_PATH_NAME
Option to include path name in the URL string.
virtual bool isKnownScheme(const std::string &scheme) const
Returns if scheme name is known to this object.
static const ViewOption EMPTY_PATH_PARAMS
Explicitely include the path parameters separator ";".
ViewOption()
Create instance with default combination of view options.
virtual std::string asString() const
Returns a default string representation of the Url object.
static const ViewOption EMPTY_QUERY_STR
Explicitely include the query string separator "?".
static const ViewOption EMPTY_FRAGMENT
Explicitely include the fragment string separator "#".
static const ViewOption WITH_PASSWORD
Option to include password in the URL string.
virtual zypp::url::ParamMap getQueryStringMap(EEncoding eflag) const
Returns a string map with query parameter and their values.
virtual std::string getPathName(EEncoding eflag) const
Returns the path name from the URL.
virtual void configure()
Configures behaviour of the instance.
static const ViewOption DEFAULTS
Default combination of view options.
bool has(const ViewOption &o) const
Check if specified option o is set in the current object.
static const ViewOption EMPTY_AUTHORITY
Explicitely include the URL authority separator "//".
virtual void setUsername(const std::string &user, EEncoding eflag)
Set the username in the URL authority.
virtual void setPathParamsMap(const zypp::url::ParamMap &pmap)
Set the path parameters.
Easy-to use interface to the ZYPP dependency resolver.
RWCOW_pointer< UrlBase > UrlRef
Copy-On-Write Url reference.
virtual std::string getAuthority() const
Returns the encoded authority component of the URL.
virtual void setPathData(const std::string &pathdata)
Set the path data component in the URL.
virtual bool isValidHost(const std::string &host) const
Verifies specified host or IP.
std::map< std::string, std::string > ParamMap
A parameter map container.
virtual std::string getHost(EEncoding eflag) const
Returns the hostname or IP from the URL authority.
virtual zypp::url::ParamVec getQueryStringVec() const
Returns a vector with query string parameter substrings.
static const ViewOption WITH_QUERY_STR
Option to include query string in the URL string.
virtual void init(const std::string &scheme, const std::string &authority, const std::string &pathdata, const std::string &querystr, const std::string &fragment)
Initializes current object with new URL components.
virtual void setQueryStringVec(const zypp::url::ParamVec &qvec)
Set the query parameters.
virtual bool isValidScheme(const std::string &scheme) const
Verifies specified scheme name.
friend ViewOption operator-(const ViewOption &l, const ViewOption &r)
Substract r from l to a new option combination.
virtual zypp::url::ParamMap getPathParamsMap(EEncoding eflag) const
Returns a string map with path parameter keys and values.
virtual std::string getScheme() const
Returns the scheme name of the URL.
std::vector< std::string > ParamVec
A parameter vector container.
virtual void setHost(const std::string &host)
Set the hostname or IP in the URL authority.
virtual void setFragment(const std::string &fragment, EEncoding eflag)
Set the fragment string in the URL.
virtual void delQueryParam(const std::string ¶m)
remove the specified query parameter.
virtual zypp::url::ParamVec getPathParamsVec() const
Returns a vector with encoded path parameter substrings.
virtual void setScheme(const std::string &scheme)
Set the scheme name in the URL.
virtual std::string getUsername(EEncoding eflag) const
Returns the username from the URL authority.
virtual void setPathParams(const std::string ¶ms)
Set the path parameters.
virtual void setQueryParam(const std::string ¶m, const std::string &value)
Set or add value for the specified query parameter.
virtual void setPort(const std::string &port)
Set the port number in the URL authority.
virtual std::string cleanupPathName(const std::string &path, bool authority) const
Utility method to cleanup an encoded path name.
virtual bool isValidPort(const std::string &port) const
Verifies specified port number.
virtual std::string getQueryString() const
Returns the encoded query string component of the URL.
Url::asString() view options.
virtual std::string getFragment(EEncoding eflag) const
Returns the encoded fragment component of the URL.
friend ViewOption operator+(const ViewOption &l, const ViewOption &r)
Adds l and r to a new option combination.
static const ViewOption WITH_SCHEME
Option to include scheme name in the URL string.
static const ViewOption WITH_HOST
Option to include hostname in the URL string.
void setViewOptions(const ViewOptions &vopts)
Change the view options of the current object.
ViewOptions getViewOptions() const
Return the view options of the current object.
virtual void setPassword(const std::string &pass, EEncoding eflag)
Set the password in the URL authority.
static const ViewOption WITH_PORT
Option to include port number in the URL string.
static const ViewOption WITH_PATH_PARAMS
Option to include path parameters in the URL string.