| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/json/qjsonarray.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | QJsonArray::QJsonArray() | - | ||||||||||||||||||
| 5 | : d(0), a(0) | - | ||||||||||||||||||
| 6 | { | - | ||||||||||||||||||
| 7 | } executed 42094 times by 116 tests: end of blockExecuted by:
| 42094 | ||||||||||||||||||
| 8 | QJsonArray::QJsonArray(QJsonPrivate::Data *data, QJsonPrivate::Array *array) | - | ||||||||||||||||||
| 9 | : d(data), a(array) | - | ||||||||||||||||||
| 10 | { | - | ||||||||||||||||||
| 11 | ((!(data)) ? qt_assert("data",__FILE__,151) : qt_noop()); | - | ||||||||||||||||||
| 12 | ((!(array)) ? qt_assert("array",__FILE__,152) : qt_noop()); | - | ||||||||||||||||||
| 13 | d->ref.ref(); | - | ||||||||||||||||||
| 14 | } executed 41985 times by 113 tests: end of blockExecuted by:
| 41985 | ||||||||||||||||||
| 15 | void QJsonArray::initialize() | - | ||||||||||||||||||
| 16 | { | - | ||||||||||||||||||
| 17 | d = 0; | - | ||||||||||||||||||
| 18 | a = 0; | - | ||||||||||||||||||
| 19 | } never executed: end of block | 0 | ||||||||||||||||||
| 20 | - | |||||||||||||||||||
| 21 | - | |||||||||||||||||||
| 22 | - | |||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | QJsonArray::~QJsonArray() | - | ||||||||||||||||||
| 25 | { | - | ||||||||||||||||||
| 26 | if (d
| 2-42433 | ||||||||||||||||||
| 27 | delete d; executed 2 times by 1 test: delete d;Executed by:
| 2 | ||||||||||||||||||
| 28 | } executed 84565 times by 116 tests: end of blockExecuted by:
| 84565 | ||||||||||||||||||
| 29 | - | |||||||||||||||||||
| 30 | - | |||||||||||||||||||
| 31 | - | |||||||||||||||||||
| 32 | - | |||||||||||||||||||
| 33 | - | |||||||||||||||||||
| 34 | - | |||||||||||||||||||
| 35 | - | |||||||||||||||||||
| 36 | QJsonArray::QJsonArray(const QJsonArray &other) | - | ||||||||||||||||||
| 37 | { | - | ||||||||||||||||||
| 38 | d = other.d; | - | ||||||||||||||||||
| 39 | a = other.a; | - | ||||||||||||||||||
| 40 | if (d
| 45-441 | ||||||||||||||||||
| 41 | d->ref.ref(); executed 441 times by 2 tests: d->ref.ref();Executed by:
| 441 | ||||||||||||||||||
| 42 | } executed 486 times by 5 tests: end of blockExecuted by:
| 486 | ||||||||||||||||||
| 43 | - | |||||||||||||||||||
| 44 | - | |||||||||||||||||||
| 45 | - | |||||||||||||||||||
| 46 | - | |||||||||||||||||||
| 47 | QJsonArray &QJsonArray::operator =(const QJsonArray &other) | - | ||||||||||||||||||
| 48 | { | - | ||||||||||||||||||
| 49 | if (d != other.d
| 5-41 | ||||||||||||||||||
| 50 | if (d
| 0-5 | ||||||||||||||||||
| 51 | delete d; never executed: delete d; | 0 | ||||||||||||||||||
| 52 | d = other.d; | - | ||||||||||||||||||
| 53 | if (d
| 0-5 | ||||||||||||||||||
| 54 | d->ref.ref(); executed 5 times by 1 test: d->ref.ref();Executed by:
| 5 | ||||||||||||||||||
| 55 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||
| 56 | a = other.a; | - | ||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | return executed 46 times by 2 tests: *this;return *this;Executed by:
executed 46 times by 2 tests: return *this;Executed by:
| 46 | ||||||||||||||||||
| 59 | } | - | ||||||||||||||||||
| 60 | QJsonArray QJsonArray::fromStringList(const QStringList &list) | - | ||||||||||||||||||
| 61 | { | - | ||||||||||||||||||
| 62 | QJsonArray array; | - | ||||||||||||||||||
| 63 | for (QStringList::const_iterator it = list.constBegin(); it != list.constEnd()
| 0 | ||||||||||||||||||
| 64 | array.append(QJsonValue(*it)); never executed: array.append(QJsonValue(*it)); | 0 | ||||||||||||||||||
| 65 | return never executed: array;return array;never executed: return array; | 0 | ||||||||||||||||||
| 66 | } | - | ||||||||||||||||||
| 67 | QJsonArray QJsonArray::fromVariantList(const QVariantList &list) | - | ||||||||||||||||||
| 68 | { | - | ||||||||||||||||||
| 69 | QJsonArray array; | - | ||||||||||||||||||
| 70 | if (list.isEmpty()
| 0 | ||||||||||||||||||
| 71 | return never executed: array;return array;never executed: return array; | 0 | ||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | array.detach2(1024); | - | ||||||||||||||||||
| 74 | - | |||||||||||||||||||
| 75 | QVector<QJsonPrivate::Value> values; | - | ||||||||||||||||||
| 76 | values.resize(list.size()); | - | ||||||||||||||||||
| 77 | QJsonPrivate::Value *valueData = values.data(); | - | ||||||||||||||||||
| 78 | uint currentOffset = sizeof(QJsonPrivate::Base); | - | ||||||||||||||||||
| 79 | - | |||||||||||||||||||
| 80 | for (int i = 0; i < list.size()
| 0 | ||||||||||||||||||
| 81 | QJsonValue val = QJsonValue::fromVariant(list.at(i)); | - | ||||||||||||||||||
| 82 | - | |||||||||||||||||||
| 83 | bool latinOrIntValue; | - | ||||||||||||||||||
| 84 | int valueSize = QJsonPrivate::Value::requiredStorage(val, &latinOrIntValue); | - | ||||||||||||||||||
| 85 | - | |||||||||||||||||||
| 86 | if (!array.detach2(valueSize)
| 0 | ||||||||||||||||||
| 87 | return never executed: QJsonArray();return QJsonArray();never executed: return QJsonArray(); | 0 | ||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | QJsonPrivate::Value *v = valueData + i; | - | ||||||||||||||||||
| 90 | v->type = (val.t == QJsonValue::Undefined
| 0 | ||||||||||||||||||
| 91 | v->latinOrIntValue = latinOrIntValue; | - | ||||||||||||||||||
| 92 | v->latinKey = false; | - | ||||||||||||||||||
| 93 | v->value = QJsonPrivate::Value::valueToStore(val, currentOffset); | - | ||||||||||||||||||
| 94 | if (valueSize
| 0 | ||||||||||||||||||
| 95 | QJsonPrivate::Value::copyData(val, (char *)array.a + currentOffset, latinOrIntValue); never executed: QJsonPrivate::Value::copyData(val, (char *)array.a + currentOffset, latinOrIntValue); | 0 | ||||||||||||||||||
| 96 | - | |||||||||||||||||||
| 97 | currentOffset += valueSize; | - | ||||||||||||||||||
| 98 | array.a->size = currentOffset; | - | ||||||||||||||||||
| 99 | } never executed: end of block | 0 | ||||||||||||||||||
| 100 | - | |||||||||||||||||||
| 101 | - | |||||||||||||||||||
| 102 | array.a->tableOffset = currentOffset; | - | ||||||||||||||||||
| 103 | if (!array.detach2(sizeof(QJsonPrivate::offset)*values.size())
| 0 | ||||||||||||||||||
| 104 | return never executed: QJsonArray();return QJsonArray();never executed: return QJsonArray(); | 0 | ||||||||||||||||||
| 105 | memcpy(array.a->table(), values.constData(), values.size()*sizeof(uint)); | - | ||||||||||||||||||
| 106 | array.a->length = values.size(); | - | ||||||||||||||||||
| 107 | array.a->size = currentOffset + sizeof(QJsonPrivate::offset)*values.size(); | - | ||||||||||||||||||
| 108 | - | |||||||||||||||||||
| 109 | return never executed: array;return array;never executed: return array; | 0 | ||||||||||||||||||
| 110 | } | - | ||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | - | |||||||||||||||||||
| 113 | - | |||||||||||||||||||
| 114 | - | |||||||||||||||||||
| 115 | - | |||||||||||||||||||
| 116 | - | |||||||||||||||||||
| 117 | QVariantList QJsonArray::toVariantList() const | - | ||||||||||||||||||
| 118 | { | - | ||||||||||||||||||
| 119 | QVariantList list; | - | ||||||||||||||||||
| 120 | - | |||||||||||||||||||
| 121 | if (a
| 0 | ||||||||||||||||||
| 122 | list.reserve(a->length); | - | ||||||||||||||||||
| 123 | for (int i = 0; i < (int)a->length
| 0 | ||||||||||||||||||
| 124 | list.append(QJsonValue(d, a, a->at(i)).toVariant()); never executed: list.append(QJsonValue(d, a, a->at(i)).toVariant()); | 0 | ||||||||||||||||||
| 125 | } never executed: end of block | 0 | ||||||||||||||||||
| 126 | return never executed: list;return list;never executed: return list; | 0 | ||||||||||||||||||
| 127 | } | - | ||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | - | |||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | - | |||||||||||||||||||
| 133 | int QJsonArray::size() const | - | ||||||||||||||||||
| 134 | { | - | ||||||||||||||||||
| 135 | if (!d
| 2-42903 | ||||||||||||||||||
| 136 | return executed 2 times by 1 test: 0;return 0;Executed by:
executed 2 times by 1 test: return 0;Executed by:
| 2 | ||||||||||||||||||
| 137 | - | |||||||||||||||||||
| 138 | return executed 42903 times by 113 tests: (int)a->length;return (int)a->length;Executed by:
executed 42903 times by 113 tests: return (int)a->length;Executed by:
| 42903 | ||||||||||||||||||
| 139 | } | - | ||||||||||||||||||
| 140 | bool QJsonArray::isEmpty() const | - | ||||||||||||||||||
| 141 | { | - | ||||||||||||||||||
| 142 | if (!d
| 3-18 | ||||||||||||||||||
| 143 | return executed 18 times by 1 test: true;return true;Executed by:
executed 18 times by 1 test: return true;Executed by:
| 18 | ||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | return executed 3 times by 1 test: !a->length;return !a->length;Executed by:
executed 3 times by 1 test: return !a->length;Executed by:
| 3 | ||||||||||||||||||
| 146 | } | - | ||||||||||||||||||
| 147 | - | |||||||||||||||||||
| 148 | - | |||||||||||||||||||
| 149 | - | |||||||||||||||||||
| 150 | - | |||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 | - | |||||||||||||||||||
| 153 | - | |||||||||||||||||||
| 154 | QJsonValue QJsonArray::at(int i) const | - | ||||||||||||||||||
| 155 | { | - | ||||||||||||||||||
| 156 | if (!a
| 0-68778 | ||||||||||||||||||
| 157 | return executed 2 times by 2 tests: QJsonValue(QJsonValue::Undefined);return QJsonValue(QJsonValue::Undefined);Executed by:
executed 2 times by 2 tests: return QJsonValue(QJsonValue::Undefined);Executed by:
| 2 | ||||||||||||||||||
| 158 | - | |||||||||||||||||||
| 159 | return executed 68776 times by 113 tests: QJsonValue(d, a, a->at(i));return QJsonValue(d, a, a->at(i));Executed by:
executed 68776 times by 113 tests: return QJsonValue(d, a, a->at(i));Executed by:
| 68776 | ||||||||||||||||||
| 160 | } | - | ||||||||||||||||||
| 161 | QJsonValue QJsonArray::first() const | - | ||||||||||||||||||
| 162 | { | - | ||||||||||||||||||
| 163 | return never executed: at(0);return at(0);never executed: return at(0); | 0 | ||||||||||||||||||
| 164 | } | - | ||||||||||||||||||
| 165 | QJsonValue QJsonArray::last() const | - | ||||||||||||||||||
| 166 | { | - | ||||||||||||||||||
| 167 | return never executed: at(a ? (a->length - 1) : 0);return at(a ? (a->length - 1) : 0);never executed: return at(a ? (a->length - 1) : 0); | 0 | ||||||||||||||||||
| 168 | } | - | ||||||||||||||||||
| 169 | void QJsonArray::prepend(const QJsonValue &value) | - | ||||||||||||||||||
| 170 | { | - | ||||||||||||||||||
| 171 | insert(0, value); | - | ||||||||||||||||||
| 172 | } never executed: end of block | 0 | ||||||||||||||||||
| 173 | - | |||||||||||||||||||
| 174 | - | |||||||||||||||||||
| 175 | - | |||||||||||||||||||
| 176 | - | |||||||||||||||||||
| 177 | - | |||||||||||||||||||
| 178 | - | |||||||||||||||||||
| 179 | void QJsonArray::append(const QJsonValue &value) | - | ||||||||||||||||||
| 180 | { | - | ||||||||||||||||||
| 181 | insert(a ? (int)a->length : 0, value); | - | ||||||||||||||||||
| 182 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 183 | - | |||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | - | |||||||||||||||||||
| 186 | - | |||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | - | |||||||||||||||||||
| 190 | void QJsonArray::removeAt(int i) | - | ||||||||||||||||||
| 191 | { | - | ||||||||||||||||||
| 192 | if (!a
| 0 | ||||||||||||||||||
| 193 | return; never executed: return; | 0 | ||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | detach2(); | - | ||||||||||||||||||
| 196 | a->removeItems(i, 1); | - | ||||||||||||||||||
| 197 | ++d->compactionCounter; | - | ||||||||||||||||||
| 198 | if (d->compactionCounter > 32u
| 0 | ||||||||||||||||||
| 199 | compact(); never executed: compact(); | 0 | ||||||||||||||||||
| 200 | } never executed: end of block | 0 | ||||||||||||||||||
| 201 | QJsonValue QJsonArray::takeAt(int i) | - | ||||||||||||||||||
| 202 | { | - | ||||||||||||||||||
| 203 | if (!a
| 0 | ||||||||||||||||||
| 204 | return never executed: QJsonValue(QJsonValue::Undefined);return QJsonValue(QJsonValue::Undefined);never executed: return QJsonValue(QJsonValue::Undefined); | 0 | ||||||||||||||||||
| 205 | - | |||||||||||||||||||
| 206 | QJsonValue v(d, a, a->at(i)); | - | ||||||||||||||||||
| 207 | removeAt(i); | - | ||||||||||||||||||
| 208 | return never executed: v;return v;never executed: return v; | 0 | ||||||||||||||||||
| 209 | } | - | ||||||||||||||||||
| 210 | void QJsonArray::insert(int i, const QJsonValue &value) | - | ||||||||||||||||||
| 211 | { | - | ||||||||||||||||||
| 212 | ((!(i >= 0 && i <= (a ? (int)a->length : 0))) ? qt_assert("i >= 0 && i <= (a ? (int)a->length : 0)",__FILE__,476) : qt_noop()); | - | ||||||||||||||||||
| 213 | QJsonValue val = value; | - | ||||||||||||||||||
| 214 | - | |||||||||||||||||||
| 215 | bool compressed; | - | ||||||||||||||||||
| 216 | int valueSize = QJsonPrivate::Value::requiredStorage(val, &compressed); | - | ||||||||||||||||||
| 217 | - | |||||||||||||||||||
| 218 | if (!detach2(valueSize + sizeof(QJsonPrivate::Value))
| 0-8 | ||||||||||||||||||
| 219 | return; never executed: return; | 0 | ||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | if (!a->length
| 2-6 | ||||||||||||||||||
| 222 | a->tableOffset = sizeof(QJsonPrivate::Array); executed 2 times by 1 test: a->tableOffset = sizeof(QJsonPrivate::Array);Executed by:
| 2 | ||||||||||||||||||
| 223 | - | |||||||||||||||||||
| 224 | int valueOffset = a->reserveSpace(valueSize, i, 1, false); | - | ||||||||||||||||||
| 225 | if (!valueOffset
| 0-8 | ||||||||||||||||||
| 226 | return; never executed: return; | 0 | ||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | QJsonPrivate::Value &v = (*a)[i]; | - | ||||||||||||||||||
| 229 | v.type = (val.t == QJsonValue::Undefined
| 0-8 | ||||||||||||||||||
| 230 | v.latinOrIntValue = compressed; | - | ||||||||||||||||||
| 231 | v.latinKey = false; | - | ||||||||||||||||||
| 232 | v.value = QJsonPrivate::Value::valueToStore(val, valueOffset); | - | ||||||||||||||||||
| 233 | if (valueSize
| 2-6 | ||||||||||||||||||
| 234 | QJsonPrivate::Value::copyData(val, (char *)a + valueOffset, compressed); executed 2 times by 1 test: QJsonPrivate::Value::copyData(val, (char *)a + valueOffset, compressed);Executed by:
| 2 | ||||||||||||||||||
| 235 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 236 | void QJsonArray::replace(int i, const QJsonValue &value) | - | ||||||||||||||||||
| 237 | { | - | ||||||||||||||||||
| 238 | ((!(a && i >= 0 && i < (int)(a->length))) ? qt_assert("a && i >= 0 && i < (int)(a->length)",__FILE__,527) : qt_noop()); | - | ||||||||||||||||||
| 239 | QJsonValue val = value; | - | ||||||||||||||||||
| 240 | - | |||||||||||||||||||
| 241 | bool compressed; | - | ||||||||||||||||||
| 242 | int valueSize = QJsonPrivate::Value::requiredStorage(val, &compressed); | - | ||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | if (!detach2(valueSize)
| 0 | ||||||||||||||||||
| 245 | return; never executed: return; | 0 | ||||||||||||||||||
| 246 | - | |||||||||||||||||||
| 247 | if (!a->length
| 0 | ||||||||||||||||||
| 248 | a->tableOffset = sizeof(QJsonPrivate::Array); never executed: a->tableOffset = sizeof(QJsonPrivate::Array); | 0 | ||||||||||||||||||
| 249 | - | |||||||||||||||||||
| 250 | int valueOffset = a->reserveSpace(valueSize, i, 1, true); | - | ||||||||||||||||||
| 251 | if (!valueOffset
| 0 | ||||||||||||||||||
| 252 | return; never executed: return; | 0 | ||||||||||||||||||
| 253 | - | |||||||||||||||||||
| 254 | QJsonPrivate::Value &v = (*a)[i]; | - | ||||||||||||||||||
| 255 | v.type = (val.t == QJsonValue::Undefined
| 0 | ||||||||||||||||||
| 256 | v.latinOrIntValue = compressed; | - | ||||||||||||||||||
| 257 | v.latinKey = false; | - | ||||||||||||||||||
| 258 | v.value = QJsonPrivate::Value::valueToStore(val, valueOffset); | - | ||||||||||||||||||
| 259 | if (valueSize
| 0 | ||||||||||||||||||
| 260 | QJsonPrivate::Value::copyData(val, (char *)a + valueOffset, compressed); never executed: QJsonPrivate::Value::copyData(val, (char *)a + valueOffset, compressed); | 0 | ||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | ++d->compactionCounter; | - | ||||||||||||||||||
| 263 | if (d->compactionCounter > 32u
| 0 | ||||||||||||||||||
| 264 | compact(); never executed: compact(); | 0 | ||||||||||||||||||
| 265 | } never executed: end of block | 0 | ||||||||||||||||||
| 266 | - | |||||||||||||||||||
| 267 | - | |||||||||||||||||||
| 268 | - | |||||||||||||||||||
| 269 | - | |||||||||||||||||||
| 270 | - | |||||||||||||||||||
| 271 | - | |||||||||||||||||||
| 272 | bool QJsonArray::contains(const QJsonValue &value) const | - | ||||||||||||||||||
| 273 | { | - | ||||||||||||||||||
| 274 | for (int i = 0; i < size()
| 0 | ||||||||||||||||||
| 275 | if (at(i) == value
| 0 | ||||||||||||||||||
| 276 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||
| 277 | } never executed: end of block | 0 | ||||||||||||||||||
| 278 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 279 | } | - | ||||||||||||||||||
| 280 | QJsonValueRef QJsonArray::operator [](int i) | - | ||||||||||||||||||
| 281 | { | - | ||||||||||||||||||
| 282 | ((!(a && i >= 0 && i < (int)a->length)) ? qt_assert("a && i >= 0 && i < (int)a->length",__FILE__,585) : qt_noop()); | - | ||||||||||||||||||
| 283 | return never executed: QJsonValueRef(this, i);return QJsonValueRef(this, i);never executed: return QJsonValueRef(this, i); | 0 | ||||||||||||||||||
| 284 | } | - | ||||||||||||||||||
| 285 | - | |||||||||||||||||||
| 286 | - | |||||||||||||||||||
| 287 | - | |||||||||||||||||||
| 288 | - | |||||||||||||||||||
| 289 | - | |||||||||||||||||||
| 290 | - | |||||||||||||||||||
| 291 | QJsonValue QJsonArray::operator[](int i) const | - | ||||||||||||||||||
| 292 | { | - | ||||||||||||||||||
| 293 | return never executed: at(i);return at(i);never executed: return at(i); | 0 | ||||||||||||||||||
| 294 | } | - | ||||||||||||||||||
| 295 | - | |||||||||||||||||||
| 296 | - | |||||||||||||||||||
| 297 | - | |||||||||||||||||||
| 298 | - | |||||||||||||||||||
| 299 | bool QJsonArray::operator==(const QJsonArray &other) const | - | ||||||||||||||||||
| 300 | { | - | ||||||||||||||||||
| 301 | if (a == other.a
| 0-8 | ||||||||||||||||||
| 302 | return executed 8 times by 1 test: true;return true;Executed by:
executed 8 times by 1 test: return true;Executed by:
| 8 | ||||||||||||||||||
| 303 | - | |||||||||||||||||||
| 304 | if (!a
| 0 | ||||||||||||||||||
| 305 | return never executed: !other.a->length;return !other.a->length;never executed: return !other.a->length; | 0 | ||||||||||||||||||
| 306 | if (!other.a
| 0 | ||||||||||||||||||
| 307 | return never executed: !a->length;return !a->length;never executed: return !a->length; | 0 | ||||||||||||||||||
| 308 | if (a->length != other.a->length
| 0 | ||||||||||||||||||
| 309 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 310 | - | |||||||||||||||||||
| 311 | for (int i = 0; i < (int)a->length
| 0 | ||||||||||||||||||
| 312 | if (QJsonValue(d, a, a->at(i)) != QJsonValue(other.d, other.a, other.a->at(i))
| 0 | ||||||||||||||||||
| 313 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 314 | } never executed: end of block | 0 | ||||||||||||||||||
| 315 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||
| 316 | } | - | ||||||||||||||||||
| 317 | - | |||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | - | |||||||||||||||||||
| 320 | - | |||||||||||||||||||
| 321 | bool QJsonArray::operator!=(const QJsonArray &other) const | - | ||||||||||||||||||
| 322 | { | - | ||||||||||||||||||
| 323 | return never executed: !(*this == other);return !(*this == other);never executed: return !(*this == other); | 0 | ||||||||||||||||||
| 324 | } | - | ||||||||||||||||||
| 325 | void QJsonArray::detach(uint reserve) | - | ||||||||||||||||||
| 326 | { | - | ||||||||||||||||||
| 327 | (void)reserve; | - | ||||||||||||||||||
| 328 | ((!(!reserve)) ? qt_assert("!reserve",__FILE__,1166) : qt_noop()); | - | ||||||||||||||||||
| 329 | detach2(0); | - | ||||||||||||||||||
| 330 | } never executed: end of block | 0 | ||||||||||||||||||
| 331 | - | |||||||||||||||||||
| 332 | - | |||||||||||||||||||
| 333 | - | |||||||||||||||||||
| 334 | - | |||||||||||||||||||
| 335 | bool QJsonArray::detach2(uint reserve) | - | ||||||||||||||||||
| 336 | { | - | ||||||||||||||||||
| 337 | if (!d
| 2-6 | ||||||||||||||||||
| 338 | if (reserve >= QJsonPrivate::Value::MaxSize
| 0-2 | ||||||||||||||||||
| 339 | QMessageLogger(__FILE__, 1177, __PRETTY_FUNCTION__).warning("QJson: Document too large to store in data structure"); | - | ||||||||||||||||||
| 340 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 341 | } | - | ||||||||||||||||||
| 342 | d = new QJsonPrivate::Data(reserve, QJsonValue::Array); | - | ||||||||||||||||||
| 343 | a = static_cast<QJsonPrivate::Array *>(d->header->root()); | - | ||||||||||||||||||
| 344 | d->ref.ref(); | - | ||||||||||||||||||
| 345 | return executed 2 times by 1 test: true;return true;Executed by:
executed 2 times by 1 test: return true;Executed by:
| 2 | ||||||||||||||||||
| 346 | } | - | ||||||||||||||||||
| 347 | if (reserve == 0
| 0-6 | ||||||||||||||||||
| 348 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||
| 349 | - | |||||||||||||||||||
| 350 | QJsonPrivate::Data *x = d->clone(a, reserve); | - | ||||||||||||||||||
| 351 | if (!x
| 0-6 | ||||||||||||||||||
| 352 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 353 | x->ref.ref(); | - | ||||||||||||||||||
| 354 | if (!d->ref.deref()
| 2-4 | ||||||||||||||||||
| 355 | delete d; executed 2 times by 1 test: delete d;Executed by:
| 2 | ||||||||||||||||||
| 356 | d = x; | - | ||||||||||||||||||
| 357 | a = static_cast<QJsonPrivate::Array *>(d->header->root()); | - | ||||||||||||||||||
| 358 | return executed 6 times by 1 test: true;return true;Executed by:
executed 6 times by 1 test: return true;Executed by:
| 6 | ||||||||||||||||||
| 359 | } | - | ||||||||||||||||||
| 360 | - | |||||||||||||||||||
| 361 | - | |||||||||||||||||||
| 362 | - | |||||||||||||||||||
| 363 | - | |||||||||||||||||||
| 364 | void QJsonArray::compact() | - | ||||||||||||||||||
| 365 | { | - | ||||||||||||||||||
| 366 | if (!d
| 0 | ||||||||||||||||||
| 367 | return; never executed: return; | 0 | ||||||||||||||||||
| 368 | - | |||||||||||||||||||
| 369 | detach2(); | - | ||||||||||||||||||
| 370 | d->compact(); | - | ||||||||||||||||||
| 371 | a = static_cast<QJsonPrivate::Array *>(d->header->root()); | - | ||||||||||||||||||
| 372 | } never executed: end of block | 0 | ||||||||||||||||||
| 373 | - | |||||||||||||||||||
| 374 | - | |||||||||||||||||||
| 375 | - | |||||||||||||||||||
| 376 | QDebug operator<<(QDebug dbg, const QJsonArray &a) | - | ||||||||||||||||||
| 377 | { | - | ||||||||||||||||||
| 378 | QDebugStateSaver saver(dbg); | - | ||||||||||||||||||
| 379 | if (!a.a
| 0-1 | ||||||||||||||||||
| 380 | dbg << "QJsonArray()"; | - | ||||||||||||||||||
| 381 | return executed 1 time by 1 test: dbg;return dbg;Executed by:
executed 1 time by 1 test: return dbg;Executed by:
| 1 | ||||||||||||||||||
| 382 | } | - | ||||||||||||||||||
| 383 | QByteArray json; | - | ||||||||||||||||||
| 384 | QJsonPrivate::Writer::arrayToJson(a.a, json, 0, true); | - | ||||||||||||||||||
| 385 | dbg.nospace() << "QJsonArray(" | - | ||||||||||||||||||
| 386 | << json.constData() | - | ||||||||||||||||||
| 387 | << ")"; | - | ||||||||||||||||||
| 388 | return never executed: dbg;return dbg;never executed: return dbg; | 0 | ||||||||||||||||||
| 389 | } | - | ||||||||||||||||||
| 390 | - | |||||||||||||||||||
| 391 | - | |||||||||||||||||||
| 392 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |