TTKMusicPlayer  4.3.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
TTKRegularExpression Class Reference

The class of the regular expression. More...

#include <ttkregularexpression.h>

Public Types

enum  PatternOption { NoPatternOption = 0x0000, CaseInsensitiveOption = 0x0001, InvertedGreedinessOption = 0x0010 }
 

Public Member Functions

 TTKRegularExpression ()
 
 TTKRegularExpression (const QString &pattern, int option=NoPatternOption)
 
QString pattern () const
 
void setPattern (const QString &v)
 
int patternOptions () const
 
void setPatternOptions (const int option)
 
bool hasMatch (const QString &str)
 
int match (const QString &str, int pos=0)
 
QString captured (int index) const
 
int capturedLength () const
 
bool isGreediness () const
 
void setGreediness (bool v)
 
bool isCaseSensitivity () const
 
void setCaseSensitivity (bool v)
 
const QRegExp & value () const
 
 operator QRegExp & ()
 
 operator const QRegExp & () const
 

Static Public Member Functions

static QString escape (const QString &str)
 

Private Attributes

QRegExp m_regular
 

Detailed Description

The class of the regular expression.

Author
Greedysky greed.nosp@m.ysky.nosp@m.@163..nosp@m.com

Definition at line 32 of file ttkregularexpression.h.

Member Enumeration Documentation

Enumerator
NoPatternOption 
CaseInsensitiveOption 
InvertedGreedinessOption 

Definition at line 35 of file ttkregularexpression.h.

Constructor & Destructor Documentation

TTKRegularExpression::TTKRegularExpression ( )

Object constructor.

Definition at line 3 of file ttkregularexpression.cpp.

TTKRegularExpression::TTKRegularExpression ( const QString &  pattern,
int  option = NoPatternOption 
)
explicit

Definition at line 12 of file ttkregularexpression.cpp.

Member Function Documentation

QString TTKRegularExpression::captured ( int  index) const
int TTKRegularExpression::capturedLength ( ) const

Returns the length of the substring captured by the nth capturing group.

Definition at line 88 of file ttkregularexpression.cpp.

References m_regular.

Referenced by MusicLrcAnalysis::matchLrcLine().

QString TTKRegularExpression::escape ( const QString &  str)
static

Escapes all characters of string.

Definition at line 137 of file ttkregularexpression.cpp.

bool TTKRegularExpression::hasMatch ( const QString &  str)

Returns true if the regular expression matched against the subject string, or false otherwise.

Definition at line 59 of file ttkregularexpression.cpp.

References m_regular.

bool TTKRegularExpression::isCaseSensitivity ( ) const

Returns the case sensitivity option.

Definition at line 117 of file ttkregularexpression.cpp.

References m_regular.

Referenced by patternOptions().

bool TTKRegularExpression::isGreediness ( ) const

Returns the greediness option.

Definition at line 97 of file ttkregularexpression.cpp.

References m_regular.

Referenced by patternOptions().

int TTKRegularExpression::match ( const QString &  str,
int  pos = 0 
)
TTKRegularExpression::operator const QRegExp & ( ) const

Definition at line 167 of file ttkregularexpression.cpp.

TTKRegularExpression::operator QRegExp & ( )

Definition at line 158 of file ttkregularexpression.cpp.

QString TTKRegularExpression::pattern ( ) const

Returns the pattern string of the regular expression.

Definition at line 21 of file ttkregularexpression.cpp.

References m_regular.

int TTKRegularExpression::patternOptions ( ) const

Returns the pattern options for the regular expression.

Definition at line 31 of file ttkregularexpression.cpp.

References isCaseSensitivity(), and isGreediness().

void TTKRegularExpression::setCaseSensitivity ( bool  v)

Set the case sensitivity option.

Definition at line 127 of file ttkregularexpression.cpp.

References m_regular.

Referenced by setPatternOptions(), and MusicBingTranslationRequest::startToRequest().

void TTKRegularExpression::setGreediness ( bool  v)

Set the greediness option.

Definition at line 107 of file ttkregularexpression.cpp.

References m_regular.

Referenced by setPatternOptions().

void TTKRegularExpression::setPattern ( const QString &  v)

Sets the pattern string of the regular expression to pattern.

Definition at line 26 of file ttkregularexpression.cpp.

References m_regular.

Referenced by MusicLrcAnalysis::matchLrcLine(), and MusicAdvancedSearchedWidget::searchedKeyWork().

void TTKRegularExpression::setPatternOptions ( const int  option)

Sets the given options as the pattern options of the regular expression.

Definition at line 46 of file ttkregularexpression.cpp.

References setCaseSensitivity(), and setGreediness().

const QRegExp & TTKRegularExpression::value ( ) const

Definition at line 149 of file ttkregularexpression.cpp.

Member Data Documentation

QRegExp TTKRegularExpression::m_regular
private

The documentation for this class was generated from the following files: