File indexing completed on 2025-01-05 03:59:34
0001 // SPDX-FileCopyrightText: 2009 Jens-Michael Hoffmann <jmho@c-xx.com> 0002 // 0003 // SPDX-License-Identifier: LGPL-2.1-or-later 0004 0005 #ifndef MARBLE_DOWNLOADPOLICY_H 0006 #define MARBLE_DOWNLOADPOLICY_H 0007 0008 #include <QString> 0009 #include <QStringList> 0010 0011 #include "MarbleGlobal.h" 0012 0013 namespace Marble 0014 { 0015 0016 class DownloadPolicyKey 0017 { 0018 friend bool operator==( DownloadPolicyKey const & lhs, DownloadPolicyKey const & rhs ); 0019 0020 public: 0021 DownloadPolicyKey(); 0022 DownloadPolicyKey( const QStringList & hostNames, const DownloadUsage usage ); 0023 DownloadPolicyKey( const QString & hostName, const DownloadUsage usage ); 0024 0025 QStringList hostNames() const; 0026 void setHostNames( const QStringList & hostNames ); 0027 0028 DownloadUsage usage() const; 0029 void setUsage( DownloadUsage const usage ); 0030 0031 bool matches( const QString & hostName, const DownloadUsage usage ) const; 0032 0033 private: 0034 QStringList m_hostNames; 0035 DownloadUsage m_usage; 0036 }; 0037 0038 inline bool operator==( const DownloadPolicyKey & lhs, const DownloadPolicyKey & rhs ) 0039 { 0040 return lhs.m_hostNames == rhs.m_hostNames && lhs.m_usage == rhs.m_usage; 0041 } 0042 0043 0044 class DownloadPolicy 0045 { 0046 friend bool operator==( const DownloadPolicy & lhs, const DownloadPolicy & rhs ); 0047 0048 public: 0049 DownloadPolicy(); 0050 explicit DownloadPolicy( const DownloadPolicyKey & key ); 0051 0052 int maximumConnections() const; 0053 void setMaximumConnections( const int ); 0054 0055 DownloadPolicyKey key() const; 0056 0057 private: 0058 DownloadPolicyKey m_key; 0059 int m_maximumConnections; 0060 }; 0061 0062 inline bool operator==( const DownloadPolicy & lhs, const DownloadPolicy & rhs ) 0063 { 0064 return lhs.m_key == rhs.m_key && lhs.m_maximumConnections == rhs.m_maximumConnections; 0065 } 0066 0067 } 0068 0069 #endif