tools/qregularexpression.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5static const unsigned int qt_qregularexpression_optimize_after_use_count = 10; -
6 -
7 -
8 -
9 -
10 -
11static int convertToPcreOptions(QRegularExpression::PatternOptions patternOptions) -
12{ -
13 int options = 0; -
14 -
15 if (patternOptions & QRegularExpression::CaseInsensitiveOption)
evaluated: patternOptions & QRegularExpression::CaseInsensitiveOption
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:329
40-329
16 options |= 0x00000001;
executed: options |= 0x00000001;
Execution Count:40
40
17 if (patternOptions & QRegularExpression::DotMatchesEverythingOption)
evaluated: patternOptions & QRegularExpression::DotMatchesEverythingOption
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:314
55-314
18 options |= 0x00000004;
executed: options |= 0x00000004;
Execution Count:55
55
19 if (patternOptions & QRegularExpression::MultilineOption)
evaluated: patternOptions & QRegularExpression::MultilineOption
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:367
2-367
20 options |= 0x00000002;
executed: options |= 0x00000002;
Execution Count:2
2
21 if (patternOptions & QRegularExpression::ExtendedPatternSyntaxOption)
evaluated: patternOptions & QRegularExpression::ExtendedPatternSyntaxOption
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:368
1-368
22 options |= 0x00000008;
executed: options |= 0x00000008;
Execution Count:1
1
23 if (patternOptions & QRegularExpression::InvertedGreedinessOption)
evaluated: patternOptions & QRegularExpression::InvertedGreedinessOption
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:368
1-368
24 options |= 0x00000200;
executed: options |= 0x00000200;
Execution Count:1
1
25 if (patternOptions & QRegularExpression::DontCaptureOption)
evaluated: patternOptions & QRegularExpression::DontCaptureOption
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:368
1-368
26 options |= 0x00001000;
executed: options |= 0x00001000;
Execution Count:1
1
27 if (patternOptions & QRegularExpression::UseUnicodePropertiesOption)
evaluated: patternOptions & QRegularExpression::UseUnicodePropertiesOption
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:368
1-368
28 options |= 0x20000000;
executed: options |= 0x20000000;
Execution Count:1
1
29 -
30 return options;
executed: return options;
Execution Count:369
369
31} -
32 -
33 -
34 -
35 -
36static int convertToPcreOptions(QRegularExpression::MatchOptions matchOptions) -
37{ -
38 int options = 0; -
39 -
40 if (matchOptions & QRegularExpression::AnchoredMatchOption)
evaluated: matchOptions & QRegularExpression::AnchoredMatchOption
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:884
10-884
41 options |= 0x00000010;
executed: options |= 0x00000010;
Execution Count:10
10
42 -
43 return options;
executed: return options;
Execution Count:894
894
44} -
45 -
46struct QRegularExpressionPrivate : QSharedData -
47{ -
48 QRegularExpressionPrivate(); -
49 ~QRegularExpressionPrivate(); -
50 QRegularExpressionPrivate(const QRegularExpressionPrivate &other); -
51 -
52 void cleanCompiledPattern(); -
53 void compilePattern(); -
54 void getPatternInfo(); -
55 pcre16_extra *optimizePattern(); -
56 -
57 QRegularExpressionMatchPrivate *doMatch(const QString &subject, -
58 int offset, -
59 QRegularExpression::MatchType matchType, -
60 QRegularExpression::MatchOptions matchOptions, -
61 bool checkSubjectString = true, -
62 const QRegularExpressionMatchPrivate *previous = 0) const; -
63 -
64 int captureIndexForName(const QString &name) const; -
65 -
66 QString pattern; -
67 QRegularExpression::PatternOptions patternOptions; -
68 -
69 -
70 -
71 -
72 -
73 -
74 -
75 QMutex mutex; -
76 -
77 -
78 -
79 -
80 pcre16 *compiledPattern; -
81 pcre16_extra *studyData; -
82 const char *errorString; -
83 int errorOffset; -
84 int capturingCount; -
85 unsigned int usedCount; -
86 bool usingCrLfNewlines; -
87 bool isDirty; -
88}; -
89 -
90struct QRegularExpressionMatchPrivate : QSharedData -
91{ -
92 QRegularExpressionMatchPrivate(const QRegularExpression &re, -
93 const QString &subject, -
94 QRegularExpression::MatchType matchType, -
95 QRegularExpression::MatchOptions matchOptions, -
96 int capturingCount); -
97 -
98 QRegularExpressionMatch nextMatch() const; -
99 -
100 const QRegularExpression regularExpression; -
101 const QString subject; -
102 -
103 -
104 QVector<int> capturedOffsets; -
105 -
106 const QRegularExpression::MatchType matchType; -
107 const QRegularExpression::MatchOptions matchOptions; -
108 -
109 int capturedCount; -
110 -
111 bool hasMatch; -
112 bool hasPartialMatch; -
113 bool isValid; -
114}; -
115 -
116struct QRegularExpressionMatchIteratorPrivate : QSharedData -
117{ -
118 QRegularExpressionMatchIteratorPrivate(const QRegularExpression &re, -
119 QRegularExpression::MatchType matchType, -
120 QRegularExpression::MatchOptions matchOptions, -
121 const QRegularExpressionMatch &next); -
122 -
123 bool hasNext() const; -
124 QRegularExpressionMatch next; -
125 const QRegularExpression regularExpression; -
126 const QRegularExpression::MatchType matchType; -
127 const QRegularExpression::MatchOptions matchOptions; -
128}; -
129 -
130 -
131 -
132 -
133QRegularExpression::QRegularExpression(QRegularExpressionPrivate &dd) -
134 : d(&dd) -
135{ -
136}
executed: }
Execution Count:902
902
137 -
138 -
139 -
140 -
141QRegularExpressionPrivate::QRegularExpressionPrivate() -
142 : pattern(), patternOptions(0), -
143 mutex(), -
144 compiledPattern(0), studyData(0), -
145 errorString(0), errorOffset(-1), -
146 capturingCount(0), -
147 usedCount(0), -
148 usingCrLfNewlines(false), -
149 isDirty(true) -
150{ -
151}
executed: }
Execution Count:582
582
152 -
153 -
154 -
155 -
156QRegularExpressionPrivate::~QRegularExpressionPrivate() -
157{ -
158 cleanCompiledPattern(); -
159}
executed: }
Execution Count:583
583
160QRegularExpressionPrivate::QRegularExpressionPrivate(const QRegularExpressionPrivate &other) -
161 : QSharedData(other), -
162 pattern(other.pattern), patternOptions(other.patternOptions), -
163 mutex(), -
164 compiledPattern(0), studyData(0), -
165 errorString(0), -
166 errorOffset(-1), capturingCount(0), -
167 usedCount(0), -
168 usingCrLfNewlines(false), isDirty(true) -
169{ -
170}
executed: }
Execution Count:1
1
171 -
172 -
173 -
174 -
175void QRegularExpressionPrivate::cleanCompiledPattern() -
176{ -
177 pcre16_free(compiledPattern); -
178 pcre16_free_study(studyData); -
179 usedCount = 0; -
180 compiledPattern = 0; -
181 studyData = 0; -
182 usingCrLfNewlines = false; -
183 errorOffset = -1; -
184 capturingCount = 0; -
185}
executed: }
Execution Count:952
952
186 -
187 -
188 -
189 -
190void QRegularExpressionPrivate::compilePattern() -
191{ -
192 QMutexLocker lock(&mutex); -
193 -
194 if (!isDirty)
evaluated: !isDirty
TRUEFALSE
yes
Evaluation Count:892
yes
Evaluation Count:369
369-892
195 return;
executed: return;
Execution Count:892
892
196 -
197 isDirty = false; -
198 cleanCompiledPattern(); -
199 -
200 int options = convertToPcreOptions(patternOptions); -
201 options |= 0x00000800; -
202 -
203 int errorCode; -
204 compiledPattern = pcre16_compile2(pattern.utf16(), options, -
205 &errorCode, &errorString, &errorOffset, 0); -
206 -
207 if (!compiledPattern)
evaluated: !compiledPattern
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:357
12-357
208 return;
executed: return;
Execution Count:12
12
209 -
210 qt_noop(); -
211 qt_noop(); -
212 errorOffset = -1; -
213 -
214 getPatternInfo(); -
215}
executed: }
Execution Count:357
357
216 -
217 -
218 -
219 -
220void QRegularExpressionPrivate::getPatternInfo() -
221{ -
222 qt_noop(); -
223 -
224 pcre16_fullinfo(compiledPattern, 0, 2, &capturingCount); -
225 -
226 -
227 unsigned long int patternNewlineSetting; -
228 pcre16_fullinfo(compiledPattern, studyData, 0, &patternNewlineSetting); -
229 patternNewlineSetting &= 0x00100000 | 0x00200000 | 0x00300000 -
230 | 0x00400000 | 0x00500000; -
231 if (patternNewlineSetting == 0) {
evaluated: patternNewlineSetting == 0
TRUEFALSE
yes
Evaluation Count:354
yes
Evaluation Count:3
3-354
232 -
233 int pcreNewlineSetting; -
234 pcre16_config(1, &pcreNewlineSetting); -
235 switch (pcreNewlineSetting) { -
236 case 13: -
237 patternNewlineSetting = 0x00100000; break;
never executed: break;
0
238 case 10: -
239 patternNewlineSetting = 0x00200000; break;
executed: break;
Execution Count:354
354
240 case 3338: -
241 patternNewlineSetting = 0x00300000; break;
never executed: break;
0
242 case -2: -
243 patternNewlineSetting = 0x00500000; break;
never executed: break;
0
244 case -1: -
245 patternNewlineSetting = 0x00400000; break;
never executed: break;
0
246 default: -
247 QMessageLogger("tools/qregularexpression.cpp", 998, __PRETTY_FUNCTION__).warning("QRegularExpressionPrivate::compilePattern(): " -
248 "PCRE_CONFIG_NEWLINE returned an unknown newline"); -
249 break;
never executed: break;
0
250 } -
251 }
executed: }
Execution Count:354
354
252 -
253 usingCrLfNewlines = (patternNewlineSetting == 0x00300000) ||
evaluated: (patternNewlineSetting == 0x00300000)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:355
2-355
254 (patternNewlineSetting == 0x00400000) ||
partially evaluated: (patternNewlineSetting == 0x00400000)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:355
0-355
255 (patternNewlineSetting == 0x00500000);
evaluated: (patternNewlineSetting == 0x00500000)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:354
1-354
256}
executed: }
Execution Count:357
357
257 -
258 -
259 -
260 -
261 -
262 -
263class QPcreJitStackPointer -
264{ -
265 QPcreJitStackPointer(const QPcreJitStackPointer &) = delete; QPcreJitStackPointer &operator=(const QPcreJitStackPointer &) = delete;; -
266 -
267public: -
268 -
269 -
270 -
271 QPcreJitStackPointer() -
272 { -
273 -
274 -
275 stack = pcre16_jit_stack_alloc(32*1024, 512*1024); -
276 }
never executed: }
0
277 -
278 -
279 -
280 ~QPcreJitStackPointer() -
281 { -
282 if (stack)
never evaluated: stack
0
283 pcre16_jit_stack_free(stack);
never executed: pcre16_jit_stack_free(stack);
0
284 }
never executed: }
0
285 -
286 pcre16_jit_stack *stack; -
287}; -
288 -
289static QThreadStorage<QPcreJitStackPointer *> *jitStacks() { static QGlobalStatic<QThreadStorage<QPcreJitStackPointer *> > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QThreadStorage<QPcreJitStackPointer *> *x = new QThreadStorage<QPcreJitStackPointer *>; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QThreadStorage<QPcreJitStackPointer *> > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:170
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:172
0-172
290 -
291 -
292 -
293 -
294static pcre16_jit_stack *qtPcreCallback(void *) -
295{ -
296 if (jitStacks()->hasLocalData())
partially evaluated: jitStacks()->hasLocalData()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:172
0-172
297 return jitStacks()->localData()->stack;
never executed: return jitStacks()->localData()->stack;
0
298 -
299 return 0;
executed: return 0;
Execution Count:172
172
300} -
301 -
302 -
303 -
304 -
305static bool isJitEnabled() -
306{ -
307 QByteArray jitEnvironment = qgetenv("QT_ENABLE_REGEXP_JIT"); -
308 if (!jitEnvironment.isEmpty()) {
partially evaluated: !jitEnvironment.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
309 bool ok; -
310 int enableJit = jitEnvironment.toInt(&ok); -
311 return ok ? (enableJit != 0) : true;
never executed: return ok ? (enableJit != 0) : true;
0
312 } -
313 -
314 -
315 -
316 -
317 return true;
executed: return true;
Execution Count:2
2
318 -
319} -
320pcre16_extra *QRegularExpressionPrivate::optimizePattern() -
321{ -
322 qt_noop(); -
323 -
324 QMutexLocker lock(&mutex); -
325 -
326 if (studyData || (++usedCount != qt_qregularexpression_optimize_after_use_count))
evaluated: studyData
TRUEFALSE
yes
Evaluation Count:168
yes
Evaluation Count:726
evaluated: (++usedCount != qt_qregularexpression_optimize_after_use_count)
TRUEFALSE
yes
Evaluation Count:711
yes
Evaluation Count:15
15-726
327 return studyData;
executed: return studyData;
Execution Count:879
879
328 -
329 static const bool enableJit = isJitEnabled(); -
330 -
331 int studyOptions = 0; -
332 if (enableJit)
partially evaluated: enableJit
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
333 studyOptions |= 0x0001;
executed: studyOptions |= 0x0001;
Execution Count:15
15
334 -
335 const char *err; -
336 studyData = pcre16_study(compiledPattern, studyOptions, &err); -
337 -
338 if (studyData && studyData->flags & 0x0040)
partially evaluated: studyData
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
partially evaluated: studyData->flags & 0x0040
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
339 pcre16_assign_jit_stack(studyData, qtPcreCallback, 0);
executed: pcre16_assign_jit_stack(studyData, qtPcreCallback, 0);
Execution Count:15
15
340 -
341 if (!studyData && err)
partially evaluated: !studyData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
never evaluated: err
0-15
342 QMessageLogger("tools/qregularexpression.cpp", 1112, __PRETTY_FUNCTION__).warning("QRegularExpressionPrivate::optimizePattern(): pcre_study failed: %s", err);
never executed: QMessageLogger("tools/qregularexpression.cpp", 1112, __PRETTY_FUNCTION__).warning("QRegularExpressionPrivate::optimizePattern(): pcre_study failed: %s", err);
0
343 -
344 return studyData;
executed: return studyData;
Execution Count:15
15
345} -
346 -
347 -
348 -
349 -
350 -
351 -
352 -
353int QRegularExpressionPrivate::captureIndexForName(const QString &name) const -
354{ -
355 qt_noop(); -
356 -
357 if (!compiledPattern)
partially evaluated: !compiledPattern
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
358 return -1;
never executed: return -1;
0
359 -
360 int index = pcre16_get_stringnumber(compiledPattern, name.utf16()); -
361 if (index >= 0)
evaluated: index >= 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:6
6
362 return index;
executed: return index;
Execution Count:6
6
363 -
364 return -1;
executed: return -1;
Execution Count:6
6
365} -
366static int pcre16SafeExec(const pcre16 *code, const pcre16_extra *extra, -
367 const unsigned short *subject, int length, -
368 int startOffset, int options, -
369 int *ovector, int ovecsize) -
370{ -
371 int result = pcre16_exec(code, extra, subject, length, -
372 startOffset, options, ovector, ovecsize); -
373 -
374 if (result == (-27) && !jitStacks()->hasLocalData()) {
partially evaluated: result == (-27)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:990
never evaluated: !jitStacks()->hasLocalData()
0-990
375 QPcreJitStackPointer *p = new QPcreJitStackPointer; -
376 jitStacks()->setLocalData(p); -
377 -
378 result = pcre16_exec(code, extra, subject, length, -
379 startOffset, options, ovector, ovecsize); -
380 }
never executed: }
0
381 -
382 return result;
executed: return result;
Execution Count:990
990
383} -
384QRegularExpressionMatchPrivate *QRegularExpressionPrivate::doMatch(const QString &subject, -
385 int offset, -
386 QRegularExpression::MatchType matchType, -
387 QRegularExpression::MatchOptions matchOptions, -
388 bool checkSubjectString, -
389 const QRegularExpressionMatchPrivate *previous) const -
390{ -
391 if (offset < 0)
evaluated: offset < 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:897
5-897
392 offset += subject.length();
executed: offset += subject.length();
Execution Count:5
5
393 -
394 QRegularExpression re(*const_cast<QRegularExpressionPrivate *>(this)); -
395 -
396 if (offset < 0 || offset > subject.length())
partially evaluated: offset < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:902
partially evaluated: offset > subject.length()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:902
0-902
397 return new QRegularExpressionMatchPrivate(re, subject, matchType, matchOptions, 0);
never executed: return new QRegularExpressionMatchPrivate(re, subject, matchType, matchOptions, 0);
0
398 -
399 if (!compiledPattern) {
evaluated: !compiledPattern
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:894
8-894
400 QMessageLogger("tools/qregularexpression.cpp", 1199, __PRETTY_FUNCTION__).warning("QRegularExpressionPrivate::doMatch(): called on an invalid QRegularExpression object"); -
401 return new QRegularExpressionMatchPrivate(re, subject, matchType, matchOptions, 0);
executed: return new QRegularExpressionMatchPrivate(re, subject, matchType, matchOptions, 0);
Execution Count:8
8
402 } -
403 -
404 QRegularExpressionMatchPrivate *priv = new QRegularExpressionMatchPrivate(re, subject, -
405 matchType, matchOptions, -
406 capturingCount); -
407 -
408 -
409 const pcre16_extra *currentStudyData = const_cast<QRegularExpressionPrivate *>(this)->optimizePattern(); -
410 -
411 int pcreOptions = convertToPcreOptions(matchOptions); -
412 -
413 if (matchType == QRegularExpression::PartialPreferCompleteMatch)
evaluated: matchType == QRegularExpression::PartialPreferCompleteMatch
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:884
10-884
414 pcreOptions |= 0x00008000;
executed: pcreOptions |= 0x00008000;
Execution Count:10
10
415 else if (matchType == QRegularExpression::PartialPreferFirstMatch)
evaluated: matchType == QRegularExpression::PartialPreferFirstMatch
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:871
13-871
416 pcreOptions |= 0x08000000;
executed: pcreOptions |= 0x08000000;
Execution Count:13
13
417 -
418 if (!checkSubjectString)
evaluated: !checkSubjectString
TRUEFALSE
yes
Evaluation Count:561
yes
Evaluation Count:333
333-561
419 pcreOptions |= 0x00002000;
executed: pcreOptions |= 0x00002000;
Execution Count:561
561
420 -
421 bool previousMatchWasEmpty = false; -
422 if (previous && previous->hasMatch &&
evaluated: previous
TRUEFALSE
yes
Evaluation Count:561
yes
Evaluation Count:333
partially evaluated: previous->hasMatch
TRUEFALSE
yes
Evaluation Count:561
no
Evaluation Count:0
0-561
423 (previous->capturedOffsets.at(0) == previous->capturedOffsets.at(1))) {
evaluated: (previous->capturedOffsets.at(0) == previous->capturedOffsets.at(1))
TRUEFALSE
yes
Evaluation Count:100
yes
Evaluation Count:461
100-461
424 previousMatchWasEmpty = true; -
425 }
executed: }
Execution Count:100
100
426 -
427 int * const captureOffsets = priv->capturedOffsets.data(); -
428 const int captureOffsetsCount = priv->capturedOffsets.size(); -
429 -
430 const unsigned short * const subjectUtf16 = subject.utf16(); -
431 const int subjectLength = subject.length(); -
432 -
433 int result; -
434 -
435 if (!previousMatchWasEmpty) {
evaluated: !previousMatchWasEmpty
TRUEFALSE
yes
Evaluation Count:794
yes
Evaluation Count:100
100-794
436 result = pcre16SafeExec(compiledPattern, currentStudyData, -
437 subjectUtf16, subjectLength, -
438 offset, pcreOptions, -
439 captureOffsets, captureOffsetsCount); -
440 } else {
executed: }
Execution Count:794
794
441 result = pcre16SafeExec(compiledPattern, currentStudyData, -
442 subjectUtf16, subjectLength, -
443 offset, pcreOptions | 0x10000000 | 0x00000010, -
444 captureOffsets, captureOffsetsCount); -
445 -
446 if (result == (-1)) {
evaluated: result == (-1)
TRUEFALSE
yes
Evaluation Count:96
yes
Evaluation Count:4
4-96
447 ++offset; -
448 -
449 if (usingCrLfNewlines
evaluated: usingCrLfNewlines
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:74
22-74
450 && offset < subjectLength
evaluated: offset < subjectLength
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:6
6-16
451 && subjectUtf16[offset - 1] == QLatin1Char('\r')
evaluated: subjectUtf16[offset - 1] == QLatin1Char('\r')
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:2
2-14
452 && subjectUtf16[offset] == QLatin1Char('\n')) {
evaluated: subjectUtf16[offset] == QLatin1Char('\n')
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2
2-12
453 ++offset; -
454 } else if (offset < subjectLength
evaluated: offset < subjectLength
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:33
executed: }
Execution Count:12
12-51
455 && QChar::isLowSurrogate(subjectUtf16[offset])) {
evaluated: QChar::isLowSurrogate(subjectUtf16[offset])
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:45
6-45
456 ++offset; -
457 }
executed: }
Execution Count:6
6
458 -
459 result = pcre16SafeExec(compiledPattern, currentStudyData, -
460 subjectUtf16, subjectLength, -
461 offset, pcreOptions, -
462 captureOffsets, captureOffsetsCount); -
463 }
executed: }
Execution Count:96
96
464 }
executed: }
Execution Count:100
100
465 qt_noop(); -
466 -
467 if (result > 0) {
evaluated: result > 0
TRUEFALSE
yes
Evaluation Count:644
yes
Evaluation Count:250
250-644
468 -
469 priv->isValid = true; -
470 priv->hasMatch = true; -
471 priv->capturedCount = result; -
472 priv->capturedOffsets.resize(result * 2); -
473 } else {
executed: }
Execution Count:644
644
474 -
475 priv->hasPartialMatch = (result == (-12)); -
476 priv->isValid = (result == (-1) || result == (-12));
evaluated: result == (-1)
TRUEFALSE
yes
Evaluation Count:205
yes
Evaluation Count:45
evaluated: result == (-12)
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:28
17-205
477 -
478 if (result == (-12)) {
evaluated: result == (-12)
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:233
17-233
479 -
480 -
481 priv->capturedCount = 1; -
482 priv->capturedOffsets.resize(2); -
483 } else {
executed: }
Execution Count:17
17
484 -
485 priv->capturedCount = 0; -
486 priv->capturedOffsets.clear(); -
487 }
executed: }
Execution Count:233
233
488 } -
489 -
490 return priv;
executed: return priv;
Execution Count:894
894
491} -
492 -
493 -
494 -
495 -
496QRegularExpressionMatchPrivate::QRegularExpressionMatchPrivate(const QRegularExpression &re, -
497 const QString &subject, -
498 QRegularExpression::MatchType matchType, -
499 QRegularExpression::MatchOptions matchOptions, -
500 int capturingCount) -
501 : regularExpression(re), subject(subject), -
502 matchType(matchType), matchOptions(matchOptions), -
503 capturedCount(0), -
504 hasMatch(false), hasPartialMatch(false), isValid(false) -
505{ -
506 qt_noop(); -
507 const int captureOffsetsCount = (capturingCount + 1) * 3; -
508 capturedOffsets.resize(captureOffsetsCount); -
509}
executed: }
Execution Count:902
902
510 -
511 -
512 -
513 -
514 -
515QRegularExpressionMatch QRegularExpressionMatchPrivate::nextMatch() const -
516{ -
517 qt_noop(); -
518 qt_noop(); -
519 -
520 -
521 -
522 -
523 -
524 QRegularExpressionMatchPrivate *nextPrivate = regularExpression.d->doMatch(subject, -
525 capturedOffsets.at(1), -
526 matchType, -
527 matchOptions, -
528 false, -
529 this); -
530 return QRegularExpressionMatch(*nextPrivate);
executed: return QRegularExpressionMatch(*nextPrivate);
Execution Count:561
561
531} -
532 -
533 -
534 -
535 -
536QRegularExpressionMatchIteratorPrivate::QRegularExpressionMatchIteratorPrivate(const QRegularExpression &re, -
537 QRegularExpression::MatchType matchType, -
538 QRegularExpression::MatchOptions matchOptions, -
539 const QRegularExpressionMatch &next) -
540 : next(next), -
541 regularExpression(re), -
542 matchType(matchType), matchOptions(matchOptions) -
543{ -
544}
executed: }
Execution Count:138
138
545 -
546 -
547 -
548 -
549bool QRegularExpressionMatchIteratorPrivate::hasNext() const -
550{ -
551 return next.isValid() && (next.hasMatch() || next.hasPartialMatch());
executed: return next.isValid() && (next.hasMatch() || next.hasPartialMatch());
Execution Count:1350
1350
552} -
553QRegularExpression::QRegularExpression() -
554 : d(new QRegularExpressionPrivate) -
555{ -
556}
executed: }
Execution Count:64
64
557 -
558 -
559 -
560 -
561 -
562 -
563 -
564QRegularExpression::QRegularExpression(const QString &pattern, PatternOptions options) -
565 : d(new QRegularExpressionPrivate) -
566{ -
567 d->pattern = pattern; -
568 d->patternOptions = options; -
569}
executed: }
Execution Count:518
518
570 -
571 -
572 -
573 -
574 -
575 -
576QRegularExpression::QRegularExpression(const QRegularExpression &re) -
577 : d(re.d) -
578{ -
579}
executed: }
Execution Count:1951
1951
580 -
581 -
582 -
583 -
584QRegularExpression::~QRegularExpression() -
585{ -
586} -
587 -
588 -
589 -
590 -
591 -
592QRegularExpression &QRegularExpression::operator=(const QRegularExpression &re) -
593{ -
594 d = re.d; -
595 return *this;
executed: return *this;
Execution Count:48
48
596} -
597QString QRegularExpression::pattern() const -
598{ -
599 return d->pattern;
executed: return d->pattern;
Execution Count:98
98
600} -
601 -
602 -
603 -
604 -
605 -
606 -
607 -
608void QRegularExpression::setPattern(const QString &pattern) -
609{ -
610 d.detach(); -
611 d->isDirty = true; -
612 d->pattern = pattern; -
613}
executed: }
Execution Count:37
37
614 -
615 -
616 -
617 -
618 -
619 -
620QRegularExpression::PatternOptions QRegularExpression::patternOptions() const -
621{ -
622 return d->patternOptions;
executed: return d->patternOptions;
Execution Count:99
99
623} -
624 -
625 -
626 -
627 -
628 -
629 -
630 -
631void QRegularExpression::setPatternOptions(PatternOptions options) -
632{ -
633 d.detach(); -
634 d->isDirty = true; -
635 d->patternOptions = options; -
636}
executed: }
Execution Count:38
38
637 -
638 -
639 -
640 -
641 -
642 -
643 -
644int QRegularExpression::captureCount() const -
645{ -
646 if (!isValid())
evaluated: !isValid()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:32
6-32
647 return -1;
executed: return -1;
Execution Count:6
6
648 return d->capturingCount;
executed: return d->capturingCount;
Execution Count:32
32
649} -
650bool QRegularExpression::isValid() const -
651{ -
652 d.data()->compilePattern(); -
653 return d->compiledPattern;
executed: return d->compiledPattern;
Execution Count:696
696
654} -
655 -
656 -
657 -
658 -
659 -
660 -
661 -
662QString QRegularExpression::errorString() const -
663{ -
664 d.data()->compilePattern(); -
665 if (d->errorString)
partially evaluated: d->errorString
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:224
0-224
666 return QCoreApplication::translate("QRegularExpression", d->errorString);
never executed: return QCoreApplication::translate("QRegularExpression", d->errorString);
0
667 return QCoreApplication::translate("QRegularExpression", "no error");
executed: return QCoreApplication::translate("QRegularExpression", "no error");
Execution Count:224
224
668} -
669int QRegularExpression::patternErrorOffset() const -
670{ -
671 d.data()->compilePattern(); -
672 return d->errorOffset;
never executed: return d->errorOffset;
0
673} -
674QRegularExpressionMatch QRegularExpression::match(const QString &subject, -
675 int offset, -
676 MatchType matchType, -
677 MatchOptions matchOptions) const -
678{ -
679 d.data()->compilePattern(); -
680 -
681 QRegularExpressionMatchPrivate *priv = d->doMatch(subject, offset, matchType, matchOptions); -
682 return QRegularExpressionMatch(*priv);
executed: return QRegularExpressionMatch(*priv);
Execution Count:341
341
683} -
684QRegularExpressionMatchIterator QRegularExpression::globalMatch(const QString &subject, -
685 int offset, -
686 MatchType matchType, -
687 MatchOptions matchOptions) const -
688{ -
689 QRegularExpressionMatchIteratorPrivate *priv = -
690 new QRegularExpressionMatchIteratorPrivate(*this, -
691 matchType, -
692 matchOptions, -
693 match(subject, offset, matchType, matchOptions)); -
694 -
695 return QRegularExpressionMatchIterator(*priv);
executed: return QRegularExpressionMatchIterator(*priv);
Execution Count:138
138
696} -
697bool QRegularExpression::operator==(const QRegularExpression &re) const -
698{ -
699 return (d == re.d) || 993
700 (d->pattern == re.d->pattern && d->patternOptions == re.d->patternOptions);
executed: return (d == re.d) || (d->pattern == re.d->pattern && d->patternOptions == re.d->patternOptions);
Execution Count:993
993
701} -
702QString QRegularExpression::escape(const QString &str) -
703{ -
704 QString result; -
705 const int count = str.size(); -
706 result.reserve(count * 2); -
707 -
708 -
709 -
710 for (int i = 0; i < count; ++i) {
evaluated: i < count
TRUEFALSE
yes
Evaluation Count:4317
yes
Evaluation Count:120
120-4317
711 const QChar current = str.at(i); -
712 -
713 if (current == QChar::Null) {
evaluated: current == QChar::Null
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:4311
6-4311
714 -
715 -
716 -
717 result.append(QLatin1Char('\\')); -
718 result.append(QLatin1Char('0')); -
719 } else if ( (current < QLatin1Char('a') || current > QLatin1Char('z')) &&
evaluated: current < QLatin1Char('a')
TRUEFALSE
yes
Evaluation Count:147
yes
Evaluation Count:4164
evaluated: current > QLatin1Char('z')
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:4146
executed: }
Execution Count:6
6-4164
720 (current < QLatin1Char('A') || current > QLatin1Char('Z')) &&
evaluated: current < QLatin1Char('A')
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:113
evaluated: current > QLatin1Char('Z')
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:87
26-113
721 (current < QLatin1Char('0') || current > QLatin1Char('9')) &&
evaluated: current < QLatin1Char('0')
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:43
evaluated: current > QLatin1Char('9')
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:11
11-43
722 current != QLatin1Char('_') )
evaluated: current != QLatin1Char('_')
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:1
1-66
723 { -
724 result.append(QLatin1Char('\\')); -
725 result.append(current); -
726 if (current.isHighSurrogate() && i < (count - 1))
evaluated: current.isHighSurrogate()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:63
partially evaluated: i < (count - 1)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-63
727 result.append(str.at(++i));
executed: result.append(str.at(++i));
Execution Count:3
3
728 } else {
executed: }
Execution Count:66
66
729 result.append(current); -
730 }
executed: }
Execution Count:4245
4245
731 } -
732 -
733 result.squeeze(); -
734 return result;
executed: return result;
Execution Count:120
120
735} -
736 -
737 -
738 -
739 -
740QRegularExpressionMatch::~QRegularExpressionMatch() -
741{ -
742} -
743 -
744 -
745 -
746 -
747 -
748 -
749QRegularExpressionMatch::QRegularExpressionMatch(const QRegularExpressionMatch &match) -
750 : d(match.d) -
751{ -
752}
executed: }
Execution Count:1355
1355
753 -
754 -
755 -
756 -
757 -
758QRegularExpressionMatch &QRegularExpressionMatch::operator=(const QRegularExpressionMatch &match) -
759{ -
760 d = match.d; -
761 return *this;
never executed: return *this;
0
762} -
763QRegularExpressionMatch::QRegularExpressionMatch(QRegularExpressionMatchPrivate &dd) -
764 : d(&dd) -
765{ -
766}
executed: }
Execution Count:902
902
767 -
768 -
769 -
770 -
771 -
772 -
773 -
774QRegularExpression QRegularExpressionMatch::regularExpression() const -
775{ -
776 return d->regularExpression;
executed: return d->regularExpression;
Execution Count:252
252
777} -
778QRegularExpression::MatchType QRegularExpressionMatch::matchType() const -
779{ -
780 return d->matchType;
executed: return d->matchType;
Execution Count:65
65
781} -
782QRegularExpression::MatchOptions QRegularExpressionMatch::matchOptions() const -
783{ -
784 return d->matchOptions;
executed: return d->matchOptions;
Execution Count:65
65
785} -
786int QRegularExpressionMatch::lastCapturedIndex() const -
787{ -
788 return d->capturedCount - 1;
executed: return d->capturedCount - 1;
Execution Count:6677
6677
789} -
790QString QRegularExpressionMatch::captured(int nth) const -
791{ -
792 if (nth < 0 || nth > lastCapturedIndex())
partially evaluated: nth < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:523
evaluated: nth > lastCapturedIndex()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:513
0-523
793 return QString();
executed: return QString();
Execution Count:10
10
794 -
795 int start = capturedStart(nth); -
796 -
797 if (start == -1)
evaluated: start == -1
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:511
2-511
798 return QString();
executed: return QString();
Execution Count:2
2
799 -
800 return d->subject.mid(start, capturedLength(nth));
executed: return d->subject.mid(start, capturedLength(nth));
Execution Count:511
511
801} -
802QStringRef QRegularExpressionMatch::capturedRef(int nth) const -
803{ -
804 if (nth < 0 || nth > lastCapturedIndex())
partially evaluated: nth < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:224
partially evaluated: nth > lastCapturedIndex()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:224
0-224
805 return QStringRef();
never executed: return QStringRef();
0
806 -
807 int start = capturedStart(nth); -
808 -
809 if (start == -1)
evaluated: start == -1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:223
1-223
810 return QStringRef();
executed: return QStringRef();
Execution Count:1
1
811 -
812 return d->subject.midRef(start, capturedLength(nth));
executed: return d->subject.midRef(start, capturedLength(nth));
Execution Count:223
223
813} -
814QString QRegularExpressionMatch::captured(const QString &name) const -
815{ -
816 if (name.isEmpty()) {
evaluated: name.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:12
4-12
817 QMessageLogger("tools/qregularexpression.cpp", 1791, __PRETTY_FUNCTION__).warning("QRegularExpressionMatch::captured: empty capturing group name passed"); -
818 return QString();
executed: return QString();
Execution Count:4
4
819 } -
820 int nth = d->regularExpression.d->captureIndexForName(name); -
821 if (nth == -1)
evaluated: nth == -1
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:6
6
822 return QString();
executed: return QString();
Execution Count:6
6
823 return captured(nth);
executed: return captured(nth);
Execution Count:6
6
824} -
825QStringRef QRegularExpressionMatch::capturedRef(const QString &name) const -
826{ -
827 if (name.isEmpty()) {
never evaluated: name.isEmpty()
0
828 QMessageLogger("tools/qregularexpression.cpp", 1811, __PRETTY_FUNCTION__).warning("QRegularExpressionMatch::capturedRef: empty capturing group name passed"); -
829 return QStringRef();
never executed: return QStringRef();
0
830 } -
831 int nth = d->regularExpression.d->captureIndexForName(name); -
832 if (nth == -1)
never evaluated: nth == -1
0
833 return QStringRef();
never executed: return QStringRef();
0
834 return capturedRef(nth);
never executed: return capturedRef(nth);
0
835} -
836 -
837 -
838 -
839 -
840 -
841QStringList QRegularExpressionMatch::capturedTexts() const -
842{ -
843 QStringList texts; -
844 for (int i = 0; i <= lastCapturedIndex(); ++i)
never evaluated: i <= lastCapturedIndex()
0
845 texts << captured(i);
never executed: texts << captured(i);
0
846 return texts;
never executed: return texts;
0
847} -
848int QRegularExpressionMatch::capturedStart(int nth) const -
849{ -
850 if (nth < 0 || nth > lastCapturedIndex())
partially evaluated: nth < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2917
evaluated: nth > lastCapturedIndex()
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:2897
0-2917
851 return -1;
executed: return -1;
Execution Count:20
20
852 -
853 return d->capturedOffsets.at(nth * 2);
executed: return d->capturedOffsets.at(nth * 2);
Execution Count:2897
2897
854} -
855int QRegularExpressionMatch::capturedLength(int nth) const -
856{ -
857 -
858 return capturedEnd(nth) - capturedStart(nth);
executed: return capturedEnd(nth) - capturedStart(nth);
Execution Count:1280
1280
859} -
860int QRegularExpressionMatch::capturedEnd(int nth) const -
861{ -
862 if (nth < 0 || nth > lastCapturedIndex())
partially evaluated: nth < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1799
evaluated: nth > lastCapturedIndex()
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:1779
0-1799
863 return -1;
executed: return -1;
Execution Count:20
20
864 -
865 return d->capturedOffsets.at(nth * 2 + 1);
executed: return d->capturedOffsets.at(nth * 2 + 1);
Execution Count:1779
1779
866} -
867int QRegularExpressionMatch::capturedStart(const QString &name) const -
868{ -
869 if (name.isEmpty()) {
never evaluated: name.isEmpty()
0
870 QMessageLogger("tools/qregularexpression.cpp", 1888, __PRETTY_FUNCTION__).warning("QRegularExpressionMatch::capturedStart: empty capturing group name passed"); -
871 return -1;
never executed: return -1;
0
872 } -
873 int nth = d->regularExpression.d->captureIndexForName(name); -
874 if (nth == -1)
never evaluated: nth == -1
0
875 return -1;
never executed: return -1;
0
876 return capturedStart(nth);
never executed: return capturedStart(nth);
0
877} -
878int QRegularExpressionMatch::capturedLength(const QString &name) const -
879{ -
880 if (name.isEmpty()) {
never evaluated: name.isEmpty()
0
881 QMessageLogger("tools/qregularexpression.cpp", 1909, __PRETTY_FUNCTION__).warning("QRegularExpressionMatch::capturedLength: empty capturing group name passed"); -
882 return 0;
never executed: return 0;
0
883 } -
884 int nth = d->regularExpression.d->captureIndexForName(name); -
885 if (nth == -1)
never evaluated: nth == -1
0
886 return 0;
never executed: return 0;
0
887 return capturedLength(nth);
never executed: return capturedLength(nth);
0
888} -
889int QRegularExpressionMatch::capturedEnd(const QString &name) const -
890{ -
891 if (name.isEmpty()) {
never evaluated: name.isEmpty()
0
892 QMessageLogger("tools/qregularexpression.cpp", 1929, __PRETTY_FUNCTION__).warning("QRegularExpressionMatch::capturedEnd: empty capturing group name passed"); -
893 return -1;
never executed: return -1;
0
894 } -
895 int nth = d->regularExpression.d->captureIndexForName(name); -
896 if (nth == -1)
never evaluated: nth == -1
0
897 return -1;
never executed: return -1;
0
898 return capturedEnd(nth);
never executed: return capturedEnd(nth);
0
899} -
900 -
901 -
902 -
903 -
904 -
905 -
906 -
907bool QRegularExpressionMatch::hasMatch() const -
908{ -
909 return d->hasMatch;
executed: return d->hasMatch;
Execution Count:2268
2268
910} -
911bool QRegularExpressionMatch::hasPartialMatch() const -
912{ -
913 return d->hasPartialMatch;
executed: return d->hasPartialMatch;
Execution Count:756
756
914} -
915bool QRegularExpressionMatch::isValid() const -
916{ -
917 return d->isValid;
executed: return d->isValid;
Execution Count:2020
2020
918} -
919 -
920 -
921 -
922 -
923QRegularExpressionMatchIterator::QRegularExpressionMatchIterator(QRegularExpressionMatchIteratorPrivate &dd) -
924 : d(&dd) -
925{ -
926}
executed: }
Execution Count:138
138
927 -
928 -
929 -
930 -
931QRegularExpressionMatchIterator::~QRegularExpressionMatchIterator() -
932{ -
933} -
934 -
935 -
936 -
937 -
938 -
939 -
940 -
941QRegularExpressionMatchIterator::QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator) -
942 : d(iterator.d) -
943{ -
944}
executed: }
Execution Count:26
26
945 -
946 -
947 -
948 -
949 -
950QRegularExpressionMatchIterator &QRegularExpressionMatchIterator::operator=(const QRegularExpressionMatchIterator &iterator) -
951{ -
952 d = iterator.d; -
953 return *this;
never executed: return *this;
0
954} -
955bool QRegularExpressionMatchIterator::isValid() const -
956{ -
957 return d->next.isValid();
executed: return d->next.isValid();
Execution Count:35
35
958} -
959 -
960 -
961 -
962 -
963 -
964 -
965 -
966bool QRegularExpressionMatchIterator::hasNext() const -
967{ -
968 return d->hasNext();
executed: return d->hasNext();
Execution Count:1350
1350
969} -
970 -
971 -
972 -
973 -
974 -
975 -
976 -
977QRegularExpressionMatch QRegularExpressionMatchIterator::peekNext() const -
978{ -
979 if (!hasNext())
evaluated: !hasNext()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:65
2-65
980 QMessageLogger("tools/qregularexpression.cpp", 2052, __PRETTY_FUNCTION__).warning("QRegularExpressionMatchIterator::peekNext() called on an iterator already at end");
executed: QMessageLogger("tools/qregularexpression.cpp", 2052, __PRETTY_FUNCTION__).warning("QRegularExpressionMatchIterator::peekNext() called on an iterator already at end");
Execution Count:2
2
981 -
982 return d->next;
executed: return d->next;
Execution Count:67
67
983} -
984 -
985 -
986 -
987 -
988 -
989 -
990 -
991QRegularExpressionMatch QRegularExpressionMatchIterator::next() -
992{ -
993 if (!hasNext()) {
evaluated: !hasNext()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:561
2-561
994 QMessageLogger("tools/qregularexpression.cpp", 2066, __PRETTY_FUNCTION__).warning("QRegularExpressionMatchIterator::next() called on an iterator already at end"); -
995 return d->next;
executed: return d->next;
Execution Count:2
2
996 } -
997 -
998 QRegularExpressionMatch current = d->next; -
999 d->next = d->next.d.constData()->nextMatch(); -
1000 return current;
executed: return current;
Execution Count:561
561
1001} -
1002 -
1003 -
1004 -
1005 -
1006 -
1007 -
1008 -
1009QRegularExpression QRegularExpressionMatchIterator::regularExpression() const -
1010{ -
1011 return d->regularExpression;
executed: return d->regularExpression;
Execution Count:65
65
1012} -
1013QRegularExpression::MatchType QRegularExpressionMatchIterator::matchType() const -
1014{ -
1015 return d->matchType;
executed: return d->matchType;
Execution Count:65
65
1016} -
1017QRegularExpression::MatchOptions QRegularExpressionMatchIterator::matchOptions() const -
1018{ -
1019 return d->matchOptions;
executed: return d->matchOptions;
Execution Count:65
65
1020} -
1021QDataStream &operator<<(QDataStream &out, const QRegularExpression &re) -
1022{ -
1023 out << re.pattern() << quint32(re.patternOptions()); -
1024 return out;
executed: return out;
Execution Count:19
19
1025} -
1026QDataStream &operator>>(QDataStream &in, QRegularExpression &re) -
1027{ -
1028 QString pattern; -
1029 quint32 patternOptions; -
1030 in >> pattern >> patternOptions; -
1031 re.setPattern(pattern); -
1032 re.setPatternOptions(QRegularExpression::PatternOptions(patternOptions)); -
1033 return in;
executed: return in;
Execution Count:22
22
1034} -
1035QDebug operator<<(QDebug debug, const QRegularExpression &re) -
1036{ -
1037 debug.nospace() << "QRegularExpression(" << re.pattern() << ", " << re.patternOptions() << ")"; -
1038 return debug.space();
executed: return debug.space();
Execution Count:1
1
1039} -
1040QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOptions) -
1041{ -
1042 QByteArray flags; -
1043 -
1044 if (patternOptions == QRegularExpression::NoPatternOption) {
partially evaluated: patternOptions == QRegularExpression::NoPatternOption
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1045 flags = "NoPatternOption"; -
1046 } else {
executed: }
Execution Count:1
1
1047 flags.reserve(200); -
1048 if (patternOptions & QRegularExpression::CaseInsensitiveOption)
never evaluated: patternOptions & QRegularExpression::CaseInsensitiveOption
0
1049 flags.append("CaseInsensitiveOption|");
never executed: flags.append("CaseInsensitiveOption|");
0
1050 if (patternOptions & QRegularExpression::DotMatchesEverythingOption)
never evaluated: patternOptions & QRegularExpression::DotMatchesEverythingOption
0
1051 flags.append("DotMatchesEverythingOption|");
never executed: flags.append("DotMatchesEverythingOption|");
0
1052 if (patternOptions & QRegularExpression::MultilineOption)
never evaluated: patternOptions & QRegularExpression::MultilineOption
0
1053 flags.append("MultilineOption|");
never executed: flags.append("MultilineOption|");
0
1054 if (patternOptions & QRegularExpression::ExtendedPatternSyntaxOption)
never evaluated: patternOptions & QRegularExpression::ExtendedPatternSyntaxOption
0
1055 flags.append("ExtendedPatternSyntaxOption|");
never executed: flags.append("ExtendedPatternSyntaxOption|");
0
1056 if (patternOptions & QRegularExpression::InvertedGreedinessOption)
never evaluated: patternOptions & QRegularExpression::InvertedGreedinessOption
0
1057 flags.append("InvertedGreedinessOption|");
never executed: flags.append("InvertedGreedinessOption|");
0
1058 if (patternOptions & QRegularExpression::DontCaptureOption)
never evaluated: patternOptions & QRegularExpression::DontCaptureOption
0
1059 flags.append("DontCaptureOption|");
never executed: flags.append("DontCaptureOption|");
0
1060 if (patternOptions & QRegularExpression::UseUnicodePropertiesOption)
never evaluated: patternOptions & QRegularExpression::UseUnicodePropertiesOption
0
1061 flags.append("UseUnicodePropertiesOption|");
never executed: flags.append("UseUnicodePropertiesOption|");
0
1062 flags.chop(1); -
1063 }
never executed: }
0
1064 -
1065 debug.nospace() << "QRegularExpression::PatternOptions(" << flags << ")"; -
1066 -
1067 return debug.space();
executed: return debug.space();
Execution Count:1
1
1068} -
1069QDebug operator<<(QDebug debug, const QRegularExpressionMatch &match) -
1070{ -
1071 debug.nospace() << "QRegularExpressionMatch("; -
1072 -
1073 if (!match.isValid()) {
never evaluated: !match.isValid()
0
1074 debug << "Invalid)"; -
1075 return debug.space();
never executed: return debug.space();
0
1076 } -
1077 -
1078 debug << "Valid"; -
1079 -
1080 if (match.hasMatch()) {
never evaluated: match.hasMatch()
0
1081 debug << ", has match: "; -
1082 for (int i = 0; i <= match.lastCapturedIndex(); ++i) {
never evaluated: i <= match.lastCapturedIndex()
0
1083 debug << i -
1084 << ":(" << match.capturedStart(i) << ", " << match.capturedEnd(i) -
1085 << ", " << match.captured(i) << ")"; -
1086 if (i < match.lastCapturedIndex())
never evaluated: i < match.lastCapturedIndex()
0
1087 debug << ", ";
never executed: debug << ", ";
0
1088 }
never executed: }
0
1089 } else if (match.hasPartialMatch()) {
never executed: }
never evaluated: match.hasPartialMatch()
0
1090 debug << ", has partial match: (" -
1091 << match.capturedStart(0) << ", " -
1092 << match.capturedEnd(0) << ", " -
1093 << match.captured(0) << ")"; -
1094 } else {
never executed: }
0
1095 debug << ", no match"; -
1096 }
never executed: }
0
1097 -
1098 debug << ")"; -
1099 -
1100 return debug.space();
never executed: return debug.space();
0
1101} -
1102 -
1103 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial