| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qtextstream.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | static const int QTEXTSTREAM_BUFFERSIZE = 16384; | - | ||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | QTextStreamPrivate::QTextStreamPrivate(QTextStream *q_ptr) | - | ||||||||||||||||||||||||
| 16 | : | - | ||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||
| 18 | readConverterSavedState(0), | - | ||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||
| 20 | readConverterSavedStateOffset(0), | - | ||||||||||||||||||||||||
| 21 | locale(QLocale::c()) | - | ||||||||||||||||||||||||
| 22 | { | - | ||||||||||||||||||||||||
| 23 | this->q_ptr = q_ptr; | - | ||||||||||||||||||||||||
| 24 | reset(); | - | ||||||||||||||||||||||||
| 25 | } executed 79221 times by 96 tests: end of blockExecuted by:
| 79221 | ||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||
| 30 | QTextStreamPrivate::~QTextStreamPrivate() | - | ||||||||||||||||||||||||
| 31 | { | - | ||||||||||||||||||||||||
| 32 | if (deleteDevice
| 845-78376 | ||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | device->blockSignals(true); | - | ||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||
| 36 | delete device; | - | ||||||||||||||||||||||||
| 37 | } executed 845 times by 8 tests: end of blockExecuted by:
| 845 | ||||||||||||||||||||||||
| 38 | - | |||||||||||||||||||||||||
| 39 | delete readConverterSavedState; | - | ||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||
| 41 | } executed 79221 times by 96 tests: end of blockExecuted by:
| 79221 | ||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | - | |||||||||||||||||||||||||
| 44 | static void resetCodecConverterStateHelper(QTextCodec::ConverterState *state) | - | ||||||||||||||||||||||||
| 45 | { | - | ||||||||||||||||||||||||
| 46 | state->~ConverterState(); | - | ||||||||||||||||||||||||
| 47 | new (state) QTextCodec::ConverterState; | - | ||||||||||||||||||||||||
| 48 | } executed 589195 times by 96 tests: end of blockExecuted by:
| 589195 | ||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | static void copyConverterStateHelper(QTextCodec::ConverterState *dest, | - | ||||||||||||||||||||||||
| 51 | const QTextCodec::ConverterState *src) | - | ||||||||||||||||||||||||
| 52 | { | - | ||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||
| 55 | ((!(!src->d)) ? qt_assert("!src->d",__FILE__,369) : qt_noop()); | - | ||||||||||||||||||||||||
| 56 | dest->flags = src->flags; | - | ||||||||||||||||||||||||
| 57 | dest->invalidChars = src->invalidChars; | - | ||||||||||||||||||||||||
| 58 | dest->state_data[0] = src->state_data[0]; | - | ||||||||||||||||||||||||
| 59 | dest->state_data[1] = src->state_data[1]; | - | ||||||||||||||||||||||||
| 60 | dest->state_data[2] = src->state_data[2]; | - | ||||||||||||||||||||||||
| 61 | } executed 2698 times by 16 tests: end of blockExecuted by:
| 2698 | ||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||
| 64 | void QTextStreamPrivate::Params::reset() | - | ||||||||||||||||||||||||
| 65 | { | - | ||||||||||||||||||||||||
| 66 | realNumberPrecision = 6; | - | ||||||||||||||||||||||||
| 67 | integerBase = 0; | - | ||||||||||||||||||||||||
| 68 | fieldWidth = 0; | - | ||||||||||||||||||||||||
| 69 | padChar = QLatin1Char(' '); | - | ||||||||||||||||||||||||
| 70 | fieldAlignment = QTextStream::AlignRight; | - | ||||||||||||||||||||||||
| 71 | realNumberNotation = QTextStream::SmartNotation; | - | ||||||||||||||||||||||||
| 72 | numberFlags = 0; | - | ||||||||||||||||||||||||
| 73 | } executed 93328 times by 96 tests: end of blockExecuted by:
| 93328 | ||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | void QTextStreamPrivate::reset() | - | ||||||||||||||||||||||||
| 79 | { | - | ||||||||||||||||||||||||
| 80 | params.reset(); | - | ||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||
| 82 | device = 0; | - | ||||||||||||||||||||||||
| 83 | deleteDevice = false; | - | ||||||||||||||||||||||||
| 84 | string = 0; | - | ||||||||||||||||||||||||
| 85 | stringOffset = 0; | - | ||||||||||||||||||||||||
| 86 | stringOpenMode = QIODevice::NotOpen; | - | ||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||
| 88 | readBufferOffset = 0; | - | ||||||||||||||||||||||||
| 89 | readBufferStartDevicePos = 0; | - | ||||||||||||||||||||||||
| 90 | lastTokenSize = 0; | - | ||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||
| 93 | codec = QTextCodec::codecForLocale(); | - | ||||||||||||||||||||||||
| 94 | resetCodecConverterStateHelper(&readConverterState); | - | ||||||||||||||||||||||||
| 95 | resetCodecConverterStateHelper(&writeConverterState); | - | ||||||||||||||||||||||||
| 96 | delete readConverterSavedState; | - | ||||||||||||||||||||||||
| 97 | readConverterSavedState = 0; | - | ||||||||||||||||||||||||
| 98 | writeConverterState.flags |= QTextCodec::IgnoreHeader; | - | ||||||||||||||||||||||||
| 99 | autoDetectUnicode = true; | - | ||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | } executed 79239 times by 96 tests: end of blockExecuted by:
| 79239 | ||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||
| 105 | - | |||||||||||||||||||||||||
| 106 | bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes) | - | ||||||||||||||||||||||||
| 107 | { | - | ||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | ((!(!string)) ? qt_assert("!string",__FILE__,424) : qt_noop()); | - | ||||||||||||||||||||||||
| 111 | ((!(device)) ? qt_assert("device",__FILE__,425) : qt_noop()); | - | ||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||
| 113 | - | |||||||||||||||||||||||||
| 114 | bool textModeEnabled = device->isTextModeEnabled(); | - | ||||||||||||||||||||||||
| 115 | if (textModeEnabled
| 2563-41040053 | ||||||||||||||||||||||||
| 116 | device->setTextModeEnabled(false); executed 41040053 times by 6 tests: device->setTextModeEnabled(false);Executed by:
| 41040053 | ||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||
| 119 | char buf[QTEXTSTREAM_BUFFERSIZE]; | - | ||||||||||||||||||||||||
| 120 | qint64 bytesRead = 0; | - | ||||||||||||||||||||||||
| 121 | { | - | ||||||||||||||||||||||||
| 122 | if (maxBytes != -1
| 7322-41035294 | ||||||||||||||||||||||||
| 123 | bytesRead = device->read(buf, qMin<qint64>(sizeof(buf), maxBytes)); executed 41035294 times by 1 test: bytesRead = device->read(buf, qMin<qint64>(sizeof(buf), maxBytes));Executed by:
| 41035294 | ||||||||||||||||||||||||
| 124 | else | - | ||||||||||||||||||||||||
| 125 | bytesRead = device->read(buf, sizeof(buf)); executed 7322 times by 17 tests: bytesRead = device->read(buf, sizeof(buf));Executed by:
| 7322 | ||||||||||||||||||||||||
| 126 | } | - | ||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | if (textModeEnabled
| 2563-41040053 | ||||||||||||||||||||||||
| 130 | device->setTextModeEnabled(true); executed 41040053 times by 6 tests: device->setTextModeEnabled(true);Executed by:
| 41040053 | ||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||
| 132 | if (bytesRead <= 0
| 2523-41040093 | ||||||||||||||||||||||||
| 133 | return executed 2523 times by 7 tests: false;return false;Executed by:
executed 2523 times by 7 tests: return false;Executed by:
| 2523 | ||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||
| 138 | if (!codec
| 0-41040093 | ||||||||||||||||||||||||
| 139 | autoDetectUnicode = false; | - | ||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | codec = QTextCodec::codecForUtfText(QByteArray::fromRawData(buf, bytesRead), codec); | - | ||||||||||||||||||||||||
| 142 | if (!codec
| 0-4547 | ||||||||||||||||||||||||
| 143 | codec = QTextCodec::codecForLocale(); | - | ||||||||||||||||||||||||
| 144 | writeConverterState.flags |= QTextCodec::IgnoreHeader; | - | ||||||||||||||||||||||||
| 145 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 146 | } executed 4547 times by 17 tests: end of blockExecuted by:
| 4547 | ||||||||||||||||||||||||
| 147 | int oldReadBufferSize = readBuffer.size(); | - | ||||||||||||||||||||||||
| 148 | - | |||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||
| 150 | readBuffer += __builtin_expect(!!(codec), true)
| 0-41040093 | ||||||||||||||||||||||||
| 151 | : QString::fromLatin1(buf, bytesRead); | - | ||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | - | |||||||||||||||||||||||||
| 154 | - | |||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||
| 157 | if (readBuffer.size() > oldReadBufferSize
| 682-41039411 | ||||||||||||||||||||||||
| 158 | QChar CR = QLatin1Char('\r'); | - | ||||||||||||||||||||||||
| 159 | QChar *writePtr = readBuffer.data() + oldReadBufferSize; | - | ||||||||||||||||||||||||
| 160 | QChar *readPtr = readBuffer.data() + oldReadBufferSize; | - | ||||||||||||||||||||||||
| 161 | QChar *endPtr = readBuffer.data() + readBuffer.size(); | - | ||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||
| 163 | int n = oldReadBufferSize; | - | ||||||||||||||||||||||||
| 164 | if (readPtr < endPtr
| 0-41037818 | ||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||
| 166 | while (*
| 110-63893758 | ||||||||||||||||||||||||
| 167 | ++n; | - | ||||||||||||||||||||||||
| 168 | if (++
| 22856050-41037708 | ||||||||||||||||||||||||
| 169 | break; executed 41037708 times by 6 tests: break;Executed by:
| 41037708 | ||||||||||||||||||||||||
| 170 | } executed 22856050 times by 6 tests: end of blockExecuted by:
| 22856050 | ||||||||||||||||||||||||
| 171 | } executed 41037818 times by 6 tests: end of blockExecuted by:
| 41037818 | ||||||||||||||||||||||||
| 172 | while (readPtr < endPtr
| 146620-41037818 | ||||||||||||||||||||||||
| 173 | QChar ch = *readPtr++; | - | ||||||||||||||||||||||||
| 174 | if (ch != CR
| 22205-124415 | ||||||||||||||||||||||||
| 175 | *writePtr++ = ch; | - | ||||||||||||||||||||||||
| 176 | } executed 124415 times by 1 test: else {end of blockExecuted by:
| 124415 | ||||||||||||||||||||||||
| 177 | if (n < readBufferOffset
| 0-22205 | ||||||||||||||||||||||||
| 178 | -- never executed: readBufferOffset;--readBufferOffset;never executed: --readBufferOffset; | 0 | ||||||||||||||||||||||||
| 179 | --bytesRead; | - | ||||||||||||||||||||||||
| 180 | } executed 22205 times by 1 test: end of blockExecuted by:
| 22205 | ||||||||||||||||||||||||
| 181 | ++n; | - | ||||||||||||||||||||||||
| 182 | } executed 146620 times by 1 test: end of blockExecuted by:
| 146620 | ||||||||||||||||||||||||
| 183 | readBuffer.resize(writePtr - readBuffer.data()); | - | ||||||||||||||||||||||||
| 184 | } executed 41037818 times by 6 tests: end of blockExecuted by:
| 41037818 | ||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||
| 186 | - | |||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | return executed 41040093 times by 17 tests: true;return true;Executed by:
executed 41040093 times by 17 tests: return true;Executed by:
| 41040093 | ||||||||||||||||||||||||
| 191 | } | - | ||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||
| 196 | void QTextStreamPrivate::resetReadBuffer() | - | ||||||||||||||||||||||||
| 197 | { | - | ||||||||||||||||||||||||
| 198 | readBuffer.clear(); | - | ||||||||||||||||||||||||
| 199 | readBufferOffset = 0; | - | ||||||||||||||||||||||||
| 200 | readBufferStartDevicePos = (device
| 1-214481 | ||||||||||||||||||||||||
| 201 | } executed 214482 times by 1 test: end of blockExecuted by:
| 214482 | ||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||
| 206 | void QTextStreamPrivate::flushWriteBuffer() | - | ||||||||||||||||||||||||
| 207 | { | - | ||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||
| 210 | if (string
| 13-241565 | ||||||||||||||||||||||||
| 211 | return; executed 48610 times by 7 tests: return;Executed by:
| 48610 | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||
| 215 | if (status != QTextStream::Ok
| 3-241549 | ||||||||||||||||||||||||
| 216 | return; executed 3 times by 1 test: return;Executed by:
| 3 | ||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||
| 218 | if (writeBuffer.isEmpty()
| 26664-214885 | ||||||||||||||||||||||||
| 219 | return; executed 214885 times by 6 tests: return;Executed by:
| 214885 | ||||||||||||||||||||||||
| 220 | if (!codec
| 1-26663 | ||||||||||||||||||||||||
| 221 | codec = QTextCodec::codecForLocale(); executed 1 time by 1 test: codec = QTextCodec::codecForLocale();Executed by:
| 1 | ||||||||||||||||||||||||
| 222 | QByteArray data = __builtin_expect(!!(codec), true)
| 1-26663 | ||||||||||||||||||||||||
| 223 | : writeBuffer.toLatin1(); | - | ||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||
| 227 | writeBuffer.clear(); | - | ||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||
| 230 | qint64 bytesWritten = device->write(data); | - | ||||||||||||||||||||||||
| 231 | if (bytesWritten <= 0
| 2-26662 | ||||||||||||||||||||||||
| 232 | status = QTextStream::WriteFailed; | - | ||||||||||||||||||||||||
| 233 | return; executed 2 times by 2 tests: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 234 | } | - | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | QFileDevice *file = qobject_cast<QFileDevice *>(device); | - | ||||||||||||||||||||||||
| 239 | bool flushed = !file
| 0-15832 | ||||||||||||||||||||||||
| 240 | if (!flushed
| 0-26662 | ||||||||||||||||||||||||
| 241 | status = QTextStream::WriteFailed; never executed: status = QTextStream::WriteFailed; | 0 | ||||||||||||||||||||||||
| 242 | } executed 26662 times by 17 tests: end of blockExecuted by:
| 26662 | ||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||
| 244 | QString QTextStreamPrivate::read(int maxlen) | - | ||||||||||||||||||||||||
| 245 | { | - | ||||||||||||||||||||||||
| 246 | QString ret; | - | ||||||||||||||||||||||||
| 247 | if (string
| 5-1871 | ||||||||||||||||||||||||
| 248 | lastTokenSize = qMin(maxlen, string->size() - stringOffset); | - | ||||||||||||||||||||||||
| 249 | ret = string->mid(stringOffset, lastTokenSize); | - | ||||||||||||||||||||||||
| 250 | } executed 5 times by 1 test: else {end of blockExecuted by:
| 5 | ||||||||||||||||||||||||
| 251 | while (readBuffer.size() - readBufferOffset < maxlen
executed 1867 times by 2 tests: ;Executed by:
| 7-3731 | ||||||||||||||||||||||||
| 252 | lastTokenSize = qMin(maxlen, readBuffer.size() - readBufferOffset); | - | ||||||||||||||||||||||||
| 253 | ret = readBuffer.mid(readBufferOffset, lastTokenSize); | - | ||||||||||||||||||||||||
| 254 | } executed 1871 times by 2 tests: end of blockExecuted by:
| 1871 | ||||||||||||||||||||||||
| 255 | consumeLastToken(); | - | ||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||
| 260 | return executed 1876 times by 2 tests: ret;return ret;Executed by:
executed 1876 times by 2 tests: return ret;Executed by:
| 1876 | ||||||||||||||||||||||||
| 261 | } | - | ||||||||||||||||||||||||
| 262 | bool QTextStreamPrivate::scan(const QChar **ptr, int *length, int maxlen, TokenDelimiter delimiter) | - | ||||||||||||||||||||||||
| 263 | { | - | ||||||||||||||||||||||||
| 264 | int totalSize = 0; | - | ||||||||||||||||||||||||
| 265 | int delimSize = 0; | - | ||||||||||||||||||||||||
| 266 | bool consumeDelimiter = false; | - | ||||||||||||||||||||||||
| 267 | bool foundToken = false; | - | ||||||||||||||||||||||||
| 268 | int startOffset = device
| 24207-183752 | ||||||||||||||||||||||||
| 269 | QChar lastChar; | - | ||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | bool canStillReadFromDevice = true; | - | ||||||||||||||||||||||||
| 272 | do { | - | ||||||||||||||||||||||||
| 273 | int endOffset; | - | ||||||||||||||||||||||||
| 274 | const QChar *chPtr; | - | ||||||||||||||||||||||||
| 275 | if (device
| 24207-186683 | ||||||||||||||||||||||||
| 276 | chPtr = readBuffer.constData(); | - | ||||||||||||||||||||||||
| 277 | endOffset = readBuffer.size(); | - | ||||||||||||||||||||||||
| 278 | } executed 186683 times by 16 tests: else {end of blockExecuted by:
| 186683 | ||||||||||||||||||||||||
| 279 | chPtr = string->constData(); | - | ||||||||||||||||||||||||
| 280 | endOffset = string->size(); | - | ||||||||||||||||||||||||
| 281 | } executed 24207 times by 4 tests: end of blockExecuted by:
| 24207 | ||||||||||||||||||||||||
| 282 | chPtr += startOffset; | - | ||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||
| 284 | for (; !foundToken
| 10-4218720 | ||||||||||||||||||||||||
| 285 | const QChar ch = *chPtr++; | - | ||||||||||||||||||||||||
| 286 | ++totalSize; | - | ||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||
| 288 | switch (delimiter) { | - | ||||||||||||||||||||||||
| 289 | case executed 5982 times by 4 tests: Space:case Space:Executed by:
executed 5982 times by 4 tests: case Space:Executed by:
| 5982 | ||||||||||||||||||||||||
| 290 | if (ch.isSpace()
| 424-5558 | ||||||||||||||||||||||||
| 291 | foundToken = true; | - | ||||||||||||||||||||||||
| 292 | delimSize = 1; | - | ||||||||||||||||||||||||
| 293 | } executed 424 times by 3 tests: end of blockExecuted by:
| 424 | ||||||||||||||||||||||||
| 294 | break; executed 5982 times by 4 tests: break;Executed by:
| 5982 | ||||||||||||||||||||||||
| 295 | case executed 63851 times by 4 tests: NotSpace:case NotSpace:Executed by:
executed 63851 times by 4 tests: case NotSpace:Executed by:
| 63851 | ||||||||||||||||||||||||
| 296 | if (!ch.isSpace()
| 22940-40911 | ||||||||||||||||||||||||
| 297 | foundToken = true; | - | ||||||||||||||||||||||||
| 298 | delimSize = 1; | - | ||||||||||||||||||||||||
| 299 | } executed 22940 times by 4 tests: end of blockExecuted by:
| 22940 | ||||||||||||||||||||||||
| 300 | break; executed 63851 times by 4 tests: break;Executed by:
| 63851 | ||||||||||||||||||||||||
| 301 | case executed 4145673 times by 14 tests: EndOfLine:case EndOfLine:Executed by:
executed 4145673 times by 14 tests: case EndOfLine:Executed by:
| 4145673 | ||||||||||||||||||||||||
| 302 | if (ch == QLatin1Char('\n')
| 184312-3961361 | ||||||||||||||||||||||||
| 303 | foundToken = true; | - | ||||||||||||||||||||||||
| 304 | delimSize = (
| 75386-108926 | ||||||||||||||||||||||||
| 305 | consumeDelimiter = true; | - | ||||||||||||||||||||||||
| 306 | } executed 184312 times by 13 tests: end of blockExecuted by:
| 184312 | ||||||||||||||||||||||||
| 307 | lastChar = ch; | - | ||||||||||||||||||||||||
| 308 | break; executed 4145673 times by 14 tests: break;Executed by:
| 4145673 | ||||||||||||||||||||||||
| 309 | } | - | ||||||||||||||||||||||||
| 310 | } executed 4214578 times by 17 tests: end of blockExecuted by:
| 4214578 | ||||||||||||||||||||||||
| 311 | } executed 210890 times by 17 tests: while (!foundTokenend of blockExecuted by:
| 3214-210890 | ||||||||||||||||||||||||
| 312 | && (!maxlen
| 12-3186 | ||||||||||||||||||||||||
| 313 | && (device
| 28-3174 | ||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||
| 315 | if (totalSize == 0
| 79-207880 | ||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||
| 319 | return executed 79 times by 1 test: false;return false;Executed by:
executed 79 times by 1 test: return false;Executed by:
| 79 | ||||||||||||||||||||||||
| 320 | } | - | ||||||||||||||||||||||||
| 321 | - | |||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 | if (delimiter == EndOfLine
| 0-184388 | ||||||||||||||||||||||||
| 325 | if (((string
| 2-55 | ||||||||||||||||||||||||
| 326 | && lastChar == QLatin1Char('\r')
| 11-58 | ||||||||||||||||||||||||
| 327 | consumeDelimiter = true; | - | ||||||||||||||||||||||||
| 328 | ++delimSize; | - | ||||||||||||||||||||||||
| 329 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 330 | } executed 76 times by 4 tests: end of blockExecuted by:
| 76 | ||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||
| 332 | - | |||||||||||||||||||||||||
| 333 | if (length
| 23039-184841 | ||||||||||||||||||||||||
| 334 | * executed 184841 times by 17 tests: length = totalSize - delimSize;*length = totalSize - delimSize;Executed by:
executed 184841 times by 17 tests: *length = totalSize - delimSize;Executed by:
| 184841 | ||||||||||||||||||||||||
| 335 | if (ptr
| 23039-184841 | ||||||||||||||||||||||||
| 336 | * executed 184841 times by 17 tests: ptr = readPtr();*ptr = readPtr();Executed by:
executed 184841 times by 17 tests: *ptr = readPtr();Executed by:
| 184841 | ||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||
| 340 | lastTokenSize = totalSize; | - | ||||||||||||||||||||||||
| 341 | if (!consumeDelimiter
| 23557-184323 | ||||||||||||||||||||||||
| 342 | lastTokenSize -= delimSize; executed 23557 times by 7 tests: lastTokenSize -= delimSize;Executed by:
| 23557 | ||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||
| 348 | return executed 207880 times by 17 tests: true;return true;Executed by:
executed 207880 times by 17 tests: return true;Executed by:
| 207880 | ||||||||||||||||||||||||
| 349 | } | - | ||||||||||||||||||||||||
| 350 | - | |||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||
| 354 | inline const QChar *QTextStreamPrivate::readPtr() const | - | ||||||||||||||||||||||||
| 355 | { | - | ||||||||||||||||||||||||
| 356 | ((!(readBufferOffset <= readBuffer.size())) ? qt_assert("readBufferOffset <= readBuffer.size()",__FILE__,744) : qt_noop()); | - | ||||||||||||||||||||||||
| 357 | if (string
| 24368-230089 | ||||||||||||||||||||||||
| 358 | return executed 24368 times by 4 tests: string->constData() + stringOffset;return string->constData() + stringOffset;Executed by:
executed 24368 times by 4 tests: return string->constData() + stringOffset;Executed by:
| 24368 | ||||||||||||||||||||||||
| 359 | return executed 230089 times by 16 tests: readBuffer.constData() + readBufferOffset;return readBuffer.constData() + readBufferOffset;Executed by:
executed 230089 times by 16 tests: return readBuffer.constData() + readBufferOffset;Executed by:
| 230089 | ||||||||||||||||||||||||
| 360 | } | - | ||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | inline void QTextStreamPrivate::consumeLastToken() | - | ||||||||||||||||||||||||
| 366 | { | - | ||||||||||||||||||||||||
| 367 | if (lastTokenSize
| 867-208105 | ||||||||||||||||||||||||
| 368 | consume(lastTokenSize); executed 208105 times by 18 tests: consume(lastTokenSize);Executed by:
| 208105 | ||||||||||||||||||||||||
| 369 | lastTokenSize = 0; | - | ||||||||||||||||||||||||
| 370 | } executed 208972 times by 18 tests: end of blockExecuted by:
| 208972 | ||||||||||||||||||||||||
| 371 | - | |||||||||||||||||||||||||
| 372 | - | |||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||
| 375 | inline void QTextStreamPrivate::consume(int size) | - | ||||||||||||||||||||||||
| 376 | { | - | ||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||
| 379 | - | |||||||||||||||||||||||||
| 380 | if (string
| 24412-253309 | ||||||||||||||||||||||||
| 381 | stringOffset += size; | - | ||||||||||||||||||||||||
| 382 | if (stringOffset > string->size()
| 0-24412 | ||||||||||||||||||||||||
| 383 | stringOffset = string->size(); never executed: stringOffset = string->size(); | 0 | ||||||||||||||||||||||||
| 384 | } executed 24412 times by 4 tests: else {end of blockExecuted by:
| 24412 | ||||||||||||||||||||||||
| 385 | readBufferOffset += size; | - | ||||||||||||||||||||||||
| 386 | if (readBufferOffset >= readBuffer.size()
| 2698-250611 | ||||||||||||||||||||||||
| 387 | readBufferOffset = 0; | - | ||||||||||||||||||||||||
| 388 | readBuffer.clear(); | - | ||||||||||||||||||||||||
| 389 | saveConverterState(device->pos()); | - | ||||||||||||||||||||||||
| 390 | } executed 2698 times by 16 tests: else if (readBufferOffset > QTEXTSTREAM_BUFFERSIZEend of blockExecuted by:
| 1300-249311 | ||||||||||||||||||||||||
| 391 | readBuffer = readBuffer.remove(0,readBufferOffset); | - | ||||||||||||||||||||||||
| 392 | readConverterSavedStateOffset += readBufferOffset; | - | ||||||||||||||||||||||||
| 393 | readBufferOffset = 0; | - | ||||||||||||||||||||||||
| 394 | } executed 1300 times by 3 tests: end of blockExecuted by:
| 1300 | ||||||||||||||||||||||||
| 395 | } executed 253309 times by 17 tests: end of blockExecuted by:
| 253309 | ||||||||||||||||||||||||
| 396 | } | - | ||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | - | |||||||||||||||||||||||||
| 400 | - | |||||||||||||||||||||||||
| 401 | inline void QTextStreamPrivate::saveConverterState(qint64 newPos) | - | ||||||||||||||||||||||||
| 402 | { | - | ||||||||||||||||||||||||
| 403 | - | |||||||||||||||||||||||||
| 404 | if (readConverterState.d
| 0-2698 | ||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||
| 407 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 408 | } | - | ||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||
| 410 | if (!readConverterSavedState
| 32-2666 | ||||||||||||||||||||||||
| 411 | readConverterSavedState = new QTextCodec::ConverterState; executed 2666 times by 16 tests: readConverterSavedState = new QTextCodec::ConverterState;Executed by:
| 2666 | ||||||||||||||||||||||||
| 412 | copyConverterStateHelper(readConverterSavedState, &readConverterState); | - | ||||||||||||||||||||||||
| 413 | - | |||||||||||||||||||||||||
| 414 | - | |||||||||||||||||||||||||
| 415 | readBufferStartDevicePos = newPos; | - | ||||||||||||||||||||||||
| 416 | readConverterSavedStateOffset = 0; | - | ||||||||||||||||||||||||
| 417 | } executed 2698 times by 16 tests: end of blockExecuted by:
| 2698 | ||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||
| 420 | - | |||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | inline void QTextStreamPrivate::restoreToSavedConverterState() | - | ||||||||||||||||||||||||
| 423 | { | - | ||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||
| 425 | if (readConverterSavedState
| 0-1775 | ||||||||||||||||||||||||
| 426 | - | |||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||
| 428 | copyConverterStateHelper(&readConverterState, readConverterSavedState); | - | ||||||||||||||||||||||||
| 429 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||
| 431 | - | |||||||||||||||||||||||||
| 432 | resetCodecConverterStateHelper(&readConverterState); | - | ||||||||||||||||||||||||
| 433 | } executed 1775 times by 1 test: end of blockExecuted by:
| 1775 | ||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | } | - | ||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||
| 438 | - | |||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||
| 440 | void QTextStreamPrivate::write(const QChar *data, int len) | - | ||||||||||||||||||||||||
| 441 | { | - | ||||||||||||||||||||||||
| 442 | if (string
| 33084-162509 | ||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||
| 444 | string->append(data, len); | - | ||||||||||||||||||||||||
| 445 | } executed 162509 times by 79 tests: else {end of blockExecuted by:
| 162509 | ||||||||||||||||||||||||
| 446 | writeBuffer.append(data, len); | - | ||||||||||||||||||||||||
| 447 | if (writeBuffer.size() > QTEXTSTREAM_BUFFERSIZE
| 4-33080 | ||||||||||||||||||||||||
| 448 | flushWriteBuffer(); executed 4 times by 2 tests: flushWriteBuffer();Executed by:
| 4 | ||||||||||||||||||||||||
| 449 | } executed 33084 times by 13 tests: end of blockExecuted by:
| 33084 | ||||||||||||||||||||||||
| 450 | } | - | ||||||||||||||||||||||||
| 451 | - | |||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||
| 454 | - | |||||||||||||||||||||||||
| 455 | inline void QTextStreamPrivate::write(QChar ch) | - | ||||||||||||||||||||||||
| 456 | { | - | ||||||||||||||||||||||||
| 457 | if (string
| 70541-94016 | ||||||||||||||||||||||||
| 458 | - | |||||||||||||||||||||||||
| 459 | string->append(ch); | - | ||||||||||||||||||||||||
| 460 | } executed 94016 times by 75 tests: else {end of blockExecuted by:
| 94016 | ||||||||||||||||||||||||
| 461 | writeBuffer += ch; | - | ||||||||||||||||||||||||
| 462 | if (writeBuffer.size() > QTEXTSTREAM_BUFFERSIZE
| 0-70541 | ||||||||||||||||||||||||
| 463 | flushWriteBuffer(); never executed: flushWriteBuffer(); | 0 | ||||||||||||||||||||||||
| 464 | } executed 70541 times by 11 tests: end of blockExecuted by:
| 70541 | ||||||||||||||||||||||||
| 465 | } | - | ||||||||||||||||||||||||
| 466 | - | |||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||
| 470 | void QTextStreamPrivate::write(QLatin1String data) | - | ||||||||||||||||||||||||
| 471 | { | - | ||||||||||||||||||||||||
| 472 | if (string
| 18796-41996 | ||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||
| 474 | string->append(data); | - | ||||||||||||||||||||||||
| 475 | } executed 41996 times by 19 tests: else {end of blockExecuted by:
| 41996 | ||||||||||||||||||||||||
| 476 | writeBuffer += data; | - | ||||||||||||||||||||||||
| 477 | if (writeBuffer.size() > QTEXTSTREAM_BUFFERSIZE
| 0-18796 | ||||||||||||||||||||||||
| 478 | flushWriteBuffer(); never executed: flushWriteBuffer(); | 0 | ||||||||||||||||||||||||
| 479 | } executed 18796 times by 14 tests: end of blockExecuted by:
| 18796 | ||||||||||||||||||||||||
| 480 | } | - | ||||||||||||||||||||||||
| 481 | - | |||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||
| 485 | void QTextStreamPrivate::writePadding(int len) | - | ||||||||||||||||||||||||
| 486 | { | - | ||||||||||||||||||||||||
| 487 | if (string
| 72-4406 | ||||||||||||||||||||||||
| 488 | - | |||||||||||||||||||||||||
| 489 | string->resize(string->size() + len, params.padChar); | - | ||||||||||||||||||||||||
| 490 | } executed 72 times by 4 tests: else {end of blockExecuted by:
| 72 | ||||||||||||||||||||||||
| 491 | writeBuffer.resize(writeBuffer.size() + len, params.padChar); | - | ||||||||||||||||||||||||
| 492 | if (writeBuffer.size() > QTEXTSTREAM_BUFFERSIZE
| 0-4406 | ||||||||||||||||||||||||
| 493 | flushWriteBuffer(); never executed: flushWriteBuffer(); | 0 | ||||||||||||||||||||||||
| 494 | } executed 4406 times by 1 test: end of blockExecuted by:
| 4406 | ||||||||||||||||||||||||
| 495 | } | - | ||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||
| 500 | inline bool QTextStreamPrivate::getChar(QChar *ch) | - | ||||||||||||||||||||||||
| 501 | { | - | ||||||||||||||||||||||||
| 502 | if ((string
| 11-69793 | ||||||||||||||||||||||||
| 503 | || (device
| 1-69793 | ||||||||||||||||||||||||
| 504 | if (ch
| 0-427 | ||||||||||||||||||||||||
| 505 | * executed 427 times by 2 tests: ch = 0;*ch = 0;Executed by:
executed 427 times by 2 tests: *ch = 0;Executed by:
| 427 | ||||||||||||||||||||||||
| 506 | return executed 427 times by 2 tests: false;return false;Executed by:
executed 427 times by 2 tests: return false;Executed by:
| 427 | ||||||||||||||||||||||||
| 507 | } | - | ||||||||||||||||||||||||
| 508 | if (ch
| 0-69616 | ||||||||||||||||||||||||
| 509 | * executed 69616 times by 3 tests: ch = *readPtr();*ch = *readPtr();Executed by:
executed 69616 times by 3 tests: *ch = *readPtr();Executed by:
| 69616 | ||||||||||||||||||||||||
| 510 | consume(1); | - | ||||||||||||||||||||||||
| 511 | return executed 69616 times by 3 tests: true;return true;Executed by:
executed 69616 times by 3 tests: return true;Executed by:
| 69616 | ||||||||||||||||||||||||
| 512 | } | - | ||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||
| 514 | - | |||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||
| 516 | - | |||||||||||||||||||||||||
| 517 | inline void QTextStreamPrivate::ungetChar(QChar ch) | - | ||||||||||||||||||||||||
| 518 | { | - | ||||||||||||||||||||||||
| 519 | if (string
| 51-39049 | ||||||||||||||||||||||||
| 520 | if (stringOffset == 0
| 0-51 | ||||||||||||||||||||||||
| 521 | string->prepend(ch); never executed: string->prepend(ch); | 0 | ||||||||||||||||||||||||
| 522 | else | - | ||||||||||||||||||||||||
| 523 | (* executed 51 times by 2 tests: string)[--stringOffset] = ch;(*string)[--stringOffset] = ch;Executed by:
executed 51 times by 2 tests: (*string)[--stringOffset] = ch;Executed by:
| 51 | ||||||||||||||||||||||||
| 524 | return; executed 51 times by 2 tests: return;Executed by:
| 51 | ||||||||||||||||||||||||
| 525 | } | - | ||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||
| 527 | if (readBufferOffset == 0
| 45-39004 | ||||||||||||||||||||||||
| 528 | readBuffer.prepend(ch); | - | ||||||||||||||||||||||||
| 529 | return; executed 45 times by 2 tests: return;Executed by:
| 45 | ||||||||||||||||||||||||
| 530 | } | - | ||||||||||||||||||||||||
| 531 | - | |||||||||||||||||||||||||
| 532 | readBuffer[--readBufferOffset] = ch; | - | ||||||||||||||||||||||||
| 533 | } executed 39004 times by 2 tests: end of blockExecuted by:
| 39004 | ||||||||||||||||||||||||
| 534 | - | |||||||||||||||||||||||||
| 535 | - | |||||||||||||||||||||||||
| 536 | - | |||||||||||||||||||||||||
| 537 | - | |||||||||||||||||||||||||
| 538 | inline void QTextStreamPrivate::putChar(QChar ch) | - | ||||||||||||||||||||||||
| 539 | { | - | ||||||||||||||||||||||||
| 540 | if (params.fieldWidth > 0
| 2004-164557 | ||||||||||||||||||||||||
| 541 | putString(&ch, 1); executed 2004 times by 2 tests: putString(&ch, 1);Executed by:
| 2004 | ||||||||||||||||||||||||
| 542 | else | - | ||||||||||||||||||||||||
| 543 | write(ch); executed 164428 times by 82 tests: write(ch);Executed by:
| 164428 | ||||||||||||||||||||||||
| 544 | } | - | ||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||
| 546 | - | |||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||
| 548 | - | |||||||||||||||||||||||||
| 549 | - | |||||||||||||||||||||||||
| 550 | QTextStreamPrivate::PaddingResult QTextStreamPrivate::padding(int len) const | - | ||||||||||||||||||||||||
| 551 | { | - | ||||||||||||||||||||||||
| 552 | ((!(params.fieldWidth > len)) ? qt_assert("params.fieldWidth > len",__FILE__,940) : qt_noop()); | - | ||||||||||||||||||||||||
| 553 | - | |||||||||||||||||||||||||
| 554 | int left = 0, right = 0; | - | ||||||||||||||||||||||||
| 555 | - | |||||||||||||||||||||||||
| 556 | const int padSize = params.fieldWidth - len; | - | ||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||
| 558 | switch (params.fieldAlignment) { | - | ||||||||||||||||||||||||
| 559 | case never executed: QTextStream::AlignLeft:case QTextStream::AlignLeft:never executed: case QTextStream::AlignLeft: | 0 | ||||||||||||||||||||||||
| 560 | right = padSize; | - | ||||||||||||||||||||||||
| 561 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 562 | case executed 2235 times by 4 tests: QTextStream::AlignRight:case QTextStream::AlignRight:Executed by:
executed 2235 times by 4 tests: case QTextStream::AlignRight:Executed by:
| 2235 | ||||||||||||||||||||||||
| 563 | case executed 4 times by 1 test: QTextStream::AlignAccountingStyle:case QTextStream::AlignAccountingStyle:Executed by:
executed 4 times by 1 test: case QTextStream::AlignAccountingStyle:Executed by:
| 4 | ||||||||||||||||||||||||
| 564 | left = padSize; | - | ||||||||||||||||||||||||
| 565 | break; executed 2239 times by 4 tests: break;Executed by:
| 2239 | ||||||||||||||||||||||||
| 566 | case never executed: QTextStream::AlignCenter:case QTextStream::AlignCenter:never executed: case QTextStream::AlignCenter: | 0 | ||||||||||||||||||||||||
| 567 | left = padSize/2; | - | ||||||||||||||||||||||||
| 568 | right = padSize - padSize/2; | - | ||||||||||||||||||||||||
| 569 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 570 | } | - | ||||||||||||||||||||||||
| 571 | const PaddingResult result = { left, right }; | - | ||||||||||||||||||||||||
| 572 | return executed 2239 times by 4 tests: result;return result;Executed by:
executed 2239 times by 4 tests: return result;Executed by:
| 2239 | ||||||||||||||||||||||||
| 573 | } | - | ||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||
| 575 | - | |||||||||||||||||||||||||
| 576 | - | |||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||
| 578 | void QTextStreamPrivate::putString(const QChar *data, int len, bool number) | - | ||||||||||||||||||||||||
| 579 | { | - | ||||||||||||||||||||||||
| 580 | if (__builtin_expect(!!(params.fieldWidth > len), false)
| 2237-149522 | ||||||||||||||||||||||||
| 581 | - | |||||||||||||||||||||||||
| 582 | - | |||||||||||||||||||||||||
| 583 | - | |||||||||||||||||||||||||
| 584 | const PaddingResult pad = padding(len); | - | ||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||
| 586 | if (params.fieldAlignment == QTextStream::AlignAccountingStyle
| 0-2235 | ||||||||||||||||||||||||
| 587 | const QChar sign = len > 0
| 0-2 | ||||||||||||||||||||||||
| 588 | if (sign == locale.negativeSign()
| 0-2 | ||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||
| 590 | write(&sign, 1); | - | ||||||||||||||||||||||||
| 591 | ++data; | - | ||||||||||||||||||||||||
| 592 | --len; | - | ||||||||||||||||||||||||
| 593 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 594 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 595 | - | |||||||||||||||||||||||||
| 596 | writePadding(pad.left); | - | ||||||||||||||||||||||||
| 597 | write(data, len); | - | ||||||||||||||||||||||||
| 598 | writePadding(pad.right); | - | ||||||||||||||||||||||||
| 599 | } executed 2237 times by 4 tests: else {end of blockExecuted by:
| 2237 | ||||||||||||||||||||||||
| 600 | write(data, len); | - | ||||||||||||||||||||||||
| 601 | } executed 149522 times by 86 tests: end of blockExecuted by:
| 149522 | ||||||||||||||||||||||||
| 602 | } | - | ||||||||||||||||||||||||
| 603 | - | |||||||||||||||||||||||||
| 604 | - | |||||||||||||||||||||||||
| 605 | - | |||||||||||||||||||||||||
| 606 | - | |||||||||||||||||||||||||
| 607 | void QTextStreamPrivate::putString(QLatin1String data, bool number) | - | ||||||||||||||||||||||||
| 608 | { | - | ||||||||||||||||||||||||
| 609 | if (__builtin_expect(!!(params.fieldWidth > data.size()), false)
| 2-60790 | ||||||||||||||||||||||||
| 610 | - | |||||||||||||||||||||||||
| 611 | - | |||||||||||||||||||||||||
| 612 | - | |||||||||||||||||||||||||
| 613 | const PaddingResult pad = padding(data.size()); | - | ||||||||||||||||||||||||
| 614 | - | |||||||||||||||||||||||||
| 615 | if (params.fieldAlignment == QTextStream::AlignAccountingStyle
| 0-2 | ||||||||||||||||||||||||
| 616 | const QChar sign = data.size() > 0
| 0 | ||||||||||||||||||||||||
| 617 | if (sign == locale.negativeSign()
| 0 | ||||||||||||||||||||||||
| 618 | - | |||||||||||||||||||||||||
| 619 | write(&sign, 1); | - | ||||||||||||||||||||||||
| 620 | data = QLatin1String(data.data() + 1, data.size() - 1); | - | ||||||||||||||||||||||||
| 621 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 622 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 623 | - | |||||||||||||||||||||||||
| 624 | writePadding(pad.left); | - | ||||||||||||||||||||||||
| 625 | write(data); | - | ||||||||||||||||||||||||
| 626 | writePadding(pad.right); | - | ||||||||||||||||||||||||
| 627 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 628 | write(data); | - | ||||||||||||||||||||||||
| 629 | } executed 60790 times by 30 tests: end of blockExecuted by:
| 60790 | ||||||||||||||||||||||||
| 630 | } | - | ||||||||||||||||||||||||
| 631 | - | |||||||||||||||||||||||||
| 632 | - | |||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||
| 634 | - | |||||||||||||||||||||||||
| 635 | - | |||||||||||||||||||||||||
| 636 | - | |||||||||||||||||||||||||
| 637 | - | |||||||||||||||||||||||||
| 638 | QTextStream::QTextStream() | - | ||||||||||||||||||||||||
| 639 | : d_ptr(new QTextStreamPrivate(this)) | - | ||||||||||||||||||||||||
| 640 | { | - | ||||||||||||||||||||||||
| 641 | - | |||||||||||||||||||||||||
| 642 | - | |||||||||||||||||||||||||
| 643 | - | |||||||||||||||||||||||||
| 644 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 645 | d->status = Ok; | - | ||||||||||||||||||||||||
| 646 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||||||||
| 647 | - | |||||||||||||||||||||||||
| 648 | - | |||||||||||||||||||||||||
| 649 | - | |||||||||||||||||||||||||
| 650 | - | |||||||||||||||||||||||||
| 651 | QTextStream::QTextStream(QIODevice *device) | - | ||||||||||||||||||||||||
| 652 | : d_ptr(new QTextStreamPrivate(this)) | - | ||||||||||||||||||||||||
| 653 | { | - | ||||||||||||||||||||||||
| 654 | - | |||||||||||||||||||||||||
| 655 | - | |||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||
| 657 | - | |||||||||||||||||||||||||
| 658 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 659 | d->device = device; | - | ||||||||||||||||||||||||
| 660 | - | |||||||||||||||||||||||||
| 661 | d->deviceClosedNotifier.setupDevice(this, d->device); | - | ||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||
| 663 | d->status = Ok; | - | ||||||||||||||||||||||||
| 664 | } executed 2874 times by 22 tests: end of blockExecuted by:
| 2874 | ||||||||||||||||||||||||
| 665 | - | |||||||||||||||||||||||||
| 666 | - | |||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||
| 670 | QTextStream::QTextStream(QString *string, QIODevice::OpenMode openMode) | - | ||||||||||||||||||||||||
| 671 | : d_ptr(new QTextStreamPrivate(this)) | - | ||||||||||||||||||||||||
| 672 | { | - | ||||||||||||||||||||||||
| 673 | - | |||||||||||||||||||||||||
| 674 | - | |||||||||||||||||||||||||
| 675 | - | |||||||||||||||||||||||||
| 676 | - | |||||||||||||||||||||||||
| 677 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 678 | d->string = string; | - | ||||||||||||||||||||||||
| 679 | d->stringOpenMode = openMode; | - | ||||||||||||||||||||||||
| 680 | d->status = Ok; | - | ||||||||||||||||||||||||
| 681 | } executed 75486 times by 80 tests: end of blockExecuted by:
| 75486 | ||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||
| 685 | - | |||||||||||||||||||||||||
| 686 | - | |||||||||||||||||||||||||
| 687 | - | |||||||||||||||||||||||||
| 688 | QTextStream::QTextStream(QByteArray *array, QIODevice::OpenMode openMode) | - | ||||||||||||||||||||||||
| 689 | : d_ptr(new QTextStreamPrivate(this)) | - | ||||||||||||||||||||||||
| 690 | { | - | ||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||
| 692 | - | |||||||||||||||||||||||||
| 693 | - | |||||||||||||||||||||||||
| 694 | - | |||||||||||||||||||||||||
| 695 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 696 | d->device = new QBuffer(array); | - | ||||||||||||||||||||||||
| 697 | d->device->open(openMode); | - | ||||||||||||||||||||||||
| 698 | d->deleteDevice = true; | - | ||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||
| 700 | d->deviceClosedNotifier.setupDevice(this, d->device); | - | ||||||||||||||||||||||||
| 701 | - | |||||||||||||||||||||||||
| 702 | d->status = Ok; | - | ||||||||||||||||||||||||
| 703 | } executed 830 times by 6 tests: end of blockExecuted by:
| 830 | ||||||||||||||||||||||||
| 704 | QTextStream::QTextStream(const QByteArray &array, QIODevice::OpenMode openMode) | - | ||||||||||||||||||||||||
| 705 | : d_ptr(new QTextStreamPrivate(this)) | - | ||||||||||||||||||||||||
| 706 | { | - | ||||||||||||||||||||||||
| 707 | - | |||||||||||||||||||||||||
| 708 | - | |||||||||||||||||||||||||
| 709 | - | |||||||||||||||||||||||||
| 710 | - | |||||||||||||||||||||||||
| 711 | QBuffer *buffer = new QBuffer; | - | ||||||||||||||||||||||||
| 712 | buffer->setData(array); | - | ||||||||||||||||||||||||
| 713 | buffer->open(openMode); | - | ||||||||||||||||||||||||
| 714 | - | |||||||||||||||||||||||||
| 715 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 716 | d->device = buffer; | - | ||||||||||||||||||||||||
| 717 | d->deleteDevice = true; | - | ||||||||||||||||||||||||
| 718 | - | |||||||||||||||||||||||||
| 719 | d->deviceClosedNotifier.setupDevice(this, d->device); | - | ||||||||||||||||||||||||
| 720 | - | |||||||||||||||||||||||||
| 721 | d->status = Ok; | - | ||||||||||||||||||||||||
| 722 | } executed 16 times by 3 tests: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||
| 723 | QTextStream::QTextStream(FILE *fileHandle, QIODevice::OpenMode openMode) | - | ||||||||||||||||||||||||
| 724 | : d_ptr(new QTextStreamPrivate(this)) | - | ||||||||||||||||||||||||
| 725 | { | - | ||||||||||||||||||||||||
| 726 | - | |||||||||||||||||||||||||
| 727 | - | |||||||||||||||||||||||||
| 728 | - | |||||||||||||||||||||||||
| 729 | - | |||||||||||||||||||||||||
| 730 | QFile *file = new QFile; | - | ||||||||||||||||||||||||
| 731 | file->open(fileHandle, openMode); | - | ||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||
| 733 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 734 | d->device = file; | - | ||||||||||||||||||||||||
| 735 | d->deleteDevice = true; | - | ||||||||||||||||||||||||
| 736 | - | |||||||||||||||||||||||||
| 737 | d->deviceClosedNotifier.setupDevice(this, d->device); | - | ||||||||||||||||||||||||
| 738 | - | |||||||||||||||||||||||||
| 739 | d->status = Ok; | - | ||||||||||||||||||||||||
| 740 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 741 | - | |||||||||||||||||||||||||
| 742 | - | |||||||||||||||||||||||||
| 743 | - | |||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||
| 745 | - | |||||||||||||||||||||||||
| 746 | - | |||||||||||||||||||||||||
| 747 | - | |||||||||||||||||||||||||
| 748 | QTextStream::~QTextStream() | - | ||||||||||||||||||||||||
| 749 | { | - | ||||||||||||||||||||||||
| 750 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 751 | - | |||||||||||||||||||||||||
| 752 | - | |||||||||||||||||||||||||
| 753 | - | |||||||||||||||||||||||||
| 754 | if (!d->writeBuffer.isEmpty()
| 21-79200 | ||||||||||||||||||||||||
| 755 | d->flushWriteBuffer(); executed 21 times by 4 tests: d->flushWriteBuffer();Executed by:
| 21 | ||||||||||||||||||||||||
| 756 | } executed 79221 times by 96 tests: end of blockExecuted by:
| 79221 | ||||||||||||||||||||||||
| 757 | - | |||||||||||||||||||||||||
| 758 | - | |||||||||||||||||||||||||
| 759 | - | |||||||||||||||||||||||||
| 760 | - | |||||||||||||||||||||||||
| 761 | - | |||||||||||||||||||||||||
| 762 | - | |||||||||||||||||||||||||
| 763 | void QTextStream::reset() | - | ||||||||||||||||||||||||
| 764 | { | - | ||||||||||||||||||||||||
| 765 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 766 | - | |||||||||||||||||||||||||
| 767 | d->params.reset(); | - | ||||||||||||||||||||||||
| 768 | } executed 924 times by 13 tests: end of blockExecuted by:
| 924 | ||||||||||||||||||||||||
| 769 | - | |||||||||||||||||||||||||
| 770 | - | |||||||||||||||||||||||||
| 771 | - | |||||||||||||||||||||||||
| 772 | - | |||||||||||||||||||||||||
| 773 | - | |||||||||||||||||||||||||
| 774 | - | |||||||||||||||||||||||||
| 775 | void QTextStream::flush() | - | ||||||||||||||||||||||||
| 776 | { | - | ||||||||||||||||||||||||
| 777 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 778 | d->flushWriteBuffer(); | - | ||||||||||||||||||||||||
| 779 | } executed 75666 times by 21 tests: end of blockExecuted by:
| 75666 | ||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||
| 781 | - | |||||||||||||||||||||||||
| 782 | - | |||||||||||||||||||||||||
| 783 | - | |||||||||||||||||||||||||
| 784 | - | |||||||||||||||||||||||||
| 785 | bool QTextStream::seek(qint64 pos) | - | ||||||||||||||||||||||||
| 786 | { | - | ||||||||||||||||||||||||
| 787 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 788 | d->lastTokenSize = 0; | - | ||||||||||||||||||||||||
| 789 | - | |||||||||||||||||||||||||
| 790 | if (d->device
| 47-214471 | ||||||||||||||||||||||||
| 791 | - | |||||||||||||||||||||||||
| 792 | d->flushWriteBuffer(); | - | ||||||||||||||||||||||||
| 793 | if (!d->device->seek(pos)
| 0-214471 | ||||||||||||||||||||||||
| 794 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 795 | d->resetReadBuffer(); | - | ||||||||||||||||||||||||
| 796 | - | |||||||||||||||||||||||||
| 797 | - | |||||||||||||||||||||||||
| 798 | - | |||||||||||||||||||||||||
| 799 | resetCodecConverterStateHelper(&d->readConverterState); | - | ||||||||||||||||||||||||
| 800 | resetCodecConverterStateHelper(&d->writeConverterState); | - | ||||||||||||||||||||||||
| 801 | delete d->readConverterSavedState; | - | ||||||||||||||||||||||||
| 802 | d->readConverterSavedState = 0; | - | ||||||||||||||||||||||||
| 803 | d->writeConverterState.flags |= QTextCodec::IgnoreHeader; | - | ||||||||||||||||||||||||
| 804 | - | |||||||||||||||||||||||||
| 805 | return executed 214471 times by 1 test: true;return true;Executed by:
executed 214471 times by 1 test: return true;Executed by:
| 214471 | ||||||||||||||||||||||||
| 806 | } | - | ||||||||||||||||||||||||
| 807 | - | |||||||||||||||||||||||||
| 808 | - | |||||||||||||||||||||||||
| 809 | if (d->string
| 0-47 | ||||||||||||||||||||||||
| 810 | d->stringOffset = int(pos); | - | ||||||||||||||||||||||||
| 811 | return executed 47 times by 1 test: true;return true;Executed by:
executed 47 times by 1 test: return true;Executed by:
| 47 | ||||||||||||||||||||||||
| 812 | } | - | ||||||||||||||||||||||||
| 813 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 814 | } | - | ||||||||||||||||||||||||
| 815 | qint64 QTextStream::pos() const | - | ||||||||||||||||||||||||
| 816 | { | - | ||||||||||||||||||||||||
| 817 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 818 | if (d->device
| 36-216444 | ||||||||||||||||||||||||
| 819 | - | |||||||||||||||||||||||||
| 820 | if (d->readBuffer.isEmpty()
| 1775-214669 | ||||||||||||||||||||||||
| 821 | return executed 214669 times by 1 test: d->device->pos();return d->device->pos();Executed by:
executed 214669 times by 1 test: return d->device->pos();Executed by:
| 214669 | ||||||||||||||||||||||||
| 822 | if (d->device->isSequential()
| 0-1775 | ||||||||||||||||||||||||
| 823 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 824 | - | |||||||||||||||||||||||||
| 825 | - | |||||||||||||||||||||||||
| 826 | if (!d->device->seek(d->readBufferStartDevicePos)
| 0-1775 | ||||||||||||||||||||||||
| 827 | return never executed: qint64(-1);return qint64(-1);never executed: return qint64(-1); | 0 | ||||||||||||||||||||||||
| 828 | - | |||||||||||||||||||||||||
| 829 | - | |||||||||||||||||||||||||
| 830 | QTextStreamPrivate *thatd = const_cast<QTextStreamPrivate *>(d); | - | ||||||||||||||||||||||||
| 831 | thatd->readBuffer.clear(); | - | ||||||||||||||||||||||||
| 832 | - | |||||||||||||||||||||||||
| 833 | - | |||||||||||||||||||||||||
| 834 | thatd->restoreToSavedConverterState(); | - | ||||||||||||||||||||||||
| 835 | if (d->readBufferStartDevicePos == 0
| 15-1760 | ||||||||||||||||||||||||
| 836 | thatd->autoDetectUnicode = true; executed 1760 times by 1 test: thatd->autoDetectUnicode = true;Executed by:
| 1760 | ||||||||||||||||||||||||
| 837 | - | |||||||||||||||||||||||||
| 838 | - | |||||||||||||||||||||||||
| 839 | - | |||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||
| 841 | int oldReadBufferOffset = d->readBufferOffset + d->readConverterSavedStateOffset; | - | ||||||||||||||||||||||||
| 842 | while (d->readBuffer.size() < oldReadBufferOffset
| 1775-41035294 | ||||||||||||||||||||||||
| 843 | if (!thatd->fillReadBuffer(1)
| 0-41035294 | ||||||||||||||||||||||||
| 844 | return never executed: qint64(-1);return qint64(-1);never executed: return qint64(-1); | 0 | ||||||||||||||||||||||||
| 845 | } executed 41035294 times by 1 test: end of blockExecuted by:
| 41035294 | ||||||||||||||||||||||||
| 846 | thatd->readBufferOffset = oldReadBufferOffset; | - | ||||||||||||||||||||||||
| 847 | thatd->readConverterSavedStateOffset = 0; | - | ||||||||||||||||||||||||
| 848 | - | |||||||||||||||||||||||||
| 849 | - | |||||||||||||||||||||||||
| 850 | return executed 1775 times by 1 test: d->device->pos();return d->device->pos();Executed by:
executed 1775 times by 1 test: return d->device->pos();Executed by:
| 1775 | ||||||||||||||||||||||||
| 851 | } | - | ||||||||||||||||||||||||
| 852 | - | |||||||||||||||||||||||||
| 853 | if (d->string
| 0-36 | ||||||||||||||||||||||||
| 854 | return executed 36 times by 1 test: d->stringOffset;return d->stringOffset;Executed by:
executed 36 times by 1 test: return d->stringOffset;Executed by:
| 36 | ||||||||||||||||||||||||
| 855 | - | |||||||||||||||||||||||||
| 856 | QMessageLogger(__FILE__, 1282, __PRETTY_FUNCTION__).warning("QTextStream::pos: no device"); | - | ||||||||||||||||||||||||
| 857 | return never executed: qint64(-1);return qint64(-1);never executed: return qint64(-1); | 0 | ||||||||||||||||||||||||
| 858 | } | - | ||||||||||||||||||||||||
| 859 | void QTextStream::skipWhiteSpace() | - | ||||||||||||||||||||||||
| 860 | { | - | ||||||||||||||||||||||||
| 861 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 862 | do { if (!d->string
never executed: ;return ;never executed: } } while (0);return ; | 0-405 | ||||||||||||||||||||||||
| 863 | d->scan(0, 0, 0, QTextStreamPrivate::NotSpace); | - | ||||||||||||||||||||||||
| 864 | d->consumeLastToken(); | - | ||||||||||||||||||||||||
| 865 | } executed 408 times by 2 tests: end of blockExecuted by:
| 408 | ||||||||||||||||||||||||
| 866 | void QTextStream::setDevice(QIODevice *device) | - | ||||||||||||||||||||||||
| 867 | { | - | ||||||||||||||||||||||||
| 868 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 869 | flush(); | - | ||||||||||||||||||||||||
| 870 | if (d->deleteDevice
| 1-10 | ||||||||||||||||||||||||
| 871 | - | |||||||||||||||||||||||||
| 872 | d->deviceClosedNotifier.disconnect(); | - | ||||||||||||||||||||||||
| 873 | - | |||||||||||||||||||||||||
| 874 | delete d->device; | - | ||||||||||||||||||||||||
| 875 | d->deleteDevice = false; | - | ||||||||||||||||||||||||
| 876 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 877 | - | |||||||||||||||||||||||||
| 878 | d->reset(); | - | ||||||||||||||||||||||||
| 879 | d->status = Ok; | - | ||||||||||||||||||||||||
| 880 | d->device = device; | - | ||||||||||||||||||||||||
| 881 | d->resetReadBuffer(); | - | ||||||||||||||||||||||||
| 882 | - | |||||||||||||||||||||||||
| 883 | d->deviceClosedNotifier.setupDevice(this, d->device); | - | ||||||||||||||||||||||||
| 884 | - | |||||||||||||||||||||||||
| 885 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 886 | - | |||||||||||||||||||||||||
| 887 | - | |||||||||||||||||||||||||
| 888 | - | |||||||||||||||||||||||||
| 889 | - | |||||||||||||||||||||||||
| 890 | - | |||||||||||||||||||||||||
| 891 | - | |||||||||||||||||||||||||
| 892 | - | |||||||||||||||||||||||||
| 893 | QIODevice *QTextStream::device() const | - | ||||||||||||||||||||||||
| 894 | { | - | ||||||||||||||||||||||||
| 895 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 896 | return executed 3 times by 1 test: d->device;return d->device;Executed by:
executed 3 times by 1 test: return d->device;Executed by:
| 3 | ||||||||||||||||||||||||
| 897 | } | - | ||||||||||||||||||||||||
| 898 | void QTextStream::setString(QString *string, QIODevice::OpenMode openMode) | - | ||||||||||||||||||||||||
| 899 | { | - | ||||||||||||||||||||||||
| 900 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 901 | flush(); | - | ||||||||||||||||||||||||
| 902 | if (d->deleteDevice
| 0-7 | ||||||||||||||||||||||||
| 903 | - | |||||||||||||||||||||||||
| 904 | d->deviceClosedNotifier.disconnect(); | - | ||||||||||||||||||||||||
| 905 | d->device->blockSignals(true); | - | ||||||||||||||||||||||||
| 906 | - | |||||||||||||||||||||||||
| 907 | delete d->device; | - | ||||||||||||||||||||||||
| 908 | d->deleteDevice = false; | - | ||||||||||||||||||||||||
| 909 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 910 | - | |||||||||||||||||||||||||
| 911 | d->reset(); | - | ||||||||||||||||||||||||
| 912 | d->status = Ok; | - | ||||||||||||||||||||||||
| 913 | d->string = string; | - | ||||||||||||||||||||||||
| 914 | d->stringOpenMode = openMode; | - | ||||||||||||||||||||||||
| 915 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||
| 916 | - | |||||||||||||||||||||||||
| 917 | - | |||||||||||||||||||||||||
| 918 | - | |||||||||||||||||||||||||
| 919 | - | |||||||||||||||||||||||||
| 920 | - | |||||||||||||||||||||||||
| 921 | - | |||||||||||||||||||||||||
| 922 | - | |||||||||||||||||||||||||
| 923 | QString *QTextStream::string() const | - | ||||||||||||||||||||||||
| 924 | { | - | ||||||||||||||||||||||||
| 925 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 926 | return executed 1 time by 1 test: d->string;return d->string;Executed by:
executed 1 time by 1 test: return d->string;Executed by:
| 1 | ||||||||||||||||||||||||
| 927 | } | - | ||||||||||||||||||||||||
| 928 | void QTextStream::setFieldAlignment(FieldAlignment mode) | - | ||||||||||||||||||||||||
| 929 | { | - | ||||||||||||||||||||||||
| 930 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 931 | d->params.fieldAlignment = mode; | - | ||||||||||||||||||||||||
| 932 | } executed 9 times by 2 tests: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 933 | - | |||||||||||||||||||||||||
| 934 | - | |||||||||||||||||||||||||
| 935 | - | |||||||||||||||||||||||||
| 936 | - | |||||||||||||||||||||||||
| 937 | - | |||||||||||||||||||||||||
| 938 | - | |||||||||||||||||||||||||
| 939 | QTextStream::FieldAlignment QTextStream::fieldAlignment() const | - | ||||||||||||||||||||||||
| 940 | { | - | ||||||||||||||||||||||||
| 941 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 942 | return executed 4 times by 1 test: d->params.fieldAlignment;return d->params.fieldAlignment;Executed by:
executed 4 times by 1 test: return d->params.fieldAlignment;Executed by:
| 4 | ||||||||||||||||||||||||
| 943 | } | - | ||||||||||||||||||||||||
| 944 | void QTextStream::setPadChar(QChar ch) | - | ||||||||||||||||||||||||
| 945 | { | - | ||||||||||||||||||||||||
| 946 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 947 | d->params.padChar = ch; | - | ||||||||||||||||||||||||
| 948 | } executed 9 times by 2 tests: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 949 | - | |||||||||||||||||||||||||
| 950 | - | |||||||||||||||||||||||||
| 951 | - | |||||||||||||||||||||||||
| 952 | - | |||||||||||||||||||||||||
| 953 | - | |||||||||||||||||||||||||
| 954 | - | |||||||||||||||||||||||||
| 955 | QChar QTextStream::padChar() const | - | ||||||||||||||||||||||||
| 956 | { | - | ||||||||||||||||||||||||
| 957 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 958 | return executed 2 times by 1 test: d->params.padChar;return d->params.padChar;Executed by:
executed 2 times by 1 test: return d->params.padChar;Executed by:
| 2 | ||||||||||||||||||||||||
| 959 | } | - | ||||||||||||||||||||||||
| 960 | void QTextStream::setFieldWidth(int width) | - | ||||||||||||||||||||||||
| 961 | { | - | ||||||||||||||||||||||||
| 962 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 963 | d->params.fieldWidth = width; | - | ||||||||||||||||||||||||
| 964 | } executed 31 times by 4 tests: end of blockExecuted by:
| 31 | ||||||||||||||||||||||||
| 965 | - | |||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||
| 967 | - | |||||||||||||||||||||||||
| 968 | - | |||||||||||||||||||||||||
| 969 | - | |||||||||||||||||||||||||
| 970 | - | |||||||||||||||||||||||||
| 971 | int QTextStream::fieldWidth() const | - | ||||||||||||||||||||||||
| 972 | { | - | ||||||||||||||||||||||||
| 973 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 974 | return executed 3 times by 1 test: d->params.fieldWidth;return d->params.fieldWidth;Executed by:
executed 3 times by 1 test: return d->params.fieldWidth;Executed by:
| 3 | ||||||||||||||||||||||||
| 975 | } | - | ||||||||||||||||||||||||
| 976 | void QTextStream::setNumberFlags(NumberFlags flags) | - | ||||||||||||||||||||||||
| 977 | { | - | ||||||||||||||||||||||||
| 978 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 979 | d->params.numberFlags = flags; | - | ||||||||||||||||||||||||
| 980 | } executed 103 times by 4 tests: end of blockExecuted by:
| 103 | ||||||||||||||||||||||||
| 981 | - | |||||||||||||||||||||||||
| 982 | - | |||||||||||||||||||||||||
| 983 | - | |||||||||||||||||||||||||
| 984 | - | |||||||||||||||||||||||||
| 985 | - | |||||||||||||||||||||||||
| 986 | - | |||||||||||||||||||||||||
| 987 | QTextStream::NumberFlags QTextStream::numberFlags() const | - | ||||||||||||||||||||||||
| 988 | { | - | ||||||||||||||||||||||||
| 989 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 990 | return executed 1624 times by 10 tests: d->params.numberFlags;return d->params.numberFlags;Executed by:
executed 1624 times by 10 tests: return d->params.numberFlags;Executed by:
| 1624 | ||||||||||||||||||||||||
| 991 | } | - | ||||||||||||||||||||||||
| 992 | void QTextStream::setIntegerBase(int base) | - | ||||||||||||||||||||||||
| 993 | { | - | ||||||||||||||||||||||||
| 994 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 995 | d->params.integerBase = base; | - | ||||||||||||||||||||||||
| 996 | } executed 240 times by 7 tests: end of blockExecuted by:
| 240 | ||||||||||||||||||||||||
| 997 | - | |||||||||||||||||||||||||
| 998 | - | |||||||||||||||||||||||||
| 999 | - | |||||||||||||||||||||||||
| 1000 | - | |||||||||||||||||||||||||
| 1001 | - | |||||||||||||||||||||||||
| 1002 | - | |||||||||||||||||||||||||
| 1003 | - | |||||||||||||||||||||||||
| 1004 | int QTextStream::integerBase() const | - | ||||||||||||||||||||||||
| 1005 | { | - | ||||||||||||||||||||||||
| 1006 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1007 | return executed 3 times by 1 test: d->params.integerBase;return d->params.integerBase;Executed by:
executed 3 times by 1 test: return d->params.integerBase;Executed by:
| 3 | ||||||||||||||||||||||||
| 1008 | } | - | ||||||||||||||||||||||||
| 1009 | void QTextStream::setRealNumberNotation(RealNumberNotation notation) | - | ||||||||||||||||||||||||
| 1010 | { | - | ||||||||||||||||||||||||
| 1011 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1012 | d->params.realNumberNotation = notation; | - | ||||||||||||||||||||||||
| 1013 | } executed 9 times by 1 test: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 1014 | - | |||||||||||||||||||||||||
| 1015 | - | |||||||||||||||||||||||||
| 1016 | - | |||||||||||||||||||||||||
| 1017 | - | |||||||||||||||||||||||||
| 1018 | - | |||||||||||||||||||||||||
| 1019 | - | |||||||||||||||||||||||||
| 1020 | QTextStream::RealNumberNotation QTextStream::realNumberNotation() const | - | ||||||||||||||||||||||||
| 1021 | { | - | ||||||||||||||||||||||||
| 1022 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1023 | return executed 309 times by 9 tests: d->params.realNumberNotation;return d->params.realNumberNotation;Executed by:
executed 309 times by 9 tests: return d->params.realNumberNotation;Executed by:
| 309 | ||||||||||||||||||||||||
| 1024 | } | - | ||||||||||||||||||||||||
| 1025 | void QTextStream::setRealNumberPrecision(int precision) | - | ||||||||||||||||||||||||
| 1026 | { | - | ||||||||||||||||||||||||
| 1027 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1028 | if (precision < 0
| 2-10 | ||||||||||||||||||||||||
| 1029 | QMessageLogger(__FILE__, 1563, __PRETTY_FUNCTION__).warning("QTextStream::setRealNumberPrecision: Invalid precision (%d)", precision); | - | ||||||||||||||||||||||||
| 1030 | d->params.realNumberPrecision = 6; | - | ||||||||||||||||||||||||
| 1031 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 1032 | } | - | ||||||||||||||||||||||||
| 1033 | d->params.realNumberPrecision = precision; | - | ||||||||||||||||||||||||
| 1034 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 1035 | - | |||||||||||||||||||||||||
| 1036 | - | |||||||||||||||||||||||||
| 1037 | - | |||||||||||||||||||||||||
| 1038 | - | |||||||||||||||||||||||||
| 1039 | - | |||||||||||||||||||||||||
| 1040 | - | |||||||||||||||||||||||||
| 1041 | - | |||||||||||||||||||||||||
| 1042 | int QTextStream::realNumberPrecision() const | - | ||||||||||||||||||||||||
| 1043 | { | - | ||||||||||||||||||||||||
| 1044 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1045 | return executed 3 times by 1 test: d->params.realNumberPrecision;return d->params.realNumberPrecision;Executed by:
executed 3 times by 1 test: return d->params.realNumberPrecision;Executed by:
| 3 | ||||||||||||||||||||||||
| 1046 | } | - | ||||||||||||||||||||||||
| 1047 | - | |||||||||||||||||||||||||
| 1048 | - | |||||||||||||||||||||||||
| 1049 | - | |||||||||||||||||||||||||
| 1050 | - | |||||||||||||||||||||||||
| 1051 | - | |||||||||||||||||||||||||
| 1052 | - | |||||||||||||||||||||||||
| 1053 | - | |||||||||||||||||||||||||
| 1054 | QTextStream::Status QTextStream::status() const | - | ||||||||||||||||||||||||
| 1055 | { | - | ||||||||||||||||||||||||
| 1056 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1057 | return executed 17141 times by 4 tests: d->status;return d->status;Executed by:
executed 17141 times by 4 tests: return d->status;Executed by:
| 17141 | ||||||||||||||||||||||||
| 1058 | } | - | ||||||||||||||||||||||||
| 1059 | void QTextStream::resetStatus() | - | ||||||||||||||||||||||||
| 1060 | { | - | ||||||||||||||||||||||||
| 1061 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1062 | d->status = Ok; | - | ||||||||||||||||||||||||
| 1063 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 1064 | void QTextStream::setStatus(Status status) | - | ||||||||||||||||||||||||
| 1065 | { | - | ||||||||||||||||||||||||
| 1066 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1067 | if (d->status == Ok
| 0-79 | ||||||||||||||||||||||||
| 1068 | d->status = status; executed 79 times by 1 test: d->status = status;Executed by:
| 79 | ||||||||||||||||||||||||
| 1069 | } executed 79 times by 1 test: end of blockExecuted by:
| 79 | ||||||||||||||||||||||||
| 1070 | - | |||||||||||||||||||||||||
| 1071 | - | |||||||||||||||||||||||||
| 1072 | - | |||||||||||||||||||||||||
| 1073 | - | |||||||||||||||||||||||||
| 1074 | - | |||||||||||||||||||||||||
| 1075 | - | |||||||||||||||||||||||||
| 1076 | - | |||||||||||||||||||||||||
| 1077 | bool QTextStream::atEnd() const | - | ||||||||||||||||||||||||
| 1078 | { | - | ||||||||||||||||||||||||
| 1079 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1080 | do { if (!d->string
executed 1 time by 1 test: true;return true;Executed by:
executed 1 time by 1 test: } } while (0);return true;Executed by:
| 1-113676 | ||||||||||||||||||||||||
| 1081 | - | |||||||||||||||||||||||||
| 1082 | if (d->string
| 48149-113675 | ||||||||||||||||||||||||
| 1083 | return executed 48149 times by 3 tests: d->string->size() == d->stringOffset;return d->string->size() == d->stringOffset;Executed by:
executed 48149 times by 3 tests: return d->string->size() == d->stringOffset;Executed by:
| 48149 | ||||||||||||||||||||||||
| 1084 | return executed 113675 times by 11 tests: d->readBuffer.isEmpty() && d->device->atEnd();return d->readBuffer.isEmpty() && d->device->atEnd();Executed by:
executed 113675 times by 11 tests: return d->readBuffer.isEmpty() && d->device->atEnd();Executed by:
| 113675 | ||||||||||||||||||||||||
| 1085 | } | - | ||||||||||||||||||||||||
| 1086 | QString QTextStream::readAll() | - | ||||||||||||||||||||||||
| 1087 | { | - | ||||||||||||||||||||||||
| 1088 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1089 | do { if (!d->string
executed 1 time by 1 test: QString();return QString();Executed by:
executed 1 time by 1 test: } } while (0);return QString();Executed by:
| 1-1865 | ||||||||||||||||||||||||
| 1090 | - | |||||||||||||||||||||||||
| 1091 | return executed 1869 times by 2 tests: d->read(2147483647);return d->read(2147483647);Executed by:
executed 1869 times by 2 tests: return d->read(2147483647);Executed by:
| 1869 | ||||||||||||||||||||||||
| 1092 | } | - | ||||||||||||||||||||||||
| 1093 | QString QTextStream::readLine(qint64 maxlen) | - | ||||||||||||||||||||||||
| 1094 | { | - | ||||||||||||||||||||||||
| 1095 | QString line; | - | ||||||||||||||||||||||||
| 1096 | - | |||||||||||||||||||||||||
| 1097 | readLineInto(&line, maxlen); | - | ||||||||||||||||||||||||
| 1098 | return executed 154261 times by 14 tests: line;return line;Executed by:
executed 154261 times by 14 tests: return line;Executed by:
| 154261 | ||||||||||||||||||||||||
| 1099 | } | - | ||||||||||||||||||||||||
| 1100 | bool QTextStream::readLineInto(QString *line, qint64 maxlen) | - | ||||||||||||||||||||||||
| 1101 | { | - | ||||||||||||||||||||||||
| 1102 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1103 | - | |||||||||||||||||||||||||
| 1104 | if (!d->string
| 0-160283 | ||||||||||||||||||||||||
| 1105 | QMessageLogger(__FILE__, 1713, __PRETTY_FUNCTION__).warning("QTextStream: No device"); | - | ||||||||||||||||||||||||
| 1106 | if (line
| 0 | ||||||||||||||||||||||||
| 1107 | line->resize(0); never executed: line->resize(0); | 0 | ||||||||||||||||||||||||
| 1108 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1109 | } | - | ||||||||||||||||||||||||
| 1110 | - | |||||||||||||||||||||||||
| 1111 | const QChar *readPtr; | - | ||||||||||||||||||||||||
| 1112 | int length; | - | ||||||||||||||||||||||||
| 1113 | if (!d->scan(&readPtr, &length, int(maxlen), QTextStreamPrivate::EndOfLine)
| 14-184388 | ||||||||||||||||||||||||
| 1114 | if (line
| 0-14 | ||||||||||||||||||||||||
| 1115 | line->resize(0); executed 4 times by 1 test: line->resize(0);Executed by:
| 4 | ||||||||||||||||||||||||
| 1116 | return executed 14 times by 1 test: false;return false;Executed by:
executed 14 times by 1 test: return false;Executed by:
| 14 | ||||||||||||||||||||||||
| 1117 | } | - | ||||||||||||||||||||||||
| 1118 | - | |||||||||||||||||||||||||
| 1119 | if (__builtin_expect(!!(line), true)
| 1-184387 | ||||||||||||||||||||||||
| 1120 | line->setUnicode(readPtr, length); executed 184387 times by 14 tests: line->setUnicode(readPtr, length);Executed by:
| 184387 | ||||||||||||||||||||||||
| 1121 | d->consumeLastToken(); | - | ||||||||||||||||||||||||
| 1122 | return executed 184388 times by 14 tests: true;return true;Executed by:
executed 184388 times by 14 tests: return true;Executed by:
| 184388 | ||||||||||||||||||||||||
| 1123 | } | - | ||||||||||||||||||||||||
| 1124 | QString QTextStream::read(qint64 maxlen) | - | ||||||||||||||||||||||||
| 1125 | { | - | ||||||||||||||||||||||||
| 1126 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1127 | do { if (!d->string
never executed: QString();return QString();never executed: } } while (0);return QString(); | 0-8 | ||||||||||||||||||||||||
| 1128 | - | |||||||||||||||||||||||||
| 1129 | if (maxlen <= 0
| 1-7 | ||||||||||||||||||||||||
| 1130 | return executed 1 time by 1 test: QString::fromLatin1("");return QString::fromLatin1("");Executed by:
executed 1 time by 1 test: return QString::fromLatin1("");Executed by:
| 1 | ||||||||||||||||||||||||
| 1131 | - | |||||||||||||||||||||||||
| 1132 | return executed 7 times by 1 test: d->read(int(maxlen));return d->read(int(maxlen));Executed by:
executed 7 times by 1 test: return d->read(int(maxlen));Executed by:
| 7 | ||||||||||||||||||||||||
| 1133 | } | - | ||||||||||||||||||||||||
| 1134 | - | |||||||||||||||||||||||||
| 1135 | - | |||||||||||||||||||||||||
| 1136 | - | |||||||||||||||||||||||||
| 1137 | - | |||||||||||||||||||||||||
| 1138 | QTextStreamPrivate::NumberParsingStatus QTextStreamPrivate::getNumber(qulonglong *ret) | - | ||||||||||||||||||||||||
| 1139 | { | - | ||||||||||||||||||||||||
| 1140 | scan(0, 0, 0, NotSpace); | - | ||||||||||||||||||||||||
| 1141 | consumeLastToken(); | - | ||||||||||||||||||||||||
| 1142 | - | |||||||||||||||||||||||||
| 1143 | - | |||||||||||||||||||||||||
| 1144 | int base = params.integerBase; | - | ||||||||||||||||||||||||
| 1145 | if (base == 0
| 4875-16440 | ||||||||||||||||||||||||
| 1146 | QChar ch; | - | ||||||||||||||||||||||||
| 1147 | if (!getChar(&ch)
| 26-16414 | ||||||||||||||||||||||||
| 1148 | return executed 26 times by 1 test: npsInvalidPrefix;return npsInvalidPrefix;Executed by:
executed 26 times by 1 test: return npsInvalidPrefix;Executed by:
| 26 | ||||||||||||||||||||||||
| 1149 | if (ch == QLatin1Char('0')
| 1733-14681 | ||||||||||||||||||||||||
| 1150 | QChar ch2; | - | ||||||||||||||||||||||||
| 1151 | if (!getChar(&ch2)
| 6-1727 | ||||||||||||||||||||||||
| 1152 | - | |||||||||||||||||||||||||
| 1153 | *ret = 0; | - | ||||||||||||||||||||||||
| 1154 | return executed 6 times by 1 test: npsOk;return npsOk;Executed by:
executed 6 times by 1 test: return npsOk;Executed by:
| 6 | ||||||||||||||||||||||||
| 1155 | } | - | ||||||||||||||||||||||||
| 1156 | ch2 = ch2.toLower(); | - | ||||||||||||||||||||||||
| 1157 | - | |||||||||||||||||||||||||
| 1158 | if (ch2 == QLatin1Char('x')
| 60-1667 | ||||||||||||||||||||||||
| 1159 | base = 16; | - | ||||||||||||||||||||||||
| 1160 | } executed 60 times by 1 test: else if (ch2 == QLatin1Char('b')end of blockExecuted by:
| 42-1625 | ||||||||||||||||||||||||
| 1161 | base = 2; | - | ||||||||||||||||||||||||
| 1162 | } executed 42 times by 1 test: else if (ch2.isDigit()end of blockExecuted by:
| 0-1601 | ||||||||||||||||||||||||
| 1163 | base = 8; | - | ||||||||||||||||||||||||
| 1164 | } executed 24 times by 1 test: else {end of blockExecuted by:
| 24 | ||||||||||||||||||||||||
| 1165 | base = 10; | - | ||||||||||||||||||||||||
| 1166 | } executed 1601 times by 1 test: end of blockExecuted by:
| 1601 | ||||||||||||||||||||||||
| 1167 | ungetChar(ch2); | - | ||||||||||||||||||||||||
| 1168 | } executed 1727 times by 1 test: else if (ch == locale.negativeSign()end of blockExecuted by:
| 2-14577 | ||||||||||||||||||||||||
| 1169 | base = 10; | - | ||||||||||||||||||||||||
| 1170 | } executed 14673 times by 2 tests: else {end of blockExecuted by:
| 14673 | ||||||||||||||||||||||||
| 1171 | ungetChar(ch); | - | ||||||||||||||||||||||||
| 1172 | return executed 8 times by 1 test: npsInvalidPrefix;return npsInvalidPrefix;Executed by:
executed 8 times by 1 test: return npsInvalidPrefix;Executed by:
| 8 | ||||||||||||||||||||||||
| 1173 | } | - | ||||||||||||||||||||||||
| 1174 | ungetChar(ch); | - | ||||||||||||||||||||||||
| 1175 | - | |||||||||||||||||||||||||
| 1176 | - | |||||||||||||||||||||||||
| 1177 | - | |||||||||||||||||||||||||
| 1178 | } executed 16400 times by 2 tests: end of blockExecuted by:
| 16400 | ||||||||||||||||||||||||
| 1179 | - | |||||||||||||||||||||||||
| 1180 | qulonglong val=0; | - | ||||||||||||||||||||||||
| 1181 | switch (base) { | - | ||||||||||||||||||||||||
| 1182 | case executed 42 times by 1 test: 2:case 2:Executed by:
executed 42 times by 1 test: {case 2:Executed by:
| 42 | ||||||||||||||||||||||||
| 1183 | QChar pf1, pf2, dig; | - | ||||||||||||||||||||||||
| 1184 | - | |||||||||||||||||||||||||
| 1185 | if (!getChar(&pf1)
| 0-42 | ||||||||||||||||||||||||
| 1186 | return never executed: npsInvalidPrefix;return npsInvalidPrefix;never executed: return npsInvalidPrefix; | 0 | ||||||||||||||||||||||||
| 1187 | if (!getChar(&pf2)
| 0-42 | ||||||||||||||||||||||||
| 1188 | return never executed: npsInvalidPrefix;return npsInvalidPrefix;never executed: return npsInvalidPrefix; | 0 | ||||||||||||||||||||||||
| 1189 | - | |||||||||||||||||||||||||
| 1190 | int ndigits = 0; | - | ||||||||||||||||||||||||
| 1191 | while (getChar(&dig)
| 30-156 | ||||||||||||||||||||||||
| 1192 | int n = dig.toLower().unicode(); | - | ||||||||||||||||||||||||
| 1193 | if (n == '0'
| 12-84 | ||||||||||||||||||||||||
| 1194 | val <<= 1; | - | ||||||||||||||||||||||||
| 1195 | val += n - '0'; | - | ||||||||||||||||||||||||
| 1196 | } executed 144 times by 1 test: else {end of blockExecuted by:
| 144 | ||||||||||||||||||||||||
| 1197 | ungetChar(dig); | - | ||||||||||||||||||||||||
| 1198 | break; executed 12 times by 1 test: break;Executed by:
| 12 | ||||||||||||||||||||||||
| 1199 | } | - | ||||||||||||||||||||||||
| 1200 | ndigits++; | - | ||||||||||||||||||||||||
| 1201 | } executed 144 times by 1 test: end of blockExecuted by:
| 144 | ||||||||||||||||||||||||
| 1202 | if (ndigits == 0
| 0-42 | ||||||||||||||||||||||||
| 1203 | - | |||||||||||||||||||||||||
| 1204 | ungetChar(pf2); | - | ||||||||||||||||||||||||
| 1205 | ungetChar(pf1); | - | ||||||||||||||||||||||||
| 1206 | return never executed: npsMissingDigit;return npsMissingDigit;never executed: return npsMissingDigit; | 0 | ||||||||||||||||||||||||
| 1207 | } | - | ||||||||||||||||||||||||
| 1208 | break; executed 42 times by 1 test: break;Executed by:
| 42 | ||||||||||||||||||||||||
| 1209 | } | - | ||||||||||||||||||||||||
| 1210 | case executed 24 times by 1 test: 8:case 8:Executed by:
executed 24 times by 1 test: {case 8:Executed by:
| 24 | ||||||||||||||||||||||||
| 1211 | QChar pf, dig; | - | ||||||||||||||||||||||||
| 1212 | - | |||||||||||||||||||||||||
| 1213 | if (!getChar(&pf)
| 0-24 | ||||||||||||||||||||||||
| 1214 | return never executed: npsInvalidPrefix;return npsInvalidPrefix;never executed: return npsInvalidPrefix; | 0 | ||||||||||||||||||||||||
| 1215 | - | |||||||||||||||||||||||||
| 1216 | int ndigits = 0; | - | ||||||||||||||||||||||||
| 1217 | while (getChar(&dig)
| 12-72 | ||||||||||||||||||||||||
| 1218 | int n = dig.toLower().unicode(); | - | ||||||||||||||||||||||||
| 1219 | if (n >= '0'
| 0-72 | ||||||||||||||||||||||||
| 1220 | val *= 8; | - | ||||||||||||||||||||||||
| 1221 | val += n - '0'; | - | ||||||||||||||||||||||||
| 1222 | } executed 60 times by 1 test: else {end of blockExecuted by:
| 60 | ||||||||||||||||||||||||
| 1223 | ungetChar(dig); | - | ||||||||||||||||||||||||
| 1224 | break; executed 12 times by 1 test: break;Executed by:
| 12 | ||||||||||||||||||||||||
| 1225 | } | - | ||||||||||||||||||||||||
| 1226 | ndigits++; | - | ||||||||||||||||||||||||
| 1227 | } executed 60 times by 1 test: end of blockExecuted by:
| 60 | ||||||||||||||||||||||||
| 1228 | if (ndigits == 0
| 0-24 | ||||||||||||||||||||||||
| 1229 | - | |||||||||||||||||||||||||
| 1230 | ungetChar(pf); | - | ||||||||||||||||||||||||
| 1231 | return never executed: npsMissingDigit;return npsMissingDigit;never executed: return npsMissingDigit; | 0 | ||||||||||||||||||||||||
| 1232 | } | - | ||||||||||||||||||||||||
| 1233 | break; executed 24 times by 1 test: break;Executed by:
| 24 | ||||||||||||||||||||||||
| 1234 | } | - | ||||||||||||||||||||||||
| 1235 | case executed 21149 times by 3 tests: 10:case 10:Executed by:
executed 21149 times by 3 tests: {case 10:Executed by:
| 21149 | ||||||||||||||||||||||||
| 1236 | - | |||||||||||||||||||||||||
| 1237 | QChar sign; | - | ||||||||||||||||||||||||
| 1238 | int ndigits = 0; | - | ||||||||||||||||||||||||
| 1239 | if (!getChar(&sign)
| 0-21149 | ||||||||||||||||||||||||
| 1240 | return never executed: npsMissingDigit;return npsMissingDigit;never executed: return npsMissingDigit; | 0 | ||||||||||||||||||||||||
| 1241 | if (sign != locale.negativeSign()
| 2-21045 | ||||||||||||||||||||||||
| 1242 | if (!sign.isDigit()
| 0-21043 | ||||||||||||||||||||||||
| 1243 | ungetChar(sign); | - | ||||||||||||||||||||||||
| 1244 | return never executed: npsMissingDigit;return npsMissingDigit;never executed: return npsMissingDigit; | 0 | ||||||||||||||||||||||||
| 1245 | } | - | ||||||||||||||||||||||||
| 1246 | val += sign.digitValue(); | - | ||||||||||||||||||||||||
| 1247 | ndigits++; | - | ||||||||||||||||||||||||
| 1248 | } executed 21043 times by 3 tests: end of blockExecuted by:
| 21043 | ||||||||||||||||||||||||
| 1249 | - | |||||||||||||||||||||||||
| 1250 | QChar ch; | - | ||||||||||||||||||||||||
| 1251 | while (getChar(&ch)
| 260-28447 | ||||||||||||||||||||||||
| 1252 | if (ch.isDigit()
| 7557-20890 | ||||||||||||||||||||||||
| 1253 | val *= 10; | - | ||||||||||||||||||||||||
| 1254 | val += ch.digitValue(); | - | ||||||||||||||||||||||||
| 1255 | } executed 7557 times by 3 tests: else if (locale != QLocale::c()end of blockExecuted by:
| 0-20889 | ||||||||||||||||||||||||
| 1256 | continue; executed 1 time by 1 test: continue;Executed by:
| 1 | ||||||||||||||||||||||||
| 1257 | } else { | - | ||||||||||||||||||||||||
| 1258 | ungetChar(ch); | - | ||||||||||||||||||||||||
| 1259 | break; executed 20889 times by 3 tests: break;Executed by:
| 20889 | ||||||||||||||||||||||||
| 1260 | } | - | ||||||||||||||||||||||||
| 1261 | ndigits++; | - | ||||||||||||||||||||||||
| 1262 | } executed 7557 times by 3 tests: end of blockExecuted by:
| 7557 | ||||||||||||||||||||||||
| 1263 | if (ndigits == 0
| 0-21149 | ||||||||||||||||||||||||
| 1264 | return never executed: npsMissingDigit;return npsMissingDigit;never executed: return npsMissingDigit; | 0 | ||||||||||||||||||||||||
| 1265 | if (sign == locale.negativeSign()
| 104-21045 | ||||||||||||||||||||||||
| 1266 | qlonglong ival = qlonglong(val); | - | ||||||||||||||||||||||||
| 1267 | if (ival > 0
| 6-98 | ||||||||||||||||||||||||
| 1268 | ival = -ival; executed 98 times by 1 test: ival = -ival;Executed by:
| 98 | ||||||||||||||||||||||||
| 1269 | val = qulonglong(ival); | - | ||||||||||||||||||||||||
| 1270 | } executed 104 times by 1 test: end of blockExecuted by:
| 104 | ||||||||||||||||||||||||
| 1271 | break; executed 21149 times by 3 tests: break;Executed by:
| 21149 | ||||||||||||||||||||||||
| 1272 | } | - | ||||||||||||||||||||||||
| 1273 | case executed 60 times by 1 test: 16:case 16:Executed by:
executed 60 times by 1 test: {case 16:Executed by:
| 60 | ||||||||||||||||||||||||
| 1274 | QChar pf1, pf2, dig; | - | ||||||||||||||||||||||||
| 1275 | - | |||||||||||||||||||||||||
| 1276 | if (!getChar(&pf1)
| 0-60 | ||||||||||||||||||||||||
| 1277 | return never executed: npsInvalidPrefix;return npsInvalidPrefix;never executed: return npsInvalidPrefix; | 0 | ||||||||||||||||||||||||
| 1278 | if (!getChar(&pf2)
| 0-60 | ||||||||||||||||||||||||
| 1279 | return never executed: npsInvalidPrefix;return npsInvalidPrefix;never executed: return npsInvalidPrefix; | 0 | ||||||||||||||||||||||||
| 1280 | - | |||||||||||||||||||||||||
| 1281 | int ndigits = 0; | - | ||||||||||||||||||||||||
| 1282 | while (getChar(&dig)
| 48-318 | ||||||||||||||||||||||||
| 1283 | int n = dig.toLower().unicode(); | - | ||||||||||||||||||||||||
| 1284 | if (n >= '0'
| 0-318 | ||||||||||||||||||||||||
| 1285 | val <<= 4; | - | ||||||||||||||||||||||||
| 1286 | val += n - '0'; | - | ||||||||||||||||||||||||
| 1287 | } executed 12 times by 1 test: else if (n >= 'a'end of blockExecuted by:
| 0-306 | ||||||||||||||||||||||||
| 1288 | val <<= 4; | - | ||||||||||||||||||||||||
| 1289 | val += 10 + (n - 'a'); | - | ||||||||||||||||||||||||
| 1290 | } executed 294 times by 1 test: else {end of blockExecuted by:
| 294 | ||||||||||||||||||||||||
| 1291 | ungetChar(dig); | - | ||||||||||||||||||||||||
| 1292 | break; executed 12 times by 1 test: break;Executed by:
| 12 | ||||||||||||||||||||||||
| 1293 | } | - | ||||||||||||||||||||||||
| 1294 | ndigits++; | - | ||||||||||||||||||||||||
| 1295 | } executed 306 times by 1 test: end of blockExecuted by:
| 306 | ||||||||||||||||||||||||
| 1296 | if (ndigits == 0
| 6-54 | ||||||||||||||||||||||||
| 1297 | return executed 6 times by 1 test: npsMissingDigit;return npsMissingDigit;Executed by:
executed 6 times by 1 test: return npsMissingDigit;Executed by:
| 6 | ||||||||||||||||||||||||
| 1298 | } | - | ||||||||||||||||||||||||
| 1299 | break; executed 54 times by 1 test: break;Executed by:
| 54 | ||||||||||||||||||||||||
| 1300 | } | - | ||||||||||||||||||||||||
| 1301 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 1302 | - | |||||||||||||||||||||||||
| 1303 | return never executed: npsInvalidPrefix;return npsInvalidPrefix;never executed: return npsInvalidPrefix; | 0 | ||||||||||||||||||||||||
| 1304 | } | - | ||||||||||||||||||||||||
| 1305 | - | |||||||||||||||||||||||||
| 1306 | if (ret
| 0-21269 | ||||||||||||||||||||||||
| 1307 | * executed 21269 times by 3 tests: ret = val;*ret = val;Executed by:
executed 21269 times by 3 tests: *ret = val;Executed by:
| 21269 | ||||||||||||||||||||||||
| 1308 | return executed 21269 times by 3 tests: npsOk;return npsOk;Executed by:
executed 21269 times by 3 tests: return npsOk;Executed by:
| 21269 | ||||||||||||||||||||||||
| 1309 | } | - | ||||||||||||||||||||||||
| 1310 | - | |||||||||||||||||||||||||
| 1311 | - | |||||||||||||||||||||||||
| 1312 | - | |||||||||||||||||||||||||
| 1313 | - | |||||||||||||||||||||||||
| 1314 | - | |||||||||||||||||||||||||
| 1315 | bool QTextStreamPrivate::getReal(double *f) | - | ||||||||||||||||||||||||
| 1316 | { | - | ||||||||||||||||||||||||
| 1317 | - | |||||||||||||||||||||||||
| 1318 | - | |||||||||||||||||||||||||
| 1319 | - | |||||||||||||||||||||||||
| 1320 | enum ParserState { | - | ||||||||||||||||||||||||
| 1321 | Init = 0, | - | ||||||||||||||||||||||||
| 1322 | Sign = 1, | - | ||||||||||||||||||||||||
| 1323 | Mantissa = 2, | - | ||||||||||||||||||||||||
| 1324 | Dot = 3, | - | ||||||||||||||||||||||||
| 1325 | Abscissa = 4, | - | ||||||||||||||||||||||||
| 1326 | ExpMark = 5, | - | ||||||||||||||||||||||||
| 1327 | ExpSign = 6, | - | ||||||||||||||||||||||||
| 1328 | Exponent = 7, | - | ||||||||||||||||||||||||
| 1329 | Nan1 = 8, | - | ||||||||||||||||||||||||
| 1330 | Nan2 = 9, | - | ||||||||||||||||||||||||
| 1331 | Inf1 = 10, | - | ||||||||||||||||||||||||
| 1332 | Inf2 = 11, | - | ||||||||||||||||||||||||
| 1333 | NanInf = 12, | - | ||||||||||||||||||||||||
| 1334 | Done = 13 | - | ||||||||||||||||||||||||
| 1335 | }; | - | ||||||||||||||||||||||||
| 1336 | enum InputToken { | - | ||||||||||||||||||||||||
| 1337 | None = 0, | - | ||||||||||||||||||||||||
| 1338 | InputSign = 1, | - | ||||||||||||||||||||||||
| 1339 | InputDigit = 2, | - | ||||||||||||||||||||||||
| 1340 | InputDot = 3, | - | ||||||||||||||||||||||||
| 1341 | InputExp = 4, | - | ||||||||||||||||||||||||
| 1342 | InputI = 5, | - | ||||||||||||||||||||||||
| 1343 | InputN = 6, | - | ||||||||||||||||||||||||
| 1344 | InputF = 7, | - | ||||||||||||||||||||||||
| 1345 | InputA = 8, | - | ||||||||||||||||||||||||
| 1346 | InputT = 9 | - | ||||||||||||||||||||||||
| 1347 | }; | - | ||||||||||||||||||||||||
| 1348 | - | |||||||||||||||||||||||||
| 1349 | static const uchar table[13][10] = { | - | ||||||||||||||||||||||||
| 1350 | - | |||||||||||||||||||||||||
| 1351 | { 0, Sign, Mantissa, Dot, 0, Inf1, Nan1, 0, 0, 0 }, | - | ||||||||||||||||||||||||
| 1352 | { 0, 0, Mantissa, Dot, 0, Inf1, Nan1, 0, 0, 0 }, | - | ||||||||||||||||||||||||
| 1353 | { Done, Done, Mantissa, Dot, ExpMark, 0, 0, 0, 0, 0 }, | - | ||||||||||||||||||||||||
| 1354 | { 0, 0, Abscissa, 0, 0, 0, 0, 0, 0, 0 }, | - | ||||||||||||||||||||||||
| 1355 | { Done, Done, Abscissa, Done, ExpMark, 0, 0, 0, 0, 0 }, | - | ||||||||||||||||||||||||
| 1356 | { 0, ExpSign, Exponent, 0, 0, 0, 0, 0, 0, 0 }, | - | ||||||||||||||||||||||||
| 1357 | { 0, 0, Exponent, 0, 0, 0, 0, 0, 0, 0 }, | - | ||||||||||||||||||||||||
| 1358 | { Done, Done, Exponent, Done, Done, 0, 0, 0, 0, 0 }, | - | ||||||||||||||||||||||||
| 1359 | { 0, 0, 0, 0, 0, 0, 0, 0, Nan2, 0 }, | - | ||||||||||||||||||||||||
| 1360 | { 0, 0, 0, 0, 0, 0, NanInf, 0, 0, 0 }, | - | ||||||||||||||||||||||||
| 1361 | { 0, 0, 0, 0, 0, 0, Inf2, 0, 0, 0 }, | - | ||||||||||||||||||||||||
| 1362 | { 0, 0, 0, 0, 0, 0, 0, NanInf, 0, 0 }, | - | ||||||||||||||||||||||||
| 1363 | { Done, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, | - | ||||||||||||||||||||||||
| 1364 | }; | - | ||||||||||||||||||||||||
| 1365 | - | |||||||||||||||||||||||||
| 1366 | ParserState state = Init; | - | ||||||||||||||||||||||||
| 1367 | InputToken input = None; | - | ||||||||||||||||||||||||
| 1368 | - | |||||||||||||||||||||||||
| 1369 | scan(0, 0, 0, NotSpace); | - | ||||||||||||||||||||||||
| 1370 | consumeLastToken(); | - | ||||||||||||||||||||||||
| 1371 | - | |||||||||||||||||||||||||
| 1372 | const int BufferSize = 128; | - | ||||||||||||||||||||||||
| 1373 | char buf[BufferSize]; | - | ||||||||||||||||||||||||
| 1374 | int i = 0; | - | ||||||||||||||||||||||||
| 1375 | - | |||||||||||||||||||||||||
| 1376 | QChar c; | - | ||||||||||||||||||||||||
| 1377 | while (getChar(&c)
| 29-282 | ||||||||||||||||||||||||
| 1378 | switch (c.unicode()) { | - | ||||||||||||||||||||||||
| 1379 | case executed 10 times by 1 test: '0':case '0':Executed by:
executed 10 times by 1 test: casecase '0':Executed by:
executed 23 times by 1 test: '1':case '1':Executed by:
executed 23 times by 1 test: casecase '1':Executed by:
executed 11 times by 1 test: '2':case '2':Executed by:
executed 11 times by 1 test: casecase '2':Executed by:
executed 15 times by 1 test: '3':case '3':Executed by:
executed 15 times by 1 test: casecase '3':Executed by:
executed 16 times by 1 test: '4':case '4':Executed by:
executed 16 times by 1 test: case '4':Executed by:
| 10-23 | ||||||||||||||||||||||||
| 1380 | case executed 2 times by 1 test: '5':case '5':Executed by:
executed 2 times by 1 test: casecase '5':Executed by:
never executed: '6':case '6':never executed: casecase '6':never executed: '7':case '7':never executed: casecase '7':never executed: '8':case '8':never executed: casecase '8':never executed: '9':case '9':never executed: case '9': | 0-2 | ||||||||||||||||||||||||
| 1381 | input = InputDigit; | - | ||||||||||||||||||||||||
| 1382 | break; executed 77 times by 1 test: break;Executed by:
| 77 | ||||||||||||||||||||||||
| 1383 | case executed 12 times by 1 test: 'i':case 'i':Executed by:
executed 12 times by 1 test: casecase 'i':Executed by:
executed 6 times by 1 test: 'I':case 'I':Executed by:
executed 6 times by 1 test: case 'I':Executed by:
| 6-12 | ||||||||||||||||||||||||
| 1384 | input = InputI; | - | ||||||||||||||||||||||||
| 1385 | break; executed 18 times by 1 test: break;Executed by:
| 18 | ||||||||||||||||||||||||
| 1386 | case executed 30 times by 1 test: 'n':case 'n':Executed by:
executed 30 times by 1 test: casecase 'n':Executed by:
executed 24 times by 1 test: 'N':case 'N':Executed by:
executed 24 times by 1 test: case 'N':Executed by:
| 24-30 | ||||||||||||||||||||||||
| 1387 | input = InputN; | - | ||||||||||||||||||||||||
| 1388 | break; executed 54 times by 1 test: break;Executed by:
| 54 | ||||||||||||||||||||||||
| 1389 | case executed 12 times by 1 test: 'f':case 'f':Executed by:
executed 12 times by 1 test: casecase 'f':Executed by:
executed 6 times by 1 test: 'F':case 'F':Executed by:
executed 6 times by 1 test: case 'F':Executed by:
| 6-12 | ||||||||||||||||||||||||
| 1390 | input = InputF; | - | ||||||||||||||||||||||||
| 1391 | break; executed 18 times by 1 test: break;Executed by:
| 18 | ||||||||||||||||||||||||
| 1392 | case executed 9 times by 1 test: 'a':case 'a':Executed by:
executed 9 times by 1 test: casecase 'a':Executed by:
executed 12 times by 1 test: 'A':case 'A':Executed by:
executed 12 times by 1 test: case 'A':Executed by:
| 9-12 | ||||||||||||||||||||||||
| 1393 | input = InputA; | - | ||||||||||||||||||||||||
| 1394 | break; executed 21 times by 1 test: break;Executed by:
| 21 | ||||||||||||||||||||||||
| 1395 | case never executed: 't':case 't':never executed: casecase 't':never executed: 'T':case 'T':never executed: case 'T': | 0 | ||||||||||||||||||||||||
| 1396 | input = InputT; | - | ||||||||||||||||||||||||
| 1397 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1398 | default executed 94 times by 1 test: :default:Executed by:
executed 94 times by 1 test: {default:Executed by:
| 94 | ||||||||||||||||||||||||
| 1399 | QChar lc = c.toLower(); | - | ||||||||||||||||||||||||
| 1400 | if (lc == locale.decimalPoint().toLower()
| 13-81 | ||||||||||||||||||||||||
| 1401 | input = InputDot; executed 13 times by 1 test: input = InputDot;Executed by:
| 13 | ||||||||||||||||||||||||
| 1402 | else if (lc == locale.exponential().toLower()
| 8-73 | ||||||||||||||||||||||||
| 1403 | input = InputExp; executed 8 times by 1 test: input = InputExp;Executed by:
| 8 | ||||||||||||||||||||||||
| 1404 | else if (lc == locale.negativeSign().toLower()
| 20-53 | ||||||||||||||||||||||||
| 1405 | || lc == locale.positiveSign().toLower()
| 16-37 | ||||||||||||||||||||||||
| 1406 | input = InputSign; executed 36 times by 1 test: input = InputSign;Executed by:
| 36 | ||||||||||||||||||||||||
| 1407 | else if (locale != QLocale::c()
| 0-37 | ||||||||||||||||||||||||
| 1408 | && lc == locale.groupSeparator().toLower()
| 0 | ||||||||||||||||||||||||
| 1409 | input = InputDigit; never executed: input = InputDigit; | 0 | ||||||||||||||||||||||||
| 1410 | else | - | ||||||||||||||||||||||||
| 1411 | input = None; executed 37 times by 1 test: input = None;Executed by:
| 37 | ||||||||||||||||||||||||
| 1412 | } | - | ||||||||||||||||||||||||
| 1413 | break; executed 94 times by 1 test: break;Executed by:
| 94 | ||||||||||||||||||||||||
| 1414 | } | - | ||||||||||||||||||||||||
| 1415 | - | |||||||||||||||||||||||||
| 1416 | state = ParserState(table[state][input]); | - | ||||||||||||||||||||||||
| 1417 | - | |||||||||||||||||||||||||
| 1418 | if (state == Init
| 0-279 | ||||||||||||||||||||||||
| 1419 | ungetChar(c); | - | ||||||||||||||||||||||||
| 1420 | if (i > (BufferSize - 5)
| 0-40 | ||||||||||||||||||||||||
| 1421 | while (getChar(&c)
| 0 | ||||||||||||||||||||||||
| 1422 | if (!c.isDigit()
| 0 | ||||||||||||||||||||||||
| 1423 | ungetChar(c); | - | ||||||||||||||||||||||||
| 1424 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1425 | } | - | ||||||||||||||||||||||||
| 1426 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1427 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1428 | break; executed 40 times by 1 test: break;Executed by:
| 40 | ||||||||||||||||||||||||
| 1429 | } | - | ||||||||||||||||||||||||
| 1430 | - | |||||||||||||||||||||||||
| 1431 | buf[i++] = c.toLatin1(); | - | ||||||||||||||||||||||||
| 1432 | } executed 242 times by 1 test: end of blockExecuted by:
| 242 | ||||||||||||||||||||||||
| 1433 | - | |||||||||||||||||||||||||
| 1434 | if (i == 0
| 10-59 | ||||||||||||||||||||||||
| 1435 | return executed 10 times by 1 test: false;return false;Executed by:
executed 10 times by 1 test: return false;Executed by:
| 10 | ||||||||||||||||||||||||
| 1436 | if (!f
| 0-59 | ||||||||||||||||||||||||
| 1437 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 1438 | buf[i] = '\0'; | - | ||||||||||||||||||||||||
| 1439 | - | |||||||||||||||||||||||||
| 1440 | - | |||||||||||||||||||||||||
| 1441 | - | |||||||||||||||||||||||||
| 1442 | - | |||||||||||||||||||||||||
| 1443 | - | |||||||||||||||||||||||||
| 1444 | if (!qstricmp(buf, "nan")
| 6-53 | ||||||||||||||||||||||||
| 1445 | *f = qSNaN(); | - | ||||||||||||||||||||||||
| 1446 | return executed 18 times by 1 test: true;return true;Executed by:
executed 18 times by 1 test: return true;Executed by:
| 18 | ||||||||||||||||||||||||
| 1447 | } else if (!qstricmp(buf, "+inf")
| 6-35 | ||||||||||||||||||||||||
| 1448 | *f = qInf(); | - | ||||||||||||||||||||||||
| 1449 | return executed 12 times by 1 test: true;return true;Executed by:
executed 12 times by 1 test: return true;Executed by:
| 12 | ||||||||||||||||||||||||
| 1450 | } else if (!qstricmp(buf, "-inf")
| 6-23 | ||||||||||||||||||||||||
| 1451 | *f = -qInf(); | - | ||||||||||||||||||||||||
| 1452 | return executed 6 times by 1 test: true;return true;Executed by:
executed 6 times by 1 test: return true;Executed by:
| 6 | ||||||||||||||||||||||||
| 1453 | } | - | ||||||||||||||||||||||||
| 1454 | bool ok; | - | ||||||||||||||||||||||||
| 1455 | *f = locale.toDouble(QString::fromLatin1(buf), &ok); | - | ||||||||||||||||||||||||
| 1456 | return executed 23 times by 1 test: ok;return ok;Executed by:
executed 23 times by 1 test: return ok;Executed by:
| 23 | ||||||||||||||||||||||||
| 1457 | } | - | ||||||||||||||||||||||||
| 1458 | QTextStream &QTextStream::operator>>(QChar &c) | - | ||||||||||||||||||||||||
| 1459 | { | - | ||||||||||||||||||||||||
| 1460 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1461 | do { if (!d->string
executed 1 time by 1 test: *this;return *this;Executed by:
executed 1 time by 1 test: } } while (0);return *this;Executed by:
| 1-830 | ||||||||||||||||||||||||
| 1462 | d->scan(0, 0, 0, QTextStreamPrivate::NotSpace); | - | ||||||||||||||||||||||||
| 1463 | if (!d->getChar(&c)
| 16-823 | ||||||||||||||||||||||||
| 1464 | setStatus(ReadPastEnd); executed 16 times by 1 test: setStatus(ReadPastEnd);Executed by:
| 16 | ||||||||||||||||||||||||
| 1465 | return executed 839 times by 1 test: *this;return *this;Executed by:
executed 839 times by 1 test: return *this;Executed by:
| 839 | ||||||||||||||||||||||||
| 1466 | } | - | ||||||||||||||||||||||||
| 1467 | QTextStream &QTextStream::operator>>(char &c) | - | ||||||||||||||||||||||||
| 1468 | { | - | ||||||||||||||||||||||||
| 1469 | QChar ch; | - | ||||||||||||||||||||||||
| 1470 | *this >> ch; | - | ||||||||||||||||||||||||
| 1471 | c = ch.toLatin1(); | - | ||||||||||||||||||||||||
| 1472 | return executed 19 times by 1 test: *this;return *this;Executed by:
executed 19 times by 1 test: return *this;Executed by:
| 19 | ||||||||||||||||||||||||
| 1473 | } | - | ||||||||||||||||||||||||
| 1474 | QTextStream &QTextStream::operator>>(signed short &i) | - | ||||||||||||||||||||||||
| 1475 | { | - | ||||||||||||||||||||||||
| 1476 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string
never executed: *this;return *this;never executed: } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { casereturn *this;executed 63 times by 1 test: QTextStreamPrivate::npsOk:case QTextStreamPrivate::npsOk:Executed by:
executed 63 times by 1 test: i = (signed short)tmp; break;case QTextStreamPrivate::npsOk:Executed by:
executed 63 times by 1 test: casebreak;Executed by:
executed 1 time by 1 test: QTextStreamPrivate::npsMissingDigit:case QTextStreamPrivate::npsMissingDigit:Executed by:
executed 1 time by 1 test: casecase QTextStreamPrivate::npsMissingDigit:Executed by:
executed 5 times by 1 test: QTextStreamPrivate::npsInvalidPrefix:case QTextStreamPrivate::npsInvalidPrefix:Executed by:
executed 5 times by 1 test: i = (signed short)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break;case QTextStreamPrivate::npsInvalidPrefix:Executed by:
executed 6 times by 1 test: } returnbreak;Executed by:
executed 69 times by 1 test: *this;return *this;Executed by:
executed 69 times by 1 test: } while (0);return *this;Executed by:
| 0-69 | ||||||||||||||||||||||||
| 1477 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1478 | - | |||||||||||||||||||||||||
| 1479 | - | |||||||||||||||||||||||||
| 1480 | - | |||||||||||||||||||||||||
| 1481 | - | |||||||||||||||||||||||||
| 1482 | - | |||||||||||||||||||||||||
| 1483 | - | |||||||||||||||||||||||||
| 1484 | QTextStream &QTextStream::operator>>(unsigned short &i) | - | ||||||||||||||||||||||||
| 1485 | { | - | ||||||||||||||||||||||||
| 1486 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string
never executed: *this;return *this;never executed: } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { casereturn *this;executed 63 times by 1 test: QTextStreamPrivate::npsOk:case QTextStreamPrivate::npsOk:Executed by:
executed 63 times by 1 test: i = (unsigned short)tmp; break;case QTextStreamPrivate::npsOk:Executed by:
executed 63 times by 1 test: casebreak;Executed by:
executed 1 time by 1 test: QTextStreamPrivate::npsMissingDigit:case QTextStreamPrivate::npsMissingDigit:Executed by:
executed 1 time by 1 test: casecase QTextStreamPrivate::npsMissingDigit:Executed by:
executed 5 times by 1 test: QTextStreamPrivate::npsInvalidPrefix:case QTextStreamPrivate::npsInvalidPrefix:Executed by:
executed 5 times by 1 test: i = (unsigned short)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break;case QTextStreamPrivate::npsInvalidPrefix:Executed by:
executed 6 times by 1 test: } returnbreak;Executed by:
executed 69 times by 1 test: *this;return *this;Executed by:
executed 69 times by 1 test: } while (0);return *this;Executed by:
| 0-69 | ||||||||||||||||||||||||
| 1487 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1488 | - | |||||||||||||||||||||||||
| 1489 | - | |||||||||||||||||||||||||
| 1490 | - | |||||||||||||||||||||||||
| 1491 | - | |||||||||||||||||||||||||
| 1492 | - | |||||||||||||||||||||||||
| 1493 | - | |||||||||||||||||||||||||
| 1494 | QTextStream &QTextStream::operator>>(signed int &i) | - | ||||||||||||||||||||||||
| 1495 | { | - | ||||||||||||||||||||||||
| 1496 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string
never executed: *this;return *this;never executed: } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { casereturn *this;executed 20960 times by 3 tests: QTextStreamPrivate::npsOk:case QTextStreamPrivate::npsOk:Executed by:
executed 20960 times by 3 tests: i = (signed int)tmp; break;case QTextStreamPrivate::npsOk:Executed by:
executed 20960 times by 3 tests: casebreak;Executed by:
executed 1 time by 1 test: QTextStreamPrivate::npsMissingDigit:case QTextStreamPrivate::npsMissingDigit:Executed by:
executed 1 time by 1 test: casecase QTextStreamPrivate::npsMissingDigit:Executed by:
executed 9 times by 1 test: QTextStreamPrivate::npsInvalidPrefix:case QTextStreamPrivate::npsInvalidPrefix:Executed by:
executed 9 times by 1 test: i = (signed int)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break;case QTextStreamPrivate::npsInvalidPrefix:Executed by:
executed 10 times by 1 test: } returnbreak;Executed by:
executed 20970 times by 3 tests: *this;return *this;Executed by:
executed 20970 times by 3 tests: } while (0);return *this;Executed by:
| 0-20970 | ||||||||||||||||||||||||
| 1497 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1498 | - | |||||||||||||||||||||||||
| 1499 | - | |||||||||||||||||||||||||
| 1500 | - | |||||||||||||||||||||||||
| 1501 | - | |||||||||||||||||||||||||
| 1502 | - | |||||||||||||||||||||||||
| 1503 | - | |||||||||||||||||||||||||
| 1504 | QTextStream &QTextStream::operator>>(unsigned int &i) | - | ||||||||||||||||||||||||
| 1505 | { | - | ||||||||||||||||||||||||
| 1506 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string
never executed: *this;return *this;never executed: } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { casereturn *this;executed 63 times by 1 test: QTextStreamPrivate::npsOk:case QTextStreamPrivate::npsOk:Executed by:
executed 63 times by 1 test: i = (unsigned int)tmp; break;case QTextStreamPrivate::npsOk:Executed by:
executed 63 times by 1 test: casebreak;Executed by:
executed 1 time by 1 test: QTextStreamPrivate::npsMissingDigit:case QTextStreamPrivate::npsMissingDigit:Executed by:
executed 1 time by 1 test: casecase QTextStreamPrivate::npsMissingDigit:Executed by:
executed 5 times by 1 test: QTextStreamPrivate::npsInvalidPrefix:case QTextStreamPrivate::npsInvalidPrefix:Executed by:
executed 5 times by 1 test: i = (unsigned int)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break;case QTextStreamPrivate::npsInvalidPrefix:Executed by:
executed 6 times by 1 test: } returnbreak;Executed by:
executed 69 times by 1 test: *this;return *this;Executed by:
executed 69 times by 1 test: } while (0);return *this;Executed by:
| 0-69 | ||||||||||||||||||||||||
| 1507 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1508 | - | |||||||||||||||||||||||||
| 1509 | - | |||||||||||||||||||||||||
| 1510 | - | |||||||||||||||||||||||||
| 1511 | - | |||||||||||||||||||||||||
| 1512 | - | |||||||||||||||||||||||||
| 1513 | - | |||||||||||||||||||||||||
| 1514 | QTextStream &QTextStream::operator>>(signed long &i) | - | ||||||||||||||||||||||||
| 1515 | { | - | ||||||||||||||||||||||||
| 1516 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string
never executed: *this;return *this;never executed: } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { casereturn *this;never executed: QTextStreamPrivate::npsOk:case QTextStreamPrivate::npsOk:never executed: i = (signed long)tmp; break;case QTextStreamPrivate::npsOk:never executed: casebreak;never executed: QTextStreamPrivate::npsMissingDigit:case QTextStreamPrivate::npsMissingDigit:never executed: casecase QTextStreamPrivate::npsMissingDigit:never executed: QTextStreamPrivate::npsInvalidPrefix:case QTextStreamPrivate::npsInvalidPrefix:never executed: i = (signed long)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break;case QTextStreamPrivate::npsInvalidPrefix:never executed: } returnbreak;never executed: *this;return *this;never executed: } while (0);return *this; | 0 | ||||||||||||||||||||||||
| 1517 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1518 | - | |||||||||||||||||||||||||
| 1519 | - | |||||||||||||||||||||||||
| 1520 | - | |||||||||||||||||||||||||
| 1521 | - | |||||||||||||||||||||||||
| 1522 | - | |||||||||||||||||||||||||
| 1523 | - | |||||||||||||||||||||||||
| 1524 | QTextStream &QTextStream::operator>>(unsigned long &i) | - | ||||||||||||||||||||||||
| 1525 | { | - | ||||||||||||||||||||||||
| 1526 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string
never executed: *this;return *this;never executed: } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { casereturn *this;never executed: QTextStreamPrivate::npsOk:case QTextStreamPrivate::npsOk:never executed: i = (unsigned long)tmp; break;case QTextStreamPrivate::npsOk:never executed: casebreak;never executed: QTextStreamPrivate::npsMissingDigit:case QTextStreamPrivate::npsMissingDigit:never executed: casecase QTextStreamPrivate::npsMissingDigit:never executed: QTextStreamPrivate::npsInvalidPrefix:case QTextStreamPrivate::npsInvalidPrefix:never executed: i = (unsigned long)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break;case QTextStreamPrivate::npsInvalidPrefix:never executed: } returnbreak;never executed: *this;return *this;never executed: } while (0);return *this; | 0 | ||||||||||||||||||||||||
| 1527 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1528 | - | |||||||||||||||||||||||||
| 1529 | - | |||||||||||||||||||||||||
| 1530 | - | |||||||||||||||||||||||||
| 1531 | - | |||||||||||||||||||||||||
| 1532 | - | |||||||||||||||||||||||||
| 1533 | - | |||||||||||||||||||||||||
| 1534 | QTextStream &QTextStream::operator>>(qlonglong &i) | - | ||||||||||||||||||||||||
| 1535 | { | - | ||||||||||||||||||||||||
| 1536 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string
never executed: *this;return *this;never executed: } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { casereturn *this;executed 63 times by 1 test: QTextStreamPrivate::npsOk:case QTextStreamPrivate::npsOk:Executed by:
executed 63 times by 1 test: i = (qlonglong)tmp; break;case QTextStreamPrivate::npsOk:Executed by:
executed 63 times by 1 test: casebreak;Executed by:
executed 1 time by 1 test: QTextStreamPrivate::npsMissingDigit:case QTextStreamPrivate::npsMissingDigit:Executed by:
executed 1 time by 1 test: casecase QTextStreamPrivate::npsMissingDigit:Executed by:
executed 5 times by 1 test: QTextStreamPrivate::npsInvalidPrefix:case QTextStreamPrivate::npsInvalidPrefix:Executed by:
executed 5 times by 1 test: i = (qlonglong)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break;case QTextStreamPrivate::npsInvalidPrefix:Executed by:
executed 6 times by 1 test: } returnbreak;Executed by:
executed 69 times by 1 test: *this;return *this;Executed by:
executed 69 times by 1 test: } while (0);return *this;Executed by:
| 0-69 | ||||||||||||||||||||||||
| 1537 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1538 | - | |||||||||||||||||||||||||
| 1539 | - | |||||||||||||||||||||||||
| 1540 | - | |||||||||||||||||||||||||
| 1541 | - | |||||||||||||||||||||||||
| 1542 | - | |||||||||||||||||||||||||
| 1543 | - | |||||||||||||||||||||||||
| 1544 | QTextStream &QTextStream::operator>>(qulonglong &i) | - | ||||||||||||||||||||||||
| 1545 | { | - | ||||||||||||||||||||||||
| 1546 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string
never executed: *this;return *this;never executed: } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { casereturn *this;executed 63 times by 1 test: QTextStreamPrivate::npsOk:case QTextStreamPrivate::npsOk:Executed by:
executed 63 times by 1 test: i = (qulonglong)tmp; break;case QTextStreamPrivate::npsOk:Executed by:
executed 63 times by 1 test: casebreak;Executed by:
executed 1 time by 1 test: QTextStreamPrivate::npsMissingDigit:case QTextStreamPrivate::npsMissingDigit:Executed by:
executed 1 time by 1 test: casecase QTextStreamPrivate::npsMissingDigit:Executed by:
executed 5 times by 1 test: QTextStreamPrivate::npsInvalidPrefix:case QTextStreamPrivate::npsInvalidPrefix:Executed by:
executed 5 times by 1 test: i = (qulonglong)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break;case QTextStreamPrivate::npsInvalidPrefix:Executed by:
executed 6 times by 1 test: } returnbreak;Executed by:
executed 69 times by 1 test: *this;return *this;Executed by:
executed 69 times by 1 test: } while (0);return *this;Executed by:
| 0-69 | ||||||||||||||||||||||||
| 1547 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1548 | QTextStream &QTextStream::operator>>(float &f) | - | ||||||||||||||||||||||||
| 1549 | { | - | ||||||||||||||||||||||||
| 1550 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string
never executed: *this;return *this;never executed: } } while (0); double tmp; if (d->getReal(&tmp)return *this;
executed 28 times by 1 test: else { f = (float)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); }end of blockExecuted by:
executed 4 times by 1 test: returnend of blockExecuted by:
executed 32 times by 1 test: *this;return *this;Executed by:
executed 32 times by 1 test: } while (0);return *this;Executed by:
| 0-32 | ||||||||||||||||||||||||
| 1551 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1552 | - | |||||||||||||||||||||||||
| 1553 | - | |||||||||||||||||||||||||
| 1554 | - | |||||||||||||||||||||||||
| 1555 | - | |||||||||||||||||||||||||
| 1556 | - | |||||||||||||||||||||||||
| 1557 | - | |||||||||||||||||||||||||
| 1558 | QTextStream &QTextStream::operator>>(double &f) | - | ||||||||||||||||||||||||
| 1559 | { | - | ||||||||||||||||||||||||
| 1560 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string
never executed: *this;return *this;never executed: } } while (0); double tmp; if (d->getReal(&tmp)return *this;
executed 31 times by 1 test: else { f = (double)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); }end of blockExecuted by:
executed 6 times by 1 test: returnend of blockExecuted by:
executed 37 times by 1 test: *this;return *this;Executed by:
executed 37 times by 1 test: } while (0);return *this;Executed by:
| 0-37 | ||||||||||||||||||||||||
| 1561 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1562 | QTextStream &QTextStream::operator>>(QString &str) | - | ||||||||||||||||||||||||
| 1563 | { | - | ||||||||||||||||||||||||
| 1564 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1565 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-425 | ||||||||||||||||||||||||
| 1566 | - | |||||||||||||||||||||||||
| 1567 | str.clear(); | - | ||||||||||||||||||||||||
| 1568 | d->scan(0, 0, 0, QTextStreamPrivate::NotSpace); | - | ||||||||||||||||||||||||
| 1569 | d->consumeLastToken(); | - | ||||||||||||||||||||||||
| 1570 | - | |||||||||||||||||||||||||
| 1571 | const QChar *ptr; | - | ||||||||||||||||||||||||
| 1572 | int length; | - | ||||||||||||||||||||||||
| 1573 | if (!d->scan(&ptr, &length, 0, QTextStreamPrivate::Space)
| 4-433 | ||||||||||||||||||||||||
| 1574 | setStatus(ReadPastEnd); | - | ||||||||||||||||||||||||
| 1575 | return executed 4 times by 1 test: *this;return *this;Executed by:
executed 4 times by 1 test: return *this;Executed by:
| 4 | ||||||||||||||||||||||||
| 1576 | } | - | ||||||||||||||||||||||||
| 1577 | - | |||||||||||||||||||||||||
| 1578 | str = QString(ptr, length); | - | ||||||||||||||||||||||||
| 1579 | d->consumeLastToken(); | - | ||||||||||||||||||||||||
| 1580 | return executed 433 times by 4 tests: *this;return *this;Executed by:
executed 433 times by 4 tests: return *this;Executed by:
| 433 | ||||||||||||||||||||||||
| 1581 | } | - | ||||||||||||||||||||||||
| 1582 | QTextStream &QTextStream::operator>>(QByteArray &array) | - | ||||||||||||||||||||||||
| 1583 | { | - | ||||||||||||||||||||||||
| 1584 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1585 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-14 | ||||||||||||||||||||||||
| 1586 | - | |||||||||||||||||||||||||
| 1587 | array.clear(); | - | ||||||||||||||||||||||||
| 1588 | d->scan(0, 0, 0, QTextStreamPrivate::NotSpace); | - | ||||||||||||||||||||||||
| 1589 | d->consumeLastToken(); | - | ||||||||||||||||||||||||
| 1590 | - | |||||||||||||||||||||||||
| 1591 | const QChar *ptr; | - | ||||||||||||||||||||||||
| 1592 | int length; | - | ||||||||||||||||||||||||
| 1593 | if (!d->scan(&ptr, &length, 0, QTextStreamPrivate::Space)
| 3-11 | ||||||||||||||||||||||||
| 1594 | setStatus(ReadPastEnd); | - | ||||||||||||||||||||||||
| 1595 | return executed 3 times by 1 test: *this;return *this;Executed by:
executed 3 times by 1 test: return *this;Executed by:
| 3 | ||||||||||||||||||||||||
| 1596 | } | - | ||||||||||||||||||||||||
| 1597 | - | |||||||||||||||||||||||||
| 1598 | for (int i = 0; i < length
| 11-20 | ||||||||||||||||||||||||
| 1599 | array += ptr[i].toLatin1(); executed 20 times by 1 test: array += ptr[i].toLatin1();Executed by:
| 20 | ||||||||||||||||||||||||
| 1600 | - | |||||||||||||||||||||||||
| 1601 | d->consumeLastToken(); | - | ||||||||||||||||||||||||
| 1602 | return executed 11 times by 1 test: *this;return *this;Executed by:
executed 11 times by 1 test: return *this;Executed by:
| 11 | ||||||||||||||||||||||||
| 1603 | } | - | ||||||||||||||||||||||||
| 1604 | QTextStream &QTextStream::operator>>(char *c) | - | ||||||||||||||||||||||||
| 1605 | { | - | ||||||||||||||||||||||||
| 1606 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1607 | *c = 0; | - | ||||||||||||||||||||||||
| 1608 | do { if (!d->string
executed 1 time by 1 test: *this;return *this;Executed by:
executed 1 time by 1 test: } } while (0);return *this;Executed by:
| 0-13 | ||||||||||||||||||||||||
| 1609 | d->scan(0, 0, 0, QTextStreamPrivate::NotSpace); | - | ||||||||||||||||||||||||
| 1610 | d->consumeLastToken(); | - | ||||||||||||||||||||||||
| 1611 | - | |||||||||||||||||||||||||
| 1612 | const QChar *ptr; | - | ||||||||||||||||||||||||
| 1613 | int length; | - | ||||||||||||||||||||||||
| 1614 | if (!d->scan(&ptr, &length, 0, QTextStreamPrivate::Space)
| 3-9 | ||||||||||||||||||||||||
| 1615 | setStatus(ReadPastEnd); | - | ||||||||||||||||||||||||
| 1616 | return executed 3 times by 1 test: *this;return *this;Executed by:
executed 3 times by 1 test: return *this;Executed by:
| 3 | ||||||||||||||||||||||||
| 1617 | } | - | ||||||||||||||||||||||||
| 1618 | - | |||||||||||||||||||||||||
| 1619 | for (int i = 0; i < length
| 9-14 | ||||||||||||||||||||||||
| 1620 | * executed 14 times by 1 test: c++ = ptr[i].toLatin1();*c++ = ptr[i].toLatin1();Executed by:
executed 14 times by 1 test: *c++ = ptr[i].toLatin1();Executed by:
| 14 | ||||||||||||||||||||||||
| 1621 | *c = '\0'; | - | ||||||||||||||||||||||||
| 1622 | d->consumeLastToken(); | - | ||||||||||||||||||||||||
| 1623 | return executed 9 times by 1 test: *this;return *this;Executed by:
executed 9 times by 1 test: return *this;Executed by:
| 9 | ||||||||||||||||||||||||
| 1624 | } | - | ||||||||||||||||||||||||
| 1625 | - | |||||||||||||||||||||||||
| 1626 | - | |||||||||||||||||||||||||
| 1627 | - | |||||||||||||||||||||||||
| 1628 | - | |||||||||||||||||||||||||
| 1629 | void QTextStreamPrivate::putNumber(qulonglong number, bool negative) | - | ||||||||||||||||||||||||
| 1630 | { | - | ||||||||||||||||||||||||
| 1631 | QString result; | - | ||||||||||||||||||||||||
| 1632 | - | |||||||||||||||||||||||||
| 1633 | unsigned flags = 0; | - | ||||||||||||||||||||||||
| 1634 | const QTextStream::NumberFlags numberFlags = params.numberFlags; | - | ||||||||||||||||||||||||
| 1635 | if (numberFlags & QTextStream::ShowBase
| 134-24545 | ||||||||||||||||||||||||
| 1636 | flags |= QLocaleData::ShowBase; executed 134 times by 11 tests: flags |= QLocaleData::ShowBase;Executed by:
| 134 | ||||||||||||||||||||||||
| 1637 | if (numberFlags & QTextStream::ForceSign
| 3-24676 | ||||||||||||||||||||||||
| 1638 | flags |= QLocaleData::AlwaysShowSign; executed 3 times by 1 test: flags |= QLocaleData::AlwaysShowSign;Executed by:
| 3 | ||||||||||||||||||||||||
| 1639 | if (numberFlags & QTextStream::UppercaseBase
| 7-24672 | ||||||||||||||||||||||||
| 1640 | flags |= QLocaleData::UppercaseBase; executed 7 times by 1 test: flags |= QLocaleData::UppercaseBase;Executed by:
| 7 | ||||||||||||||||||||||||
| 1641 | if (numberFlags & QTextStream::UppercaseDigits
| 9-24670 | ||||||||||||||||||||||||
| 1642 | flags |= QLocaleData::CapitalEorX; executed 9 times by 1 test: flags |= QLocaleData::CapitalEorX;Executed by:
| 9 | ||||||||||||||||||||||||
| 1643 | - | |||||||||||||||||||||||||
| 1644 | - | |||||||||||||||||||||||||
| 1645 | - | |||||||||||||||||||||||||
| 1646 | if (locale != QLocale::c()
| 86-24418 | ||||||||||||||||||||||||
| 1647 | flags |= QLocaleData::ThousandsGroup; executed 175 times by 1 test: flags |= QLocaleData::ThousandsGroup;Executed by:
| 175 | ||||||||||||||||||||||||
| 1648 | - | |||||||||||||||||||||||||
| 1649 | const QLocaleData *dd = locale.d->m_data; | - | ||||||||||||||||||||||||
| 1650 | int base = params.integerBase
| 235-24444 | ||||||||||||||||||||||||
| 1651 | if (negative
| 4-23338 | ||||||||||||||||||||||||
| 1652 | result = dd->longLongToString(-static_cast<qlonglong>(number), -1, | - | ||||||||||||||||||||||||
| 1653 | base, -1, flags); | - | ||||||||||||||||||||||||
| 1654 | } executed 1337 times by 8 tests: else if (negativeend of blockExecuted by:
| 4-23338 | ||||||||||||||||||||||||
| 1655 | - | |||||||||||||||||||||||||
| 1656 | - | |||||||||||||||||||||||||
| 1657 | - | |||||||||||||||||||||||||
| 1658 | - | |||||||||||||||||||||||||
| 1659 | result = dd->unsLongLongToString(number, -1, base, -1, flags); | - | ||||||||||||||||||||||||
| 1660 | result.prepend(locale.negativeSign()); | - | ||||||||||||||||||||||||
| 1661 | } executed 4 times by 1 test: else {end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1662 | result = dd->unsLongLongToString(number, -1, base, -1, flags); | - | ||||||||||||||||||||||||
| 1663 | - | |||||||||||||||||||||||||
| 1664 | - | |||||||||||||||||||||||||
| 1665 | if (number == 0
| 1-20588 | ||||||||||||||||||||||||
| 1666 | && result == QLatin1String("0")
| 0-1 | ||||||||||||||||||||||||
| 1667 | result.prepend(QLatin1Char('0')); | - | ||||||||||||||||||||||||
| 1668 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 1669 | } executed 23338 times by 47 tests: end of blockExecuted by:
| 23338 | ||||||||||||||||||||||||
| 1670 | putString(result, true); | - | ||||||||||||||||||||||||
| 1671 | } executed 24679 times by 47 tests: end of blockExecuted by:
| 24679 | ||||||||||||||||||||||||
| 1672 | - | |||||||||||||||||||||||||
| 1673 | - | |||||||||||||||||||||||||
| 1674 | - | |||||||||||||||||||||||||
| 1675 | - | |||||||||||||||||||||||||
| 1676 | - | |||||||||||||||||||||||||
| 1677 | - | |||||||||||||||||||||||||
| 1678 | - | |||||||||||||||||||||||||
| 1679 | QTextStream &QTextStream::operator<<(QChar c) | - | ||||||||||||||||||||||||
| 1680 | { | - | ||||||||||||||||||||||||
| 1681 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1682 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-26222 | ||||||||||||||||||||||||
| 1683 | d->putChar(c); | - | ||||||||||||||||||||||||
| 1684 | return executed 50798 times by 15 tests: *this;return *this;Executed by:
executed 50798 times by 15 tests: return *this;Executed by:
| 50798 | ||||||||||||||||||||||||
| 1685 | } | - | ||||||||||||||||||||||||
| 1686 | - | |||||||||||||||||||||||||
| 1687 | - | |||||||||||||||||||||||||
| 1688 | - | |||||||||||||||||||||||||
| 1689 | - | |||||||||||||||||||||||||
| 1690 | - | |||||||||||||||||||||||||
| 1691 | - | |||||||||||||||||||||||||
| 1692 | QTextStream &QTextStream::operator<<(char c) | - | ||||||||||||||||||||||||
| 1693 | { | - | ||||||||||||||||||||||||
| 1694 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1695 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-69444 | ||||||||||||||||||||||||
| 1696 | d->putChar(QChar::fromLatin1(c)); | - | ||||||||||||||||||||||||
| 1697 | return executed 115763 times by 80 tests: *this;return *this;Executed by:
executed 115763 times by 80 tests: return *this;Executed by:
| 115763 | ||||||||||||||||||||||||
| 1698 | } | - | ||||||||||||||||||||||||
| 1699 | QTextStream &QTextStream::operator<<(signed short i) | - | ||||||||||||||||||||||||
| 1700 | { | - | ||||||||||||||||||||||||
| 1701 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1702 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-36 | ||||||||||||||||||||||||
| 1703 | d->putNumber((qulonglong)qAbs(qlonglong(i)), i < 0); | - | ||||||||||||||||||||||||
| 1704 | return executed 38 times by 3 tests: *this;return *this;Executed by:
executed 38 times by 3 tests: return *this;Executed by:
| 38 | ||||||||||||||||||||||||
| 1705 | } | - | ||||||||||||||||||||||||
| 1706 | - | |||||||||||||||||||||||||
| 1707 | - | |||||||||||||||||||||||||
| 1708 | - | |||||||||||||||||||||||||
| 1709 | - | |||||||||||||||||||||||||
| 1710 | - | |||||||||||||||||||||||||
| 1711 | - | |||||||||||||||||||||||||
| 1712 | QTextStream &QTextStream::operator<<(unsigned short i) | - | ||||||||||||||||||||||||
| 1713 | { | - | ||||||||||||||||||||||||
| 1714 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1715 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-117 | ||||||||||||||||||||||||
| 1716 | d->putNumber((qulonglong)i, false); | - | ||||||||||||||||||||||||
| 1717 | return executed 198 times by 6 tests: *this;return *this;Executed by:
executed 198 times by 6 tests: return *this;Executed by:
| 198 | ||||||||||||||||||||||||
| 1718 | } | - | ||||||||||||||||||||||||
| 1719 | - | |||||||||||||||||||||||||
| 1720 | - | |||||||||||||||||||||||||
| 1721 | - | |||||||||||||||||||||||||
| 1722 | - | |||||||||||||||||||||||||
| 1723 | - | |||||||||||||||||||||||||
| 1724 | - | |||||||||||||||||||||||||
| 1725 | QTextStream &QTextStream::operator<<(signed int i) | - | ||||||||||||||||||||||||
| 1726 | { | - | ||||||||||||||||||||||||
| 1727 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1728 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-14993 | ||||||||||||||||||||||||
| 1729 | d->putNumber((qulonglong)qAbs(qlonglong(i)), i < 0); | - | ||||||||||||||||||||||||
| 1730 | return executed 18403 times by 39 tests: *this;return *this;Executed by:
executed 18403 times by 39 tests: return *this;Executed by:
| 18403 | ||||||||||||||||||||||||
| 1731 | } | - | ||||||||||||||||||||||||
| 1732 | - | |||||||||||||||||||||||||
| 1733 | - | |||||||||||||||||||||||||
| 1734 | - | |||||||||||||||||||||||||
| 1735 | - | |||||||||||||||||||||||||
| 1736 | - | |||||||||||||||||||||||||
| 1737 | - | |||||||||||||||||||||||||
| 1738 | QTextStream &QTextStream::operator<<(unsigned int i) | - | ||||||||||||||||||||||||
| 1739 | { | - | ||||||||||||||||||||||||
| 1740 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1741 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-60 | ||||||||||||||||||||||||
| 1742 | d->putNumber((qulonglong)i, false); | - | ||||||||||||||||||||||||
| 1743 | return executed 66 times by 4 tests: *this;return *this;Executed by:
executed 66 times by 4 tests: return *this;Executed by:
| 66 | ||||||||||||||||||||||||
| 1744 | } | - | ||||||||||||||||||||||||
| 1745 | - | |||||||||||||||||||||||||
| 1746 | - | |||||||||||||||||||||||||
| 1747 | - | |||||||||||||||||||||||||
| 1748 | - | |||||||||||||||||||||||||
| 1749 | - | |||||||||||||||||||||||||
| 1750 | - | |||||||||||||||||||||||||
| 1751 | QTextStream &QTextStream::operator<<(signed long i) | - | ||||||||||||||||||||||||
| 1752 | { | - | ||||||||||||||||||||||||
| 1753 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1754 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-2 | ||||||||||||||||||||||||
| 1755 | d->putNumber((qulonglong)qAbs(qlonglong(i)), i < 0); | - | ||||||||||||||||||||||||
| 1756 | return executed 2 times by 2 tests: *this;return *this;Executed by:
executed 2 times by 2 tests: return *this;Executed by:
| 2 | ||||||||||||||||||||||||
| 1757 | } | - | ||||||||||||||||||||||||
| 1758 | - | |||||||||||||||||||||||||
| 1759 | - | |||||||||||||||||||||||||
| 1760 | - | |||||||||||||||||||||||||
| 1761 | - | |||||||||||||||||||||||||
| 1762 | - | |||||||||||||||||||||||||
| 1763 | - | |||||||||||||||||||||||||
| 1764 | QTextStream &QTextStream::operator<<(unsigned long i) | - | ||||||||||||||||||||||||
| 1765 | { | - | ||||||||||||||||||||||||
| 1766 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1767 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-1 | ||||||||||||||||||||||||
| 1768 | d->putNumber((qulonglong)i, false); | - | ||||||||||||||||||||||||
| 1769 | return executed 1 time by 1 test: *this;return *this;Executed by:
executed 1 time by 1 test: return *this;Executed by:
| 1 | ||||||||||||||||||||||||
| 1770 | } | - | ||||||||||||||||||||||||
| 1771 | - | |||||||||||||||||||||||||
| 1772 | - | |||||||||||||||||||||||||
| 1773 | - | |||||||||||||||||||||||||
| 1774 | - | |||||||||||||||||||||||||
| 1775 | - | |||||||||||||||||||||||||
| 1776 | - | |||||||||||||||||||||||||
| 1777 | QTextStream &QTextStream::operator<<(qlonglong i) | - | ||||||||||||||||||||||||
| 1778 | { | - | ||||||||||||||||||||||||
| 1779 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1780 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-5734 | ||||||||||||||||||||||||
| 1781 | d->putNumber((qulonglong)qAbs(i), i < 0); | - | ||||||||||||||||||||||||
| 1782 | return executed 5831 times by 11 tests: *this;return *this;Executed by:
executed 5831 times by 11 tests: return *this;Executed by:
| 5831 | ||||||||||||||||||||||||
| 1783 | } | - | ||||||||||||||||||||||||
| 1784 | - | |||||||||||||||||||||||||
| 1785 | - | |||||||||||||||||||||||||
| 1786 | - | |||||||||||||||||||||||||
| 1787 | - | |||||||||||||||||||||||||
| 1788 | - | |||||||||||||||||||||||||
| 1789 | - | |||||||||||||||||||||||||
| 1790 | QTextStream &QTextStream::operator<<(qulonglong i) | - | ||||||||||||||||||||||||
| 1791 | { | - | ||||||||||||||||||||||||
| 1792 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1793 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-76 | ||||||||||||||||||||||||
| 1794 | d->putNumber(i, false); | - | ||||||||||||||||||||||||
| 1795 | return executed 90 times by 5 tests: *this;return *this;Executed by:
executed 90 times by 5 tests: return *this;Executed by:
| 90 | ||||||||||||||||||||||||
| 1796 | } | - | ||||||||||||||||||||||||
| 1797 | QTextStream &QTextStream::operator<<(float f) | - | ||||||||||||||||||||||||
| 1798 | { | - | ||||||||||||||||||||||||
| 1799 | return executed 54 times by 3 tests: *this << double(f);return *this << double(f);Executed by:
executed 54 times by 3 tests: return *this << double(f);Executed by:
| 54 | ||||||||||||||||||||||||
| 1800 | } | - | ||||||||||||||||||||||||
| 1801 | - | |||||||||||||||||||||||||
| 1802 | - | |||||||||||||||||||||||||
| 1803 | - | |||||||||||||||||||||||||
| 1804 | - | |||||||||||||||||||||||||
| 1805 | - | |||||||||||||||||||||||||
| 1806 | - | |||||||||||||||||||||||||
| 1807 | QTextStream &QTextStream::operator<<(double f) | - | ||||||||||||||||||||||||
| 1808 | { | - | ||||||||||||||||||||||||
| 1809 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1810 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-278 | ||||||||||||||||||||||||
| 1811 | - | |||||||||||||||||||||||||
| 1812 | QLocaleData::DoubleForm form = QLocaleData::DFDecimal; | - | ||||||||||||||||||||||||
| 1813 | switch (realNumberNotation()) { | - | ||||||||||||||||||||||||
| 1814 | case executed 2 times by 1 test: FixedNotation:case FixedNotation:Executed by:
executed 2 times by 1 test: case FixedNotation:Executed by:
| 2 | ||||||||||||||||||||||||
| 1815 | form = QLocaleData::DFDecimal; | - | ||||||||||||||||||||||||
| 1816 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||||||||||||||||||||
| 1817 | case executed 5 times by 1 test: ScientificNotation:case ScientificNotation:Executed by:
executed 5 times by 1 test: case ScientificNotation:Executed by:
| 5 | ||||||||||||||||||||||||
| 1818 | form = QLocaleData::DFExponent; | - | ||||||||||||||||||||||||
| 1819 | break; executed 5 times by 1 test: break;Executed by:
| 5 | ||||||||||||||||||||||||
| 1820 | case executed 299 times by 9 tests: SmartNotation:case SmartNotation:Executed by:
executed 299 times by 9 tests: case SmartNotation:Executed by:
| 299 | ||||||||||||||||||||||||
| 1821 | form = QLocaleData::DFSignificantDigits; | - | ||||||||||||||||||||||||
| 1822 | break; executed 299 times by 9 tests: break;Executed by:
| 299 | ||||||||||||||||||||||||
| 1823 | } | - | ||||||||||||||||||||||||
| 1824 | - | |||||||||||||||||||||||||
| 1825 | uint flags = 0; | - | ||||||||||||||||||||||||
| 1826 | if (numberFlags() & ShowBase
| 0-306 | ||||||||||||||||||||||||
| 1827 | flags |= QLocaleData::ShowBase; never executed: flags |= QLocaleData::ShowBase; | 0 | ||||||||||||||||||||||||
| 1828 | if (numberFlags() & ForceSign
| 4-302 | ||||||||||||||||||||||||
| 1829 | flags |= QLocaleData::AlwaysShowSign; executed 4 times by 1 test: flags |= QLocaleData::AlwaysShowSign;Executed by:
| 4 | ||||||||||||||||||||||||
| 1830 | if (numberFlags() & UppercaseBase
| 1-305 | ||||||||||||||||||||||||
| 1831 | flags |= QLocaleData::UppercaseBase; executed 1 time by 1 test: flags |= QLocaleData::UppercaseBase;Executed by:
| 1 | ||||||||||||||||||||||||
| 1832 | if (numberFlags() & UppercaseDigits
| 7-299 | ||||||||||||||||||||||||
| 1833 | flags |= QLocaleData::CapitalEorX; executed 7 times by 1 test: flags |= QLocaleData::CapitalEorX;Executed by:
| 7 | ||||||||||||||||||||||||
| 1834 | if (numberFlags() & ForcePoint
| 6-300 | ||||||||||||||||||||||||
| 1835 | flags |= QLocaleData::Alternate; executed 6 times by 1 test: flags |= QLocaleData::Alternate;Executed by:
| 6 | ||||||||||||||||||||||||
| 1836 | if (locale() != QLocale::c()
| 0-294 | ||||||||||||||||||||||||
| 1837 | flags |= QLocaleData::ThousandsGroup; executed 12 times by 1 test: flags |= QLocaleData::ThousandsGroup;Executed by:
| 12 | ||||||||||||||||||||||||
| 1838 | if (!(locale().numberOptions() & QLocale::OmitLeadingZeroInExponent)
| 0-306 | ||||||||||||||||||||||||
| 1839 | flags |= QLocaleData::ZeroPadExponent; executed 306 times by 9 tests: flags |= QLocaleData::ZeroPadExponent;Executed by:
| 306 | ||||||||||||||||||||||||
| 1840 | - | |||||||||||||||||||||||||
| 1841 | const QLocaleData *dd = d->locale.d->m_data; | - | ||||||||||||||||||||||||
| 1842 | QString num = dd->doubleToString(f, d->params.realNumberPrecision, form, -1, flags); | - | ||||||||||||||||||||||||
| 1843 | d->putString(num, true); | - | ||||||||||||||||||||||||
| 1844 | return executed 306 times by 9 tests: *this;return *this;Executed by:
executed 306 times by 9 tests: return *this;Executed by:
| 306 | ||||||||||||||||||||||||
| 1845 | } | - | ||||||||||||||||||||||||
| 1846 | QTextStream &QTextStream::operator<<(const QString &string) | - | ||||||||||||||||||||||||
| 1847 | { | - | ||||||||||||||||||||||||
| 1848 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1849 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-95658 | ||||||||||||||||||||||||
| 1850 | d->putString(string); | - | ||||||||||||||||||||||||
| 1851 | return executed 122669 times by 78 tests: *this;return *this;Executed by:
executed 122669 times by 78 tests: return *this;Executed by:
| 122669 | ||||||||||||||||||||||||
| 1852 | } | - | ||||||||||||||||||||||||
| 1853 | - | |||||||||||||||||||||||||
| 1854 | - | |||||||||||||||||||||||||
| 1855 | - | |||||||||||||||||||||||||
| 1856 | - | |||||||||||||||||||||||||
| 1857 | - | |||||||||||||||||||||||||
| 1858 | - | |||||||||||||||||||||||||
| 1859 | - | |||||||||||||||||||||||||
| 1860 | QTextStream &QTextStream::operator<<(QLatin1String string) | - | ||||||||||||||||||||||||
| 1861 | { | - | ||||||||||||||||||||||||
| 1862 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1863 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-3 | ||||||||||||||||||||||||
| 1864 | d->putString(string); | - | ||||||||||||||||||||||||
| 1865 | return executed 3 times by 1 test: *this;return *this;Executed by:
executed 3 times by 1 test: return *this;Executed by:
| 3 | ||||||||||||||||||||||||
| 1866 | } | - | ||||||||||||||||||||||||
| 1867 | QTextStream &QTextStream::operator<<(const QStringRef &string) | - | ||||||||||||||||||||||||
| 1868 | { | - | ||||||||||||||||||||||||
| 1869 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1870 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-2 | ||||||||||||||||||||||||
| 1871 | d->putString(string.data(), string.size()); | - | ||||||||||||||||||||||||
| 1872 | return executed 2 times by 1 test: *this;return *this;Executed by:
executed 2 times by 1 test: return *this;Executed by:
| 2 | ||||||||||||||||||||||||
| 1873 | } | - | ||||||||||||||||||||||||
| 1874 | - | |||||||||||||||||||||||||
| 1875 | - | |||||||||||||||||||||||||
| 1876 | - | |||||||||||||||||||||||||
| 1877 | - | |||||||||||||||||||||||||
| 1878 | - | |||||||||||||||||||||||||
| 1879 | - | |||||||||||||||||||||||||
| 1880 | - | |||||||||||||||||||||||||
| 1881 | QTextStream &QTextStream::operator<<(const QByteArray &array) | - | ||||||||||||||||||||||||
| 1882 | { | - | ||||||||||||||||||||||||
| 1883 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1884 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-247 | ||||||||||||||||||||||||
| 1885 | d->putString(QString::fromUtf8(array.constData(), array.length())); | - | ||||||||||||||||||||||||
| 1886 | return executed 441 times by 3 tests: *this;return *this;Executed by:
executed 441 times by 3 tests: return *this;Executed by:
| 441 | ||||||||||||||||||||||||
| 1887 | } | - | ||||||||||||||||||||||||
| 1888 | QTextStream &QTextStream::operator<<(const char *string) | - | ||||||||||||||||||||||||
| 1889 | { | - | ||||||||||||||||||||||||
| 1890 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1891 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-41996 | ||||||||||||||||||||||||
| 1892 | d->putString(QLatin1String(string)); | - | ||||||||||||||||||||||||
| 1893 | return executed 60789 times by 30 tests: *this;return *this;Executed by:
executed 60789 times by 30 tests: return *this;Executed by:
| 60789 | ||||||||||||||||||||||||
| 1894 | } | - | ||||||||||||||||||||||||
| 1895 | - | |||||||||||||||||||||||||
| 1896 | - | |||||||||||||||||||||||||
| 1897 | - | |||||||||||||||||||||||||
| 1898 | - | |||||||||||||||||||||||||
| 1899 | - | |||||||||||||||||||||||||
| 1900 | - | |||||||||||||||||||||||||
| 1901 | - | |||||||||||||||||||||||||
| 1902 | QTextStream &QTextStream::operator<<(const void *ptr) | - | ||||||||||||||||||||||||
| 1903 | { | - | ||||||||||||||||||||||||
| 1904 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1905 | do { if (!d->string
never executed: *this;return *this;never executed: } } while (0);return *this; | 0-50 | ||||||||||||||||||||||||
| 1906 | const int oldBase = d->params.integerBase; | - | ||||||||||||||||||||||||
| 1907 | const NumberFlags oldFlags = d->params.numberFlags; | - | ||||||||||||||||||||||||
| 1908 | d->params.integerBase = 16; | - | ||||||||||||||||||||||||
| 1909 | d->params.numberFlags |= ShowBase; | - | ||||||||||||||||||||||||
| 1910 | d->putNumber(reinterpret_cast<quintptr>(ptr), false); | - | ||||||||||||||||||||||||
| 1911 | d->params.integerBase = oldBase; | - | ||||||||||||||||||||||||
| 1912 | d->params.numberFlags = oldFlags; | - | ||||||||||||||||||||||||
| 1913 | return executed 50 times by 7 tests: *this;return *this;Executed by:
executed 50 times by 7 tests: return *this;Executed by:
| 50 | ||||||||||||||||||||||||
| 1914 | } | - | ||||||||||||||||||||||||
| 1915 | QTextStream &bin(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1916 | { | - | ||||||||||||||||||||||||
| 1917 | stream.setIntegerBase(2); | - | ||||||||||||||||||||||||
| 1918 | return executed 15 times by 1 test: stream;return stream;Executed by:
executed 15 times by 1 test: return stream;Executed by:
| 15 | ||||||||||||||||||||||||
| 1919 | } | - | ||||||||||||||||||||||||
| 1920 | QTextStream &oct(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1921 | { | - | ||||||||||||||||||||||||
| 1922 | stream.setIntegerBase(8); | - | ||||||||||||||||||||||||
| 1923 | return executed 3 times by 1 test: stream;return stream;Executed by:
executed 3 times by 1 test: return stream;Executed by:
| 3 | ||||||||||||||||||||||||
| 1924 | } | - | ||||||||||||||||||||||||
| 1925 | QTextStream &dec(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1926 | { | - | ||||||||||||||||||||||||
| 1927 | stream.setIntegerBase(10); | - | ||||||||||||||||||||||||
| 1928 | return executed 82 times by 2 tests: stream;return stream;Executed by:
executed 82 times by 2 tests: return stream;Executed by:
| 82 | ||||||||||||||||||||||||
| 1929 | } | - | ||||||||||||||||||||||||
| 1930 | QTextStream &hex(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1931 | { | - | ||||||||||||||||||||||||
| 1932 | stream.setIntegerBase(16); | - | ||||||||||||||||||||||||
| 1933 | return executed 136 times by 6 tests: stream;return stream;Executed by:
executed 136 times by 6 tests: return stream;Executed by:
| 136 | ||||||||||||||||||||||||
| 1934 | } | - | ||||||||||||||||||||||||
| 1935 | QTextStream &showbase(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1936 | { | - | ||||||||||||||||||||||||
| 1937 | stream.setNumberFlags(stream.numberFlags() | QTextStream::ShowBase); | - | ||||||||||||||||||||||||
| 1938 | return executed 59 times by 4 tests: stream;return stream;Executed by:
executed 59 times by 4 tests: return stream;Executed by:
| 59 | ||||||||||||||||||||||||
| 1939 | } | - | ||||||||||||||||||||||||
| 1940 | QTextStream &forcesign(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1941 | { | - | ||||||||||||||||||||||||
| 1942 | stream.setNumberFlags(stream.numberFlags() | QTextStream::ForceSign); | - | ||||||||||||||||||||||||
| 1943 | return executed 1 time by 1 test: stream;return stream;Executed by:
executed 1 time by 1 test: return stream;Executed by:
| 1 | ||||||||||||||||||||||||
| 1944 | } | - | ||||||||||||||||||||||||
| 1945 | QTextStream &forcepoint(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1946 | { | - | ||||||||||||||||||||||||
| 1947 | stream.setNumberFlags(stream.numberFlags() | QTextStream::ForcePoint); | - | ||||||||||||||||||||||||
| 1948 | return executed 3 times by 1 test: stream;return stream;Executed by:
executed 3 times by 1 test: return stream;Executed by:
| 3 | ||||||||||||||||||||||||
| 1949 | } | - | ||||||||||||||||||||||||
| 1950 | QTextStream &noshowbase(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1951 | { | - | ||||||||||||||||||||||||
| 1952 | stream.setNumberFlags(stream.numberFlags() &= ~QTextStream::ShowBase); | - | ||||||||||||||||||||||||
| 1953 | return executed 1 time by 1 test: stream;return stream;Executed by:
executed 1 time by 1 test: return stream;Executed by:
| 1 | ||||||||||||||||||||||||
| 1954 | } | - | ||||||||||||||||||||||||
| 1955 | QTextStream &noforcesign(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1956 | { | - | ||||||||||||||||||||||||
| 1957 | stream.setNumberFlags(stream.numberFlags() &= ~QTextStream::ForceSign); | - | ||||||||||||||||||||||||
| 1958 | return never executed: stream;return stream;never executed: return stream; | 0 | ||||||||||||||||||||||||
| 1959 | } | - | ||||||||||||||||||||||||
| 1960 | QTextStream &noforcepoint(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1961 | { | - | ||||||||||||||||||||||||
| 1962 | stream.setNumberFlags(stream.numberFlags() &= ~QTextStream::ForcePoint); | - | ||||||||||||||||||||||||
| 1963 | return never executed: stream;return stream;never executed: return stream; | 0 | ||||||||||||||||||||||||
| 1964 | } | - | ||||||||||||||||||||||||
| 1965 | QTextStream &uppercasebase(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1966 | { | - | ||||||||||||||||||||||||
| 1967 | stream.setNumberFlags(stream.numberFlags() | QTextStream::UppercaseBase); | - | ||||||||||||||||||||||||
| 1968 | return executed 7 times by 1 test: stream;return stream;Executed by:
executed 7 times by 1 test: return stream;Executed by:
| 7 | ||||||||||||||||||||||||
| 1969 | } | - | ||||||||||||||||||||||||
| 1970 | QTextStream &uppercasedigits(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1971 | { | - | ||||||||||||||||||||||||
| 1972 | stream.setNumberFlags(stream.numberFlags() | QTextStream::UppercaseDigits); | - | ||||||||||||||||||||||||
| 1973 | return executed 10 times by 1 test: stream;return stream;Executed by:
executed 10 times by 1 test: return stream;Executed by:
| 10 | ||||||||||||||||||||||||
| 1974 | } | - | ||||||||||||||||||||||||
| 1975 | QTextStream &lowercasebase(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1976 | { | - | ||||||||||||||||||||||||
| 1977 | stream.setNumberFlags(stream.numberFlags() & ~QTextStream::UppercaseBase); | - | ||||||||||||||||||||||||
| 1978 | return executed 5 times by 1 test: stream;return stream;Executed by:
executed 5 times by 1 test: return stream;Executed by:
| 5 | ||||||||||||||||||||||||
| 1979 | } | - | ||||||||||||||||||||||||
| 1980 | QTextStream &lowercasedigits(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1981 | { | - | ||||||||||||||||||||||||
| 1982 | stream.setNumberFlags(stream.numberFlags() & ~QTextStream::UppercaseDigits); | - | ||||||||||||||||||||||||
| 1983 | return executed 3 times by 1 test: stream;return stream;Executed by:
executed 3 times by 1 test: return stream;Executed by:
| 3 | ||||||||||||||||||||||||
| 1984 | } | - | ||||||||||||||||||||||||
| 1985 | QTextStream &fixed(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1986 | { | - | ||||||||||||||||||||||||
| 1987 | stream.setRealNumberNotation(QTextStream::FixedNotation); | - | ||||||||||||||||||||||||
| 1988 | return executed 1 time by 1 test: stream;return stream;Executed by:
executed 1 time by 1 test: return stream;Executed by:
| 1 | ||||||||||||||||||||||||
| 1989 | } | - | ||||||||||||||||||||||||
| 1990 | QTextStream &scientific(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1991 | { | - | ||||||||||||||||||||||||
| 1992 | stream.setRealNumberNotation(QTextStream::ScientificNotation); | - | ||||||||||||||||||||||||
| 1993 | return executed 1 time by 1 test: stream;return stream;Executed by:
executed 1 time by 1 test: return stream;Executed by:
| 1 | ||||||||||||||||||||||||
| 1994 | } | - | ||||||||||||||||||||||||
| 1995 | QTextStream &left(QTextStream &stream) | - | ||||||||||||||||||||||||
| 1996 | { | - | ||||||||||||||||||||||||
| 1997 | stream.setFieldAlignment(QTextStream::AlignLeft); | - | ||||||||||||||||||||||||
| 1998 | return never executed: stream;return stream;never executed: return stream; | 0 | ||||||||||||||||||||||||
| 1999 | } | - | ||||||||||||||||||||||||
| 2000 | QTextStream &right(QTextStream &stream) | - | ||||||||||||||||||||||||
| 2001 | { | - | ||||||||||||||||||||||||
| 2002 | stream.setFieldAlignment(QTextStream::AlignRight); | - | ||||||||||||||||||||||||
| 2003 | return executed 1 time by 1 test: stream;return stream;Executed by:
executed 1 time by 1 test: return stream;Executed by:
| 1 | ||||||||||||||||||||||||
| 2004 | } | - | ||||||||||||||||||||||||
| 2005 | QTextStream ¢er(QTextStream &stream) | - | ||||||||||||||||||||||||
| 2006 | { | - | ||||||||||||||||||||||||
| 2007 | stream.setFieldAlignment(QTextStream::AlignCenter); | - | ||||||||||||||||||||||||
| 2008 | return never executed: stream;return stream;never executed: return stream; | 0 | ||||||||||||||||||||||||
| 2009 | } | - | ||||||||||||||||||||||||
| 2010 | QTextStream &endl(QTextStream &stream) | - | ||||||||||||||||||||||||
| 2011 | { | - | ||||||||||||||||||||||||
| 2012 | return executed 50771 times by 14 tests: stream << QLatin1Char('\n') << flush;return stream << QLatin1Char('\n') << flush;Executed by:
executed 50771 times by 14 tests: return stream << QLatin1Char('\n') << flush;Executed by:
| 50771 | ||||||||||||||||||||||||
| 2013 | } | - | ||||||||||||||||||||||||
| 2014 | QTextStream &flush(QTextStream &stream) | - | ||||||||||||||||||||||||
| 2015 | { | - | ||||||||||||||||||||||||
| 2016 | stream.flush(); | - | ||||||||||||||||||||||||
| 2017 | return executed 50774 times by 15 tests: stream;return stream;Executed by:
executed 50774 times by 15 tests: return stream;Executed by:
| 50774 | ||||||||||||||||||||||||
| 2018 | } | - | ||||||||||||||||||||||||
| 2019 | QTextStream &reset(QTextStream &stream) | - | ||||||||||||||||||||||||
| 2020 | { | - | ||||||||||||||||||||||||
| 2021 | stream.reset(); | - | ||||||||||||||||||||||||
| 2022 | return executed 3 times by 2 tests: stream;return stream;Executed by:
executed 3 times by 2 tests: return stream;Executed by:
| 3 | ||||||||||||||||||||||||
| 2023 | } | - | ||||||||||||||||||||||||
| 2024 | QTextStream &ws(QTextStream &stream) | - | ||||||||||||||||||||||||
| 2025 | { | - | ||||||||||||||||||||||||
| 2026 | stream.skipWhiteSpace(); | - | ||||||||||||||||||||||||
| 2027 | return executed 3 times by 1 test: stream;return stream;Executed by:
executed 3 times by 1 test: return stream;Executed by:
| 3 | ||||||||||||||||||||||||
| 2028 | } | - | ||||||||||||||||||||||||
| 2029 | QTextStream &bom(QTextStream &stream) | - | ||||||||||||||||||||||||
| 2030 | { | - | ||||||||||||||||||||||||
| 2031 | stream.setGenerateByteOrderMark(true); | - | ||||||||||||||||||||||||
| 2032 | return executed 1 time by 1 test: stream;return stream;Executed by:
executed 1 time by 1 test: return stream;Executed by:
| 1 | ||||||||||||||||||||||||
| 2033 | } | - | ||||||||||||||||||||||||
| 2034 | void QTextStream::setCodec(QTextCodec *codec) | - | ||||||||||||||||||||||||
| 2035 | { | - | ||||||||||||||||||||||||
| 2036 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2037 | qint64 seekPos = -1; | - | ||||||||||||||||||||||||
| 2038 | if (!d->readBuffer.isEmpty()
| 1-2129 | ||||||||||||||||||||||||
| 2039 | if (!d->device->isSequential()
| 0-1 | ||||||||||||||||||||||||
| 2040 | seekPos = pos(); | - | ||||||||||||||||||||||||
| 2041 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 2042 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 2043 | d->codec = codec; | - | ||||||||||||||||||||||||
| 2044 | if (seekPos >=0
| 0-2129 | ||||||||||||||||||||||||
| 2045 | seek(seekPos); executed 1 time by 1 test: seek(seekPos);Executed by:
| 1 | ||||||||||||||||||||||||
| 2046 | } executed 2130 times by 6 tests: end of blockExecuted by:
| 2130 | ||||||||||||||||||||||||
| 2047 | void QTextStream::setCodec(const char *codecName) | - | ||||||||||||||||||||||||
| 2048 | { | - | ||||||||||||||||||||||||
| 2049 | QTextCodec *codec = QTextCodec::codecForName(codecName); | - | ||||||||||||||||||||||||
| 2050 | if (codec
| 0-1941 | ||||||||||||||||||||||||
| 2051 | setCodec(codec); executed 1941 times by 4 tests: setCodec(codec);Executed by:
| 1941 | ||||||||||||||||||||||||
| 2052 | } executed 1941 times by 4 tests: end of blockExecuted by:
| 1941 | ||||||||||||||||||||||||
| 2053 | - | |||||||||||||||||||||||||
| 2054 | - | |||||||||||||||||||||||||
| 2055 | - | |||||||||||||||||||||||||
| 2056 | - | |||||||||||||||||||||||||
| 2057 | - | |||||||||||||||||||||||||
| 2058 | - | |||||||||||||||||||||||||
| 2059 | QTextCodec *QTextStream::codec() const | - | ||||||||||||||||||||||||
| 2060 | { | - | ||||||||||||||||||||||||
| 2061 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2062 | return executed 401 times by 3 tests: d->codec;return d->codec;Executed by:
executed 401 times by 3 tests: return d->codec;Executed by:
| 401 | ||||||||||||||||||||||||
| 2063 | } | - | ||||||||||||||||||||||||
| 2064 | void QTextStream::setAutoDetectUnicode(bool enabled) | - | ||||||||||||||||||||||||
| 2065 | { | - | ||||||||||||||||||||||||
| 2066 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2067 | d->autoDetectUnicode = enabled; | - | ||||||||||||||||||||||||
| 2068 | } executed 55 times by 1 test: end of blockExecuted by:
| 55 | ||||||||||||||||||||||||
| 2069 | - | |||||||||||||||||||||||||
| 2070 | - | |||||||||||||||||||||||||
| 2071 | - | |||||||||||||||||||||||||
| 2072 | - | |||||||||||||||||||||||||
| 2073 | - | |||||||||||||||||||||||||
| 2074 | - | |||||||||||||||||||||||||
| 2075 | - | |||||||||||||||||||||||||
| 2076 | bool QTextStream::autoDetectUnicode() const | - | ||||||||||||||||||||||||
| 2077 | { | - | ||||||||||||||||||||||||
| 2078 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2079 | return executed 2 times by 1 test: d->autoDetectUnicode;return d->autoDetectUnicode;Executed by:
executed 2 times by 1 test: return d->autoDetectUnicode;Executed by:
| 2 | ||||||||||||||||||||||||
| 2080 | } | - | ||||||||||||||||||||||||
| 2081 | void QTextStream::setGenerateByteOrderMark(bool generate) | - | ||||||||||||||||||||||||
| 2082 | { | - | ||||||||||||||||||||||||
| 2083 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2084 | if (d->writeBuffer.isEmpty()
| 0-3 | ||||||||||||||||||||||||
| 2085 | d->writeConverterState.flags.setFlag(QTextCodec::IgnoreHeader, !generate); | - | ||||||||||||||||||||||||
| 2086 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 2087 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 2088 | bool QTextStream::generateByteOrderMark() const | - | ||||||||||||||||||||||||
| 2089 | { | - | ||||||||||||||||||||||||
| 2090 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2091 | return executed 2 times by 1 test: (d->writeConverterState.flags & QTextCodec::IgnoreHeader) == 0;return (d->writeConverterState.flags & QTextCodec::IgnoreHeader) == 0;Executed by:
executed 2 times by 1 test: return (d->writeConverterState.flags & QTextCodec::IgnoreHeader) == 0;Executed by:
| 2 | ||||||||||||||||||||||||
| 2092 | } | - | ||||||||||||||||||||||||
| 2093 | void QTextStream::setLocale(const QLocale &locale) | - | ||||||||||||||||||||||||
| 2094 | { | - | ||||||||||||||||||||||||
| 2095 | QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2096 | d->locale = locale; | - | ||||||||||||||||||||||||
| 2097 | } executed 384 times by 1 test: end of blockExecuted by:
| 384 | ||||||||||||||||||||||||
| 2098 | QLocale QTextStream::locale() const | - | ||||||||||||||||||||||||
| 2099 | { | - | ||||||||||||||||||||||||
| 2100 | const QTextStreamPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2101 | return executed 624 times by 9 tests: d->locale;return d->locale;Executed by:
executed 624 times by 9 tests: return d->locale;Executed by:
| 624 | ||||||||||||||||||||||||
| 2102 | } | - | ||||||||||||||||||||||||
| 2103 | - | |||||||||||||||||||||||||
| 2104 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |