| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qtextboundaryfinder.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | class QTextBoundaryFinderPrivate | - | ||||||||||||||||||
| 6 | { | - | ||||||||||||||||||
| 7 | public: | - | ||||||||||||||||||
| 8 | QCharAttributes attributes[1]; | - | ||||||||||||||||||
| 9 | }; | - | ||||||||||||||||||
| 10 | - | |||||||||||||||||||
| 11 | static void init(QTextBoundaryFinder::BoundaryType type, const QChar *chars, int length, QCharAttributes *attributes) | - | ||||||||||||||||||
| 12 | { | - | ||||||||||||||||||
| 13 | const ushort *string = reinterpret_cast<const ushort *>(chars); | - | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | QVarLengthArray<QUnicodeTools::ScriptItem> scriptItems; | - | ||||||||||||||||||
| 16 | { | - | ||||||||||||||||||
| 17 | QVarLengthArray<uchar> scripts(length); | - | ||||||||||||||||||
| 18 | - | |||||||||||||||||||
| 19 | QUnicodeTools::initScripts(string, length, scripts.data()); | - | ||||||||||||||||||
| 20 | - | |||||||||||||||||||
| 21 | int start = 0; | - | ||||||||||||||||||
| 22 | for (int i = start + 1; i <= length
| 8846-160347 | ||||||||||||||||||
| 23 | if (i == length
| 373-151501 | ||||||||||||||||||
| 24 | QUnicodeTools::ScriptItem item; | - | ||||||||||||||||||
| 25 | item.position = start; | - | ||||||||||||||||||
| 26 | item.script = scripts[start]; | - | ||||||||||||||||||
| 27 | scriptItems.append(item); | - | ||||||||||||||||||
| 28 | start = i; | - | ||||||||||||||||||
| 29 | } executed 9219 times by 3 tests: end of blockExecuted by:
| 9219 | ||||||||||||||||||
| 30 | } executed 160347 times by 3 tests: end of blockExecuted by:
| 160347 | ||||||||||||||||||
| 31 | } | - | ||||||||||||||||||
| 32 | - | |||||||||||||||||||
| 33 | QUnicodeTools::CharAttributeOptions options = 0; | - | ||||||||||||||||||
| 34 | switch (type) { | - | ||||||||||||||||||
| 35 | case executed 434 times by 2 tests: QTextBoundaryFinder::Grapheme:case QTextBoundaryFinder::Grapheme:Executed by:
executed 434 times by 2 tests: options |= QUnicodeTools::GraphemeBreaks; break;case QTextBoundaryFinder::Grapheme:Executed by:
executed 434 times by 2 tests: break;Executed by:
| 434 | ||||||||||||||||||
| 36 | case executed 1553 times by 3 tests: QTextBoundaryFinder::Word:case QTextBoundaryFinder::Word:Executed by:
executed 1553 times by 3 tests: options |= QUnicodeTools::WordBreaks; break;case QTextBoundaryFinder::Word:Executed by:
executed 1553 times by 3 tests: break;Executed by:
| 1553 | ||||||||||||||||||
| 37 | case executed 521 times by 2 tests: QTextBoundaryFinder::Sentence:case QTextBoundaryFinder::Sentence:Executed by:
executed 521 times by 2 tests: options |= QUnicodeTools::SentenceBreaks; break;case QTextBoundaryFinder::Sentence:Executed by:
executed 521 times by 2 tests: break;Executed by:
| 521 | ||||||||||||||||||
| 38 | case executed 6338 times by 1 test: QTextBoundaryFinder::Line:case QTextBoundaryFinder::Line:Executed by:
executed 6338 times by 1 test: options |= QUnicodeTools::LineBreaks; break;case QTextBoundaryFinder::Line:Executed by:
executed 6338 times by 1 test: break;Executed by:
| 6338 | ||||||||||||||||||
| 39 | default never executed: :default:never executed: break;default:never executed: break; | 0 | ||||||||||||||||||
| 40 | } | - | ||||||||||||||||||
| 41 | QUnicodeTools::initCharAttributes(string, length, scriptItems.data(), scriptItems.count(), attributes, options); | - | ||||||||||||||||||
| 42 | } executed 8846 times by 3 tests: end of blockExecuted by:
| 8846 | ||||||||||||||||||
| 43 | QTextBoundaryFinder::QTextBoundaryFinder() | - | ||||||||||||||||||
| 44 | : t(Grapheme) | - | ||||||||||||||||||
| 45 | , chars(0) | - | ||||||||||||||||||
| 46 | , length(0) | - | ||||||||||||||||||
| 47 | , freePrivate(true) | - | ||||||||||||||||||
| 48 | , d(0) | - | ||||||||||||||||||
| 49 | { | - | ||||||||||||||||||
| 50 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 51 | - | |||||||||||||||||||
| 52 | - | |||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | - | |||||||||||||||||||
| 55 | QTextBoundaryFinder::QTextBoundaryFinder(const QTextBoundaryFinder &other) | - | ||||||||||||||||||
| 56 | : t(other.t) | - | ||||||||||||||||||
| 57 | , s(other.s) | - | ||||||||||||||||||
| 58 | , chars(other.chars) | - | ||||||||||||||||||
| 59 | , length(other.length) | - | ||||||||||||||||||
| 60 | , pos(other.pos) | - | ||||||||||||||||||
| 61 | , freePrivate(true) | - | ||||||||||||||||||
| 62 | , d(0) | - | ||||||||||||||||||
| 63 | { | - | ||||||||||||||||||
| 64 | if (other.d
| 0-15 | ||||||||||||||||||
| 65 | ((!(length > 0)) ? qt_assert("length > 0",__FILE__,184) : qt_noop()); | - | ||||||||||||||||||
| 66 | d = (QTextBoundaryFinderPrivate *) malloc((length + 1) * sizeof(QCharAttributes)); | - | ||||||||||||||||||
| 67 | do { if (!(d)
never executed: } while (0);qBadAlloc(); | 0 | ||||||||||||||||||
| 68 | memcpy(d, other.d, (length + 1) * sizeof(QCharAttributes)); | - | ||||||||||||||||||
| 69 | } never executed: end of block | 0 | ||||||||||||||||||
| 70 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||
| 71 | - | |||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | - | |||||||||||||||||||
| 74 | - | |||||||||||||||||||
| 75 | QTextBoundaryFinder &QTextBoundaryFinder::operator=(const QTextBoundaryFinder &other) | - | ||||||||||||||||||
| 76 | { | - | ||||||||||||||||||
| 77 | if (&other == this
| 0-4 | ||||||||||||||||||
| 78 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||||||||
| 79 | - | |||||||||||||||||||
| 80 | if (other.d
| 2 | ||||||||||||||||||
| 81 | ((!(other.length > 0)) ? qt_assert("other.length > 0",__FILE__,200) : qt_noop()); | - | ||||||||||||||||||
| 82 | uint newCapacity = (other.length + 1) * sizeof(QCharAttributes); | - | ||||||||||||||||||
| 83 | QTextBoundaryFinderPrivate *newD = (QTextBoundaryFinderPrivate *) realloc(freePrivate ? d : 0, newCapacity); | - | ||||||||||||||||||
| 84 | do { if (!(newD)
never executed: } while (0);qBadAlloc(); | 0-2 | ||||||||||||||||||
| 85 | freePrivate = true; | - | ||||||||||||||||||
| 86 | d = newD; | - | ||||||||||||||||||
| 87 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | t = other.t; | - | ||||||||||||||||||
| 90 | s = other.s; | - | ||||||||||||||||||
| 91 | chars = other.chars; | - | ||||||||||||||||||
| 92 | length = other.length; | - | ||||||||||||||||||
| 93 | pos = other.pos; | - | ||||||||||||||||||
| 94 | - | |||||||||||||||||||
| 95 | if (other.d
| 2 | ||||||||||||||||||
| 96 | memcpy(d, other.d, (length + 1) * sizeof(QCharAttributes)); | - | ||||||||||||||||||
| 97 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||
| 98 | if (freePrivate
| 0-2 | ||||||||||||||||||
| 99 | free(d); executed 2 times by 1 test: free(d);Executed by:
| 2 | ||||||||||||||||||
| 100 | d = 0; | - | ||||||||||||||||||
| 101 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 102 | - | |||||||||||||||||||
| 103 | return executed 4 times by 1 test: *this;return *this;Executed by:
executed 4 times by 1 test: return *this;Executed by:
| 4 | ||||||||||||||||||
| 104 | } | - | ||||||||||||||||||
| 105 | - | |||||||||||||||||||
| 106 | - | |||||||||||||||||||
| 107 | - | |||||||||||||||||||
| 108 | - | |||||||||||||||||||
| 109 | QTextBoundaryFinder::~QTextBoundaryFinder() | - | ||||||||||||||||||
| 110 | { | - | ||||||||||||||||||
| 111 | (void)unused;; | - | ||||||||||||||||||
| 112 | if (freePrivate
| 0-8867 | ||||||||||||||||||
| 113 | free(d); executed 8867 times by 3 tests: free(d);Executed by:
| 8867 | ||||||||||||||||||
| 114 | } executed 8867 times by 3 tests: end of blockExecuted by:
| 8867 | ||||||||||||||||||
| 115 | - | |||||||||||||||||||
| 116 | - | |||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, const QString &string) | - | ||||||||||||||||||
| 120 | : t(type) | - | ||||||||||||||||||
| 121 | , s(string) | - | ||||||||||||||||||
| 122 | , chars(string.unicode()) | - | ||||||||||||||||||
| 123 | , length(string.length()) | - | ||||||||||||||||||
| 124 | , pos(0) | - | ||||||||||||||||||
| 125 | , freePrivate(true) | - | ||||||||||||||||||
| 126 | , d(0) | - | ||||||||||||||||||
| 127 | { | - | ||||||||||||||||||
| 128 | if (length > 0
| 1-8843 | ||||||||||||||||||
| 129 | d = (QTextBoundaryFinderPrivate *) malloc((length + 1) * sizeof(QCharAttributes)); | - | ||||||||||||||||||
| 130 | do { if (!(d)
never executed: } while (0);qBadAlloc(); | 0-8843 | ||||||||||||||||||
| 131 | init(t, chars, length, d->attributes); | - | ||||||||||||||||||
| 132 | } executed 8843 times by 2 tests: end of blockExecuted by:
| 8843 | ||||||||||||||||||
| 133 | } executed 8844 times by 2 tests: end of blockExecuted by:
| 8844 | ||||||||||||||||||
| 134 | QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, const QChar *chars, int length, unsigned char *buffer, int bufferSize) | - | ||||||||||||||||||
| 135 | : t(type) | - | ||||||||||||||||||
| 136 | , chars(chars) | - | ||||||||||||||||||
| 137 | , length(length) | - | ||||||||||||||||||
| 138 | , pos(0) | - | ||||||||||||||||||
| 139 | , freePrivate(true) | - | ||||||||||||||||||
| 140 | , d(0) | - | ||||||||||||||||||
| 141 | { | - | ||||||||||||||||||
| 142 | if (!chars
| 2-5 | ||||||||||||||||||
| 143 | length = 0; | - | ||||||||||||||||||
| 144 | } executed 2 times by 1 test: else if (length > 0end of blockExecuted by:
| 2-3 | ||||||||||||||||||
| 145 | if (buffer
| 0-3 | ||||||||||||||||||
| 146 | d = (QTextBoundaryFinderPrivate *)buffer; | - | ||||||||||||||||||
| 147 | freePrivate = false; | - | ||||||||||||||||||
| 148 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 149 | d = (QTextBoundaryFinderPrivate *) malloc((length + 1) * sizeof(QCharAttributes)); | - | ||||||||||||||||||
| 150 | do { if (!(d)
never executed: } while (0);qBadAlloc(); | 0-3 | ||||||||||||||||||
| 151 | } executed 3 times by 2 tests: end of blockExecuted by:
| 3 | ||||||||||||||||||
| 152 | init(t, chars, length, d->attributes); | - | ||||||||||||||||||
| 153 | } executed 3 times by 2 tests: end of blockExecuted by:
| 3 | ||||||||||||||||||
| 154 | } executed 7 times by 2 tests: end of blockExecuted by:
| 7 | ||||||||||||||||||
| 155 | - | |||||||||||||||||||
| 156 | - | |||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | - | |||||||||||||||||||
| 159 | - | |||||||||||||||||||
| 160 | - | |||||||||||||||||||
| 161 | void QTextBoundaryFinder::toStart() | - | ||||||||||||||||||
| 162 | { | - | ||||||||||||||||||
| 163 | pos = 0; | - | ||||||||||||||||||
| 164 | } never executed: end of block | 0 | ||||||||||||||||||
| 165 | - | |||||||||||||||||||
| 166 | - | |||||||||||||||||||
| 167 | - | |||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | - | |||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | void QTextBoundaryFinder::toEnd() | - | ||||||||||||||||||
| 172 | { | - | ||||||||||||||||||
| 173 | pos = length; | - | ||||||||||||||||||
| 174 | } executed 8797 times by 1 test: end of blockExecuted by:
| 8797 | ||||||||||||||||||
| 175 | int QTextBoundaryFinder::position() const | - | ||||||||||||||||||
| 176 | { | - | ||||||||||||||||||
| 177 | return executed 195130 times by 3 tests: pos;return pos;Executed by:
executed 195130 times by 3 tests: return pos;Executed by:
| 195130 | ||||||||||||||||||
| 178 | } | - | ||||||||||||||||||
| 179 | void QTextBoundaryFinder::setPosition(int position) | - | ||||||||||||||||||
| 180 | { | - | ||||||||||||||||||
| 181 | pos = qBound(0, position, length); | - | ||||||||||||||||||
| 182 | } executed 39074 times by 3 tests: end of blockExecuted by:
| 39074 | ||||||||||||||||||
| 183 | QString QTextBoundaryFinder::string() const | - | ||||||||||||||||||
| 184 | { | - | ||||||||||||||||||
| 185 | if (chars == s.unicode()
| 0-2 | ||||||||||||||||||
| 186 | return executed 2 times by 1 test: s;return s;Executed by:
executed 2 times by 1 test: return s;Executed by:
| 2 | ||||||||||||||||||
| 187 | return executed 2 times by 1 test: QString(chars, length);return QString(chars, length);Executed by:
executed 2 times by 1 test: return QString(chars, length);Executed by:
| 2 | ||||||||||||||||||
| 188 | } | - | ||||||||||||||||||
| 189 | - | |||||||||||||||||||
| 190 | - | |||||||||||||||||||
| 191 | - | |||||||||||||||||||
| 192 | - | |||||||||||||||||||
| 193 | - | |||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | - | |||||||||||||||||||
| 196 | int QTextBoundaryFinder::toNextBoundary() | - | ||||||||||||||||||
| 197 | { | - | ||||||||||||||||||
| 198 | if (!d
| 0-24931 | ||||||||||||||||||
| 199 | pos = -1; | - | ||||||||||||||||||
| 200 | return executed 8807 times by 2 tests: pos;return pos;Executed by:
executed 8807 times by 2 tests: return pos;Executed by:
| 8807 | ||||||||||||||||||
| 201 | } | - | ||||||||||||||||||
| 202 | - | |||||||||||||||||||
| 203 | ++pos; | - | ||||||||||||||||||
| 204 | switch(t) { | - | ||||||||||||||||||
| 205 | case executed 826 times by 2 tests: Grapheme:case Grapheme:Executed by:
executed 826 times by 2 tests: case Grapheme:Executed by:
| 826 | ||||||||||||||||||
| 206 | while (pos < length
| 295-713 | ||||||||||||||||||
| 207 | ++ executed 295 times by 1 test: pos;++pos;Executed by:
executed 295 times by 1 test: ++pos;Executed by:
| 295 | ||||||||||||||||||
| 208 | break; executed 826 times by 2 tests: break;Executed by:
| 826 | ||||||||||||||||||
| 209 | case executed 4027 times by 3 tests: Word:case Word:Executed by:
executed 4027 times by 3 tests: case Word:Executed by:
| 4027 | ||||||||||||||||||
| 210 | while (pos < length
| 1543-132701 | ||||||||||||||||||
| 211 | ++ executed 130217 times by 3 tests: pos;++pos;Executed by:
executed 130217 times by 3 tests: ++pos;Executed by:
| 130217 | ||||||||||||||||||
| 212 | break; executed 4027 times by 3 tests: break;Executed by:
| 4027 | ||||||||||||||||||
| 213 | case executed 663 times by 2 tests: Sentence:case Sentence:Executed by:
executed 663 times by 2 tests: case Sentence:Executed by:
| 663 | ||||||||||||||||||
| 214 | while (pos < length
| 145-1585 | ||||||||||||||||||
| 215 | ++ executed 1440 times by 2 tests: pos;++pos;Executed by:
executed 1440 times by 2 tests: ++pos;Executed by:
| 1440 | ||||||||||||||||||
| 216 | break; executed 663 times by 2 tests: break;Executed by:
| 663 | ||||||||||||||||||
| 217 | case executed 10615 times by 1 test: Line:case Line:Executed by:
executed 10615 times by 1 test: case Line:Executed by:
| 10615 | ||||||||||||||||||
| 218 | while (pos < length
| 4278-14608 | ||||||||||||||||||
| 219 | ++ executed 10330 times by 1 test: pos;++pos;Executed by:
executed 10330 times by 1 test: ++pos;Executed by:
| 10330 | ||||||||||||||||||
| 220 | break; executed 10615 times by 1 test: break;Executed by:
| 10615 | ||||||||||||||||||
| 221 | } | - | ||||||||||||||||||
| 222 | - | |||||||||||||||||||
| 223 | return executed 16131 times by 3 tests: pos;return pos;Executed by:
executed 16131 times by 3 tests: return pos;Executed by:
| 16131 | ||||||||||||||||||
| 224 | } | - | ||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 | - | |||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | - | |||||||||||||||||||
| 229 | - | |||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | int QTextBoundaryFinder::toPreviousBoundary() | - | ||||||||||||||||||
| 232 | { | - | ||||||||||||||||||
| 233 | if (!d
| 0-24899 | ||||||||||||||||||
| 234 | pos = -1; | - | ||||||||||||||||||
| 235 | return executed 8797 times by 1 test: pos;return pos;Executed by:
executed 8797 times by 1 test: return pos;Executed by:
| 8797 | ||||||||||||||||||
| 236 | } | - | ||||||||||||||||||
| 237 | - | |||||||||||||||||||
| 238 | --pos; | - | ||||||||||||||||||
| 239 | switch(t) { | - | ||||||||||||||||||
| 240 | case executed 809 times by 2 tests: Grapheme:case Grapheme:Executed by:
executed 809 times by 2 tests: case Grapheme:Executed by:
| 809 | ||||||||||||||||||
| 241 | while (pos > 0
| 295-700 | ||||||||||||||||||
| 242 | -- executed 295 times by 1 test: pos;--pos;Executed by:
executed 295 times by 1 test: --pos;Executed by:
| 295 | ||||||||||||||||||
| 243 | break; executed 809 times by 2 tests: break;Executed by:
| 809 | ||||||||||||||||||
| 244 | case executed 4015 times by 2 tests: Word:case Word:Executed by:
executed 4015 times by 2 tests: case Word:Executed by:
| 4015 | ||||||||||||||||||
| 245 | while (pos > 0
| 1540-4659 | ||||||||||||||||||
| 246 | -- executed 2184 times by 2 tests: pos;--pos;Executed by:
executed 2184 times by 2 tests: --pos;Executed by:
| 2184 | ||||||||||||||||||
| 247 | break; executed 4015 times by 2 tests: break;Executed by:
| 4015 | ||||||||||||||||||
| 248 | case executed 663 times by 2 tests: Sentence:case Sentence:Executed by:
executed 663 times by 2 tests: case Sentence:Executed by:
| 663 | ||||||||||||||||||
| 249 | while (pos > 0
| 143-1537 | ||||||||||||||||||
| 250 | -- executed 1394 times by 2 tests: pos;--pos;Executed by:
executed 1394 times by 2 tests: --pos;Executed by:
| 1394 | ||||||||||||||||||
| 251 | break; executed 663 times by 2 tests: break;Executed by:
| 663 | ||||||||||||||||||
| 252 | case executed 10615 times by 1 test: Line:case Line:Executed by:
executed 10615 times by 1 test: case Line:Executed by:
| 10615 | ||||||||||||||||||
| 253 | while (pos > 0
| 4278-14608 | ||||||||||||||||||
| 254 | -- executed 10330 times by 1 test: pos;--pos;Executed by:
executed 10330 times by 1 test: --pos;Executed by:
| 10330 | ||||||||||||||||||
| 255 | break; executed 10615 times by 1 test: break;Executed by:
| 10615 | ||||||||||||||||||
| 256 | } | - | ||||||||||||||||||
| 257 | - | |||||||||||||||||||
| 258 | return executed 16102 times by 2 tests: pos;return pos;Executed by:
executed 16102 times by 2 tests: return pos;Executed by:
| 16102 | ||||||||||||||||||
| 259 | } | - | ||||||||||||||||||
| 260 | - | |||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | bool QTextBoundaryFinder::isAtBoundary() const | - | ||||||||||||||||||
| 265 | { | - | ||||||||||||||||||
| 266 | if (!d
| 0-67350 | ||||||||||||||||||
| 267 | return executed 17594 times by 1 test: false;return false;Executed by:
executed 17594 times by 1 test: return false;Executed by:
| 17594 | ||||||||||||||||||
| 268 | - | |||||||||||||||||||
| 269 | switch(t) { | - | ||||||||||||||||||
| 270 | case executed 2400 times by 1 test: Grapheme:case Grapheme:Executed by:
executed 2400 times by 1 test: case Grapheme:Executed by:
| 2400 | ||||||||||||||||||
| 271 | return executed 2400 times by 1 test: d->attributes[pos].graphemeBoundary;return d->attributes[pos].graphemeBoundary;Executed by:
executed 2400 times by 1 test: return d->attributes[pos].graphemeBoundary;Executed by:
| 2400 | ||||||||||||||||||
| 272 | case executed 11096 times by 1 test: Word:case Word:Executed by:
executed 11096 times by 1 test: case Word:Executed by:
| 11096 | ||||||||||||||||||
| 273 | return executed 11096 times by 1 test: d->attributes[pos].wordBreak;return d->attributes[pos].wordBreak;Executed by:
executed 11096 times by 1 test: return d->attributes[pos].wordBreak;Executed by:
| 11096 | ||||||||||||||||||
| 274 | case executed 2356 times by 1 test: Sentence:case Sentence:Executed by:
executed 2356 times by 1 test: case Sentence:Executed by:
| 2356 | ||||||||||||||||||
| 275 | return executed 2356 times by 1 test: d->attributes[pos].sentenceBoundary;return d->attributes[pos].sentenceBoundary;Executed by:
executed 2356 times by 1 test: return d->attributes[pos].sentenceBoundary;Executed by:
| 2356 | ||||||||||||||||||
| 276 | case executed 33904 times by 1 test: Line:case Line:Executed by:
executed 33904 times by 1 test: case Line:Executed by:
| 33904 | ||||||||||||||||||
| 277 | - | |||||||||||||||||||
| 278 | return executed 33904 times by 1 test: d->attributes[pos].lineBreak || pos == 0;return d->attributes[pos].lineBreak || pos == 0;Executed by:
executed 33904 times by 1 test: return d->attributes[pos].lineBreak || pos == 0;Executed by:
| 33904 | ||||||||||||||||||
| 279 | } | - | ||||||||||||||||||
| 280 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 281 | } | - | ||||||||||||||||||
| 282 | - | |||||||||||||||||||
| 283 | - | |||||||||||||||||||
| 284 | - | |||||||||||||||||||
| 285 | - | |||||||||||||||||||
| 286 | QTextBoundaryFinder::BoundaryReasons QTextBoundaryFinder::boundaryReasons() const | - | ||||||||||||||||||
| 287 | { | - | ||||||||||||||||||
| 288 | BoundaryReasons reasons = NotAtBoundary; | - | ||||||||||||||||||
| 289 | if (!d
| 0-106479 | ||||||||||||||||||
| 290 | return executed 17611 times by 2 tests: reasons;return reasons;Executed by:
executed 17611 times by 2 tests: return reasons;Executed by:
| 17611 | ||||||||||||||||||
| 291 | - | |||||||||||||||||||
| 292 | const QCharAttributes attr = d->attributes[pos]; | - | ||||||||||||||||||
| 293 | switch (t) { | - | ||||||||||||||||||
| 294 | case executed 3951 times by 2 tests: Grapheme:case Grapheme:Executed by:
executed 3951 times by 2 tests: case Grapheme:Executed by:
| 3951 | ||||||||||||||||||
| 295 | if (attr.graphemeBoundary
| 295-3656 | ||||||||||||||||||
| 296 | reasons |= BreakOpportunity | StartOfItem | EndOfItem; | - | ||||||||||||||||||
| 297 | if (pos == 0
| 1209-2447 | ||||||||||||||||||
| 298 | reasons &= (~EndOfItem); executed 1209 times by 2 tests: reasons &= (~EndOfItem);Executed by:
| 1209 | ||||||||||||||||||
| 299 | else if (pos == length
| 1214-1233 | ||||||||||||||||||
| 300 | reasons &= (~StartOfItem); executed 1214 times by 2 tests: reasons &= (~StartOfItem);Executed by:
| 1214 | ||||||||||||||||||
| 301 | } executed 3656 times by 2 tests: end of blockExecuted by:
| 3656 | ||||||||||||||||||
| 302 | break; executed 3951 times by 2 tests: break;Executed by:
| 3951 | ||||||||||||||||||
| 303 | case executed 18853 times by 3 tests: Word:case Word:Executed by:
executed 18853 times by 3 tests: case Word:Executed by:
| 18853 | ||||||||||||||||||
| 304 | if (attr.wordBreak
| 2178-16675 | ||||||||||||||||||
| 305 | reasons |= BreakOpportunity; | - | ||||||||||||||||||
| 306 | if (attr.wordStart
| 4571-12104 | ||||||||||||||||||
| 307 | reasons |= StartOfItem; executed 4571 times by 3 tests: reasons |= StartOfItem;Executed by:
| 4571 | ||||||||||||||||||
| 308 | if (attr.wordEnd
| 4569-12106 | ||||||||||||||||||
| 309 | reasons |= EndOfItem; executed 4569 times by 3 tests: reasons |= EndOfItem;Executed by:
| 4569 | ||||||||||||||||||
| 310 | } executed 16675 times by 3 tests: end of blockExecuted by:
| 16675 | ||||||||||||||||||
| 311 | break; executed 18853 times by 3 tests: break;Executed by:
| 18853 | ||||||||||||||||||
| 312 | case executed 4892 times by 2 tests: Sentence:case Sentence:Executed by:
executed 4892 times by 2 tests: case Sentence:Executed by:
| 4892 | ||||||||||||||||||
| 313 | if (attr.sentenceBoundary
| 1354-3538 | ||||||||||||||||||
| 314 | reasons |= BreakOpportunity | StartOfItem | EndOfItem; | - | ||||||||||||||||||
| 315 | if (pos == 0
| 1554-1984 | ||||||||||||||||||
| 316 | reasons &= (~EndOfItem); executed 1554 times by 1 test: reasons &= (~EndOfItem);Executed by:
| 1554 | ||||||||||||||||||
| 317 | else if (pos == length
| 430-1554 | ||||||||||||||||||
| 318 | reasons &= (~StartOfItem); executed 1554 times by 1 test: reasons &= (~StartOfItem);Executed by:
| 1554 | ||||||||||||||||||
| 319 | } executed 3538 times by 2 tests: end of blockExecuted by:
| 3538 | ||||||||||||||||||
| 320 | break; executed 4892 times by 2 tests: break;Executed by:
| 4892 | ||||||||||||||||||
| 321 | case executed 61186 times by 1 test: Line:case Line:Executed by:
executed 61186 times by 1 test: case Line:Executed by:
| 61186 | ||||||||||||||||||
| 322 | - | |||||||||||||||||||
| 323 | if (attr.lineBreak
| 10330-31845 | ||||||||||||||||||
| 324 | reasons |= BreakOpportunity; | - | ||||||||||||||||||
| 325 | if (attr.mandatoryBreak
| 10893-29904 | ||||||||||||||||||
| 326 | reasons |= MandatoryBreak | StartOfItem | EndOfItem; | - | ||||||||||||||||||
| 327 | if (pos == 0
| 19011-20952 | ||||||||||||||||||
| 328 | reasons &= (~EndOfItem); executed 19011 times by 1 test: reasons &= (~EndOfItem);Executed by:
| 19011 | ||||||||||||||||||
| 329 | else if (pos == length
| 1941-19011 | ||||||||||||||||||
| 330 | reasons &= (~StartOfItem); executed 19011 times by 1 test: reasons &= (~StartOfItem);Executed by:
| 19011 | ||||||||||||||||||
| 331 | } executed 39963 times by 1 test: else if (pos > 0end of blockExecuted by:
| 0-39963 | ||||||||||||||||||
| 332 | reasons |= SoftHyphen; | - | ||||||||||||||||||
| 333 | } executed 45 times by 1 test: end of blockExecuted by:
| 45 | ||||||||||||||||||
| 334 | } executed 50856 times by 1 test: end of blockExecuted by:
| 50856 | ||||||||||||||||||
| 335 | break; executed 61186 times by 1 test: break;Executed by:
| 61186 | ||||||||||||||||||
| 336 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 337 | break; never executed: break; | 0 | ||||||||||||||||||
| 338 | } | - | ||||||||||||||||||
| 339 | - | |||||||||||||||||||
| 340 | return executed 88882 times by 3 tests: reasons;return reasons;Executed by:
executed 88882 times by 3 tests: return reasons;Executed by:
| 88882 | ||||||||||||||||||
| 341 | } | - | ||||||||||||||||||
| 342 | - | |||||||||||||||||||
| 343 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |