refs #497, improved URL and network utils

* utility functions
* URL, allow to switch to https
* Adjusted database writer
This commit is contained in:
Klaus Basan
2015-10-29 03:03:53 +01:00
committed by Mathew Sutcliffe
parent 03f4aa6889
commit 7cb4c6a6c6
6 changed files with 86 additions and 21 deletions

View File

@@ -100,7 +100,6 @@ namespace BlackMisc
QString CUrl::getFullUrl() const
{
Q_ASSERT_X(!m_host.isEmpty(), Q_FUNC_INFO, "missing address");
if (m_host.isEmpty()) { return ""; }
QString qn(m_host);
@@ -138,6 +137,16 @@ namespace BlackMisc
return url;
}
CUrl CUrl::withSwitchedScheme(const QString &scheme, int port) const
{
if (getPort() == port && getScheme() == scheme) { return *this; }
QUrl qurl(this->toQUrl());
qurl.setPort(port);
qurl.setScheme(scheme);
CUrl url(qurl);
return url;
}
CUrl CUrl::withAppendedQuery(const QString &query) const
{
if (query.isEmpty()) { return *this; }