| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/text/qsyntaxhighlighter.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | class QSyntaxHighlighterPrivate : public QObjectPrivate | - | ||||||||||||||||||
| 9 | { | - | ||||||||||||||||||
| 10 | inline QSyntaxHighlighter* q_func() { return static_cast<QSyntaxHighlighter *>(q_ptr); } inline const QSyntaxHighlighter* q_func() const { return static_cast<const QSyntaxHighlighter *>(q_ptr); } friend class QSyntaxHighlighter; | - | ||||||||||||||||||
| 11 | public: | - | ||||||||||||||||||
| 12 | inline QSyntaxHighlighterPrivate() | - | ||||||||||||||||||
| 13 | : rehighlightPending(false), inReformatBlocks(false) | - | ||||||||||||||||||
| 14 | {} never executed: end of block | 0 | ||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | QPointer<QTextDocument> doc; | - | ||||||||||||||||||
| 17 | - | |||||||||||||||||||
| 18 | void _q_reformatBlocks(int from, int charsRemoved, int charsAdded); | - | ||||||||||||||||||
| 19 | void reformatBlocks(int from, int charsRemoved, int charsAdded); | - | ||||||||||||||||||
| 20 | void reformatBlock(const QTextBlock &block); | - | ||||||||||||||||||
| 21 | - | |||||||||||||||||||
| 22 | inline void rehighlight(QTextCursor &cursor, QTextCursor::MoveOperation operation) { | - | ||||||||||||||||||
| 23 | inReformatBlocks = true; | - | ||||||||||||||||||
| 24 | cursor.beginEditBlock(); | - | ||||||||||||||||||
| 25 | int from = cursor.position(); | - | ||||||||||||||||||
| 26 | cursor.movePosition(operation); | - | ||||||||||||||||||
| 27 | reformatBlocks(from, 0, cursor.position() - from); | - | ||||||||||||||||||
| 28 | cursor.endEditBlock(); | - | ||||||||||||||||||
| 29 | inReformatBlocks = false; | - | ||||||||||||||||||
| 30 | } never executed: end of block | 0 | ||||||||||||||||||
| 31 | - | |||||||||||||||||||
| 32 | inline void _q_delayedRehighlight() { | - | ||||||||||||||||||
| 33 | if (!rehighlightPending
| 0 | ||||||||||||||||||
| 34 | return; never executed: return; | 0 | ||||||||||||||||||
| 35 | rehighlightPending = false; | - | ||||||||||||||||||
| 36 | q_func()->rehighlight(); | - | ||||||||||||||||||
| 37 | } never executed: end of block | 0 | ||||||||||||||||||
| 38 | - | |||||||||||||||||||
| 39 | void applyFormatChanges(); | - | ||||||||||||||||||
| 40 | QVector<QTextCharFormat> formatChanges; | - | ||||||||||||||||||
| 41 | QTextBlock currentBlock; | - | ||||||||||||||||||
| 42 | bool rehighlightPending; | - | ||||||||||||||||||
| 43 | bool inReformatBlocks; | - | ||||||||||||||||||
| 44 | }; | - | ||||||||||||||||||
| 45 | - | |||||||||||||||||||
| 46 | void QSyntaxHighlighterPrivate::applyFormatChanges() | - | ||||||||||||||||||
| 47 | { | - | ||||||||||||||||||
| 48 | bool formatsChanged = false; | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | QTextLayout *layout = currentBlock.layout(); | - | ||||||||||||||||||
| 51 | - | |||||||||||||||||||
| 52 | QVector<QTextLayout::FormatRange> ranges = layout->formats(); | - | ||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | const int preeditAreaStart = layout->preeditAreaPosition(); | - | ||||||||||||||||||
| 55 | const int preeditAreaLength = layout->preeditAreaText().length(); | - | ||||||||||||||||||
| 56 | - | |||||||||||||||||||
| 57 | if (preeditAreaLength != 0
| 0 | ||||||||||||||||||
| 58 | auto isOutsidePreeditArea = [=](const QTextLayout::FormatRange &range) { | - | ||||||||||||||||||
| 59 | return never executed: range.start < preeditAreaStartreturn range.start < preeditAreaStart || range.start + range.length > preeditAreaStart + preeditAreaLength;never executed: return range.start < preeditAreaStart || range.start + range.length > preeditAreaStart + preeditAreaLength; | 0 | ||||||||||||||||||
| 60 | || range.start + range.length > preeditAreaStart + preeditAreaLength; never executed: return range.start < preeditAreaStart || range.start + range.length > preeditAreaStart + preeditAreaLength; | 0 | ||||||||||||||||||
| 61 | }; | - | ||||||||||||||||||
| 62 | const auto it = std::remove_if(ranges.begin(), ranges.end(), | - | ||||||||||||||||||
| 63 | isOutsidePreeditArea); | - | ||||||||||||||||||
| 64 | if (it != ranges.end()
| 0 | ||||||||||||||||||
| 65 | ranges.erase(it, ranges.end()); | - | ||||||||||||||||||
| 66 | formatsChanged = true; | - | ||||||||||||||||||
| 67 | } never executed: end of block | 0 | ||||||||||||||||||
| 68 | } never executed: else if (!ranges.isEmpty()end of block
| 0 | ||||||||||||||||||
| 69 | ranges.clear(); | - | ||||||||||||||||||
| 70 | formatsChanged = true; | - | ||||||||||||||||||
| 71 | } never executed: end of block | 0 | ||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | int i = 0; | - | ||||||||||||||||||
| 74 | while (i < formatChanges.count()
| 0 | ||||||||||||||||||
| 75 | QTextLayout::FormatRange r; | - | ||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 | while (i < formatChanges.count()
| 0 | ||||||||||||||||||
| 78 | ++ never executed: i;++i;never executed: ++i; | 0 | ||||||||||||||||||
| 79 | - | |||||||||||||||||||
| 80 | if (i == formatChanges.count()
| 0 | ||||||||||||||||||
| 81 | break; never executed: break; | 0 | ||||||||||||||||||
| 82 | - | |||||||||||||||||||
| 83 | r.start = i; | - | ||||||||||||||||||
| 84 | r.format = formatChanges.at(i); | - | ||||||||||||||||||
| 85 | - | |||||||||||||||||||
| 86 | while (i < formatChanges.count()
| 0 | ||||||||||||||||||
| 87 | ++ never executed: i;++i;never executed: ++i; | 0 | ||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | ((!(i <= formatChanges.count())) ? qt_assert("i <= formatChanges.count()",__FILE__,138) : qt_noop()); | - | ||||||||||||||||||
| 90 | r.length = i - r.start; | - | ||||||||||||||||||
| 91 | - | |||||||||||||||||||
| 92 | if (preeditAreaLength != 0
| 0 | ||||||||||||||||||
| 93 | if (r.start >= preeditAreaStart
| 0 | ||||||||||||||||||
| 94 | r.start += preeditAreaLength; never executed: r.start += preeditAreaLength; | 0 | ||||||||||||||||||
| 95 | else if (r.start + r.length >= preeditAreaStart
| 0 | ||||||||||||||||||
| 96 | r.length += preeditAreaLength; never executed: r.length += preeditAreaLength; | 0 | ||||||||||||||||||
| 97 | } never executed: end of block | 0 | ||||||||||||||||||
| 98 | - | |||||||||||||||||||
| 99 | ranges << r; | - | ||||||||||||||||||
| 100 | formatsChanged = true; | - | ||||||||||||||||||
| 101 | } never executed: end of block | 0 | ||||||||||||||||||
| 102 | - | |||||||||||||||||||
| 103 | if (formatsChanged
| 0 | ||||||||||||||||||
| 104 | layout->setFormats(ranges); | - | ||||||||||||||||||
| 105 | doc->markContentsDirty(currentBlock.position(), currentBlock.length()); | - | ||||||||||||||||||
| 106 | } never executed: end of block | 0 | ||||||||||||||||||
| 107 | } never executed: end of block | 0 | ||||||||||||||||||
| 108 | - | |||||||||||||||||||
| 109 | void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, int charsAdded) | - | ||||||||||||||||||
| 110 | { | - | ||||||||||||||||||
| 111 | if (!inReformatBlocks
| 0 | ||||||||||||||||||
| 112 | reformatBlocks(from, charsRemoved, charsAdded); never executed: reformatBlocks(from, charsRemoved, charsAdded); | 0 | ||||||||||||||||||
| 113 | } never executed: end of block | 0 | ||||||||||||||||||
| 114 | - | |||||||||||||||||||
| 115 | void QSyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int charsAdded) | - | ||||||||||||||||||
| 116 | { | - | ||||||||||||||||||
| 117 | rehighlightPending = false; | - | ||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | QTextBlock block = doc->findBlock(from); | - | ||||||||||||||||||
| 120 | if (!block.isValid()
| 0 | ||||||||||||||||||
| 121 | return; never executed: return; | 0 | ||||||||||||||||||
| 122 | - | |||||||||||||||||||
| 123 | int endPosition; | - | ||||||||||||||||||
| 124 | QTextBlock lastBlock = doc->findBlock(from + charsAdded + (charsRemoved > 0 ? 1 : 0)); | - | ||||||||||||||||||
| 125 | if (lastBlock.isValid()
| 0 | ||||||||||||||||||
| 126 | endPosition = lastBlock.position() + lastBlock.length(); never executed: endPosition = lastBlock.position() + lastBlock.length(); | 0 | ||||||||||||||||||
| 127 | else | - | ||||||||||||||||||
| 128 | endPosition = doc->docHandle()->length(); never executed: endPosition = doc->docHandle()->length(); | 0 | ||||||||||||||||||
| 129 | - | |||||||||||||||||||
| 130 | bool forceHighlightOfNextBlock = false; | - | ||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | while (block.isValid()
| 0 | ||||||||||||||||||
| 133 | const int stateBeforeHighlight = block.userState(); | - | ||||||||||||||||||
| 134 | - | |||||||||||||||||||
| 135 | reformatBlock(block); | - | ||||||||||||||||||
| 136 | - | |||||||||||||||||||
| 137 | forceHighlightOfNextBlock = (block.userState() != stateBeforeHighlight); | - | ||||||||||||||||||
| 138 | - | |||||||||||||||||||
| 139 | block = block.next(); | - | ||||||||||||||||||
| 140 | } never executed: end of block | 0 | ||||||||||||||||||
| 141 | - | |||||||||||||||||||
| 142 | formatChanges.clear(); | - | ||||||||||||||||||
| 143 | } never executed: end of block | 0 | ||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block) | - | ||||||||||||||||||
| 146 | { | - | ||||||||||||||||||
| 147 | QSyntaxHighlighter * const q = q_func(); | - | ||||||||||||||||||
| 148 | - | |||||||||||||||||||
| 149 | ((!(!currentBlock.isValid())) ? qt_assert_x("QSyntaxHighlighter::reformatBlock()", "reFormatBlock() called recursively",__FILE__,198) : qt_noop()); | - | ||||||||||||||||||
| 150 | - | |||||||||||||||||||
| 151 | currentBlock = block; | - | ||||||||||||||||||
| 152 | - | |||||||||||||||||||
| 153 | formatChanges.fill(QTextCharFormat(), block.length() - 1); | - | ||||||||||||||||||
| 154 | q->highlightBlock(block.text()); | - | ||||||||||||||||||
| 155 | applyFormatChanges(); | - | ||||||||||||||||||
| 156 | - | |||||||||||||||||||
| 157 | currentBlock = QTextBlock(); | - | ||||||||||||||||||
| 158 | } never executed: end of block | 0 | ||||||||||||||||||
| 159 | QSyntaxHighlighter::QSyntaxHighlighter(QObject *parent) | - | ||||||||||||||||||
| 160 | : QObject(*new QSyntaxHighlighterPrivate, parent) | - | ||||||||||||||||||
| 161 | { | - | ||||||||||||||||||
| 162 | if (parent->inherits("QTextEdit")
| 0 | ||||||||||||||||||
| 163 | QTextDocument *doc = parent->property("document").value<QTextDocument *>(); | - | ||||||||||||||||||
| 164 | if (doc
| 0 | ||||||||||||||||||
| 165 | setDocument(doc); never executed: setDocument(doc); | 0 | ||||||||||||||||||
| 166 | } never executed: end of block | 0 | ||||||||||||||||||
| 167 | } never executed: end of block | 0 | ||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | - | |||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | - | |||||||||||||||||||
| 172 | - | |||||||||||||||||||
| 173 | - | |||||||||||||||||||
| 174 | QSyntaxHighlighter::QSyntaxHighlighter(QTextDocument *parent) | - | ||||||||||||||||||
| 175 | : QObject(*new QSyntaxHighlighterPrivate, parent) | - | ||||||||||||||||||
| 176 | { | - | ||||||||||||||||||
| 177 | setDocument(parent); | - | ||||||||||||||||||
| 178 | } never executed: end of block | 0 | ||||||||||||||||||
| 179 | - | |||||||||||||||||||
| 180 | - | |||||||||||||||||||
| 181 | - | |||||||||||||||||||
| 182 | - | |||||||||||||||||||
| 183 | QSyntaxHighlighter::~QSyntaxHighlighter() | - | ||||||||||||||||||
| 184 | { | - | ||||||||||||||||||
| 185 | setDocument(0); | - | ||||||||||||||||||
| 186 | } never executed: end of block | 0 | ||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | - | |||||||||||||||||||
| 190 | - | |||||||||||||||||||
| 191 | - | |||||||||||||||||||
| 192 | void QSyntaxHighlighter::setDocument(QTextDocument *doc) | - | ||||||||||||||||||
| 193 | { | - | ||||||||||||||||||
| 194 | QSyntaxHighlighterPrivate * const d = d_func(); | - | ||||||||||||||||||
| 195 | if (d->doc
| 0 | ||||||||||||||||||
| 196 | disconnect(d->doc, qFlagLocation("2""contentsChange(int,int,int)" "\0" __FILE__ ":" "334"), | - | ||||||||||||||||||
| 197 | this, qFlagLocation("1""_q_reformatBlocks(int,int,int)" "\0" __FILE__ ":" "335")); | - | ||||||||||||||||||
| 198 | - | |||||||||||||||||||
| 199 | QTextCursor cursor(d->doc); | - | ||||||||||||||||||
| 200 | cursor.beginEditBlock(); | - | ||||||||||||||||||
| 201 | for (QTextBlock blk = d->doc->begin(); blk.isValid()
| 0 | ||||||||||||||||||
| 202 | blk.layout()->clearFormats(); never executed: blk.layout()->clearFormats(); | 0 | ||||||||||||||||||
| 203 | cursor.endEditBlock(); | - | ||||||||||||||||||
| 204 | } never executed: end of block | 0 | ||||||||||||||||||
| 205 | d->doc = doc; | - | ||||||||||||||||||
| 206 | if (d->doc
| 0 | ||||||||||||||||||
| 207 | connect(d->doc, qFlagLocation("2""contentsChange(int,int,int)" "\0" __FILE__ ":" "345"), | - | ||||||||||||||||||
| 208 | this, qFlagLocation("1""_q_reformatBlocks(int,int,int)" "\0" __FILE__ ":" "346")); | - | ||||||||||||||||||
| 209 | d->rehighlightPending = true; | - | ||||||||||||||||||
| 210 | QTimer::singleShot(0, this, qFlagLocation("1""_q_delayedRehighlight()" "\0" __FILE__ ":" "348")); | - | ||||||||||||||||||
| 211 | } never executed: end of block | 0 | ||||||||||||||||||
| 212 | } never executed: end of block | 0 | ||||||||||||||||||
| 213 | - | |||||||||||||||||||
| 214 | - | |||||||||||||||||||
| 215 | - | |||||||||||||||||||
| 216 | - | |||||||||||||||||||
| 217 | - | |||||||||||||||||||
| 218 | QTextDocument *QSyntaxHighlighter::document() const | - | ||||||||||||||||||
| 219 | { | - | ||||||||||||||||||
| 220 | const QSyntaxHighlighterPrivate * const d = d_func(); | - | ||||||||||||||||||
| 221 | return never executed: d->doc;return d->doc;never executed: return d->doc; | 0 | ||||||||||||||||||
| 222 | } | - | ||||||||||||||||||
| 223 | void QSyntaxHighlighter::rehighlight() | - | ||||||||||||||||||
| 224 | { | - | ||||||||||||||||||
| 225 | QSyntaxHighlighterPrivate * const d = d_func(); | - | ||||||||||||||||||
| 226 | if (!d->doc
| 0 | ||||||||||||||||||
| 227 | return; never executed: return; | 0 | ||||||||||||||||||
| 228 | - | |||||||||||||||||||
| 229 | QTextCursor cursor(d->doc); | - | ||||||||||||||||||
| 230 | d->rehighlight(cursor, QTextCursor::End); | - | ||||||||||||||||||
| 231 | } never executed: end of block | 0 | ||||||||||||||||||
| 232 | void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block) | - | ||||||||||||||||||
| 233 | { | - | ||||||||||||||||||
| 234 | QSyntaxHighlighterPrivate * const d = d_func(); | - | ||||||||||||||||||
| 235 | if (!d->doc
| 0 | ||||||||||||||||||
| 236 | return; never executed: return; | 0 | ||||||||||||||||||
| 237 | - | |||||||||||||||||||
| 238 | const bool rehighlightPending = d->rehighlightPending; | - | ||||||||||||||||||
| 239 | - | |||||||||||||||||||
| 240 | QTextCursor cursor(block); | - | ||||||||||||||||||
| 241 | d->rehighlight(cursor, QTextCursor::EndOfBlock); | - | ||||||||||||||||||
| 242 | - | |||||||||||||||||||
| 243 | if (rehighlightPending
| 0 | ||||||||||||||||||
| 244 | d->rehighlightPending = rehighlightPending; never executed: d->rehighlightPending = rehighlightPending; | 0 | ||||||||||||||||||
| 245 | } never executed: end of block | 0 | ||||||||||||||||||
| 246 | void QSyntaxHighlighter::setFormat(int start, int count, const QTextCharFormat &format) | - | ||||||||||||||||||
| 247 | { | - | ||||||||||||||||||
| 248 | QSyntaxHighlighterPrivate * const d = d_func(); | - | ||||||||||||||||||
| 249 | if (start < 0
| 0 | ||||||||||||||||||
| 250 | return; never executed: return; | 0 | ||||||||||||||||||
| 251 | - | |||||||||||||||||||
| 252 | const int end = qMin(start + count, d->formatChanges.count()); | - | ||||||||||||||||||
| 253 | for (int i = start; i < end
| 0 | ||||||||||||||||||
| 254 | d->formatChanges[i] = format; never executed: d->formatChanges[i] = format; | 0 | ||||||||||||||||||
| 255 | } never executed: end of block | 0 | ||||||||||||||||||
| 256 | void QSyntaxHighlighter::setFormat(int start, int count, const QColor &color) | - | ||||||||||||||||||
| 257 | { | - | ||||||||||||||||||
| 258 | QTextCharFormat format; | - | ||||||||||||||||||
| 259 | format.setForeground(color); | - | ||||||||||||||||||
| 260 | setFormat(start, count, format); | - | ||||||||||||||||||
| 261 | } never executed: end of block | 0 | ||||||||||||||||||
| 262 | void QSyntaxHighlighter::setFormat(int start, int count, const QFont &font) | - | ||||||||||||||||||
| 263 | { | - | ||||||||||||||||||
| 264 | QTextCharFormat format; | - | ||||||||||||||||||
| 265 | format.setFont(font); | - | ||||||||||||||||||
| 266 | setFormat(start, count, format); | - | ||||||||||||||||||
| 267 | } never executed: end of block | 0 | ||||||||||||||||||
| 268 | - | |||||||||||||||||||
| 269 | - | |||||||||||||||||||
| 270 | - | |||||||||||||||||||
| 271 | - | |||||||||||||||||||
| 272 | - | |||||||||||||||||||
| 273 | - | |||||||||||||||||||
| 274 | - | |||||||||||||||||||
| 275 | QTextCharFormat QSyntaxHighlighter::format(int pos) const | - | ||||||||||||||||||
| 276 | { | - | ||||||||||||||||||
| 277 | const QSyntaxHighlighterPrivate * const d = d_func(); | - | ||||||||||||||||||
| 278 | if (pos < 0
| 0 | ||||||||||||||||||
| 279 | return never executed: QTextCharFormat();return QTextCharFormat();never executed: return QTextCharFormat(); | 0 | ||||||||||||||||||
| 280 | return never executed: d->formatChanges.at(pos);return d->formatChanges.at(pos);never executed: return d->formatChanges.at(pos); | 0 | ||||||||||||||||||
| 281 | } | - | ||||||||||||||||||
| 282 | int QSyntaxHighlighter::previousBlockState() const | - | ||||||||||||||||||
| 283 | { | - | ||||||||||||||||||
| 284 | const QSyntaxHighlighterPrivate * const d = d_func(); | - | ||||||||||||||||||
| 285 | if (!d->currentBlock.isValid()
| 0 | ||||||||||||||||||
| 286 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 287 | - | |||||||||||||||||||
| 288 | const QTextBlock previous = d->currentBlock.previous(); | - | ||||||||||||||||||
| 289 | if (!previous.isValid()
| 0 | ||||||||||||||||||
| 290 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 291 | - | |||||||||||||||||||
| 292 | return never executed: previous.userState();return previous.userState();never executed: return previous.userState(); | 0 | ||||||||||||||||||
| 293 | } | - | ||||||||||||||||||
| 294 | - | |||||||||||||||||||
| 295 | - | |||||||||||||||||||
| 296 | - | |||||||||||||||||||
| 297 | - | |||||||||||||||||||
| 298 | - | |||||||||||||||||||
| 299 | int QSyntaxHighlighter::currentBlockState() const | - | ||||||||||||||||||
| 300 | { | - | ||||||||||||||||||
| 301 | const QSyntaxHighlighterPrivate * const d = d_func(); | - | ||||||||||||||||||
| 302 | if (!d->currentBlock.isValid()
| 0 | ||||||||||||||||||
| 303 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 304 | - | |||||||||||||||||||
| 305 | return never executed: d->currentBlock.userState();return d->currentBlock.userState();never executed: return d->currentBlock.userState(); | 0 | ||||||||||||||||||
| 306 | } | - | ||||||||||||||||||
| 307 | - | |||||||||||||||||||
| 308 | - | |||||||||||||||||||
| 309 | - | |||||||||||||||||||
| 310 | - | |||||||||||||||||||
| 311 | - | |||||||||||||||||||
| 312 | - | |||||||||||||||||||
| 313 | void QSyntaxHighlighter::setCurrentBlockState(int newState) | - | ||||||||||||||||||
| 314 | { | - | ||||||||||||||||||
| 315 | QSyntaxHighlighterPrivate * const d = d_func(); | - | ||||||||||||||||||
| 316 | if (!d->currentBlock.isValid()
| 0 | ||||||||||||||||||
| 317 | return; never executed: return; | 0 | ||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | d->currentBlock.setUserState(newState); | - | ||||||||||||||||||
| 320 | } never executed: end of block | 0 | ||||||||||||||||||
| 321 | void QSyntaxHighlighter::setCurrentBlockUserData(QTextBlockUserData *data) | - | ||||||||||||||||||
| 322 | { | - | ||||||||||||||||||
| 323 | QSyntaxHighlighterPrivate * const d = d_func(); | - | ||||||||||||||||||
| 324 | if (!d->currentBlock.isValid()
| 0 | ||||||||||||||||||
| 325 | return; never executed: return; | 0 | ||||||||||||||||||
| 326 | - | |||||||||||||||||||
| 327 | d->currentBlock.setUserData(data); | - | ||||||||||||||||||
| 328 | } never executed: end of block | 0 | ||||||||||||||||||
| 329 | - | |||||||||||||||||||
| 330 | - | |||||||||||||||||||
| 331 | - | |||||||||||||||||||
| 332 | - | |||||||||||||||||||
| 333 | - | |||||||||||||||||||
| 334 | - | |||||||||||||||||||
| 335 | - | |||||||||||||||||||
| 336 | QTextBlockUserData *QSyntaxHighlighter::currentBlockUserData() const | - | ||||||||||||||||||
| 337 | { | - | ||||||||||||||||||
| 338 | const QSyntaxHighlighterPrivate * const d = d_func(); | - | ||||||||||||||||||
| 339 | if (!d->currentBlock.isValid()
| 0 | ||||||||||||||||||
| 340 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 341 | - | |||||||||||||||||||
| 342 | return never executed: d->currentBlock.userData();return d->currentBlock.userData();never executed: return d->currentBlock.userData(); | 0 | ||||||||||||||||||
| 343 | } | - | ||||||||||||||||||
| 344 | - | |||||||||||||||||||
| 345 | - | |||||||||||||||||||
| 346 | - | |||||||||||||||||||
| 347 | - | |||||||||||||||||||
| 348 | - | |||||||||||||||||||
| 349 | - | |||||||||||||||||||
| 350 | QTextBlock QSyntaxHighlighter::currentBlock() const | - | ||||||||||||||||||
| 351 | { | - | ||||||||||||||||||
| 352 | const QSyntaxHighlighterPrivate * const d = d_func(); | - | ||||||||||||||||||
| 353 | return never executed: d->currentBlock;return d->currentBlock;never executed: return d->currentBlock; | 0 | ||||||||||||||||||
| 354 | } | - | ||||||||||||||||||
| 355 | - | |||||||||||||||||||
| 356 | - | |||||||||||||||||||
| 357 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |