Qt 4.8
Public Types | Static Public Functions | List of all members
QDeclarativeJS::Ecma::RegExp Class Reference

#include <qdeclarativejsengine_p.h>

Public Types

enum  RegExpFlag { Global = 0x01, IgnoreCase = 0x02, Multiline = 0x04 }
 

Static Public Functions

static int flagFromChar (const QChar &)
 
static QString flagsToString (int flags)
 

Detailed Description

Definition at line 98 of file qdeclarativejsengine_p.h.

Enumerations

◆ RegExpFlag

Enumerator
Global 
IgnoreCase 
Multiline 

Definition at line 101 of file qdeclarativejsengine_p.h.

Functions

◆ flagFromChar()

int QDeclarativeJS::Ecma::RegExp::flagFromChar ( const QChar ch)
static

Definition at line 60 of file qdeclarativejsengine_p.cpp.

Referenced by QDeclarativeJS::Lexer::scanRegExp().

61 {
62  static QHash<QChar, int> flagsHash;
63  if (flagsHash.isEmpty()) {
64  flagsHash[QLatin1Char('g')] = Global;
65  flagsHash[QLatin1Char('i')] = IgnoreCase;
66  flagsHash[QLatin1Char('m')] = Multiline;
67  }
69  it = flagsHash.constFind(ch);
70  if (it == flagsHash.constEnd())
71  return 0;
72  return it.value();
73 }
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
Definition: qhash.h:395
#define it(className, varName)
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
Definition: qhash.h:297
const T & value() const
Returns the current item&#39;s value.
Definition: qhash.h:420
const_iterator constFind(const Key &key) const
Returns an iterator pointing to the item with the key in the hash.
Definition: qhash.h:859
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:469
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ flagsToString()

QString QDeclarativeJS::Ecma::RegExp::flagsToString ( int  flags)
static

Definition at line 75 of file qdeclarativejsengine_p.cpp.

76 {
77  QString result;
78  if (flags & Global)
79  result += QLatin1Char('g');
80  if (flags & IgnoreCase)
81  result += QLatin1Char('i');
82  if (flags & Multiline)
83  result += QLatin1Char('m');
84  return result;
85 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

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