![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
Public Types | |
enum | CheckSubjectStringOption { CheckSubjectString , DontCheckSubjectString , CheckSubjectString , DontCheckSubjectString } |
enum | CheckSubjectStringOption { CheckSubjectString , DontCheckSubjectString , CheckSubjectString , DontCheckSubjectString } |
Public Attributes | |
QRegularExpression::PatternOptions | patternOptions |
QString | pattern |
QMutex | mutex |
pcre2_code_16 * | compiledPattern |
int | errorCode |
qsizetype | errorOffset |
int | capturingCount |
bool | usingCrLfNewlines |
bool | isDirty |
![]() | |
QAtomicInt | ref |
Definition at line 705 of file qregularexpression.cpp.
Enumerator | |
---|---|
CheckSubjectString | |
DontCheckSubjectString | |
CheckSubjectString | |
DontCheckSubjectString |
Definition at line 716 of file qregularexpression.cpp.
Enumerator | |
---|---|
CheckSubjectString | |
DontCheckSubjectString | |
CheckSubjectString | |
DontCheckSubjectString |
Definition at line 716 of file qregularexpression.cpp.
QRegularExpressionPrivate::QRegularExpressionPrivate | ( | ) |
Definition at line 823 of file qregularexpression.cpp.
References QRegularExpressionPrivate(), capturingCount, compiledPattern, errorCode, isDirty, and usingCrLfNewlines.
Referenced by QRegularExpressionPrivate().
QRegularExpressionPrivate::~QRegularExpressionPrivate | ( | ) |
Definition at line 840 of file qregularexpression.cpp.
References cleanCompiledPattern().
QRegularExpressionPrivate::QRegularExpressionPrivate | ( | const QRegularExpressionPrivate & | other | ) |
Copies the private, which means copying only the pattern and the pattern options. The compiledPattern pointer is NOT copied (we do not own it any more), and in general all the members set when compiling a pattern are set to default values. isDirty is set back to true so that the pattern has to be recompiled again.
Definition at line 854 of file qregularexpression.cpp.
References QRegularExpressionPrivate(), capturingCount, compiledPattern, errorCode, isDirty, and usingCrLfNewlines.
Referenced by QRegularExpressionPrivate().
QRegularExpressionPrivate::QRegularExpressionPrivate | ( | ) |
QRegularExpressionPrivate::~QRegularExpressionPrivate | ( | ) |
QRegularExpressionPrivate::QRegularExpressionPrivate | ( | const QRegularExpressionPrivate & | other | ) |
int QRegularExpressionPrivate::captureIndexForName | ( | QAnyStringView | name | ) | const |
Returns the capturing group number for the given name. Duplicated names for capturing groups are not supported.
Definition at line 1018 of file qregularexpression.cpp.
References compiledPattern.
int QRegularExpressionPrivate::captureIndexForName | ( | QAnyStringView | name | ) | const |
void QRegularExpressionPrivate::cleanCompiledPattern | ( | ) |
Definition at line 871 of file qregularexpression.cpp.
References capturingCount, compiledPattern, errorCode, and usingCrLfNewlines.
Referenced by ~QRegularExpressionPrivate(), and compilePattern().
void QRegularExpressionPrivate::cleanCompiledPattern | ( | ) |
void QRegularExpressionPrivate::compilePattern | ( | ) |
Definition at line 884 of file qregularexpression.cpp.
References cleanCompiledPattern(), compiledPattern, errorCode, getPatternInfo(), isDirty, and optimizePattern().
void QRegularExpressionPrivate::compilePattern | ( | ) |
void QRegularExpressionPrivate::doMatch | ( | QRegularExpressionMatchPrivate * | priv, |
qsizetype | offset, | ||
CheckSubjectStringOption | checkSubjectStringOption = CheckSubjectString, | ||
const QRegularExpressionMatchPrivate * | previous = nullptr ) const |
Performs a match on the subject string view held by priv. The match will be of type priv->matchType and using the options priv->matchOptions; the matching offset is relative the substring, and if negative, it's taken as an offset from the end of the substring.
It also advances a match if a previous result is given as previous. The subject string goes a Unicode validity check if checkSubjectString is CheckSubjectString and the match options don't include DontCheckSubjectStringMatchOption (PCRE doesn't like illegal UTF-16 sequences).
priv is modified to hold the results of the match.
Advancing a match is a tricky algorithm. If the previous match matched a non-empty string, we just do an ordinary match at the offset position.
If the previous match matched an empty string, then an anchored, non-empty match is attempted at the offset position. If that succeeds, then we got the next match and we can return it. Otherwise, we advance by 1 position (which can be one or two code units in UTF-16!) and reattempt a "normal" match. We also have the problem of detecting the current newline format: if the new advanced offset is pointing to the beginning of a CRLF sequence, we must advance over it.
Definition at line 1103 of file qregularexpression.cpp.
References QRegularExpressionMatchPrivate::capturedCount, compiledPattern, DontCheckSubjectString, QRegularExpressionMatchPrivate::hasMatch, QRegularExpressionMatchPrivate::hasPartialMatch, QRegularExpressionMatchPrivate::isValid, qtPcreCallback(), and usingCrLfNewlines.
void QRegularExpressionPrivate::doMatch | ( | QRegularExpressionMatchPrivate * | priv, |
qsizetype | offset, | ||
CheckSubjectStringOption | checkSubjectStringOption = CheckSubjectString, | ||
const QRegularExpressionMatchPrivate * | previous = nullptr ) const |
void QRegularExpressionPrivate::getPatternInfo | ( | ) |
Definition at line 920 of file qregularexpression.cpp.
References capturingCount, compiledPattern, and usingCrLfNewlines.
Referenced by compilePattern().
void QRegularExpressionPrivate::getPatternInfo | ( | ) |
void QRegularExpressionPrivate::optimizePattern | ( | ) |
The purpose of the function is to call pcre2_jit_compile_16, which JIT-compiles the pattern.
It gets called when a pattern is recompiled by us (in compilePattern()), under mutex protection.
Definition at line 1000 of file qregularexpression.cpp.
References compiledPattern, and isJitEnabled().
Referenced by compilePattern().
void QRegularExpressionPrivate::optimizePattern | ( | ) |
int QRegularExpressionPrivate::capturingCount |
Definition at line 743 of file qregularexpression.cpp.
Referenced by QRegularExpressionPrivate(), QRegularExpressionPrivate(), cleanCompiledPattern(), and getPatternInfo().
pcre2_code_16 * QRegularExpressionPrivate::compiledPattern |
Definition at line 740 of file qregularexpression.cpp.
Referenced by QRegularExpressionPrivate(), QRegularExpressionPrivate(), captureIndexForName(), cleanCompiledPattern(), compilePattern(), doMatch(), getPatternInfo(), and optimizePattern().
int QRegularExpressionPrivate::errorCode |
Definition at line 741 of file qregularexpression.cpp.
Referenced by QRegularExpressionPrivate(), QRegularExpressionPrivate(), cleanCompiledPattern(), and compilePattern().
qsizetype QRegularExpressionPrivate::errorOffset |
Definition at line 742 of file qregularexpression.cpp.
bool QRegularExpressionPrivate::isDirty |
Definition at line 745 of file qregularexpression.cpp.
Referenced by QRegularExpressionPrivate(), QRegularExpressionPrivate(), and compilePattern().
|
mutable |
Definition at line 735 of file qregularexpression.cpp.
QString QRegularExpressionPrivate::pattern |
Definition at line 730 of file qregularexpression.cpp.
QRegularExpression::PatternOptions QRegularExpressionPrivate::patternOptions |
Definition at line 729 of file qregularexpression.cpp.
bool QRegularExpressionPrivate::usingCrLfNewlines |
Definition at line 744 of file qregularexpression.cpp.
Referenced by QRegularExpressionPrivate(), QRegularExpressionPrivate(), cleanCompiledPattern(), doMatch(), and getPatternInfo().