Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QUrl &newUrl) | - |
7 | :url(newUrl) | - |
8 | { | - |
9 | } executed: } Execution Count:6558 | 6558 |
10 | | - |
11 | QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QHttpNetworkHeaderPrivate &other) | - |
12 | :QSharedData(other) | - |
13 | { | - |
14 | url = other.url; | - |
15 | fields = other.fields; | - |
16 | } executed: } Execution Count:867 | 867 |
17 | | - |
18 | qint64 QHttpNetworkHeaderPrivate::contentLength() const | - |
19 | { | - |
20 | bool ok = false; | - |
21 | | - |
22 | | - |
23 | QByteArray value; | - |
24 | QList<QPair<QByteArray, QByteArray> >::ConstIterator it = fields.constBegin(), | - |
25 | end = fields.constEnd(); | - |
26 | for ( ; it != end; ++it) evaluated: it != end yes Evaluation Count:13891 | yes Evaluation Count:607 |
| 607-13891 |
27 | if (qstricmp("content-length", it->first) == 0) { evaluated: qstricmp("content-length", it->first) == 0 yes Evaluation Count:2881 | yes Evaluation Count:11010 |
| 2881-11010 |
28 | value = it->second; | - |
29 | break; executed: break; Execution Count:2881 | 2881 |
30 | } | - |
31 | | - |
32 | qint64 length = value.toULongLong(&ok); | - |
33 | if (ok) evaluated: ok yes Evaluation Count:2881 | yes Evaluation Count:607 |
| 607-2881 |
34 | return length; executed: return length; Execution Count:2881 | 2881 |
35 | return -1; executed: return -1; Execution Count:607 | 607 |
36 | } | - |
37 | | - |
38 | void QHttpNetworkHeaderPrivate::setContentLength(qint64 length) | - |
39 | { | - |
40 | setHeaderField("Content-Length", QByteArray::number(length)); | - |
41 | } executed: } Execution Count:178 | 178 |
42 | | - |
43 | QByteArray QHttpNetworkHeaderPrivate::headerField(const QByteArray &name, const QByteArray &defaultValue) const | - |
44 | { | - |
45 | QList<QByteArray> allValues = headerFieldValues(name); | - |
46 | if (allValues.isEmpty()) evaluated: allValues.isEmpty() yes Evaluation Count:6786 | yes Evaluation Count:1768 |
| 1768-6786 |
47 | return defaultValue; executed: return defaultValue; Execution Count:6786 | 6786 |
48 | | - |
49 | QByteArray result; | - |
50 | bool first = true; | - |
51 | for (QForeachContainer<__typeof__(allValues)> _container_(allValues); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QByteArray &value = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
52 | if (!first) partially evaluated: !first no Evaluation Count:0 | yes Evaluation Count:1768 |
| 0-1768 |
53 | result += ", "; never executed: result += ", "; | 0 |
54 | first = false; | - |
55 | result += value; | - |
56 | } executed: } Execution Count:1768 | 1768 |
57 | return result; executed: return result; Execution Count:1768 | 1768 |
58 | } | - |
59 | | - |
60 | QList<QByteArray> QHttpNetworkHeaderPrivate::headerFieldValues(const QByteArray &name) const | - |
61 | { | - |
62 | QList<QByteArray> result; | - |
63 | QList<QPair<QByteArray, QByteArray> >::ConstIterator it = fields.constBegin(), | - |
64 | end = fields.constEnd(); | - |
65 | for ( ; it != end; ++it) evaluated: it != end yes Evaluation Count:46061 | yes Evaluation Count:8889 |
| 8889-46061 |
66 | if (qstricmp(name.constData(), it->first) == 0) evaluated: qstricmp(name.constData(), it->first) == 0 yes Evaluation Count:2102 | yes Evaluation Count:43959 |
| 2102-43959 |
67 | result += it->second; executed: result += it->second; Execution Count:2102 | 2102 |
68 | | - |
69 | return result; executed: return result; Execution Count:8889 | 8889 |
70 | } | - |
71 | | - |
72 | void QHttpNetworkHeaderPrivate::setHeaderField(const QByteArray &name, const QByteArray &data) | - |
73 | { | - |
74 | QList<QPair<QByteArray, QByteArray> >::Iterator it = fields.begin(); | - |
75 | while (it != fields.end()) { evaluated: it != fields.end() yes Evaluation Count:10393 | yes Evaluation Count:4144 |
| 4144-10393 |
76 | if (qstricmp(name.constData(), it->first) == 0) evaluated: qstricmp(name.constData(), it->first) == 0 yes Evaluation Count:155 | yes Evaluation Count:10238 |
| 155-10238 |
77 | it = fields.erase(it); executed: it = fields.erase(it); Execution Count:155 | 155 |
78 | else | - |
79 | ++it; executed: ++it; Execution Count:10238 | 10238 |
80 | } | - |
81 | fields.append(qMakePair(name, data)); | - |
82 | } executed: } Execution Count:4144 | 4144 |
83 | | - |
84 | bool QHttpNetworkHeaderPrivate::operator==(const QHttpNetworkHeaderPrivate &other) const | - |
85 | { | - |
86 | return (url == other.url); never executed: return (url == other.url); | 0 |
87 | } | - |
88 | | - |
89 | | - |
90 | | - |
91 | | - |
| | |