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
qregularexpression.cpp File Reference

(c1a4f722eca79a1811304a47349d332d57a86704)

#include "qregularexpression.h"
#include <QtCore/qcoreapplication.h>
#include <QtCore/qhashfunctions.h>
#include <QtCore/qlist.h>
#include <QtCore/qmutex.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qdebug.h>
#include <QtCore/qglobal.h>
#include <QtCore/qatomic.h>
#include <QtCore/qdatastream.h>
#include <pcre2.h>
Include dependency graph for qregularexpression.cpp:

Go to the source code of this file.

Classes

struct  QRegularExpressionPrivate
struct  QRegularExpressionMatchPrivate
struct  QRegularExpressionMatchIteratorPrivate

Macros

#define PCRE2_CODE_UNIT_WIDTH   16

Functions

static int convertToPcreOptions (QRegularExpression::PatternOptions patternOptions)
static int convertToPcreOptions (QRegularExpression::MatchOptions matchOptions)
Q_DECL_COLD_FUNCTION void qtWarnAboutInvalidRegularExpression (const QString &pattern, const char *cls, const char *method)
static pcre2_jit_stack_16 * qtPcreCallback (void *)
static bool isJitEnabled ()
static int safe_pcre2_match_16 (const pcre2_code_16 *code, PCRE2_SPTR16 subject, qsizetype length, qsizetype startOffset, int options, pcre2_match_data_16 *matchData, pcre2_match_context_16 *matchContext)
bool comparesEqual (const QRegularExpression &lhs, const QRegularExpression &rhs)
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin (const QRegularExpressionMatchIterator &iterator)

Macro Definition Documentation

◆ PCRE2_CODE_UNIT_WIDTH

#define PCRE2_CODE_UNIT_WIDTH   16

Definition at line 23 of file qregularexpression.cpp.

Function Documentation

◆ begin()

◆ comparesEqual()

bool comparesEqual ( const QRegularExpression & lhs,
const QRegularExpression & rhs )
noexcept

Definition at line 1747 of file qregularexpression.cpp.

◆ convertToPcreOptions() [1/2]

int convertToPcreOptions ( QRegularExpression::MatchOptions matchOptions)
static

Definition at line 694 of file qregularexpression.cpp.

◆ convertToPcreOptions() [2/2]

int convertToPcreOptions ( QRegularExpression::PatternOptions patternOptions)
static

Definition at line 669 of file qregularexpression.cpp.

◆ isJitEnabled()

bool isJitEnabled ( )
static

Definition at line 975 of file qregularexpression.cpp.

Referenced by QRegularExpressionPrivate::optimizePattern().

Here is the caller graph for this function:

◆ qtPcreCallback()

pcre2_jit_stack_16 * qtPcreCallback ( void * )
static

Definition at line 967 of file qregularexpression.cpp.

Referenced by QRegularExpressionPrivate::doMatch().

Here is the caller graph for this function:

◆ qtWarnAboutInvalidRegularExpression()

Q_DECL_COLD_FUNCTION void qtWarnAboutInvalidRegularExpression ( const QString & pattern,
const char * cls,
const char * method )

Used to centralize the warning about using an invalid QRegularExpression. In case the pattern is an illegal UTF-16 string, we can't pass print it (pass it to qUtf16Printable, etc.), so we need to check for that.

Definition at line 803 of file qregularexpression.cpp.

◆ safe_pcre2_match_16()

int safe_pcre2_match_16 ( const pcre2_code_16 * code,
PCRE2_SPTR16 subject,
qsizetype length,
qsizetype startOffset,
int options,
pcre2_match_data_16 * matchData,
pcre2_match_context_16 * matchContext )
static

This is a simple wrapper for pcre2_match_16 for handling the case in which the JIT runs out of memory. In that case, we allocate a thread-local JIT stack and re-run pcre2_match_16.

Definition at line 1056 of file qregularexpression.cpp.