text/qtextobject.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5QTextObject::QTextObject(QTextDocument *doc) -
6 : QObject(*new QTextObjectPrivate(doc), doc) -
7{ -
8}
executed: }
Execution Count:1
1
9 -
10 -
11 -
12 -
13 -
14 -
15QTextObject::QTextObject(QTextObjectPrivate &p, QTextDocument *doc) -
16 : QObject(p, doc) -
17{ -
18}
executed: }
Execution Count:2217
2217
19 -
20 -
21 -
22 -
23 -
24 -
25 -
26QTextObject::~QTextObject() -
27{ -
28} -
29 -
30 -
31 -
32 -
33 -
34 -
35QTextFormat QTextObject::format() const -
36{ -
37 const QTextObjectPrivate * const d = d_func(); -
38 return d->pieceTable->formatCollection()->objectFormat(d->objectIndex);
executed: return d->pieceTable->formatCollection()->objectFormat(d->objectIndex);
Execution Count:5302
5302
39} -
40 -
41 -
42 -
43 -
44 -
45 -
46 -
47int QTextObject::formatIndex() const -
48{ -
49 const QTextObjectPrivate * const d = d_func(); -
50 return d->pieceTable->formatCollection()->objectFormatIndex(d->objectIndex);
executed: return d->pieceTable->formatCollection()->objectFormatIndex(d->objectIndex);
Execution Count:1
1
51} -
52 -
53 -
54 -
55 -
56 -
57 -
58 -
59void QTextObject::setFormat(const QTextFormat &format) -
60{ -
61 QTextObjectPrivate * const d = d_func(); -
62 int idx = d->pieceTable->formatCollection()->indexForFormat(format); -
63 d->pieceTable->changeObjectFormat(this, idx); -
64}
executed: }
Execution Count:104
104
65 -
66 -
67 -
68 -
69 -
70int QTextObject::objectIndex() const -
71{ -
72 const QTextObjectPrivate * const d = d_func(); -
73 return d->objectIndex;
executed: return d->objectIndex;
Execution Count:392
392
74} -
75 -
76 -
77 -
78 -
79 -
80 -
81QTextDocument *QTextObject::document() const -
82{ -
83 return static_cast<QTextDocument *>(parent());
executed: return static_cast<QTextDocument *>(parent());
Execution Count:25
25
84} -
85 -
86 -
87 -
88 -
89QTextDocumentPrivate *QTextObject::docHandle() const -
90{ -
91 return static_cast<const QTextDocument *>(parent())->docHandle();
executed: return static_cast<const QTextDocument *>(parent())->docHandle();
Execution Count:35199
35199
92} -
93void QTextBlockGroupPrivate::markBlocksDirty() -
94{ -
95 for (int i = 0; i < blocks.count(); ++i) {
evaluated: i < blocks.count()
TRUEFALSE
yes
Evaluation Count:25270651
yes
Evaluation Count:11079
11079-25270651
96 const QTextBlock &block = blocks.at(i); -
97 pieceTable->documentChange(block.position(), block.length()); -
98 }
executed: }
Execution Count:25270651
25270651
99}
executed: }
Execution Count:11079
11079
100QTextBlockGroup::QTextBlockGroup(QTextDocument *doc) -
101 : QTextObject(*new QTextBlockGroupPrivate(doc), doc) -
102{ -
103}
never executed: }
0
104 -
105 -
106 -
107 -
108QTextBlockGroup::QTextBlockGroup(QTextBlockGroupPrivate &p, QTextDocument *doc) -
109 : QTextObject(p, doc) -
110{ -
111}
executed: }
Execution Count:105
105
112 -
113 -
114 -
115 -
116 -
117QTextBlockGroup::~QTextBlockGroup() -
118{ -
119} -
120void QTextBlockGroup::blockInserted(const QTextBlock &block) -
121{ -
122 QTextBlockGroupPrivate * const d = d_func(); -
123 QTextBlockGroupPrivate::BlockList::Iterator it = std::lower_bound(d->blocks.begin(), d->blocks.end(), block); -
124 d->blocks.insert(it, block); -
125 d->markBlocksDirty(); -
126}
executed: }
Execution Count:11068
11068
127 -
128 -
129 -
130 -
131 -
132 -
133void QTextBlockGroup::blockRemoved(const QTextBlock &block) -
134{ -
135 QTextBlockGroupPrivate * const d = d_func(); -
136 d->blocks.removeAll(block); -
137 d->markBlocksDirty(); -
138 if (d->blocks.isEmpty()) {
evaluated: d->blocks.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:5
5
139 document()->docHandle()->deleteObject(this); -
140 return;
executed: return;
Execution Count:5
5
141 } -
142}
executed: }
Execution Count:5
5
143 -
144 -
145 -
146 -
147 -
148 -
149 -
150void QTextBlockGroup::blockFormatChanged(const QTextBlock &) -
151{ -
152} -
153 -
154 -
155 -
156 -
157 -
158QList<QTextBlock> QTextBlockGroup::blockList() const -
159{ -
160 const QTextBlockGroupPrivate * const d = d_func(); -
161 return d->blocks;
never executed: return d->blocks;
0
162} -
163 -
164 -
165 -
166QTextFrameLayoutData::~QTextFrameLayoutData() -
167{ -
168} -
169QTextFrame::QTextFrame(QTextDocument *doc) -
170 : QTextObject(*new QTextFramePrivate(doc), doc) -
171{ -
172}
executed: }
Execution Count:1872
1872
173 -
174 -
175 -
176 -
177 -
178QTextFrame::~QTextFrame() -
179{ -
180 QTextFramePrivate * const d = d_func(); -
181 delete d->layoutData; -
182}
executed: }
Execution Count:2108
2108
183 -
184 -
185 -
186 -
187QTextFrame::QTextFrame(QTextFramePrivate &p, QTextDocument *doc) -
188 : QTextObject(p, doc) -
189{ -
190}
executed: }
Execution Count:240
240
191 -
192 -
193 -
194 -
195 -
196 -
197QList<QTextFrame *> QTextFrame::childFrames() const -
198{ -
199 const QTextFramePrivate * const d = d_func(); -
200 return d->childFrames;
executed: return d->childFrames;
Execution Count:17627
17627
201} -
202 -
203 -
204 -
205 -
206 -
207 -
208 -
209QTextFrame *QTextFrame::parentFrame() const -
210{ -
211 const QTextFramePrivate * const d = d_func(); -
212 return d->parentFrame;
executed: return d->parentFrame;
Execution Count:9476
9476
213} -
214 -
215 -
216 -
217 -
218 -
219 -
220 -
221QTextCursor QTextFrame::firstCursorPosition() const -
222{ -
223 const QTextFramePrivate * const d = d_func(); -
224 return QTextCursor(d->pieceTable, firstPosition());
executed: return QTextCursor(d->pieceTable, firstPosition());
Execution Count:1
1
225} -
226 -
227 -
228 -
229 -
230 -
231 -
232QTextCursor QTextFrame::lastCursorPosition() const -
233{ -
234 const QTextFramePrivate * const d = d_func(); -
235 return QTextCursor(d->pieceTable, lastPosition());
executed: return QTextCursor(d->pieceTable, lastPosition());
Execution Count:66
66
236} -
237 -
238 -
239 -
240 -
241 -
242 -
243int QTextFrame::firstPosition() const -
244{ -
245 const QTextFramePrivate * const d = d_func(); -
246 if (!d->fragment_start)
evaluated: !d->fragment_start
TRUEFALSE
yes
Evaluation Count:7364
yes
Evaluation Count:1200
1200-7364
247 return 0;
executed: return 0;
Execution Count:7364
7364
248 return d->pieceTable->fragmentMap().position(d->fragment_start) + 1;
executed: return d->pieceTable->fragmentMap().position(d->fragment_start) + 1;
Execution Count:1200
1200
249} -
250 -
251 -
252 -
253 -
254 -
255 -
256int QTextFrame::lastPosition() const -
257{ -
258 const QTextFramePrivate * const d = d_func(); -
259 if (!d->fragment_end)
evaluated: !d->fragment_end
TRUEFALSE
yes
Evaluation Count:7054
yes
Evaluation Count:1385
1385-7054
260 return d->pieceTable->length() - 1;
executed: return d->pieceTable->length() - 1;
Execution Count:7054
7054
261 return d->pieceTable->fragmentMap().position(d->fragment_end);
executed: return d->pieceTable->fragmentMap().position(d->fragment_end);
Execution Count:1385
1385
262} -
263 -
264 -
265 -
266 -
267QTextFrameLayoutData *QTextFrame::layoutData() const -
268{ -
269 const QTextFramePrivate * const d = d_func(); -
270 return d->layoutData;
executed: return d->layoutData;
Execution Count:77273
77273
271} -
272 -
273 -
274 -
275 -
276void QTextFrame::setLayoutData(QTextFrameLayoutData *data) -
277{ -
278 QTextFramePrivate * const d = d_func(); -
279 delete d->layoutData; -
280 d->layoutData = data; -
281}
executed: }
Execution Count:830
830
282 -
283 -
284 -
285void QTextFramePrivate::fragmentAdded(QChar type, uint fragment) -
286{ -
287 if (type == QChar(0xfdd0)) {
evaluated: type == QChar(0xfdd0)
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:140
17-140
288 qt_noop(); -
289 fragment_start = fragment; -
290 } else if (type == QChar(0xfdd1)) {
evaluated: type == QChar(0xfdd1)
TRUEFALSE
yes
Evaluation Count:107
yes
Evaluation Count:33
executed: }
Execution Count:17
17-107
291 qt_noop(); -
292 fragment_end = fragment; -
293 } else if (type == QChar::ObjectReplacementCharacter) {
partially evaluated: type == QChar::ObjectReplacementCharacter
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
executed: }
Execution Count:107
0-107
294 qt_noop(); -
295 qt_noop(); -
296 fragment_start = fragment; -
297 fragment_end = fragment; -
298 } else {
executed: }
Execution Count:33
33
299 qt_noop(); -
300 }
never executed: }
0
301} -
302 -
303void QTextFramePrivate::fragmentRemoved(QChar type, uint fragment) -
304{ -
305 (void)fragment;; -
306 if (type == QChar(0xfdd0)) {
evaluated: type == QChar(0xfdd0)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:7
6-7
307 qt_noop(); -
308 fragment_start = 0; -
309 } else if (type == QChar(0xfdd1)) {
partially evaluated: type == QChar(0xfdd1)
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
executed: }
Execution Count:6
0-7
310 qt_noop(); -
311 fragment_end = 0; -
312 } else if (type == QChar::ObjectReplacementCharacter) {
never evaluated: type == QChar::ObjectReplacementCharacter
executed: }
Execution Count:7
0-7
313 qt_noop(); -
314 qt_noop(); -
315 fragment_start = 0; -
316 fragment_end = 0; -
317 } else {
never executed: }
0
318 qt_noop(); -
319 }
never executed: }
0
320 remove_me(); -
321}
executed: }
Execution Count:13
13
322 -
323 -
324void QTextFramePrivate::remove_me() -
325{ -
326 QTextFrame * const q = q_func(); -
327 if (fragment_start == 0 && fragment_end == 0
evaluated: fragment_start == 0
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:4
evaluated: fragment_end == 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3
3-9
328 && !parentFrame) {
partially evaluated: !parentFrame
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
329 q->document()->docHandle()->deleteObject(q); -
330 return;
executed: return;
Execution Count:6
6
331 } -
332 -
333 if (!parentFrame)
partially evaluated: !parentFrame
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
334 return;
never executed: return;
0
335 -
336 int index = parentFrame->d_func()->childFrames.indexOf(q); -
337 -
338 -
339 for (int i = 0; i < childFrames.size(); ++i) {
partially evaluated: i < childFrames.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
340 QTextFrame *c = childFrames.at(i); -
341 parentFrame->d_func()->childFrames.insert(index, c); -
342 c->d_func()->parentFrame = parentFrame; -
343 ++index; -
344 }
never executed: }
0
345 qt_noop(); -
346 parentFrame->d_func()->childFrames.removeAt(index); -
347 -
348 childFrames.clear(); -
349 parentFrame = 0; -
350}
executed: }
Execution Count:7
7
351QTextFrame::iterator QTextFrame::begin() const -
352{ -
353 const QTextDocumentPrivate *priv = docHandle(); -
354 int b = priv->blockMap().findNode(firstPosition()); -
355 int e = priv->blockMap().findNode(lastPosition()+1); -
356 return iterator(const_cast<QTextFrame *>(this), b, b, e);
executed: return iterator(const_cast<QTextFrame *>(this), b, b, e);
Execution Count:2353
2353
357} -
358 -
359 -
360 -
361 -
362 -
363 -
364QTextFrame::iterator QTextFrame::end() const -
365{ -
366 const QTextDocumentPrivate *priv = docHandle(); -
367 int b = priv->blockMap().findNode(firstPosition()); -
368 int e = priv->blockMap().findNode(lastPosition()+1); -
369 return iterator(const_cast<QTextFrame *>(this), e, b, e);
executed: return iterator(const_cast<QTextFrame *>(this), e, b, e);
Execution Count:13
13
370} -
371 -
372 -
373 -
374 -
375QTextFrame::iterator::iterator() -
376{ -
377 f = 0; -
378 b = 0; -
379 e = 0; -
380 cf = 0; -
381 cb = 0; -
382}
executed: }
Execution Count:6412
6412
383 -
384 -
385 -
386 -
387QTextFrame::iterator::iterator(QTextFrame *frame, int block, int begin, int end) -
388{ -
389 f = frame; -
390 b = begin; -
391 e = end; -
392 cf = 0; -
393 cb = block; -
394}
executed: }
Execution Count:4330
4330
395 -
396 -
397 -
398 -
399QTextFrame::iterator::iterator(const iterator &other) -
400{ -
401 f = other.f; -
402 b = other.b; -
403 e = other.e; -
404 cf = other.cf; -
405 cb = other.cb; -
406}
executed: }
Execution Count:2524
2524
407 -
408 -
409 -
410 -
411 -
412QTextFrame::iterator &QTextFrame::iterator::operator=(const iterator &other) -
413{ -
414 f = other.f; -
415 b = other.b; -
416 e = other.e; -
417 cf = other.cf; -
418 cb = other.cb; -
419 return *this;
executed: return *this;
Execution Count:5217
5217
420} -
421 -
422 -
423 -
424 -
425 -
426 -
427 -
428QTextFrame *QTextFrame::iterator::currentFrame() const -
429{ -
430 return cf;
executed: return cf;
Execution Count:17138
17138
431} -
432 -
433 -
434 -
435 -
436 -
437 -
438 -
439QTextBlock QTextFrame::iterator::currentBlock() const -
440{ -
441 if (!f)
evaluated: !f
TRUEFALSE
yes
Evaluation Count:5563
yes
Evaluation Count:10549
5563-10549
442 return QTextBlock();
executed: return QTextBlock();
Execution Count:5563
5563
443 return QTextBlock(f->docHandle(), cb);
executed: return QTextBlock(f->docHandle(), cb);
Execution Count:10549
10549
444} -
445 -
446 -
447 -
448 -
449 -
450 -
451QTextFrame::iterator &QTextFrame::iterator::operator++() -
452{ -
453 const QTextDocumentPrivate *priv = f->docHandle(); -
454 const QTextDocumentPrivate::BlockMap &map = priv->blockMap(); -
455 if (cf) {
evaluated: cf
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:4411
60-4411
456 int end = cf->lastPosition() + 1; -
457 cb = map.findNode(end); -
458 cf = 0; -
459 } else if (cb) {
partially evaluated: cb
TRUEFALSE
yes
Evaluation Count:4411
no
Evaluation Count:0
executed: }
Execution Count:60
0-4411
460 cb = map.next(cb); -
461 if (cb == e)
evaluated: cb == e
TRUEFALSE
yes
Evaluation Count:3329
yes
Evaluation Count:1082
1082-3329
462 return *this;
executed: return *this;
Execution Count:3329
3329
463 -
464 if (!f->d_func()->childFrames.isEmpty()) {
evaluated: !f->d_func()->childFrames.isEmpty()
TRUEFALSE
yes
Evaluation Count:95
yes
Evaluation Count:987
95-987
465 int pos = map.position(cb); -
466 -
467 QTextDocumentPrivate::FragmentIterator frag = priv->find(pos-1); -
468 if (priv->buffer().at(frag->stringPosition) != QChar::ParagraphSeparator) {
evaluated: priv->buffer().at(frag->stringPosition) != QChar::ParagraphSeparator
TRUEFALSE
yes
Evaluation Count:91
yes
Evaluation Count:4
4-91
469 QTextFrame *nf = qobject_cast<QTextFrame *>(priv->objectForFormat(frag->format)); -
470 if (nf) {
partially evaluated: nf
TRUEFALSE
yes
Evaluation Count:91
no
Evaluation Count:0
0-91
471 if (priv->buffer().at(frag->stringPosition) == QChar(0xfdd0) && nf != f) {
partially evaluated: priv->buffer().at(frag->stringPosition) == QChar(0xfdd0)
TRUEFALSE
yes
Evaluation Count:91
no
Evaluation Count:0
evaluated: nf != f
TRUEFALSE
yes
Evaluation Count:81
yes
Evaluation Count:10
0-91
472 cf = nf; -
473 cb = 0; -
474 } else {
executed: }
Execution Count:81
81
475 qt_noop(); -
476 }
executed: }
Execution Count:10
10
477 } -
478 }
executed: }
Execution Count:91
91
479 }
executed: }
Execution Count:95
95
480 }
executed: }
Execution Count:1082
1082
481 return *this;
executed: return *this;
Execution Count:1142
1142
482} -
483 -
484 -
485 -
486 -
487 -
488 -
489QTextFrame::iterator &QTextFrame::iterator::operator--() -
490{ -
491 const QTextDocumentPrivate *priv = f->docHandle(); -
492 const QTextDocumentPrivate::BlockMap &map = priv->blockMap(); -
493 if (cf) {
partially evaluated: cf
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
494 int start = cf->firstPosition() - 1; -
495 cb = map.findNode(start); -
496 cf = 0; -
497 } else {
never executed: }
0
498 if (cb == b)
partially evaluated: cb == b
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
499 goto end;
executed: goto end;
Execution Count:2
2
500 if (cb != e) {
never evaluated: cb != e
0
501 int pos = map.position(cb); -
502 -
503 QTextDocumentPrivate::FragmentIterator frag = priv->find(pos-1); -
504 if (priv->buffer().at(frag->stringPosition) != QChar::ParagraphSeparator) {
never evaluated: priv->buffer().at(frag->stringPosition) != QChar::ParagraphSeparator
0
505 QTextFrame *pf = qobject_cast<QTextFrame *>(priv->objectForFormat(frag->format)); -
506 if (pf) {
never evaluated: pf
0
507 if (priv->buffer().at(frag->stringPosition) == QChar(0xfdd0)) {
never evaluated: priv->buffer().at(frag->stringPosition) == QChar(0xfdd0)
0
508 qt_noop(); -
509 } else if (priv->buffer().at(frag->stringPosition) == QChar(0xfdd1)) {
never evaluated: priv->buffer().at(frag->stringPosition) == QChar(0xfdd1)
never executed: }
0
510 qt_noop(); -
511 cf = pf; -
512 cb = 0; -
513 goto end;
never executed: goto end;
0
514 } -
515 } -
516 }
never executed: }
0
517 }
never executed: }
0
518 cb = map.previous(cb); -
519 }
never executed: }
0
520 end: -
521 return *this;
executed: return *this;
Execution Count:2
2
522} -
523QTextBlockUserData::~QTextBlockUserData() -
524{ -
525} -
526bool QTextBlock::isValid() const -
527{ -
528 return p != 0 && p->blockMap().isValid(n);
executed: return p != 0 && p->blockMap().isValid(n);
Execution Count:73059
73059
529} -
530int QTextBlock::position() const -
531{ -
532 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25594783
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25594783
0-25594783
533 return 0;
never executed: return 0;
0
534 -
535 return p->blockMap().position(n);
executed: return p->blockMap().position(n);
Execution Count:25594783
25594783
536} -
537int QTextBlock::length() const -
538{ -
539 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25345962
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25345962
0-25345962
540 return 0;
never executed: return 0;
0
541 -
542 return p->blockMap().size(n);
executed: return p->blockMap().size(n);
Execution Count:25345962
25345962
543} -
544 -
545 -
546 -
547 -
548 -
549bool QTextBlock::contains(int position) const -
550{ -
551 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
552 return false;
never executed: return false;
0
553 -
554 int pos = p->blockMap().position(n); -
555 int len = p->blockMap().size(n); -
556 return position >= pos && position < pos + len;
executed: return position >= pos && position < pos + len;
Execution Count:9
9
557} -
558QTextLayout *QTextBlock::layout() const -
559{ -
560 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36033
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36033
0-36033
561 return 0;
never executed: return 0;
0
562 -
563 const QTextBlockData *b = p->blockMap().fragment(n); -
564 if (!b->layout)
evaluated: !b->layout
TRUEFALSE
yes
Evaluation Count:15452
yes
Evaluation Count:20581
15452-20581
565 b->layout = new QTextLayout(*this);
executed: b->layout = new QTextLayout(*this);
Execution Count:15452
15452
566 return b->layout;
executed: return b->layout;
Execution Count:36033
36033
567} -
568void QTextBlock::clearLayout() -
569{ -
570 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6174
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6174
0-6174
571 return;
never executed: return;
0
572 -
573 const QTextBlockData *b = p->blockMap().fragment(n); -
574 if (b->layout)
evaluated: b->layout
TRUEFALSE
yes
Evaluation Count:2338
yes
Evaluation Count:3836
2338-3836
575 b->layout->clearLayout();
executed: b->layout->clearLayout();
Execution Count:2338
2338
576}
executed: }
Execution Count:6174
6174
577 -
578 -
579 -
580 -
581 -
582 -
583QTextBlockFormat QTextBlock::blockFormat() const -
584{ -
585 if (!p || !n)
evaluated: !p
TRUEFALSE
yes
Evaluation Count:3117
yes
Evaluation Count:29734
evaluated: !n
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:29725
9-29734
586 return QTextFormat().toBlockFormat();
executed: return QTextFormat().toBlockFormat();
Execution Count:3126
3126
587 -
588 return p->formatCollection()->blockFormat(p->blockMap().fragment(n)->format);
executed: return p->formatCollection()->blockFormat(p->blockMap().fragment(n)->format);
Execution Count:29725
29725
589} -
590 -
591 -
592 -
593 -
594 -
595 -
596 -
597int QTextBlock::blockFormatIndex() const -
598{ -
599 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
600 return -1;
never executed: return -1;
0
601 -
602 return p->blockMap().fragment(n)->format;
executed: return p->blockMap().fragment(n)->format;
Execution Count:3
3
603} -
604QTextCharFormat QTextBlock::charFormat() const -
605{ -
606 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6929
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6929
0-6929
607 return QTextFormat().toCharFormat();
never executed: return QTextFormat().toCharFormat();
0
608 -
609 return p->formatCollection()->charFormat(charFormatIndex());
executed: return p->formatCollection()->charFormat(charFormatIndex());
Execution Count:6929
6929
610} -
611 -
612 -
613 -
614 -
615 -
616 -
617 -
618int QTextBlock::charFormatIndex() const -
619{ -
620 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6929
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6929
0-6929
621 return -1;
never executed: return -1;
0
622 -
623 return p->blockCharFormatIndex(n);
executed: return p->blockCharFormatIndex(n);
Execution Count:6929
6929
624} -
625Qt::LayoutDirection QTextBlock::textDirection() const -
626{ -
627 Qt::LayoutDirection dir = blockFormat().layoutDirection(); -
628 if (dir != Qt::LayoutDirectionAuto)
evaluated: dir != Qt::LayoutDirectionAuto
TRUEFALSE
yes
Evaluation Count:147
yes
Evaluation Count:6552
147-6552
629 return dir;
executed: return dir;
Execution Count:147
147
630 -
631 dir = p->defaultTextOption.textDirection(); -
632 if (dir != Qt::LayoutDirectionAuto)
partially evaluated: dir != Qt::LayoutDirectionAuto
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6552
0-6552
633 return dir;
never executed: return dir;
0
634 -
635 const QString buffer = p->buffer(); -
636 -
637 const int pos = position(); -
638 QTextDocumentPrivate::FragmentIterator it = p->find(pos); -
639 QTextDocumentPrivate::FragmentIterator end = p->find(pos + length() - 1); -
640 for (; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:4010
yes
Evaluation Count:3161
3161-4010
641 const QTextFragmentData * const frag = it.value(); -
642 const QChar *p = buffer.constData() + frag->stringPosition; -
643 const QChar * const end = p + frag->size_array[0]; -
644 while (p < end) {
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:7115
yes
Evaluation Count:619
619-7115
645 uint ucs4 = p->unicode(); -
646 if (QChar::isHighSurrogate(ucs4) && p + 1 < end) {
partially evaluated: QChar::isHighSurrogate(ucs4)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7115
never evaluated: p + 1 < end
0-7115
647 ushort low = p[1].unicode(); -
648 if (QChar::isLowSurrogate(low)) {
never evaluated: QChar::isLowSurrogate(low)
0
649 ucs4 = QChar::surrogateToUcs4(ucs4, low); -
650 ++p; -
651 }
never executed: }
0
652 }
never executed: }
0
653 switch (QChar::direction(ucs4)) { -
654 case QChar::DirL: -
655 return Qt::LeftToRight;
executed: return Qt::LeftToRight;
Execution Count:3390
3390
656 case QChar::DirR: -
657 case QChar::DirAL: -
658 return Qt::RightToLeft;
executed: return Qt::RightToLeft;
Execution Count:1
1
659 default: -
660 break;
executed: break;
Execution Count:3724
3724
661 } -
662 ++p; -
663 }
executed: }
Execution Count:3724
3724
664 }
executed: }
Execution Count:619
619
665 return Qt::LeftToRight;
executed: return Qt::LeftToRight;
Execution Count:3161
3161
666} -
667 -
668 -
669 -
670 -
671 -
672 -
673QString QTextBlock::text() const -
674{ -
675 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21074
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21074
0-21074
676 return QString();
never executed: return QString();
0
677 -
678 const QString buffer = p->buffer(); -
679 QString text; -
680 text.reserve(length()); -
681 -
682 const int pos = position(); -
683 QTextDocumentPrivate::FragmentIterator it = p->find(pos); -
684 QTextDocumentPrivate::FragmentIterator end = p->find(pos + length() - 1); -
685 for (; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:6170
yes
Evaluation Count:21074
6170-21074
686 const QTextFragmentData * const frag = it.value(); -
687 text += QString::fromRawData(buffer.constData() + frag->stringPosition, frag->size_array[0]); -
688 }
executed: }
Execution Count:6170
6170
689 -
690 return text;
executed: return text;
Execution Count:21074
21074
691} -
692 -
693 -
694 -
695 -
696 -
697 -
698const QTextDocument *QTextBlock::document() const -
699{ -
700 return p ? p->document() : 0;
executed: return p ? p->document() : 0;
Execution Count:3
3
701} -
702 -
703 -
704 -
705 -
706 -
707QTextList *QTextBlock::textList() const -
708{ -
709 if (!isValid())
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:996
0-996
710 return 0;
never executed: return 0;
0
711 -
712 const QTextBlockFormat fmt = blockFormat(); -
713 QTextObject *obj = p->document()->objectForFormat(fmt); -
714 return qobject_cast<QTextList *>(obj);
executed: return qobject_cast<QTextList *>(obj);
Execution Count:996
996
715} -
716 -
717 -
718 -
719 -
720 -
721 -
722 -
723QTextBlockUserData *QTextBlock::userData() const -
724{ -
725 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
726 return 0;
never executed: return 0;
0
727 -
728 const QTextBlockData *b = p->blockMap().fragment(n); -
729 return b->userData;
executed: return b->userData;
Execution Count:5
5
730} -
731void QTextBlock::setUserData(QTextBlockUserData *data) -
732{ -
733 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
734 return;
never executed: return;
0
735 -
736 const QTextBlockData *b = p->blockMap().fragment(n); -
737 if (data != b->userData)
partially evaluated: data != b->userData
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
738 delete b->userData;
executed: delete b->userData;
Execution Count:3
3
739 b->userData = data; -
740}
executed: }
Execution Count:3
3
741 -
742 -
743 -
744 -
745 -
746 -
747int QTextBlock::userState() const -
748{ -
749 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1070
evaluated: !n
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1068
0-1070
750 return -1;
executed: return -1;
Execution Count:2
2
751 -
752 const QTextBlockData *b = p->blockMap().fragment(n); -
753 return b->userState;
executed: return b->userState;
Execution Count:1068
1068
754} -
755 -
756 -
757 -
758 -
759 -
760 -
761 -
762void QTextBlock::setUserState(int state) -
763{ -
764 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-22
765 return;
never executed: return;
0
766 -
767 const QTextBlockData *b = p->blockMap().fragment(n); -
768 b->userState = state; -
769}
executed: }
Execution Count:22
22
770int QTextBlock::revision() const -
771{ -
772 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
773 return -1;
never executed: return -1;
0
774 -
775 const QTextBlockData *b = p->blockMap().fragment(n); -
776 return b->revision;
executed: return b->revision;
Execution Count:14
14
777} -
778void QTextBlock::setRevision(int rev) -
779{ -
780 if (!p || !n)
never evaluated: !p
never evaluated: !n
0
781 return;
never executed: return;
0
782 -
783 const QTextBlockData *b = p->blockMap().fragment(n); -
784 b->revision = rev; -
785}
never executed: }
0
786bool QTextBlock::isVisible() const -
787{ -
788 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5405
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5405
0-5405
789 return true;
never executed: return true;
0
790 -
791 const QTextBlockData *b = p->blockMap().fragment(n); -
792 return !b->hidden;
executed: return !b->hidden;
Execution Count:5405
5405
793} -
794void QTextBlock::setVisible(bool visible) -
795{ -
796 if (!p || !n)
never evaluated: !p
never evaluated: !n
0
797 return;
never executed: return;
0
798 -
799 const QTextBlockData *b = p->blockMap().fragment(n); -
800 b->hidden = !visible; -
801}
never executed: }
0
802int QTextBlock::blockNumber() const -
803{ -
804 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2397
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2397
0-2397
805 return -1;
never executed: return -1;
0
806 return p->blockMap().position(n, 1);
executed: return p->blockMap().position(n, 1);
Execution Count:2397
2397
807} -
808int QTextBlock::firstLineNumber() const -
809{ -
810 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:733
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:733
0-733
811 return -1;
never executed: return -1;
0
812 return p->blockMap().position(n, 2);
executed: return p->blockMap().position(n, 2);
Execution Count:733
733
813} -
814void QTextBlock::setLineCount(int count) -
815{ -
816 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1621
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1621
0-1621
817 return;
never executed: return;
0
818 p->blockMap().setSize(n, count, 2); -
819}
executed: }
Execution Count:1621
1621
820 -
821 -
822 -
823 -
824 -
825 -
826 -
827int QTextBlock::lineCount() const -
828{ -
829 if (!p || !n)
never evaluated: !p
never evaluated: !n
0
830 return -1;
never executed: return -1;
0
831 return p->blockMap().size(n, 2);
never executed: return p->blockMap().size(n, 2);
0
832} -
833QTextBlock::iterator QTextBlock::begin() const -
834{ -
835 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:748
evaluated: !n
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:747
0-748
836 return iterator();
executed: return iterator();
Execution Count:1
1
837 -
838 int pos = position(); -
839 int len = length() - 1; -
840 int b = p->fragmentMap().findNode(pos); -
841 int e = p->fragmentMap().findNode(pos+len); -
842 return iterator(p, b, e, b);
executed: return iterator(p, b, e, b);
Execution Count:747
747
843} -
844 -
845 -
846 -
847 -
848 -
849 -
850 -
851QTextBlock::iterator QTextBlock::end() const -
852{ -
853 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
854 return iterator();
never executed: return iterator();
0
855 -
856 int pos = position(); -
857 int len = length() - 1; -
858 int b = p->fragmentMap().findNode(pos); -
859 int e = p->fragmentMap().findNode(pos+len); -
860 return iterator(p, b, e, e);
executed: return iterator(p, b, e, e);
Execution Count:3
3
861} -
862QTextBlock QTextBlock::next() const -
863{ -
864 if (!isValid())
evaluated: !isValid()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:26075
4-26075
865 return QTextBlock();
executed: return QTextBlock();
Execution Count:4
4
866 -
867 return QTextBlock(p, p->blockMap().next(n));
executed: return QTextBlock(p, p->blockMap().next(n));
Execution Count:26075
26075
868} -
869QTextBlock QTextBlock::previous() const -
870{ -
871 if (!p)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:277
0-277
872 return QTextBlock();
never executed: return QTextBlock();
0
873 -
874 return QTextBlock(p, p->blockMap().previous(n));
executed: return QTextBlock(p, p->blockMap().previous(n));
Execution Count:277
277
875} -
876 -
877 -
878 -
879 -
880 -
881QTextFragment QTextBlock::iterator::fragment() const -
882{ -
883 int ne = n; -
884 int formatIndex = p->fragmentMap().fragment(n)->format; -
885 do { -
886 ne = p->fragmentMap().next(ne); -
887 } while (ne != e && p->fragmentMap().fragment(ne)->format == formatIndex);
executed: }
Execution Count:242
evaluated: ne != e
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:177
partially evaluated: p->fragmentMap().fragment(ne)->format == formatIndex
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65
0-242
888 return QTextFragment(p, n, ne);
executed: return QTextFragment(p, n, ne);
Execution Count:242
242
889} -
890 -
891 -
892 -
893 -
894 -
895 -
896 -
897QTextBlock::iterator &QTextBlock::iterator::operator++() -
898{ -
899 int ne = n; -
900 int formatIndex = p->fragmentMap().fragment(n)->format; -
901 do { -
902 ne = p->fragmentMap().next(ne); -
903 } while (ne != e && p->fragmentMap().fragment(ne)->format == formatIndex);
executed: }
Execution Count:141
evaluated: ne != e
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:106
partially evaluated: p->fragmentMap().fragment(ne)->format == formatIndex
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:35
0-141
904 n = ne; -
905 return *this;
executed: return *this;
Execution Count:141
141
906} -
907 -
908 -
909 -
910 -
911 -
912 -
913QTextBlock::iterator &QTextBlock::iterator::operator--() -
914{ -
915 n = p->fragmentMap().previous(n); -
916 -
917 if (n == b)
evaluated: n == b
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
918 return *this;
executed: return *this;
Execution Count:3
3
919 -
920 int formatIndex = p->fragmentMap().fragment(n)->format; -
921 int last = n; -
922 -
923 while (n != b && p->fragmentMap().fragment(n)->format != formatIndex) {
partially evaluated: n != b
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
partially evaluated: p->fragmentMap().fragment(n)->format != formatIndex
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
924 last = n; -
925 n = p->fragmentMap().previous(n); -
926 }
never executed: }
0
927 -
928 n = last; -
929 return *this;
executed: return *this;
Execution Count:3
3
930} -
931QList<QGlyphRun> QTextFragment::glyphRuns(int pos, int len) const -
932{ -
933 if (!p || !n)
never evaluated: !p
never evaluated: !n
0
934 return QList<QGlyphRun>();
never executed: return QList<QGlyphRun>();
0
935 -
936 int blockNode = p->blockMap().findNode(position()); -
937 -
938 const QTextBlockData *blockData = p->blockMap().fragment(blockNode); -
939 QTextLayout *layout = blockData->layout; -
940 -
941 int blockPosition = p->blockMap().position(blockNode); -
942 if (pos < 0)
never evaluated: pos < 0
0
943 pos = position() - blockPosition;
never executed: pos = position() - blockPosition;
0
944 if (len < 0)
never evaluated: len < 0
0
945 len = length();
never executed: len = length();
0
946 if (len == 0)
never evaluated: len == 0
0
947 return QList<QGlyphRun>();
never executed: return QList<QGlyphRun>();
0
948 -
949 QList<QGlyphRun> ret; -
950 for (int i=0; i<layout->lineCount(); ++i) {
never evaluated: i<layout->lineCount()
0
951 QTextLine textLine = layout->lineAt(i); -
952 ret += textLine.glyphRuns(pos, len); -
953 }
never executed: }
0
954 -
955 return ret;
never executed: return ret;
0
956} -
957 -
958 -
959 -
960 -
961 -
962int QTextFragment::position() const -
963{ -
964 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46
0-46
965 return 0;
never executed: return 0;
0
966 -
967 return p->fragmentMap().position(n);
executed: return p->fragmentMap().position(n);
Execution Count:46
46
968} -
969 -
970 -
971 -
972 -
973 -
974 -
975int QTextFragment::length() const -
976{ -
977 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
978 return 0;
never executed: return 0;
0
979 -
980 int len = 0; -
981 int f = n; -
982 while (f != ne) {
evaluated: f != ne
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:10
10
983 len += p->fragmentMap().size(f); -
984 f = p->fragmentMap().next(f); -
985 }
executed: }
Execution Count:10
10
986 return len;
executed: return len;
Execution Count:10
10
987} -
988 -
989 -
990 -
991 -
992 -
993bool QTextFragment::contains(int position) const -
994{ -
995 if (!p || !n)
never evaluated: !p
never evaluated: !n
0
996 return false;
never executed: return false;
0
997 int pos = this->position(); -
998 return position >= pos && position < pos + length();
never executed: return position >= pos && position < pos + length();
0
999} -
1000 -
1001 -
1002 -
1003 -
1004 -
1005 -
1006QTextCharFormat QTextFragment::charFormat() const -
1007{ -
1008 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:193
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:193
0-193
1009 return QTextCharFormat();
never executed: return QTextCharFormat();
0
1010 const QTextFragmentData *data = p->fragmentMap().fragment(n); -
1011 return p->formatCollection()->charFormat(data->format);
executed: return p->formatCollection()->charFormat(data->format);
Execution Count:193
193
1012} -
1013 -
1014 -
1015 -
1016 -
1017 -
1018 -
1019 -
1020int QTextFragment::charFormatIndex() const -
1021{ -
1022 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1023 return -1;
never executed: return -1;
0
1024 const QTextFragmentData *data = p->fragmentMap().fragment(n); -
1025 return data->format;
executed: return data->format;
Execution Count:3
3
1026} -
1027 -
1028 -
1029 -
1030 -
1031 -
1032 -
1033QString QTextFragment::text() const -
1034{ -
1035 if (!p || !n)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:119
partially evaluated: !n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:119
0-119
1036 return QString();
never executed: return QString();
0
1037 -
1038 QString result; -
1039 QString buffer = p->buffer(); -
1040 int f = n; -
1041 while (f != ne) {
evaluated: f != ne
TRUEFALSE
yes
Evaluation Count:119
yes
Evaluation Count:119
119
1042 const QTextFragmentData * const frag = p->fragmentMap().fragment(f); -
1043 result += QString(buffer.constData() + frag->stringPosition, frag->size_array[0]); -
1044 f = p->fragmentMap().next(f); -
1045 }
executed: }
Execution Count:119
119
1046 return result;
executed: return result;
Execution Count:119
119
1047} -
1048 -
1049 -
1050 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial