mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
refs #485 URL/URL list
* added constructor for CUrlList * added registration of metadata of fail over class * default port support for getPort
This commit is contained in:
committed by
Mathew Sutcliffe
parent
ce3edc37d0
commit
92a36890eb
@@ -28,6 +28,7 @@ namespace BlackMisc
|
||||
CTextMessageList::registerMetadata();
|
||||
CUrl::registerMetadata();
|
||||
CUrlList::registerMetadata();
|
||||
CFailoverUrlList::registerMetadata();
|
||||
CUser::registerMetadata();
|
||||
CUserList::registerMetadata();
|
||||
CVoiceCapabilities::registerMetadata();
|
||||
|
||||
@@ -56,6 +56,12 @@ namespace BlackMisc
|
||||
return m_path;
|
||||
}
|
||||
|
||||
int CUrl::getPort() const
|
||||
{
|
||||
if (m_port > 0) { return m_port; }
|
||||
return protocolToDefaultPort(this->getScheme());
|
||||
}
|
||||
|
||||
bool CUrl::hasPort() const
|
||||
{
|
||||
return m_port >= 0;
|
||||
@@ -128,6 +134,11 @@ namespace BlackMisc
|
||||
this->setQuery(url.query());
|
||||
}
|
||||
|
||||
QNetworkRequest CUrl::toNetworkRequest() const
|
||||
{
|
||||
return QNetworkRequest(this->toQUrl());
|
||||
}
|
||||
|
||||
CUrl CUrl::withAppendedPath(const QString &path) const
|
||||
{
|
||||
if (path.isEmpty()) { return *this; }
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include <QUrl>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -75,7 +76,7 @@ namespace BlackMisc
|
||||
bool hasPath() const { return !m_path.isEmpty(); }
|
||||
|
||||
//! Get port
|
||||
int getPort() const { return m_port; }
|
||||
int getPort() const;
|
||||
|
||||
//! Set port
|
||||
void setPort(int port) { m_port = port; }
|
||||
@@ -113,6 +114,9 @@ namespace BlackMisc
|
||||
//! To QUrl
|
||||
void setQUrl(const QUrl &url);
|
||||
|
||||
//! To request
|
||||
QNetworkRequest toNetworkRequest() const;
|
||||
|
||||
//! Append path
|
||||
CUrl withAppendedPath(const QString &path) const;
|
||||
|
||||
|
||||
@@ -163,6 +163,10 @@ namespace BlackMisc
|
||||
CUrlList(other), m_maxTrials(maxTrials)
|
||||
{ }
|
||||
|
||||
CFailoverUrlList::CFailoverUrlList(const CUrlList &urlIst) :
|
||||
CUrlList(urlIst)
|
||||
{ }
|
||||
|
||||
CUrlList CFailoverUrlList::getWithoutFailed() const
|
||||
{
|
||||
CUrlList urls(*this);
|
||||
|
||||
@@ -90,6 +90,9 @@ namespace BlackMisc
|
||||
//! Construct from a base class object.
|
||||
CFailoverUrlList(const CSequence<CUrl> &other, int maxTrials = 2);
|
||||
|
||||
//! From url list
|
||||
CFailoverUrlList(const CUrlList &urlIst);
|
||||
|
||||
//! All failed URLs
|
||||
const CUrlList &getFailedUrls() const { return m_failedUrls; }
|
||||
|
||||
@@ -117,6 +120,7 @@ namespace BlackMisc
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::Network::CUrlList)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Network::CFailoverUrlList)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Network::CUrl>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Network::CUrl>)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user