Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/bearer/qbearerengine.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||
2 | ** | - | ||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||
5 | ** | - | ||||||
6 | ** This file is part of the QtNetwork module of the Qt Toolkit. | - | ||||||
7 | ** | - | ||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||
9 | ** Commercial License Usage | - | ||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||
15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||
16 | ** | - | ||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||
25 | ** | - | ||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||
29 | ** | - | ||||||
30 | ** $QT_END_LICENSE$ | - | ||||||
31 | ** | - | ||||||
32 | ****************************************************************************/ | - | ||||||
33 | - | |||||||
34 | #include "qbearerengine_p.h" | - | ||||||
35 | - | |||||||
36 | #ifndef QT_NO_BEARERMANAGEMENT | - | ||||||
37 | - | |||||||
38 | QT_BEGIN_NAMESPACE | - | ||||||
39 | - | |||||||
40 | QBearerEngine::QBearerEngine(QObject *parent) | - | ||||||
41 | : QObject(parent), mutex(QMutex::Recursive) | - | ||||||
42 | { | - | ||||||
43 | } executed 54 times by 16 tests: end of block Executed by:
| 54 | ||||||
44 | - | |||||||
45 | QBearerEngine::~QBearerEngine() | - | ||||||
46 | { | - | ||||||
47 | QHash<QString, QNetworkConfigurationPrivatePointer>::Iterator it; | - | ||||||
48 | QHash<QString, QNetworkConfigurationPrivatePointer>::Iterator end; | - | ||||||
49 | - | |||||||
50 | for (it = snapConfigurations.begin(), end = snapConfigurations.end(); it != end; ++it) {
| 0-58 | ||||||
51 | it.value()->isValid = false; | - | ||||||
52 | it.value()->id.clear(); | - | ||||||
53 | } never executed: end of block | 0 | ||||||
54 | snapConfigurations.clear(); | - | ||||||
55 | - | |||||||
56 | for (it = accessPointConfigurations.begin(), end = accessPointConfigurations.end(); | - | ||||||
57 | it != end; ++it) {
| 58-60 | ||||||
58 | it.value()->isValid = false; | - | ||||||
59 | it.value()->id.clear(); | - | ||||||
60 | } executed 60 times by 19 tests: end of block Executed by:
| 60 | ||||||
61 | accessPointConfigurations.clear(); | - | ||||||
62 | - | |||||||
63 | for (it = userChoiceConfigurations.begin(), end = userChoiceConfigurations.end(); | - | ||||||
64 | it != end; ++it) {
| 0-58 | ||||||
65 | it.value()->isValid = false; | - | ||||||
66 | it.value()->id.clear(); | - | ||||||
67 | } never executed: end of block | 0 | ||||||
68 | userChoiceConfigurations.clear(); | - | ||||||
69 | } executed 58 times by 34 tests: end of block Executed by:
| 58 | ||||||
70 | - | |||||||
71 | bool QBearerEngine::requiresPolling() const | - | ||||||
72 | { | - | ||||||
73 | return false; executed 125 times by 18 tests: return false; Executed by:
| 125 | ||||||
74 | } | - | ||||||
75 | - | |||||||
76 | /* | - | ||||||
77 | Returns \c true if configurations are in use; otherwise returns \c false. | - | ||||||
78 | - | |||||||
79 | If configurations are in use and requiresPolling() returns \c true, polling will be enabled for | - | ||||||
80 | this engine. | - | ||||||
81 | */ | - | ||||||
82 | bool QBearerEngine::configurationsInUse() const | - | ||||||
83 | { | - | ||||||
84 | QHash<QString, QNetworkConfigurationPrivatePointer>::ConstIterator it; | - | ||||||
85 | QHash<QString, QNetworkConfigurationPrivatePointer>::ConstIterator end; | - | ||||||
86 | - | |||||||
87 | QMutexLocker locker(&mutex); | - | ||||||
88 | - | |||||||
89 | for (it = accessPointConfigurations.constBegin(), | - | ||||||
90 | end = accessPointConfigurations.constEnd(); it != end; ++it) {
| 6-12 | ||||||
91 | if (it.value()->ref.load() > 1)
| 0-12 | ||||||
92 | return true; never executed: return true; | 0 | ||||||
93 | } executed 12 times by 4 tests: end of block Executed by:
| 12 | ||||||
94 | - | |||||||
95 | for (it = snapConfigurations.constBegin(), | - | ||||||
96 | end = snapConfigurations.constEnd(); it != end; ++it) {
| 0-6 | ||||||
97 | if (it.value()->ref.load() > 1)
| 0 | ||||||
98 | return true; never executed: return true; | 0 | ||||||
99 | } never executed: end of block | 0 | ||||||
100 | - | |||||||
101 | for (it = userChoiceConfigurations.constBegin(), | - | ||||||
102 | end = userChoiceConfigurations.constEnd(); it != end; ++it) {
| 0-6 | ||||||
103 | if (it.value()->ref.load() > 1)
| 0 | ||||||
104 | return true; never executed: return true; | 0 | ||||||
105 | } never executed: end of block | 0 | ||||||
106 | - | |||||||
107 | return false; executed 6 times by 4 tests: return false; Executed by:
| 6 | ||||||
108 | } | - | ||||||
109 | - | |||||||
110 | #include "moc_qbearerengine_p.cpp" | - | ||||||
111 | - | |||||||
112 | #endif // QT_NO_BEARERMANAGEMENT | - | ||||||
113 | - | |||||||
114 | QT_END_NAMESPACE | - | ||||||
Source code | Switch to Preprocessed file |