Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QRegularExpressionPrivate Struct Reference
Inheritance diagram for QRegularExpressionPrivate:
Collaboration diagram for QRegularExpressionPrivate:

Public Types

enum  CheckSubjectStringOption { CheckSubjectString , DontCheckSubjectString , CheckSubjectString , DontCheckSubjectString }
enum  CheckSubjectStringOption { CheckSubjectString , DontCheckSubjectString , CheckSubjectString , DontCheckSubjectString }

Public Member Functions

 QRegularExpressionPrivate ()
 ~QRegularExpressionPrivate ()
 QRegularExpressionPrivate (const QRegularExpressionPrivate &other)
void cleanCompiledPattern ()
void compilePattern ()
void getPatternInfo ()
void optimizePattern ()
void doMatch (QRegularExpressionMatchPrivate *priv, qsizetype offset, CheckSubjectStringOption checkSubjectStringOption=CheckSubjectString, const QRegularExpressionMatchPrivate *previous=nullptr) const
int captureIndexForName (QAnyStringView name) const
 QRegularExpressionPrivate ()
 ~QRegularExpressionPrivate ()
 QRegularExpressionPrivate (const QRegularExpressionPrivate &other)
void cleanCompiledPattern ()
void compilePattern ()
void getPatternInfo ()
void optimizePattern ()
void doMatch (QRegularExpressionMatchPrivate *priv, qsizetype offset, CheckSubjectStringOption checkSubjectStringOption=CheckSubjectString, const QRegularExpressionMatchPrivate *previous=nullptr) const
int captureIndexForName (QAnyStringView name) const
Public Member Functions inherited from QSharedData
 QSharedData () noexcept
 Constructs a QSharedData object with a reference count of 0.
 QSharedData (const QSharedData &) noexcept
 Constructs a QSharedData object with reference count 0.
QSharedDataoperator= (const QSharedData &)=delete
 ~QSharedData ()=default

Public Attributes

QRegularExpression::PatternOptions patternOptions
QString pattern
QMutex mutex
pcre2_code_16 * compiledPattern
int errorCode
qsizetype errorOffset
int capturingCount
bool usingCrLfNewlines
bool isDirty
Public Attributes inherited from QSharedData
QAtomicInt ref

Detailed Description

Definition at line 706 of file qregularexpression.cpp.

Member Enumeration Documentation

◆ CheckSubjectStringOption [1/2]

Enumerator
CheckSubjectString 
DontCheckSubjectString 
CheckSubjectString 
DontCheckSubjectString 

Definition at line 717 of file qregularexpression.cpp.

◆ CheckSubjectStringOption [2/2]

Enumerator
CheckSubjectString 
DontCheckSubjectString 
CheckSubjectString 
DontCheckSubjectString 

Definition at line 717 of file qregularexpression.cpp.

Constructor & Destructor Documentation

◆ QRegularExpressionPrivate() [1/4]

QRegularExpressionPrivate::QRegularExpressionPrivate ( )

Definition at line 825 of file qregularexpression.cpp.

References QRegularExpressionPrivate(), capturingCount, compiledPattern, errorCode, isDirty, and usingCrLfNewlines.

Referenced by QRegularExpressionPrivate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~QRegularExpressionPrivate() [1/2]

QRegularExpressionPrivate::~QRegularExpressionPrivate ( )

Definition at line 842 of file qregularexpression.cpp.

References cleanCompiledPattern().

Here is the call graph for this function:

◆ QRegularExpressionPrivate() [2/4]

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 856 of file qregularexpression.cpp.

References QRegularExpressionPrivate(), capturingCount, compiledPattern, errorCode, isDirty, and usingCrLfNewlines.

Referenced by QRegularExpressionPrivate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ QRegularExpressionPrivate() [3/4]

QRegularExpressionPrivate::QRegularExpressionPrivate ( )

◆ ~QRegularExpressionPrivate() [2/2]

QRegularExpressionPrivate::~QRegularExpressionPrivate ( )

◆ QRegularExpressionPrivate() [4/4]

QRegularExpressionPrivate::QRegularExpressionPrivate ( const QRegularExpressionPrivate & other)

Member Function Documentation

◆ captureIndexForName() [1/2]

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 1020 of file qregularexpression.cpp.

References compiledPattern.

◆ captureIndexForName() [2/2]

int QRegularExpressionPrivate::captureIndexForName ( QAnyStringView name) const

◆ cleanCompiledPattern() [1/2]

void QRegularExpressionPrivate::cleanCompiledPattern ( )

Definition at line 873 of file qregularexpression.cpp.

References capturingCount, compiledPattern, errorCode, and usingCrLfNewlines.

Referenced by ~QRegularExpressionPrivate(), and compilePattern().

Here is the caller graph for this function:

◆ cleanCompiledPattern() [2/2]

void QRegularExpressionPrivate::cleanCompiledPattern ( )

◆ compilePattern() [1/2]

void QRegularExpressionPrivate::compilePattern ( )

Definition at line 886 of file qregularexpression.cpp.

References cleanCompiledPattern(), compiledPattern, errorCode, getPatternInfo(), isDirty, and optimizePattern().

Here is the call graph for this function:

◆ compilePattern() [2/2]

void QRegularExpressionPrivate::compilePattern ( )

◆ doMatch() [1/2]

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 1105 of file qregularexpression.cpp.

References QRegularExpressionMatchPrivate::capturedCount, compiledPattern, DontCheckSubjectString, QRegularExpressionMatchPrivate::hasMatch, QRegularExpressionMatchPrivate::hasPartialMatch, QRegularExpressionMatchPrivate::isValid, qtPcreCallback(), and usingCrLfNewlines.

Here is the call graph for this function:

◆ doMatch() [2/2]

void QRegularExpressionPrivate::doMatch ( QRegularExpressionMatchPrivate * priv,
qsizetype offset,
CheckSubjectStringOption checkSubjectStringOption = CheckSubjectString,
const QRegularExpressionMatchPrivate * previous = nullptr ) const

◆ getPatternInfo() [1/2]

void QRegularExpressionPrivate::getPatternInfo ( )

Definition at line 922 of file qregularexpression.cpp.

References capturingCount, compiledPattern, and usingCrLfNewlines.

Referenced by compilePattern().

Here is the caller graph for this function:

◆ getPatternInfo() [2/2]

void QRegularExpressionPrivate::getPatternInfo ( )

◆ optimizePattern() [1/2]

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 1002 of file qregularexpression.cpp.

References compiledPattern, and isJitEnabled().

Referenced by compilePattern().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ optimizePattern() [2/2]

void QRegularExpressionPrivate::optimizePattern ( )

Member Data Documentation

◆ capturingCount

int QRegularExpressionPrivate::capturingCount

◆ compiledPattern

pcre2_code_16 * QRegularExpressionPrivate::compiledPattern

◆ errorCode

int QRegularExpressionPrivate::errorCode

◆ errorOffset

qsizetype QRegularExpressionPrivate::errorOffset

Definition at line 743 of file qregularexpression.cpp.

◆ isDirty

bool QRegularExpressionPrivate::isDirty

◆ mutex

QMutex QRegularExpressionPrivate::mutex
mutable

Definition at line 736 of file qregularexpression.cpp.

◆ pattern

QString QRegularExpressionPrivate::pattern

Definition at line 731 of file qregularexpression.cpp.

◆ patternOptions

QRegularExpression::PatternOptions QRegularExpressionPrivate::patternOptions

Definition at line 730 of file qregularexpression.cpp.

◆ usingCrLfNewlines

bool QRegularExpressionPrivate::usingCrLfNewlines

The documentation for this struct was generated from the following file: