45 #include <QtCore/qchar.h> 46 #include <QtCore/qbytearray.h> 47 #include <QtCore/qatomic.h> 48 #include <QtCore/qnamespace.h> 49 #ifdef QT_INCLUDE_COMPAT 50 #include <Qt3Support/q3cstring.h> 56 # ifndef QT_NO_STL_WCHAR 59 # endif // QT_NO_STL_WCHAR 66 #error qstring.h must be included before any header file that defines truncate 81 template <
typename T>
class QVector;
97 #ifdef Q_COMPILER_RVALUE_REFS 99 {
qSwap(
d, other.d);
return *
this; }
102 inline int size()
const {
return d->size; }
103 inline int count()
const {
return d->size; }
104 inline int length()
const;
106 void resize(
int size);
109 void truncate(
int pos);
112 int capacity()
const;
113 inline void reserve(
int size);
114 inline void squeeze() {
if (
d->size <
d->alloc ||
d->ref != 1) realloc();
d->capacity = 0;}
116 inline const QChar *unicode()
const;
119 inline const QChar *constData()
const;
121 inline void detach();
122 inline bool isDetached()
const;
126 inline const QChar at(
int i)
const;
127 const QChar operator[](
int i)
const;
140 QString arg(
int a,
int fieldWidth = 0,
int base = 10,
144 QString arg(
short a,
int fieldWidth = 0,
int base = 10,
148 QString arg(
double a,
int fieldWidth = 0,
char fmt =
'g',
int prec = -1,
150 QString arg(
char a,
int fieldWidth = 0,
175 #if defined(Q_CC_GNU) && !defined(__INSURE__) 176 __attribute__ ((format (printf, 2, 0)))
179 QString &sprintf(
const char *format, ...)
180 #if defined(Q_CC_GNU) && !defined(__INSURE__) 181 __attribute__ ((format (printf, 2, 3)))
202 int indexOf(
const QRegExp &,
int from = 0)
const;
203 int lastIndexOf(
const QRegExp &,
int from = -1)
const;
205 int count(
const QRegExp &)
const;
207 int indexOf(
QRegExp &,
int from = 0)
const;
208 int lastIndexOf(
QRegExp &,
int from = -1)
const;
213 SectionDefault = 0x00,
214 SectionSkipEmpty = 0x01,
215 SectionIncludeLeadingSep = 0x02,
216 SectionIncludeTrailingSep = 0x04,
217 SectionCaseInsensitiveSeps = 0x08
221 QString section(
QChar sep,
int start,
int end = -1, SectionFlags flags = SectionDefault)
const;
222 QString section(
const QString &in_sep,
int start,
int end = -1, SectionFlags flags = SectionDefault)
const;
224 QString section(
const QRegExp ®,
int start,
int end = -1, SectionFlags flags = SectionDefault)
const;
230 QStringRef leftRef(
int n) const Q_REQUIRED_RESULT;
231 QStringRef rightRef(
int n) const Q_REQUIRED_RESULT;
232 QStringRef midRef(
int position,
int n = -1) const Q_REQUIRED_RESULT;
244 QString rightJustified(
int width,
QChar fill = QLatin1Char(' '),
bool trunc = false) const Q_REQUIRED_RESULT;
246 QString toLower() const Q_REQUIRED_RESULT;
247 QString toUpper() const Q_REQUIRED_RESULT;
248 QString toCaseFolded() const Q_REQUIRED_RESULT;
251 QString simplified() const Q_REQUIRED_RESULT;
266 if (
d->ref != 1 ||
d->size + 1 >
d->alloc)
267 realloc(
grow(
d->size + 1));
269 d->data[
d->size] =
'\0';
278 QString &
remove(
int i,
int len);
282 QString &replace(
int i,
int len,
const QChar *s,
int slen);
296 {
return replace(rx,
QString()); }
318 QString repeated(
int times)
const;
320 const ushort *utf16()
const;
323 QByteArray toLatin1() const Q_REQUIRED_RESULT;
325 QByteArray toLocal8Bit() const Q_REQUIRED_RESULT;
328 static
QString fromAscii(const
char *,
int size = -1);
329 static
QString fromLatin1(const
char *,
int size = -1);
330 static
QString fromUtf8(const
char *,
int size = -1);
331 static
QString fromLocal8Bit(const
char *,
int size = -1);
333 static
QString fromUcs4(const
uint *,
int size = -1);
336 int toWCharArray(
wchar_t *array) const;
337 static
QString fromWCharArray(const
wchar_t *,
int size = -1);
339 QString &setRawData(const QChar *unicode,
int size);
340 QString &setUnicode(const QChar *unicode,
int size);
341 inline
QString &setUtf16(const ushort *utf16,
int size);
351 {
return s1.compare(s2); }
360 {
return -s2.
compare(s1, cs); }
366 int localeAwareCompare(
const QString& s)
const;
370 int localeAwareCompare(
const QStringRef &s)
const;
373 short toShort(
bool *ok=0,
int base=10)
const;
374 ushort toUShort(
bool *ok=0,
int base=10)
const;
375 int toInt(
bool *ok=0,
int base=10)
const;
376 uint toUInt(
bool *ok=0,
int base=10)
const;
377 long toLong(
bool *ok=0,
int base=10)
const;
378 ulong toULong(
bool *ok=0,
int base=10)
const;
381 float toFloat(
bool *ok=0)
const;
392 QString &setNum(
float,
char f=
'g',
int prec=6);
393 QString &setNum(
double,
char f=
'g',
int prec=6);
401 static QString number(
double,
char f=
'g',
int prec=6);
418 #ifndef QT_NO_CAST_FROM_ASCII 422 :
d(fromAscii_helper(a.constData(),
qstrnlen(a.constData(), a.size())))
425 {
return (*
this = fromAscii(ch)); }
471 const_iterator begin()
const;
472 const_iterator constBegin()
const;
474 const_iterator
end()
const;
475 const_iterator constEnd()
const;
487 static inline QString fromStdString(
const std::string &s);
488 inline std::string toStdString()
const;
490 static inline QString fromStdWString(
const std::wstring &s);
491 inline std::wstring toStdWString()
const;
493 # ifndef QT_NO_STL_WCHAR 496 # endif // QT_NO_STL_WCHAR 505 inline bool isNull()
const {
return d == &shared_null; }
508 inline QT3_SUPPORT
const char *ascii()
const {
return ascii_helper(); }
509 inline QT3_SUPPORT
const char *latin1()
const {
return latin1_helper(); }
510 inline QT3_SUPPORT
QByteArray utf8()
const {
return toUtf8(); }
511 inline QT3_SUPPORT
QByteArray local8Bit()
const{
return toLocal8Bit(); }
512 inline QT3_SUPPORT
void setLength(
int nl) { resize(nl); }
513 inline QT3_SUPPORT
QString copy()
const {
return *
this; }
522 #ifndef QT_NO_CAST_FROM_ASCII 523 inline QT3_SUPPORT
QString &replace(
char c,
const QString &after,
bool cs)
529 inline QT3_SUPPORT
int find(
QChar c,
int i = 0,
bool cs =
true)
const 531 inline QT3_SUPPORT
int find(
const QString &s,
int i = 0,
bool cs =
true)
const 533 inline QT3_SUPPORT
int findRev(
QChar c,
int i = -1,
bool cs =
true)
const 535 inline QT3_SUPPORT
int findRev(
const QString &s,
int i = -1,
bool cs =
true)
const 538 inline QT3_SUPPORT
int find(
const QRegExp &rx,
int i=0)
const 539 {
return indexOf(rx, i); }
540 inline QT3_SUPPORT
int findRev(
const QRegExp &rx,
int i=-1)
const 541 {
return lastIndexOf(rx, i); }
542 inline QT3_SUPPORT
int find(
QRegExp &rx,
int i=0)
const 543 {
return indexOf(rx, i); }
544 inline QT3_SUPPORT
int findRev(
QRegExp &rx,
int i=-1)
const 545 {
return lastIndexOf(rx, i); }
547 inline QT3_SUPPORT
QBool contains(
QChar c,
bool cs)
const 549 inline QT3_SUPPORT
QBool contains(
const QString &s,
bool cs)
const 551 inline QT3_SUPPORT
bool startsWith(
const QString &s,
bool cs)
const 553 inline QT3_SUPPORT
bool endsWith(
const QString &s,
bool cs)
const 555 inline QT3_SUPPORT
QChar constref(
uint i)
const 559 {
return leftJustified(width, aFill, trunc); }
561 {
return rightJustified(width, aFill, trunc); }
562 inline QT3_SUPPORT
QString lower()
const {
return toLower(); }
563 inline QT3_SUPPORT
QString upper()
const {
return toUpper(); }
564 inline QT3_SUPPORT
QString stripWhiteSpace()
const {
return trimmed(); }
565 inline QT3_SUPPORT
QString simplifyWhiteSpace()
const {
return simplified(); }
566 inline QT3_SUPPORT
QString &setUnicodeCodes(
const ushort *unicode_as_ushorts,
int aSize)
567 {
return setUtf16(unicode_as_ushorts, aSize); }
568 inline QT3_SUPPORT
const ushort *ucs2()
const {
return utf16(); }
569 inline static QT3_SUPPORT
QString fromUcs2(
const ushort *unicode,
int size = -1)
570 {
return fromUtf16(unicode, size); }
571 inline QT3_SUPPORT
QString &setAscii(
const char *str,
int len = -1)
572 { *
this = fromAscii(str, len);
return *
this; }
573 inline QT3_SUPPORT
QString &setLatin1(
const char *str,
int len = -1)
574 { *
this = fromLatin1(str, len);
return *
this; }
577 const char *ascii_helper()
const;
578 const char *latin1_helper()
const;
580 #ifndef QT_NO_CAST_TO_ASCII 581 inline QT3_SUPPORT
operator const char *()
const {
return ascii_helper(); }
588 bool isSimpleText()
const {
if (!
d->clean) updateProperties();
return d->simpletext; }
589 bool isRightToLeft()
const;
594 #if defined(QT_NO_CAST_FROM_ASCII) && !defined(Q_NO_DECLARED_NOT_DEFINED) 599 QString &operator=(
const char *ch);
620 #ifndef QT_NO_TEXTCODEC 623 static int grow(
int);
624 static void free(
Data *);
626 void realloc(
int alloc);
628 void updateProperties()
const;
631 const QChar *data2,
int length2,
636 static int localeAwareCompare_helper(
const QChar *data1,
int length1,
637 const QChar *data2,
int length2);
638 static Data *fromLatin1_helper(
const char *str,
int size = -1);
639 static Data *fromAscii_helper(
const char *str,
int size = -1);
640 void replace_helper(
uint *indices,
int nIndices,
int blen,
const QChar *after,
int alen);
659 { chars = other.
chars;
return *
this; }
661 inline const char *
latin1()
const {
return chars; }
664 {
return s == *
this; }
666 {
return s != *
this; }
668 {
return s < *
this; }
670 {
return s > *
this; }
672 {
return s <= *
this; }
674 {
return s >= *
this; }
705 {
return d->
size == 0; }
707 {
return reinterpret_cast<const QChar*
>(
d->
data); }
709 {
return reinterpret_cast<const QChar*
>(
d->
data); }
713 {
return reinterpret_cast<const QChar*
>(
d->
data); }
717 {
return d->
ref == 1; }
742 {
return setNum(
double(n),f,prec); }
744 {
return arg(
qlonglong(a), fieldWidth, base, fillChar); }
748 {
return arg(
qlonglong(a), fieldWidth, base, fillChar); }
752 {
return arg(
qlonglong(a), fieldWidth, base, fillChar); }
758 {
const QString *args[3] = { &a1, &a2, &a3 };
return multiArg(3, args); }
761 {
const QString *args[4] = { &a1, &a2, &a3, &a4 };
return multiArg(4, args); }
764 {
const QString *args[5] = { &a1, &a2, &a3, &a4, &a5 };
return multiArg(5, args); }
767 {
const QString *args[6] = { &a1, &a2, &a3, &a4, &a5, &a6 };
return multiArg(6, args); }
771 {
const QString *args[7] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7 };
return multiArg(7, args); }
775 {
const QString *args[8] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8 };
return multiArg(8, args); }
779 {
const QString *args[9] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9 };
return multiArg(9, args); }
803 #ifndef QT_NO_CAST_FROM_ASCII 847 inline void setCell(
uchar cell);
848 inline void setRow(
uchar row);
850 #ifdef Q_COMPILER_MANGLES_RETURN_TYPE 862 inline QT3_SUPPORT
bool mirrored()
const {
return hasMirrored(); }
865 #ifdef Q_COMPILER_MANGLES_RETURN_TYPE 866 const QT3_SUPPORT
char latin1()
const {
return QChar(*this).
toLatin1(); }
867 const QT3_SUPPORT
char ascii()
const {
return QChar(*this).
toAscii(); }
869 QT3_SUPPORT
char latin1()
const {
return QChar(*this).
toLatin1(); }
870 QT3_SUPPORT
char ascii()
const {
return QChar(*this).
toAscii(); }
883 {
return setUnicode(reinterpret_cast<const QChar *>(autf16), asize); }
891 {
return reinterpret_cast<const QChar*
>(
d->
data); }
893 {
return reinterpret_cast<const QChar*
>(
d->
data); }
915 #ifndef QT_NO_CAST_FROM_ASCII 918 # ifndef QT_NO_TEXTCODEC 993 #endif // QT_NO_CAST_FROM_ASCII 995 #ifndef QT_NO_CAST_TO_ASCII 1013 inline int QByteArray::find(
const QString &s,
int from)
const 1015 inline int QByteArray::findRev(
const QString &s,
int from)
const 1017 # endif // QT3_SUPPORT 1018 #endif // QT_NO_CAST_TO_ASCII 1020 #if !defined(QT_USE_FAST_OPERATOR_PLUS) && !defined(QT_USE_QSTRINGBUILDER) 1022 {
QString t(s1); t += s2;
return t; }
1024 {
QString t(s1); t += s2;
return t; }
1026 {
QString t(s1); t += s2;
return t; }
1027 # ifndef QT_NO_CAST_FROM_ASCII 1040 # endif // QT_NO_CAST_FROM_ASCII 1041 #endif // QT_USE_QSTRINGBUILDER 1048 {
return fromAscii(s.data(), int(s.size())); }
1050 # ifndef QT_NO_STL_WCHAR 1056 #if defined(_MSC_VER) && _MSC_VER >= 1400 1079 #if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)) 1090 inline QT3_SUPPORT
const QString &string()
const {
return *
this; }
1108 :m_string(other.m_string), m_position(other.m_position), m_size(other.m_size)
1114 inline int size()
const {
return m_size; }
1115 inline int count()
const {
return m_size; }
1120 m_size = other.
m_size;
return *
this;
1156 return m_string->
unicode() + m_position;
1167 inline void clear() { m_string = 0; m_position = m_size = 0; }
1169 inline bool isEmpty()
const {
return m_size == 0; }
1194 { m_string = aString; m_position = 0; m_size = aString?aString->
size():0;
return *
this; }
1197 :m_string(aString), m_position(aPosition), m_size(aSize){}
1204 {
return !(s1 == s2); }
1207 {
return !(s1 == s2); }
1209 {
return s2 == s1; }
1211 {
return s2 != s1; }
1214 {
return !(s1 == s2); }
1216 {
return s2 == s1; }
1218 {
return s2 != s1; }
1224 {
return !(s1 > s2); }
1226 {
return !(s1 < s2); }
1230 # ifndef QT_NO_TEXTCODEC 1290 #if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER) 1291 #include <QtCore/qstringbuilder.h> #define QT_ASCII_CAST_WARN
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
bool isSharedWith(const QString &other) const
QT_ASCII_CAST_WARN bool operator>(const char *s1, const QString &s2)
QString decomposition() const
bool operator>(const QStringRef &s1, const QStringRef &s2)
QString section(QChar sep, int start, int end=-1, SectionFlags flags=SectionDefault) const
This function returns a section of the string.
iterator end()
Returns an STL-style iterator pointing to the imaginary character after the last character in the str...
void clear()
Clears the contents of the string reference by making it null and empty.
bool operator!=(const QLatin1String &s) const
QT_ASCII_CAST_WARN QString & prepend(const char *s)
~QStringRef()
Destroys the string reference.
const QChar * const_iterator
The QString::const_iterator typedef provides an STL-style const iterator for QString.
Joining
This enum type defines the Unicode joining attributes.
The QConstString class is a wrapper for constant Unicode string data.
QStringRef(const QStringRef &other)
Constructs a copy of the other string reference.
QChar::UnicodeVersion unicodeVersion() const
bool operator==(const QStringRef &s1, const QStringRef &s2)
Returns true if string reference s1 is lexically equal to string reference s2; otherwise returns fals...
QString & operator+=(const QString &s)
Appends the string other onto the end of this string and returns a reference to this string...
void push_front(const QString &s)
This function is provided for STL compatibility, prepending the given other string to the beginning o...
bool isLetter() const
Returns true if the character is a letter (Letter_* categories); otherwise returns false...
QChar::Joining joining() const
Category
This enum maps the Unicode character categories.
static int localeAwareCompare_helper(const QChar *data1, int length1, const QChar *data2, int length2)
#define QT_END_NAMESPACE
This macro expands to.
QChar::Decomposition decompositionTag() const
QString & operator=(QChar c)
bool qStringComparisonHelper(const QString &s1, const char *s2)
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
NormalizationForm
This enum describes the various normalized forms of Unicode text.
bool operator<=(const QLatin1String &s) const
int length() const
Returns the number of characters referred to by the string reference.
int digitValue() const
Returns the numeric value of the digit, or -1 if the character is not a digit.
const QChar at(int i) const
Returns the character at the given index position in the string.
QCharRef(QString &str, int idx)
QT_ASCII_CAST_WARN bool operator==(const QString &s2) const
Returns true if this byte array is equal to string str; otherwise returns false.
The QRegExp class provides pattern matching using regular expressions.
QChar * iterator
The QString::iterator typedef provides an STL-style non-const iterator for QString.
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
bool isNull() const
Returns true if the character is the Unicode character 0x0000 ('\0'); otherwise returns false...
QChar value_type
The QString::const_reference typedef provides an STL-style value type for QString.
QT_ASCII_CAST_WARN bool operator==(const char *s) const
QByteArray & append(char c)
Appends the character ch to this byte array.
bool operator!=(QString::Null, QString::Null)
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
const_iterator ConstIterator
Qt-style synonym for QString::const_iterator.
QChar mirroredChar() const
QString & replace(int i, int len, QChar after)
#define at(className, varName)
The QByteArray class provides an array of bytes.
QCharRef & operator=(ushort rc)
int length() const
Returns the number of characters in this string.
QString & prepend(QChar c)
bool operator<(const QString &s) const
Returns true if this string is lexically less than the other string; otherwise returns false...
int toWCharArray(wchar_t *array) const
Fills the array with the data contained in this QString object.
Decomposition decompositionTag() const
Returns the tag defining the composition of the character.
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
QT_ASCII_CAST_WARN QCharRef & operator=(char c)
QCharRef & operator=(uint rc)
static void clear(QVariant::Private *d)
Joining joining() const
Returns information about the joining properties of the character (needed for certain languages such ...
void push_front(QChar c)
Prepends the given ch character to the beginning of this string.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
static int compare(const QString &s1, const QLatin1String &s2, Qt::CaseSensitivity cs=Qt::CaseSensitive)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
long ASN1_INTEGER_get ASN1_INTEGER * a
bool isSimpleText() const
std::string toStdString() const
Returns a std::string object with the data contained in this QString.
bool operator==(QString::Null, QString::Null)
bool operator>=(const QString &s) const
Returns true if this string is lexically greater than or equal to string other; otherwise returns fal...
The QString class provides a Unicode character string.
const QChar * data() const
Same as unicode().
QString multiArg(int numArgs, const QString **args) const
The QVector class is a template class that provides a dynamic array.
The QObject class is the base class of all Qt objects.
bool isPrint() const
Returns true if the character is a printable character; otherwise returns false.
QChar::Direction direction() const
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 fal...
The QChar class provides a 16-bit Unicode character.
void push_back(QChar c)
Appends the given ch character onto the end of this string.
QChar * data()
Returns a pointer to the data stored in the QString.
QCharRef & operator=(int rc)
QT_ASCII_CAST_WARN QString & prepend(const QByteArray &s)
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
Category category() const
Returns the character's category.
QT_ASCII_CAST_WARN QString & operator+=(const QByteArray &s)
bool isLower() const
Returns true if the character is a lowercase letter, i.
const QChar & const_reference
The QString::const_reference typedef provides an STL-style const reference for QString.
static QString fromStdWString(const std::wstring &s)
Returns a copy of the str string.
QChar::Category category() const
#define Q_DECLARE_SHARED(TYPE)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first character in the string. ...
void push_back(const QString &s)
This function is provided for STL compatibility, appending the given other string onto the end of thi...
UnicodeVersion unicodeVersion() const
Returns the Unicode version that introduced this character.
const QChar * constData() const
Same as unicode().
int localeAwareCompare(const QString &s) const
Compares this string with the other string and returns an integer less than, equal to...
QT_ASCII_CAST_WARN bool operator>=(const char *s) const
~QString()
Destroys the string.
void reserve(int size)
Attempts to allocate memory for at least size characters.
bool hasMirrored() const
Returns true if the character should be reversed if the text direction is reversed; otherwise returns...
static QString toString(Register *reg, int type, bool *ok=0)
QT_ASCII_CAST_WARN bool operator>(const QByteArray &s) const
static int localeAwareCompare(const QString &s1, const QString &s2)
Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less th...
QT_ASCII_CAST_WARN bool operator>=(const QString &s2) const
Returns true if this byte array is greater than or equal to string str; otherwise returns false...
bool operator>=(const QStringRef &s1, const QStringRef &s2)
bool operator==(const QString &s) const
Returns true if string other is equal to this string; otherwise returns false.
static int compare_helper(const QChar *data1, int length1, const QChar *data2, int length2, Qt::CaseSensitivity cs=Qt::CaseSensitive)
int size() const
Returns the number of characters referred to by the string reference.
#define QT_BEGIN_NAMESPACE
This macro expands to.
const char * latin1() const
Returns the Latin-1 string stored in this object.
QLatin1String(const char *s)
Constructs a QLatin1String object that stores str.
QT_ASCII_CAST_WARN bool operator<=(const char *s) const
static bool compare(const QVariant::Private *a, const QVariant::Private *b)
Compares a to b.
int lastIndexOf(char c, int from=-1) const
Returns the index position of the last occurrence of character ch in the byte array, searching backward from index position from.
static bool isEmpty(const char *str)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
bool operator<(const QStringRef &s1, const QStringRef &s2)
Returns true if string reference s1 is lexically less than string reference s2; otherwise returns fal...
bool operator>=(const QString &s) const
Returns true if this string is lexically greater than or equal to string other; otherwise returns fal...
QT_ASCII_CAST_WARN bool operator<(const char *s) const
int size() const
Returns the number of characters in this string.
const QChar * unicode() const
Returns a '\0'-terminated Unicode representation of the string.
QString & setNum(short, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool operator<=(const QString &s) const
Returns true if this string is lexically less than or equal to string other; otherwise returns false...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QT_ASCII_CAST_WARN QCharRef & operator=(uchar c)
QT_ASCII_CAST_WARN bool operator!=(const QString &s2) const
Returns true if this byte array is not equal to string str; otherwise returns false.
QChar mirroredChar() const
Returns the mirrored character if this character is a mirrored character; otherwise returns the chara...
bool operator!=(const QString &s) const
Returns true if this string is not equal to string other; otherwise returns false.
The QStringList class provides a list of strings.
bool operator==(const QString &s) const
Returns true if this string is equal to string other; otherwise returns false.
static int toInt(const QByteArray &str)
bool isPunct() const
Returns true if the character is a punctuation mark (Punctuation_* categories); otherwise returns fal...
Q_DECLARE_TYPEINFO(QString, Q_MOVABLE_TYPE)
bool isEmpty() const
Returns true if the string reference has no characters; otherwise returns false.
int count() const
Returns the number of characters referred to by the string reference.
static const char * data(const QByteArray &arr)
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...
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
const QChar operator[](int i) const
QString & prepend(const QLatin1String &s)
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
QChar toUpper() const
Returns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the ch...
#define QT_ASCII_CAST_WARN_CONSTRUCTOR
bool operator>(const QString &s) const
Returns true if this string is lexically greater than string other; otherwise returns false...
static void split(QT_FT_Vector *b)
const QChar * unicode() const
Returns a Unicode representation of the string reference.
QT_ASCII_CAST_WARN QString & operator=(const char *ch)
SectionFlag
This enum specifies flags that can be used to affect various aspects of the section() function's beha...
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
QBool contains(const QRegExp &rx) const
static int compare(const QLatin1String &s1, const QString &s2, Qt::CaseSensitivity cs=Qt::CaseSensitive)
QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QString &s2)
int indexOf(char c, int from=0) const
Returns the index position of the first occurrence of the character ch in the byte array...
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
bool operator>(const QString &s) const
Returns true if this string is lexically greater than string other; otherwise returns false...
void squeeze()
Releases any memory not required to store the character data.
QString & operator+=(const QLatin1String &s)
static QString fromStdString(const std::string &s)
Returns a copy of the str string.
UnicodeVersion
Specifies which version of the [Unicode standard](http://www.
int localeAwareCompare(const QString &s) const
QT_ASCII_CAST_WARN bool operator>(const QString &s2) const
Returns true if this byte array is lexically greater than string str; otherwise returns false...
The QStringRef class provides a thin wrapper around QString substrings.
QChar toTitleCase() const
Returns the title case equivalent if the character is lowercase or uppercase; otherwise returns the c...
QT_ASCII_CAST_WARN bool operator<(const QByteArray &s) const
QDataStream & operator<<(QDataStream &stream, const QString &string)
Writes the given string to the specified stream.
void qSwap(T &value1, T &value2)
QT_ASCII_CAST_WARN bool operator!=(const char *s) const
bool isUpper() const
Returns true if the character is an uppercase letter, i.
char toAscii() const
Returns the character value of the QChar obtained using the current codec used to read C strings...
int length() const
Same as size().
bool operator<=(const QStringRef &s1, const QStringRef &s2)
void resize(int size)
Sets the size of the string to size characters.
const char * constData() const
Returns a pointer to the data stored in the byte array.
QStringRef()
Constructs an empty string reference.
bool isNull() const
Returns true if this string is null; otherwise returns false.
bool operator<=(const QString &s) const
Returns true if this string is lexically less than or equal to string other; otherwise returns false...
#define Q_REQUIRED_RESULT
friend bool qStringComparisonHelper(const QString &s1, const char *s2)
int position() const
Returns the starting position in the referenced string that is referred to by the string reference...
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
QT_ASCII_CAST_WARN bool operator<(const char *s1, const QString &s2)
QString & append(QChar c)
int compare(const QString &s) const
Direction
This enum type defines the Unicode direction attributes.
QString trimmed(QString source)
QString & insert(int i, const QString &s)
Inserts the string str at the given index position and returns a reference to this string...
const QString * string() const
Returns a pointer to the string referred to by the string reference, or 0 if it does not reference a ...
int capacity() const
Returns the maximum number of characters that can be stored in the string without forcing a reallocat...
QT_ASCII_CAST_WARN QString & operator=(const QByteArray &a)
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 o...
QDataStream & operator>>(QDataStream &stream, QString &string)
Reads a string from the specified stream into the given string.
void clear()
Clears the contents of the string and makes it empty.
QT_ASCII_CAST_WARN QString & operator=(char c)
std::basic_string< wchar_t > QStdWString
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
void swap(QString &other)
Swaps string other with this string.
The QCharRef class is a helper class for QString.
QT_ASCII_CAST_WARN bool operator<=(const QString &s2) const
Returns true if this byte array is lexically less than or equal to string str; otherwise returns fals...
QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const QByteArray &a)
Constructs a string initialized with the byte array ba.
static QTextCodec * codecForCStrings
iterator begin()
Returns an STL-style iterator pointing to the first character in the string.
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
uint qstrnlen(const char *str, uint maxlen)
QStringRef & operator=(const QStringRef &other)
Assigns the other string reference to this string reference, and returns the result.
uchar cell() const
Returns the cell (least significant byte) of the Unicode character.
bool operator!=(const QString &s) const
Returns true if this string is not equal to string other; otherwise returns false.
QString & prepend(const QString &s)
Prepends the string str to the beginning of this string and returns a reference to this string...
QT_ASCII_CAST_WARN QString & operator+=(char c)
int size() const
Returns the number of bytes in this byte array.
char toLatin1() const
Returns the Latin-1 character equivalent to the QChar, or 0.
QChar & reference
The QString::const_reference typedef provides an STL-style reference for QString. ...
QByteArray & operator+=(char c)
Appends the character ch onto the end of this byte array and returns a reference to this byte array...
Q_TESTLIB_EXPORT bool compare_helper(bool success, const char *msg, const char *file, int line)
QT_ASCII_CAST_WARN bool operator<=(const QByteArray &s) const
QBool contains(QRegExp &rx) const
QT_ASCII_CAST_WARN bool operator>(const char *s) const
bool operator>=(const QLatin1String &s) const
bool isMark() const
Returns true if the character is a mark (Mark_* categories); otherwise returns false.
static qreal toDouble(const QChar *&str)
QByteArray & replace(int index, int len, const char *s)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QCharRef & operator=(const QCharRef &c)
QCharRef & operator=(const QChar &c)
QString & setUtf16(const ushort *utf16, int size)
Resizes the string to size characters and copies unicode into the string.
int qstrcmp(const QByteArray &str1, const char *str2)
The QDataStream class provides serialization of binary data to a QIODevice.
bool isNull() const
Returns true if string() returns a null pointer or a pointer to a null string; otherwise returns true...
QString & operator=(const Null &)
static int grow(int size)
Direction direction() const
Returns the character's direction.
unsigned char combiningClass() const
Returns the combining class for the character as defined in the Unicode standard. ...
QT_ASCII_CAST_WARN QString & append(const char *s)
The QTextCodec class provides conversions between text encodings.
QString & operator+=(QChar c)
timeval & operator+=(timeval &t1, const timeval &t2)
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
const QString operator+(const QString &s1, const QString &s2)
Returns a string which is the result of concatenating s1 and s2.
static const KeyPair *const end
QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QString &s2)
uchar combiningClass() const
bool isTitleCase() const
Returns true if the character is a titlecase letter, i.
static QChar fromAscii(char c)
Converts the ASCII character c to its equivalent QChar.
QT_ASCII_CAST_WARN QString & append(const QByteArray &s)
QT_ASCII_CAST_WARN bool operator<(const QString &s2) const
Returns true if this byte array is lexically less than string str; otherwise returns false...
QVector< uint > toUcs4() const Q_REQUIRED_RESULT
Returns a UCS-4/UTF-32 representation of the string as a QVector<uint>.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
QCharRef & operator=(short rc)
QString decomposition() const
Decomposes a character into its parts.
QString & insert(int i, QChar c)
iterator Iterator
Qt-style synonym for QString::iterator.
QChar toLower() const
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the ch...
uchar row() const
Returns the row (most significant byte) of the Unicode character.
static int compare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs)
Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less th...
QString & operator+=(const QStringRef &s)
SplitBehavior
This enum specifies how the split() function should behave with respect to empty strings.
QChar toTitleCase() const
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QString & setUnicode(const QChar *unicode, int size)
Resizes the string to size characters and copies unicode into the string.
QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const char *ch)
Constructs a string initialized with the 8-bit string str.
QString & operator+=(QChar::SpecialCharacter c)
const QChar * constData() const
Returns a pointer to the data stored in the QString.
bool isNumber() const
Returns true if the character is a number (Number_* categories, not just 0-9); otherwise returns fals...
bool isDigit() const
Returns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false...
const QChar at(int i) const
Returns the character at the given index position in the string reference.
QLatin1String & operator=(const QLatin1String &other)
Constructs a copy of other.
bool operator<(const QString &s) const
Returns true if this string is lexically less than string other; otherwise returns false...
bool isLetterOrNumber() const
Returns true if the character is a letter or number (Letter_* or Number_* categories); otherwise retu...
QT_ASCII_CAST_WARN bool operator>=(const QByteArray &s) const
QString()
Constructs a null string.
std::wstring toStdWString() const
Returns a std::wstring object with the data contained in this QString.
QT_ASCII_CAST_WARN QString & operator+=(const char *s)
QByteArray & insert(int i, char c)
Inserts character ch at index position i in the byte array.
Decomposition
This enum type defines the Unicode decomposition attributes.