| qanystringview.cpp |
|
27279 |
- |
| qanystringview.h |
|
15749 |
- |
| qbytearray.cpp |
Safe and portable C string functions; extensions to standard string.h
*************************************************************************** |
158583 |
- |
| qbytearray.h |
|
34375 |
- |
| qbytearrayalgorithms.h |
|
9033 |
- |
| qbytearraylist.cpp |
! \typedef QByteArrayListIterator
\relates QByteArrayList
The QByteArrayListIterator type definition provides a Java-style const
iterator for QByteArrayList.
QByteArrayList provides both \l{Java-style iterators} and
\l{STL-style iterators}. The Java-style const iterator is simply
a type definition for QListIterator<QByteArray>.
\sa QMutableByteArrayListIterator, QByteArrayList::const_iterator
|
4008 |
- |
| qbytearraylist.h |
|
2085 |
- |
| qbytearraymatcher.cpp |
! \class QByteArrayMatcher
\inmodule QtCore
\brief The QByteArrayMatcher class holds a sequence of bytes that
can be quickly matched in a byte array.
\ingroup tools
\ingroup string-processing
This class is useful when you have a sequence of bytes that you
want to repeatedly match against some byte arrays (perhaps in a
loop), or when you want to search for the same sequence of bytes
multiple times in the same byte array. Using a matcher object and
indexIn() is faster than matching a plain QByteArray with
QByteArray::indexOf() if repeated matching takes place. This
class offers no benefit if you are doing one-off byte array
matches.
Create the QByteArrayMatcher with the QByteArray you want to
search for. Then call indexIn() on the QByteArray that you want to
search.
\sa QByteArray, QStringMatcher
|
13167 |
- |
| qbytearraymatcher.h |
|
4354 |
- |
| qbytearrayview.h |
|
21194 |
- |
| qbytearrayview.qdoc |
|
36338 |
- |
| qchar.cpp |
!
\class QLatin1Char
\inmodule QtCore
\reentrant
\brief The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
\ingroup string-processing
This class is only useful to construct a QChar with 8-bit character.
\sa QChar, QLatin1StringView, QString
|
62977 |
- |
| qchar.h |
|
27236 |
- |
| qcollator.cpp |
!
\class QCollator
\inmodule QtCore
\brief The QCollator class compares strings according to a localized collation algorithm.
\compares equality
\since 5.2
\reentrant
\ingroup i18n
\ingroup string-processing
\ingroup shared
QCollator is initialized with a QLocale. It can then be used to compare and
sort strings by using the ordering appropriate for that locale.
A QCollator object can be used together with template-based sorting
algorithms, such as std::sort(), to sort a list with QString entries.
\snippet code/src_corelib_text_qcollator.cpp 0
In addition to the locale, several optional flags can be set that influence
the result of the collation.
\section1 POSIX fallback implementation
On Unix systems, Qt is normally compiled to use ICU (except for \macos,
where Qt defaults to using an equivalent Apple API). However, if ICU was
not available at compile time or explicitly disabled, Qt will use a
fallback backend that uses the POSIX API only. This backend has several
limitations:
\list
\li Only the QLocale::c() and QLocale::system() locales are supported.
Consult the POSIX and C Standard Library manuals for the
\c{<locale.h>} header for more information on the system locale.
\li caseSensitivity() is not supported: only case-sensitive collation
can be performed.
\li The options set via numericMode(), ignorePunctuation(), and
options() are not supported.
\endlist
On Android systems, when not compiled to use an own copy of ICU Qt uses
the platform-provided ICU on Android 33 and newer. On older Android versions
it falls back to the Java Collator API, which has a few limitations:
\list
\li The IgnorePunctuation and NumericSort options are not supported.
\li The DiacriticInsensitive option only has an effect in combination
with CaseInsensitive also being set, using DiacriticInsensitive
without CaseInsensitive is not supported.
\endlist
The use of any of the unsupported options will cause a warning to be
printed to the application's output.
\section1 WebAssembly implementation
On WebAssembly, Qt uses the JavaScript \c{Intl.Collator} API as its
collation backend (unless ICU is available). This supports arbitrary
locales as well as numericMode(), caseSensitivity(), and ignorePunctuation().
\c{Intl.Collator} provides no sort-key extraction, so sortKey() produces
keys that delegate back to the collator when compared: their ordering
matches compare(), but they offer none of the performance benefit that sort
keys provide on the other backends (see QCollator::sortKey()).
|
21554 |
- |
| qcollator.h |
|
3935 |
- |
| qcollator_icu.cpp |
|
9604 |
- |
| qcollator_macx.cpp |
LocaleRefFromLocaleString() will accept "POSIX" as the locale name, but
the locale it produces (named "pos") doesn't implement the [A-Z] < [a-z]
behavior we expect of the C locale. We can use QStringView to get round
that for collation, but this leaves no way to do a sort key.
|
4621 |
- |
| qcollator_p.h |
|
3491 |
- |
| qcollator_posix.cpp |
|
3983 |
- |
| qcollator_wasm.cpp |
|
3797 |
- |
| qcollator_win.cpp |
|
4630 |
- |
| qdoublescanprint_p.h |
|
3765 |
- |
| qlatin1stringmatcher.cpp |
! \class QLatin1StringMatcher
\inmodule QtCore
\brief Optimized search for substring in Latin-1 text.
A QLatin1StringMatcher can search for one QLatin1StringView
as a substring of another, either ignoring case or taking it into
account.
\since 6.5
\ingroup tools
\ingroup string-processing
This class is useful when you have a Latin-1 encoded string that
you want to repeatedly search for in some QLatin1StringViews
(perhaps in a loop), or when you want to search for all
instances of it in a given QLatin1StringView. Using a matcher
object and indexIn() is faster than matching a plain
QLatin1StringView with QLatin1StringView::indexOf() if repeated
matching takes place. This class offers no benefit if you are
doing one-off matches. The string to be searched for must not
be destroyed or changed before the matcher object is destroyed,
as the matcher accesses the string when searching for it.
Create a QLatin1StringMatcher for the QLatin1StringView
you want to search for and the case sensitivity. Then call
indexIn() with the QLatin1StringView that you want to search
within.
\sa QLatin1StringView, QStringMatcher, QByteArrayMatcher
|
6976 |
- |
| qlatin1stringmatcher.h |
|
6889 |
- |
| qlatin1stringview.h |
|
19480 |
- |
| qlatin1stringview.qdoc |
|
44818 |
- |
| qlocale.cpp |
gcc has complained about storing a pointer to a static QLocalePrivate in a
QSharedDataPointer, whose destructor would free the non-heap object if the
refcount ever got down to zero. The static instances this happens to are
instantiated with a refcount of 1 that never gets decremented so as long as
QSharedDataPointer keeps its incref()s and decref()s balanced it'll never get
down to zero - but the clever compiler isn't quite smart enough to figure
that out.
|
196445 |
- |
| qlocale.h |
|
38482 |
- |
| qlocale.qdoc |
|
41062 |
- |
| qlocale_android.cpp |
|
7113 |
- |
| qlocale_data_p.h |
This part of the file was generated on 2026-05-06 from the
Common Locale Data Repository v48.2
http://www.unicode.org/cldr/
Do not edit this section: instead regenerate it using
cldr2qlocalexml.py and qlocalexml2cpp.py on updated (or
edited) CLDR data; see qtbase/util/locale_database/.
|
809443 |
- |
| qlocale_icu.cpp |
|
2778 |
- |
| qlocale_mac.mm |
Wrappers for Mac locale system functions
|
29037 |
- |
| qlocale_p.h |
|
30211 |
- |
| qlocale_tools.cpp |
|
33507 |
- |
| qlocale_tools_p.h |
|
4671 |
- |
| qlocale_unix.cpp |
If \a known (our current best shot at deciding which language to use)
provides more information (e.g. script, country) than \a maybe (a
candidate to replace \a known) and \a maybe agrees with \a known in what
it does provide, we keep \a known; this happens when \a maybe comes from
LANGUAGE (usually a simple language code) and LANG includes script and/or
country. A textual comparison won't do because, for example, bn (Bengali)
isn't a prefix of ben_IN, but the latter is a refinement of the former.
(Meanwhile, bn is a prefix of bnt, Bantu; and a prefix of ben is be,
Belarusian. There are many more such prefixings between two- and
three-letter codes.)
|
10859 |
- |
| qlocale_wasm.cpp |
|
1295 |
- |
| qlocale_win.cpp |
|
41399 |
- |
| qregularexpression.cpp |
|
119342 |
- |
| qregularexpression.h |
|
15684 |
- |
| qstaticlatin1stringmatcher.h |
|
5322 |
- |
| qstaticlatin1stringmatcher.qdoc |
|
3857 |
- |
| qstring.cpp |
!
\internal
Returns the index position of the first occurrence of the
character \a ch in the string given by \a str and \a len,
searching forward from index
position \a from. Returns -1 if \a ch could not be found.
|
330064 |
- |
| qstring.h |
|
78214 |
- |
| qstring_mips_dsp_asm.S |
|
9197 |
- |
| qstringalgorithms.h |
|
13952 |
- |
| qstringalgorithms_p.h |
|
11419 |
- |
| qstringbuilder.cpp |
!
\class QStringBuilder
\inmodule QtCore
\internal
\reentrant
\since 4.6
\brief The QStringBuilder class is a template class that provides a facility to build up QStrings and QByteArrays from smaller chunks.
\ingroup tools
\ingroup shared
\ingroup string-processing
To build a QString by multiple concatenations, QString::operator+()
is typically used. This causes \e{n - 1} allocations when building
a string from \e{n} chunks. The same is true for QByteArray.
QStringBuilder uses expression templates to collect the individual
chunks, compute the total size, allocate the required amount of
memory for the final string object, and copy the chunks into the
allocated memory.
The QStringBuilder class is not to be used explicitly in user
code. Instances of the class are created as return values of the
operator%() function, acting on objects of the following types:
For building QStrings:
\list
\li QString, (since 5.10:) QStringView
\li QChar, QLatin1Char, (since 5.10:) \c char16_t,
\li QLatin1StringView,
\li (since 5.10:) \c{const char16_t[]} (\c{u"foo"}),
\li QByteArray, \c char, \c{const char[]}.
\endlist
The types in the last list point are only available when
\c QT_NO_CAST_FROM_ASCII is not defined.
For building QByteArrays:
\list
\li QByteArray, \c char, \c{const char[]}.
\endlist
Concatenating strings with operator%() generally yields better
performance than using \c QString::operator+() on the same chunks
if there are three or more of them, and performs equally well in other
cases.
\note Defining \c QT_USE_QSTRINGBUILDER at build time (this is the
default when building Qt libraries and tools), will make using \c {'+'}
when concatenating strings work the same way as \c operator%().
\sa QLatin1StringView, QString
|
3767 |
- |
| qstringbuilder.h |
|
15184 |
- |
| qstringconverter.cpp |
|
119535 |
- |
| qstringconverter.h |
|
10317 |
- |
| qstringconverter_base.h |
|
5721 |
- |
| qstringconverter_base_deprecated.h |
|
923 |
- |
| qstringconverter_p.h |
|
15165 |
- |
| qstringfwd.h |
|
1794 |
- |
| qstringiterator.qdoc |
|
10538 |
- |
| qstringiterator_p.h |
|
7329 |
- |
| qstringlist.cpp |
! \typedef QStringListIterator
\relates QStringList
The QStringListIterator type definition provides a Java-style const
iterator for QStringList.
QStringList provides both \l{Java-style iterators} and
\l{STL-style iterators}. The Java-style const iterator is simply
a type definition for QListIterator<QString>.
\sa QMutableStringListIterator, QStringList::const_iterator
|
23152 |
- |
| qstringlist.h |
|
9287 |
- |
| qstringliteral.h |
|
479 |
- |
| qstringmatcher.cpp |
|
10255 |
- |
| qstringmatcher.h |
|
1854 |
- |
| qstringtokenizer.cpp |
!
\class QStringTokenizer
\inmodule QtCore
\since 6.0
\brief The QStringTokenizer class splits strings into tokens along given separators.
\reentrant
\ingroup tools
\ingroup string-processing
QStringTokenizer\<Haystack, Needle\> is a template class where \a Haystack
is the type of the string being tokenized and \a Needle is the type of the
separator. In practice, you should never need to specify these template
arguments explicitly; they are deduced automatically by the compiler.
Splits a string into substrings wherever a given separator occurs,
returning a (lazily constructed) list of those strings. If the separator does
not match anywhere in the string, produces a single-element list
containing this string. If the separator is empty,
QStringTokenizer produces an empty string, followed by each of the
string's characters, followed by another empty string. The two
enumerations Qt::SplitBehavior and Qt::CaseSensitivity further
control the output.
QStringTokenizer drives QStringView::tokenize(), but you can use it
directly, too:
\code
for (auto it : QStringTokenizer{string, separator})
use(*it);
\endcode
\note You should never name the template arguments of a
QStringTokenizer explicitly. You may write
\c{QStringTokenizer{string, separator}} (without template arguments),
or use either QStringView::tokenize() or QLatin1StringView::tokenize(),
then store the return value only in an \c{auto} variable:
\code
auto result = strview.tokenize(sep);
\endcode
This is because the template arguments of QStringTokenizer have a
very subtle dependency on the specific string and separator types
from with which they are constructed, and they don't usually
correspond to the actual types passed.
\section1 Lazy Sequences
QStringTokenizer acts as a so-called lazy sequence, that is, each
next element is only computed once you ask for it. Lazy sequences
have the advantage that they only require O(1) memory. They have
the disadvantage that, at least for QStringTokenizer, they only
allow forward, not random-access, iteration.
The intended use-case is that you just plug it into a ranged for loop:
\code
for (auto it : QStringTokenizer{string, separator})
use(*it);
\endcode
or a C++20 ranged algorithm:
\code
std::ranges::for_each(QStringTokenizer{string, separator},
[] (auto token) { use(token); });
\endcode
\section1 End Sentinel
The QStringTokenizer iterators cannot be used with classical STL
algorithms, because those require iterator/iterator pairs, while
QStringTokenizer uses sentinels. That is, it uses a different
type, QStringTokenizer::sentinel, to mark the end of the
range. This improves performance, because the sentinel is an empty
type. Sentinels are supported from C++17 (for ranged for)
and C++20 (for algorithms using the new ranges library).
\section1 Temporaries
QStringTokenizer is very carefully designed to avoid dangling
references. If you construct a tokenizer from a temporary string
(an rvalue), that argument is stored internally, so the referenced
data isn't deleted before it is tokenized:
\code
auto tok = QStringTokenizer{widget.text(), u','};
// return value of `widget.text()` is destroyed, but content was moved into `tok`
for (auto e : tok)
use(e);
\endcode
If you pass named objects (lvalues), then QStringTokenizer does
not store a copy. You are responsible to keep the named object's
data around for longer than the tokenizer operates on it:
\code
auto text = widget.text();
auto tok = QStringTokenizer{text, u','};
text.clear(); // destroy content of `text`
for (auto e : tok) // ERROR: `tok` references deleted data!
use(e);
\endcode
\sa QStringView::split(), QString::split(), QRegularExpression
|
11390 |
- |
| qstringtokenizer.h |
|
17310 |
- |
| qstringview.cpp |
!
\class QStringView
\inmodule QtCore
\since 5.10
\brief The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QString API.
\reentrant
\ingroup tools
\ingroup string-processing
A QStringView references a contiguous portion of a UTF-16 string it does
not own. It acts as an interface type to all kinds of UTF-16 string,
without the need to construct a QString first.
The UTF-16 string may be represented as an array (or an array-compatible
data-structure such as QString,
std::basic_string, etc.) of QChar, \c ushort, \c char16_t or
(on platforms, such as Windows, where it is a 16-bit type) \c wchar_t.
QStringView is designed as an interface type; its main use-case is
as a function parameter type. When QStringViews are used as automatic
variables or data members, care must be taken to ensure that the referenced
string data (for example, owned by a QString) outlives the QStringView on all code paths,
lest the string view ends up referencing deleted data.
When used as an interface type, QStringView allows a single function to accept
a wide variety of UTF-16 string data sources. One function accepting QStringView
thus replaces three function overloads (taking QString and
\c{(const QChar*, qsizetype)}), while at the same time enabling even more string data
sources to be passed to the function, such as \c{u"Hello World"}, a \c char16_t
string literal.
QStringViews should be passed by value, not by reference-to-const:
\snippet code/src_corelib_text_qstringview.cpp 0
If you want to give your users maximum freedom in what strings they can pass
to your function, accompany the QStringView overload with overloads for
\list
\li \e QChar: this overload can delegate to the QStringView version:
\snippet code/src_corelib_text_qstringview.cpp 1
even though, for technical reasons, QStringView cannot provide a
QChar constructor by itself.
\li \e QString: if you store an unmodified copy of the string and thus would
like to take advantage of QString's implicit sharing.
\li QLatin1StringView: if you can implement the function without converting the
QLatin1StringView to UTF-16 first; users expect a function overloaded on
QLatin1StringView to perform strictly less memory allocations than the
semantically equivalent call of the QStringView version, involving
construction of a QString from the QLatin1StringView.
\endlist
QStringView can also be used as the return value of a function. If you call a
function returning QStringView, take extra care to not keep the QStringView
around longer than the function promises to keep the referenced string data alive.
If in doubt, obtain a strong reference to the data by calling toString() to convert
the QStringView into a QString.
QStringView is a \e{Literal Type}, but since it stores data as \c{char16_t}, iteration
is not \c constexpr (casts from \c{const char16_t*} to \c{const QChar*}, which is not
allowed in \c constexpr functions). You can use an indexed loop and/or utf16() in
\c constexpr contexts instead.
\sa {Which string class to use?}, QString
|
49066 |
- |
| qstringview.h |
|
25759 |
- |
| qt_attribution.json |
|
2170 |
- |
| qtextboundaryfinder.cpp |
!
\class QTextBoundaryFinder
\inmodule QtCore
\brief The QTextBoundaryFinder class provides a way of finding Unicode text boundaries in a string.
\since 4.4
\ingroup tools
\ingroup shared
\ingroup string-processing
\reentrant
QTextBoundaryFinder allows to find Unicode text boundaries in a
string, accordingly to the Unicode text boundary specification (see
\l{https://www.unicode.org/reports/tr14/}{Unicode Standard Annex #14} and
\l{https://www.unicode.org/reports/tr29/}{Unicode Standard Annex #29}).
QTextBoundaryFinder can operate on a QString in four possible
modes depending on the value of \a BoundaryType.
Units of Unicode characters that make up what the user thinks of
as a character or basic unit of the language are here called
Grapheme clusters. The two unicode characters 'A' + diaeresis do
for example form one grapheme cluster as the user thinks of them
as one character, yet it is in this case represented by two
unicode code points
(see \l{https://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries}).
Word boundaries are there to locate the start and end of what a
language considers to be a word
(see \l{https://www.unicode.org/reports/tr29/#Word_Boundaries}).
Line break boundaries give possible places where a line break
might happen and sentence boundaries will show the beginning and
end of whole sentences
(see \l{https://www.unicode.org/reports/tr29/#Sentence_Boundaries} and
\l{https://www.unicode.org/reports/tr14/}).
The first position in a string is always a valid boundary and
refers to the position before the first character. The last
position at the length of the string is also valid and refers
to the position after the last character.
|
14109 |
- |
| qtextboundaryfinder.h |
|
3094 |
- |
| qtformat_impl.h |
|
1004 |
- |
| qtliterals.qdoc |
|
1632 |
- |
| qunicodetables.cpp |
This file is autogenerated from the Unicode 17.0 database. Do not edit |
1111937 |
- |
| qunicodetables_p.h |
This file is autogenerated from the Unicode 17.0 database. Do not edit |
6076 |
- |
| qunicodetools.cpp |
|
124906 |
- |
| qunicodetools_p.h |
|
1986 |
- |
| qutf8stringview.h |
|
18171 |
- |
| qutf8stringview.qdoc |
|
23404 |
- |
| qvsnprintf.cpp |
!
\macro QT_NO_QSNPRINTF
\since 6.8
\relates QByteArray
Defining this macro removes the availability of the qsnprintf() and
qvsnprintf() functions. See the functions' documentation for why you may
want to disable them.
\sa qsnprintf(), qvsnprintf().
|
3650 |
- |