QStringRef Class Reference

#include <qstring.h>

Class Description

Definition at line 1099 of file qstring.h.

Public Member Functions

 QStringRef ()
 
 QStringRef (const QString *string, int position, int size)
 
 QStringRef (const QString *string)
 
 QStringRef (const QStringRef &other)
 
 ~QStringRef ()
 
const QStringstring () const
 
int position () const
 
int size () const
 
int count () const
 
int length () const
 
QStringRefoperator= (const QStringRef &other)
 
int indexOf (const QString &str, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int indexOf (QChar ch, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int indexOf (QLatin1String str, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int indexOf (const QStringRef &str, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int lastIndexOf (const QString &str, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int lastIndexOf (QChar ch, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int lastIndexOf (QLatin1String str, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int lastIndexOf (const QStringRef &str, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
QBool contains (const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
QBool contains (QChar ch, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
QBool contains (QLatin1String str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
QBool contains (const QStringRef &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int count (const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int count (QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int count (const QStringRef &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool startsWith (const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool startsWith (QLatin1String s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool startsWith (QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool startsWith (const QStringRef &c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool endsWith (const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool endsWith (QLatin1String s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool endsWith (QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool endsWith (const QStringRef &c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
QStringRefoperator= (const QString *string)
 
const QCharunicode () const
 
const QChardata () const
 
const QCharconstData () const
 
QByteArray toAscii () const Q_REQUIRED_RESULT
 
QByteArray toLatin1 () const Q_REQUIRED_RESULT
 
QByteArray toUtf8 () const Q_REQUIRED_RESULT
 
QByteArray toLocal8Bit () const Q_REQUIRED_RESULT
 
QVector< uint > toUcs4 () const Q_REQUIRED_RESULT
 
void clear ()
 
QString toString () const
 
bool isEmpty () const
 
bool isNull () const
 
QStringRef appendTo (QString *string) const
 
const QChar at (int i) const
 
int compare (const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int compare (const QStringRef &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int compare (QLatin1String s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int localeAwareCompare (const QString &s) const
 
int localeAwareCompare (const QStringRef &s) const
 

Static Public Member Functions

static int compare (const QStringRef &s1, const QString &s2, Qt::CaseSensitivity=Qt::CaseSensitive)
 
static int compare (const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity=Qt::CaseSensitive)
 
static int compare (const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 
static int localeAwareCompare (const QStringRef &s1, const QString &s2)
 
static int localeAwareCompare (const QStringRef &s1, const QStringRef &s2)
 

Constructor & Destructor Documentation

QStringRef ( )
inline

Definition at line 1104 of file qstring.h.

1104 :m_string(0), m_position(0), m_size(0){}
QStringRef ( const QString string,
int  position,
int  size 
)
inline

Definition at line 1196 of file qstring.h.

1197  :m_string(aString), m_position(aPosition), m_size(aSize){}
QStringRef ( const QString string)
inline

Definition at line 1199 of file qstring.h.

1200  :m_string(aString), m_position(0), m_size(aString?aString->size() : 0){}
QStringRef ( const QStringRef other)
inline

Definition at line 1107 of file qstring.h.

1108  :m_string(other.m_string), m_position(other.m_position), m_size(other.m_size)
1109  {}
~QStringRef ( )
inline

Definition at line 1111 of file qstring.h.

1111 {}

Member Function Documentation

const QString* string ( ) const
inline

Definition at line 1112 of file qstring.h.

1112 { return m_string; }
int position ( ) const
inline

Definition at line 1113 of file qstring.h.

1113 { return m_position; }
int size ( ) const
inline

Definition at line 1114 of file qstring.h.

1114 { return m_size; }
int count ( ) const
inline

Definition at line 1115 of file qstring.h.

1115 { return m_size; }
int length ( ) const
inline

Definition at line 1116 of file qstring.h.

1116 { return m_size; }
QStringRef& operator= ( const QStringRef other)
inline

Definition at line 1118 of file qstring.h.

1118  {
1119  m_string = other.m_string; m_position = other.m_position;
1120  m_size = other.m_size; return *this;
1121  }
int indexOf ( const QString str,
int  from = 0,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
int indexOf ( QChar  ch,
int  from = 0,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
int indexOf ( QLatin1String  str,
int  from = 0,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
int indexOf ( const QStringRef str,
int  from = 0,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
int lastIndexOf ( const QString str,
int  from = -1,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
int lastIndexOf ( QChar  ch,
int  from = -1,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
int lastIndexOf ( QLatin1String  str,
int  from = -1,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
int lastIndexOf ( const QStringRef str,
int  from = -1,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
QBool contains ( const QString str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Definition at line 1275 of file qstring.h.

1276 { return QBool(indexOf(s, 0, cs) != -1); }
int indexOf(const QString &str, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
GLdouble s
Definition: GLee.h:1173
QBool contains ( QChar  ch,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Definition at line 1279 of file qstring.h.

1280 { return QBool(indexOf(c, 0, cs) != -1); }
int indexOf(const QString &str, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
const GLubyte * c
Definition: GLee.h:5419
QBool contains ( QLatin1String  str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Definition at line 1277 of file qstring.h.

1278 { return QBool(indexOf(s, 0, cs) != -1); }
int indexOf(const QString &str, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
GLdouble s
Definition: GLee.h:1173
QBool contains ( const QStringRef str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Definition at line 1281 of file qstring.h.

1282 { return QBool(indexOf(s, 0, cs) != -1); }
int indexOf(const QString &str, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
GLdouble s
Definition: GLee.h:1173
int count ( const QString s,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
int count ( const QStringRef s,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
bool startsWith ( const QString s,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
bool startsWith ( QLatin1String  s,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
bool startsWith ( QChar  c,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
bool startsWith ( const QStringRef c,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
bool endsWith ( const QString s,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
bool endsWith ( QLatin1String  s,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
bool endsWith ( QChar  c,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
bool endsWith ( const QStringRef c,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
QStringRef & operator= ( const QString string)
inline

Definition at line 1193 of file qstring.h.

1194 { m_string = aString; m_position = 0; m_size = aString?aString->size():0; return *this; }
const QChar* unicode ( ) const
inline

Definition at line 1153 of file qstring.h.

1153  {
1154  if (!m_string)
1155  return reinterpret_cast<const QChar *>(QString::shared_null.data);
1156  return m_string->unicode() + m_position;
1157  }
const QChar * unicode() const
Definition: qstring.h:706
Definition: qchar.h:72
const QChar* data ( ) const
inline

Definition at line 1158 of file qstring.h.

1158 { return unicode(); }
const QChar * unicode() const
Definition: qstring.h:1153
const QChar* constData ( ) const
inline

Definition at line 1159 of file qstring.h.

1159 { return unicode(); }
const QChar * unicode() const
Definition: qstring.h:1153
QByteArray toAscii ( ) const
QByteArray toLatin1 ( ) const
QByteArray toUtf8 ( ) const
QByteArray toLocal8Bit ( ) const
QVector<uint> toUcs4 ( ) const
void clear ( )
inline

Definition at line 1167 of file qstring.h.

1167 { m_string = 0; m_position = m_size = 0; }
QString toString ( ) const
bool isEmpty ( ) const
inline

Definition at line 1169 of file qstring.h.

1169 { return m_size == 0; }
bool isNull ( ) const
inline

Definition at line 1170 of file qstring.h.

1170 { return m_string == 0 || m_string->isNull(); }
bool isNull() const
Definition: qstring.h:505
QStringRef appendTo ( QString string) const
const QChar at ( int  i) const
inline

Definition at line 1174 of file qstring.h.

1175  { Q_ASSERT(uint(i) < uint(size())); return m_string->at(i + m_position); }
const QChar at(int i) const
Definition: qstring.h:698
int size() const
Definition: qstring.h:1114
int compare ( const QString s,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Definition at line 1249 of file qstring.h.

1250 { return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
const QChar * constData() const
Definition: qstring.h:712
const QChar * constData() const
Definition: qstring.h:1159
int length() const
Definition: qstring.h:1116
int length() const
Definition: qstring.h:696
int compare ( const QStringRef s,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Definition at line 1251 of file qstring.h.

1252 { return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
const QChar * constData() const
Definition: qstring.h:1159
int length() const
Definition: qstring.h:1116
int compare ( QLatin1String  s,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Definition at line 1253 of file qstring.h.

1254 { return QString::compare_helper(constData(), length(), s, cs); }
const QChar * constData() const
Definition: qstring.h:1159
int length() const
Definition: qstring.h:1116
int compare ( const QStringRef s1,
const QString s2,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)
inlinestatic

Definition at line 1255 of file qstring.h.

1256 { return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
const QChar * constData() const
Definition: qstring.h:712
const QChar * constData() const
Definition: qstring.h:1159
int length() const
Definition: qstring.h:1116
int length() const
Definition: qstring.h:696
int compare ( const QStringRef s1,
const QStringRef s2,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)
inlinestatic

Definition at line 1257 of file qstring.h.

1258 { return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
const QChar * constData() const
Definition: qstring.h:1159
int length() const
Definition: qstring.h:1116
int compare ( const QStringRef s1,
QLatin1String  s2,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)
inlinestatic

Definition at line 1259 of file qstring.h.

1260 { return QString::compare_helper(s1.constData(), s1.length(), s2, cs); }
const QChar * constData() const
Definition: qstring.h:1159
int length() const
Definition: qstring.h:1116
int localeAwareCompare ( const QString s) const
inline

Definition at line 1266 of file qstring.h.

1267 { return QString::localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); }
const QChar * constData() const
Definition: qstring.h:712
const QChar * constData() const
Definition: qstring.h:1159
int length() const
Definition: qstring.h:1116
int length() const
Definition: qstring.h:696
int localeAwareCompare ( const QStringRef s) const
inline

Definition at line 1268 of file qstring.h.

1269 { return QString::localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); }
const QChar * constData() const
Definition: qstring.h:1159
int length() const
Definition: qstring.h:1116
int localeAwareCompare ( const QStringRef s1,
const QString s2 
)
inlinestatic

Definition at line 1270 of file qstring.h.

1271 { return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
const QChar * constData() const
Definition: qstring.h:712
const QChar * constData() const
Definition: qstring.h:1159
int length() const
Definition: qstring.h:1116
int length() const
Definition: qstring.h:696
int localeAwareCompare ( const QStringRef s1,
const QStringRef s2 
)
inlinestatic

Definition at line 1272 of file qstring.h.

1273 { return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
const QChar * constData() const
Definition: qstring.h:1159
int length() const
Definition: qstring.h:1116

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