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