Qt 4.8
|
The QStringRef class provides a thin wrapper around QString substrings. More...
#include <qstring.h>
Public Functions | |
QStringRef | appendTo (QString *string) const |
Appends the string reference to string, and returns a new reference to the combined string data. More... | |
const QChar | at (int i) const |
Returns the character at the given index position in the string reference. More... | |
void | clear () |
Clears the contents of the string reference by making it null and empty. More... | |
int | compare (const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
int | compare (const QStringRef &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
int | compare (QLatin1String s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
const QChar * | constData () const |
Same as unicode(). More... | |
QBool | contains (const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
Returns true if this string reference contains an occurrence of the string str; otherwise returns false. More... | |
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 |
Returns the number of characters referred to by the string reference. More... | |
int | count (const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
Returns the number of (potentially overlapping) occurrences of the string str in this string reference. More... | |
int | count (QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
int | count (const QStringRef &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
const QChar * | data () const |
Same as unicode(). More... | |
bool | endsWith (const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
Returns true if the string reference ends with str; otherwise returns false. More... | |
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 |
int | indexOf (const QString &str, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
Returns the index position of the first occurrence of the string str in this string reference, searching forward from index position from. More... | |
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 |
Returns the index position of the first occurrence of the string str in this string reference, searching forward from index position from. More... | |
int | indexOf (const QStringRef &str, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
bool | isEmpty () const |
Returns true if the string reference has no characters; otherwise returns false. More... | |
bool | isNull () const |
Returns true if string() returns a null pointer or a pointer to a null string; otherwise returns true. More... | |
int | lastIndexOf (const QString &str, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
Returns the index position of the last occurrence of the string str in this string reference, searching backward from index position from. More... | |
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 |
int | length () const |
Returns the number of characters referred to by the string reference. More... | |
int | localeAwareCompare (const QString &s) const |
Compares this string with the other string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string. More... | |
int | localeAwareCompare (const QStringRef &s) const |
Compares this string with the other string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string. More... | |
QStringRef & | operator= (const QStringRef &other) |
Assigns the other string reference to this string reference, and returns the result. More... | |
QStringRef & | operator= (const QString *string) |
Constructs a string reference to the given string and assigns it to this string reference, returning the result. More... | |
int | position () const |
Returns the starting position in the referenced string that is referred to by the string reference. More... | |
QStringRef () | |
Constructs an empty string reference. More... | |
QStringRef (const QString *string, int position, int size) | |
Constructs a string reference to the range of characters in the given string specified by the starting position and length in characters. More... | |
QStringRef (const QString *string) | |
Constructs a string reference to the given string. More... | |
QStringRef (const QStringRef &other) | |
Constructs a copy of the other string reference. More... | |
int | size () const |
Returns the number of characters referred to by the string reference. More... | |
bool | startsWith (const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
Returns true if the string reference starts with str; otherwise returns false. More... | |
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 |
const QString * | string () const |
Returns a pointer to the string referred to by the string reference, or 0 if it does not reference a string. More... | |
QByteArray | toAscii () const Q_REQUIRED_RESULT |
Returns an 8-bit representation of the string as a QByteArray. More... | |
QByteArray | toLatin1 () const Q_REQUIRED_RESULT |
Returns a Latin-1 representation of the string as a QByteArray. More... | |
QByteArray | toLocal8Bit () const Q_REQUIRED_RESULT |
Returns the local 8-bit representation of the string as a QByteArray. More... | |
QString | toString () const |
Returns a copy of the string reference as a QString object. More... | |
QVector< uint > | toUcs4 () const Q_REQUIRED_RESULT |
Returns a UCS-4/UTF-32 representation of the string as a QVector<uint>. More... | |
QByteArray | toUtf8 () const Q_REQUIRED_RESULT |
Returns a UTF-8 representation of the string as a QByteArray. More... | |
const QChar * | unicode () const |
Returns a Unicode representation of the string reference. More... | |
~QStringRef () | |
Destroys the string reference. More... | |
Static Public Functions | |
static int | compare (const QStringRef &s1, const QString &s2, Qt::CaseSensitivity=Qt::CaseSensitive) |
Compares the string s1 with the string s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2. More... | |
static int | compare (const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity=Qt::CaseSensitive) |
Compares the string s1 with the string s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2. More... | |
static int | compare (const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs=Qt::CaseSensitive) |
Compares the string s1 with the string s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2. More... | |
static int | localeAwareCompare (const QStringRef &s1, const QString &s2) |
Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2. More... | |
static int | localeAwareCompare (const QStringRef &s1, const QStringRef &s2) |
Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2. More... | |
Properties | |
int | m_position |
int | m_size |
const QString * | m_string |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator< (const QStringRef &s1, const QStringRef &s2) |
Returns true if string reference s1 is lexically less than string reference s2; otherwise returns false. More... | |
bool | operator<= (const QStringRef &s1, const QStringRef &s2) |
bool | operator== (const QStringRef &s1, const QStringRef &s2) |
Returns true if string reference s1 is lexically equal to string reference s2; otherwise returns false. More... | |
bool | operator== (const QString &s1, const QStringRef &s2) |
Returns true if string s1 is lexically equal to string reference s2; otherwise returns false. More... | |
bool | operator== (const QLatin1String &s1, const QStringRef &s2) |
Returns true if string s1 is lexically equal to string reference s2; otherwise returns false. More... | |
bool | operator> (const QStringRef &s1, const QStringRef &s2) |
bool | operator>= (const QStringRef &s1, const QStringRef &s2) |
The QStringRef class provides a thin wrapper around QString substrings.
QStringRef provides a read-only subset of the QString API.
A string reference explicitly references a portion of a string() with a given size(), starting at a specific position(). Calling toString() returns a copy of the data as a real QString instance.
This class is designed to improve the performance of substring handling when manipulating substrings obtained from existing QString instances. QStringRef avoids the memory allocation and reference counting overhead of a standard QString by simply referencing a part of the original string. This can prove to be advantageous in low level code, such as that used in a parser, at the expense of potentially more complex code.
For most users, there are no semantic benefits to using QStringRef instead of QString since QStringRef requires attention to be paid to memory management issues, potentially making code more complex to write and maintain.
We suggest that you only use this class in stable code where profiling has clearly identified that performance improvements can be made by replacing standard string operations with the optimized substring handling provided by this class.
|
inline |
|
inline |
Constructs a string reference to the range of characters in the given string specified by the starting position and length in characters.
This means that the starting position must be positive or 0 and smaller than string's length, and length must be positive or 0 but smaller than the string's length minus the starting position; i.e, 0 <= position < string->length() and 0 <= length <= string->length() - position must both be satisfied.
Definition at line 1196 of file qstring.h.
|
inline |
|
inline |
|
inline |
QStringRef QStringRef::appendTo | ( | QString * | string | ) | const |
Appends the string reference to string, and returns a new reference to the combined string data.
Definition at line 8828 of file qstring.cpp.
Referenced by QString::append(), and QXmlStreamWriterPrivate::write().
|
inline |
Returns the character at the given index position in the string reference.
The position must be a valid index position in the string (i.e., 0 <= position < size()).
Definition at line 1174 of file qstring.h.
Referenced by QPatternist::CompressedWhitespace::compress(), createSvgGlyph(), QXmlUtils::isNCName(), QString::lastIndexOf(), lastIndexOf(), QDateTimeParser::parse(), QDeclarativeStyledTextPrivate::parseCloseTag(), parseCoreNode(), parseFont(), QDeclarativeStyledTextPrivate::parseFontAttributes(), QDeclarativeStyledTextPrivate::parseTag(), QSvgAttributes::QSvgAttributes(), and resolveColor().
|
inline |
Clears the contents of the string reference by making it null and empty.
Definition at line 1167 of file qstring.h.
Referenced by QXmlStreamReaderPrivate::EntityDeclaration::clear(), QXmlStreamWriterPrivate::findNamespace(), QXmlStreamReaderPrivate::parse(), QXmlStreamReaderPrivate::resolveTag(), and QXmlStreamWriter::writeDefaultNamespace().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Compares this string with the other string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string.
If cs is Qt::CaseSensitive, the comparison is case sensitive; otherwise the comparison is case insensitive.
Equivalent to {compare(*this, other, cs)}
.
Definition at line 1249 of file qstring.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Compares this string with the other string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string.
If cs is Qt::CaseSensitive, the comparison is case sensitive; otherwise the comparison is case insensitive.
Equivalent to {compare(*this, other, cs)}
.
Definition at line 1251 of file qstring.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Compares this string with the other string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string.
If cs is Qt::CaseSensitive, the comparison is case sensitive; otherwise the comparison is case insensitive.
Equivalent to {compare(*this, other, cs)}
.
Definition at line 1253 of file qstring.h.
|
inlinestatic |
Compares the string s1 with the string s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2.
If cs is Qt::CaseSensitive, the comparison is case sensitive; otherwise the comparison is case insensitive.
Definition at line 1255 of file qstring.h.
|
inlinestatic |
Compares the string s1 with the string s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2.
If cs is Qt::CaseSensitive, the comparison is case sensitive; otherwise the comparison is case insensitive.
Definition at line 1257 of file qstring.h.
|
inlinestatic |
Compares the string s1 with the string s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2.
If cs is Qt::CaseSensitive, the comparison is case sensitive; otherwise the comparison is case insensitive.
Definition at line 1259 of file qstring.h.
|
inline |
Same as unicode().
Definition at line 1159 of file qstring.h.
Referenced by QConcatenable< QStringRef >::appendTo(), QXmlStreamReaderPrivate::checkPublicLiteral(), QString::compare(), compare(), QString::localeAwareCompare(), localeAwareCompare(), operator<(), parsePathDataFast(), parseTransformationMatrix(), resolveColor(), toDouble(), XsdSchemaToken::toToken(), QPatternist::XSLTTokenLookup::toToken(), and QXmlStreamWriterPrivate::write().
|
inline |
Returns true if this string reference contains an occurrence of the string str; otherwise returns false.
If cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive.
Definition at line 1275 of file qstring.h.
|
inline |
Definition at line 1279 of file qstring.h.
|
inline |
Definition at line 1277 of file qstring.h.
|
inline |
Definition at line 1281 of file qstring.h.
|
inline |
int QStringRef::count | ( | const QString & | str, |
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Returns the number of (potentially overlapping) occurrences of the string str in this string reference.
If cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive.
Definition at line 9350 of file qstring.cpp.
int QStringRef::count | ( | QChar | c, |
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9370 of file qstring.cpp.
int QStringRef::count | ( | const QStringRef & | s, |
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9390 of file qstring.cpp.
|
inline |
Same as unicode().
Definition at line 1158 of file qstring.h.
bool QStringRef::endsWith | ( | const QString & | str, |
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Returns true if the string reference ends with str; otherwise returns false.
If cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive.
Definition at line 9476 of file qstring.cpp.
bool QStringRef::endsWith | ( | QLatin1String | s, |
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9515 of file qstring.cpp.
bool QStringRef::endsWith | ( | QChar | c, |
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9497 of file qstring.cpp.
bool QStringRef::endsWith | ( | const QStringRef & | c, |
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9525 of file qstring.cpp.
int QStringRef::indexOf | ( | const QString & | str, |
int | from = 0 , |
||
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Returns the index position of the first occurrence of the string str in this string reference, searching forward from index position from.
Returns -1 if str is not found.
If cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive.
If from is -1, the search starts at the last character; if it is -2, at the next to last character and so on.
Definition at line 9132 of file qstring.cpp.
Referenced by contains().
int QStringRef::indexOf | ( | QChar | ch, |
int | from = 0 , |
||
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9150 of file qstring.cpp.
int QStringRef::indexOf | ( | QLatin1String | str, |
int | from = 0 , |
||
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Returns the index position of the first occurrence of the string str in this string reference, searching forward from index position from.
Returns -1 if str is not found.
If cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive.
If from is -1, the search starts at the last character; if it is -2, at the next to last character and so on.
Definition at line 9173 of file qstring.cpp.
int QStringRef::indexOf | ( | const QStringRef & | str, |
int | from = 0 , |
||
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9195 of file qstring.cpp.
|
inline |
Returns true if the string reference has no characters; otherwise returns false.
A string reference is empty if its size is zero.
Definition at line 1169 of file qstring.h.
Referenced by QPatternist::AccelTreeBuilder< true >::characters(), QPatternist::CompressedWhitespace::compress(), constructColor(), createSolidColorNode(), createSvgGlyph(), QXmlStreamWriterPrivate::findNamespace(), QPatternist::XSLTTokenizer::insideSequenceConstructor(), QPatternist::XSLTTokenizer::insideStylesheetModule(), QXmlUtils::isNCName(), QXmlStreamReaderPrivate::namespaceForPrefix(), operator==(), QXmlStreamReaderPrivate::parse(), QDeclarativeStyledTextPrivate::parseAttribute(), parseBaseGradient(), parseBrush(), parseCompOp(), parseCoreNode(), parseFont(), QDeclarativeStyledTextPrivate::parseFontAttributes(), parseOpacity(), parseOthers(), parsePen(), parseServerList(), parseStopNode(), parseTransform(), parseTransformationMatrix(), parseVisibility(), QSvgAttributes::QSvgAttributes(), resolveColor(), QXmlStreamReaderPrivate::resolveTag(), QXmlStreamReaderPrivate::startDocument(), trimRef(), QPatternist::MaintainingReader< XSLTTokenLookup >::validateElement(), QPatternist::AccelTreeBuilder< true >::whitespaceOnly(), QXmlStreamWriter::writeAttribute(), QXmlStreamWriter::writeEndElement(), and QXmlStreamWriterPrivate::writeNamespaceDeclaration().
|
inline |
Returns true if string() returns a null pointer or a pointer to a null string; otherwise returns true.
Definition at line 1170 of file qstring.h.
Referenced by QString::endsWith(), endsWith(), QPatternist::XSLTTokenizer::handleValidationAttributes(), QXmlStreamReaderPrivate::parse(), QXmlStreamReaderPrivate::resolveTag(), QString::startsWith(), and startsWith().
int QStringRef::lastIndexOf | ( | const QString & | str, |
int | from = -1 , |
||
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Returns the index position of the last occurrence of the string str in this string reference, searching backward from index position from.
If from is -1 (default), the search starts at the last character; if from is -2, at the next to last character and so on. Returns -1 if str is not found.
If cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive.
Definition at line 9217 of file qstring.cpp.
int QStringRef::lastIndexOf | ( | QChar | ch, |
int | from = -1 , |
||
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9250 of file qstring.cpp.
int QStringRef::lastIndexOf | ( | QLatin1String | str, |
int | from = -1 , |
||
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9273 of file qstring.cpp.
int QStringRef::lastIndexOf | ( | const QStringRef & | str, |
int | from = -1 , |
||
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9315 of file qstring.cpp.
|
inline |
Returns the number of characters referred to by the string reference.
Equivalent to size() and count().
Definition at line 1116 of file qstring.h.
Referenced by QConcatenable< QStringRef >::appendTo(), QString::compare(), compare(), QPatternist::CompressedWhitespace::compress(), QString::indexOf(), QString::localeAwareCompare(), localeAwareCompare(), operator<(), parseBrush(), parsePen(), parseTransformationMatrix(), QSvgAttributes::QSvgAttributes(), resolveColor(), toDouble(), XsdSchemaToken::toToken(), QPatternist::XSLTTokenLookup::toToken(), and trimRef().
|
inline |
Compares this string with the other string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string.
The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.
Definition at line 1266 of file qstring.h.
|
inline |
Compares this string with the other string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string.
The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.
Definition at line 1268 of file qstring.h.
|
inlinestatic |
Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2.
The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.
On Mac OS X, this function compares according the "Order for sorted lists" setting in the International prefereces panel.
Definition at line 1270 of file qstring.h.
|
inlinestatic |
Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2.
The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.
Definition at line 1272 of file qstring.h.
|
inline |
|
inline |
|
inline |
Returns the starting position in the referenced string that is referred to by the string reference.
Definition at line 1113 of file qstring.h.
Referenced by parseBrush(), parsePen(), QSvgAttributes::QSvgAttributes(), resolveColor(), and trimRef().
|
inline |
Returns the number of characters referred to by the string reference.
Equivalent to length() and count().
Definition at line 1114 of file qstring.h.
Referenced by QXmlStreamPrivateTagStack::addToStringStorage(), QString::append(), QConcatenable< QStringRef >::appendTo(), QXmlStreamReaderPrivate::checkPublicLiteral(), QString::count(), count(), QString::endsWith(), endsWith(), indexOf(), QXmlUtils::isNCName(), QString::lastIndexOf(), lastIndexOf(), operator==(), parsePathDataFast(), qHash(), QConcatenable< QStringRef >::size(), QString::startsWith(), startsWith(), and QXmlStreamWriterPrivate::write().
bool QStringRef::startsWith | ( | const QString & | str, |
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Returns true if the string reference starts with str; otherwise returns false.
If cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive.
Definition at line 9409 of file qstring.cpp.
bool QStringRef::startsWith | ( | QLatin1String | s, |
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9420 of file qstring.cpp.
bool QStringRef::startsWith | ( | QChar | c, |
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9451 of file qstring.cpp.
bool QStringRef::startsWith | ( | const QStringRef & | c, |
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 9430 of file qstring.cpp.
|
inline |
Returns a pointer to the string referred to by the string reference, or 0 if it does not reference a string.
Definition at line 1112 of file qstring.h.
Referenced by QString::append(), parseBrush(), parsePen(), QSvgAttributes::QSvgAttributes(), resolveColor(), and trimRef().
QByteArray QStringRef::toAscii | ( | ) | const |
Returns an 8-bit representation of the string as a QByteArray.
If a codec has been set using QTextCodec::setCodecForCStrings(), it is used to convert Unicode to 8-bit char; otherwise this function does the same as toLatin1().
Note that, despite the name, this function does not necessarily return an US-ASCII (ANSI X3.4-1986) string and its result may not be US-ASCII compatible.
Definition at line 9810 of file qstring.cpp.
QByteArray QStringRef::toLatin1 | ( | ) | const |
Returns a Latin-1 representation of the string as a QByteArray.
The returned byte array is undefined if the string contains non-Latin1 characters. Those characters may be suppressed or replaced with a question mark.
Definition at line 9788 of file qstring.cpp.
Referenced by QXmlStreamReaderPrivate::startDocument(), and QXmlStreamWriterPrivate::write().
QByteArray QStringRef::toLocal8Bit | ( | ) | const |
Returns the local 8-bit representation of the string as a QByteArray.
The returned byte array is undefined if the string contains characters not supported by the local 8-bit encoding.
QTextCodec::codecForLocale() is used to perform the conversion from Unicode. If the locale encoding could not be determined, this function does the same as toLatin1().
If this string contains any characters that cannot be encoded in the locale, the returned byte array is undefined. Those characters may be suppressed or replaced by another.
Definition at line 9839 of file qstring.cpp.
QString QStringRef::toString | ( | ) | const |
Returns a copy of the string reference as a QString object.
If the string reference is not a complete reference of the string (meaning that position() is 0 and size() equals string()->size()), this function will allocate a new string to return.
Definition at line 8653 of file qstring.cpp.
Referenced by QXmlSerializer::attribute(), QPatternist::AccelTreeBuilder< true >::attribute(), QXmlFormatter::characters(), QXmlSerializer::characters(), QSvgHandler::characters(), QPatternist::ColoringMessageHandler::colorifyDescription(), createCircleNode(), createEllipseNode(), createFontNode(), createImageNode(), createLinearGradientNode(), createLineNode(), createPolygonNode(), createPolylineNode(), createRadialGradientNode(), createRectNode(), createSvgNode(), createTextAreaNode(), createTextNode(), createUseNode(), QDeclarativeXMLHttpRequest::findTextCodec(), QPatternist::formatKeyword(), QPatternist::XSLTTokenizer::handleXSLTVersion(), QPatternist::XSLTTokenizer::insideSequenceConstructor(), QPatternist::XSLTTokenizer::insideTemplate(), Document::load(), QXmlStreamReaderPrivate::namespaceForPrefix(), QDeclarativeInfo::operator<<(), QDebug::operator<<(), QScriptXmlParser::parse(), QSvgHandler::parse(), QXmlStreamReaderPrivate::parse(), parseAnimateColorNode(), parseAnimateTransformNode(), parseBaseGradient(), parseCompOp(), parseCoreNode(), parseFont(), QDeclarativeStyledTextPrivate::parseFontAttributes(), parseFontFaceNameNode(), parseFontFaceNode(), parseOpacity(), parseOthers(), parsePen(), parseServerList(), parseStopNode(), parseStyleNode(), QSvgAttributes::QSvgAttributes(), QPatternist::XSLTTokenizer::queueNamespaceDeclarations(), QPatternist::XSLTTokenizer::queueSelectOrSequenceConstructor(), QPatternist::XSLTTokenizer::queueSimpleContentConstructor(), QPatternist::XSLTTokenizer::queueSorting(), QPatternist::XSLTTokenizer::queueVariableDeclaration(), QPatternist::XSLTTokenizer::readAlternativeAttribute(), QPatternist::XSLTTokenizer::readElementText(), QPatternist::XSLTTokenizer::readToggleAttribute(), QXmlStreamReaderPrivate::resolveCharRef(), resolveColor(), QPatternist::NamespaceSupport::setPrefixes(), someId(), QXmlStreamReaderPrivate::startDocument(), QPatternist::AccelTreeResourceLoader::streamToReceiver(), tokenUntil(), QPatternist::TagValidationHandler::validate(), QPatternist::MaintainingReader< XSLTTokenLookup >::validateElement(), QAbstractXmlReceiver::whitespaceOnly(), QPatternist::AccelTreeBuilder< true >::whitespaceOnly(), QPatternist::QAbstractXmlReceiver::whitespaceOnly(), QXmlStreamWriter::writeAttribute(), and QXmlStreamWriter::writeCurrentToken().
Returns a UCS-4/UTF-32 representation of the string as a QVector<uint>.
UCS-4 is a Unicode codec and is lossless. All characters from this string can be encoded in UCS-4.
Definition at line 9890 of file qstring.cpp.
QByteArray QStringRef::toUtf8 | ( | ) | const |
Returns a UTF-8 representation of the string as a QByteArray.
UTF-8 is a Unicode codec and can represent all characters in a Unicode string like QString.
However, in the Unicode range, there are certain codepoints that are not considered characters. The Unicode standard reserves the last two codepoints in each Unicode Plane (U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, U+2FFFE, etc.), as well as 16 codepoints in the range U+FDD0..U+FDDF, inclusive, as non-characters. If any of those appear in the string, they may be discarded and will not appear in the UTF-8 representation, or they may be replaced by one or more replacement characters.
Definition at line 9869 of file qstring.cpp.
|
inline |
Returns a Unicode representation of the string reference.
Since the data stems directly from the referenced string, it is not null-terminated unless the string reference includes the string's null terminator.
Definition at line 1153 of file qstring.h.
Referenced by QXmlStreamPrivateTagStack::addToStringStorage(), QString::append(), QString::count(), count(), QString::endsWith(), endsWith(), QString::indexOf(), indexOf(), QString::lastIndexOf(), lastIndexOf(), operator==(), qHash(), resolveColor(), QString::startsWith(), and startsWith().
|
related |
Returns true if string reference s1 is lexically less than string reference s2; otherwise returns false.
The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the QString::localeAwareCompare() function.
Definition at line 8727 of file qstring.cpp.
Referenced by operator!=().
|
related |
Returns true if string reference s1 is lexically less than or equal to string reference s2; otherwise returns false.
The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the QString::localeAwareCompare() function.
|
related |
Returns true if string reference s1 is lexically equal to string reference s2; otherwise returns false.
Definition at line 8670 of file qstring.cpp.
Referenced by operator!=(), and QStringRef().
|
related |
Returns true if string s1 is lexically equal to string reference s2; otherwise returns false.
Definition at line 8683 of file qstring.cpp.
|
related |
Returns true if string s1 is lexically equal to string reference s2; otherwise returns false.
Definition at line 8696 of file qstring.cpp.
|
related |
Returns true if string reference s1 is lexically greater than string reference s2; otherwise returns false.
The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the QString::localeAwareCompare() function.
|
related |
Returns true if string reference s1 is lexically greater than or equal to string reference s2; otherwise returns false.
The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the QString::localeAwareCompare() function.
|
private |
Definition at line 1101 of file qstring.h.
Referenced by operator=().
|
private |
Definition at line 1102 of file qstring.h.
Referenced by operator=().
|
private |
Definition at line 1100 of file qstring.h.
Referenced by operator=().