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 #include "DownloadPolicy.h" 0006 0007 namespace Marble 0008 { 0009 0010 DownloadPolicyKey::DownloadPolicyKey() 0011 : m_hostNames(), 0012 m_usage( DownloadBrowse ) 0013 { 0014 } 0015 0016 DownloadPolicyKey::DownloadPolicyKey( const QStringList & hostNames, 0017 const DownloadUsage usage ) 0018 : m_hostNames( hostNames ), 0019 m_usage( usage ) 0020 { 0021 } 0022 0023 DownloadPolicyKey::DownloadPolicyKey( const QString & hostName, 0024 const DownloadUsage usage ) 0025 : m_hostNames( hostName ), 0026 m_usage( usage ) 0027 { 0028 } 0029 0030 QStringList DownloadPolicyKey::hostNames() const 0031 { 0032 return m_hostNames; 0033 } 0034 0035 void DownloadPolicyKey::setHostNames( const QStringList & hostNames ) 0036 { 0037 m_hostNames = hostNames; 0038 } 0039 0040 DownloadUsage DownloadPolicyKey::usage() const 0041 { 0042 return m_usage; 0043 } 0044 0045 void DownloadPolicyKey::setUsage( DownloadUsage const usage ) 0046 { 0047 m_usage = usage; 0048 } 0049 0050 bool DownloadPolicyKey::matches( QString const & hostName, const DownloadUsage usage ) const 0051 { 0052 return m_hostNames.contains( hostName ) && m_usage == usage; 0053 } 0054 0055 0056 DownloadPolicy::DownloadPolicy() 0057 : m_key(), 0058 m_maximumConnections( 1 ) 0059 { 0060 } 0061 0062 DownloadPolicy::DownloadPolicy( const DownloadPolicyKey & key ) 0063 : m_key( key ), 0064 m_maximumConnections( 1 ) 0065 { 0066 } 0067 0068 int DownloadPolicy::maximumConnections() const 0069 { 0070 return m_maximumConnections; 0071 } 0072 0073 void DownloadPolicy::setMaximumConnections( const int n ) 0074 { 0075 m_maximumConnections = n; 0076 } 0077 0078 DownloadPolicyKey DownloadPolicy::key() const 0079 { 0080 return m_key; 0081 } 0082 0083 }