#ifndef ZYPP_URL_URLBASE_H
#define ZYPP_URL_URLBASE_H
-#include <zypp/url/UrlUtils.h>
-#include <zypp/base/PtrTypes.h>
+#include "zypp/url/UrlUtils.h"
+#include "zypp/base/PtrTypes.h"
//////////////////////////////////////////////////////////////////////
/**
* Create instance with default combination of view options.
*/
- ViewOption(): opt(DEFAULTS.opt)
- {}
+ ViewOption();
/**
}
private:
- ViewOption(int o): opt(o) {}
+ ViewOption(int option);
int opt;
};
*
* The UrlBase class implements default behaviour for URL
* manipulations and a base for implementation of scheme-
- * specialized URL's for the Url class.
+ * specialized URLs for the Url class.
*
*/
class UrlBase
* or compatible to).
*
* For example, if your derived class implements special
- * features of LDAP URL's, this method may return "ldap"
+ * features of LDAP URLs, this method may return "ldap"
* and "ldaps" scheme names.
*
* The UrlBase class returns an empty vector, that signals
- * that it is useable with all URL's.
+ * that it is useable with all URLs.
*
* \return A vector with scheme names known by this object.
*/
* 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
+ * character. Further "?" characters as in e.g. LDAP URLs
* remains in the returned string.
*
* \return The encoded query string component of the URL.
virtual void
setQueryParam(const std::string ¶m, const std::string &value);
+ /**
+ * \brief remove the specified query parameter.
+ * \param param The decoded query parameter name.
+ * \throws UrlNotSupportedException if parameter parsing
+ * is not supported for a URL (scheme).
+ * \throws UrlDecodingException if the decoded result string
+ * would contain a '\\0' character.
+ */
+ virtual void
+ delQueryParam(const std::string ¶m);
+
// -----------------
/**
*
* It is not required if there is an authority ("//" behind
* the "scheme:"), that is in the path-abempty rule, but it
- * is allowed and used e.g. in ftp url's defined by RFC1738.
+ * is used e.g. in ftp url's defined by RFC1738.
+ *
+ * We apply this operation in both cases (for all paths),
+ * but if \p authority is true, the encoding of the second
+ * slash depends on the schema configuration (for ftp only).
+ *
+ * \param path The encoded path name to cleanup.
+ * \param authority Whether the url contains authority or not.
+ * \return A modified encoded path.
+ */
+ virtual std::string
+ cleanupPathName(const std::string &path, bool authority) const;
+
+ /**
+ * Utility method to cleanup an encoded path name.
*
- * We apply this operation in both cases (for all paths).
+ * This variant of the method checks if the host component
+ * in the url is empty or not to differentiate if there is
+ * an authority.
*
- * \param path The encoded path name to cleanup.
+ * \param path The encoded path name to cleanup.
* \return A modified encoded path.
*/
virtual std::string
- cleanupPathName(const std::string &path);
+ cleanupPathName(const std::string &path) const;
/**
* \brief Verifies specified host or IP.
* \return True, if host seems to be valid.
*/
virtual bool
- isValidHost(const std::string &host);
+ isValidHost(const std::string &host) const;
/**
* \brief Verifies specified port number.
* \return True, if port number is valid.
*/
virtual bool
- isValidPort(const std::string &port);
+ isValidPort(const std::string &port) const;
private:
UrlBaseData *m_data;