Rename snippet files to match the carved up corelib/tools/
This is a folllow-up to commitsbb10548513a4bdanda9aa206b7b, renaming the snippets files referenced by the files moved out of corelib/tools/ to match the new locations of the files using them. Change-Id: I59f5d3c217ef835e9244387cc769e7212de9d8f5 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
parent
f439df7893
commit
21549529ef
|
|
@ -799,7 +799,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
|
|||
char *} to its constructor. For example, the following code
|
||||
creates a byte array of size 5 containing the data "Hello":
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 0
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 0
|
||||
|
||||
Although the size() is 5, the byte array also maintains an extra
|
||||
'\\0' character at the end so that if a function is used that
|
||||
|
|
@ -818,11 +818,11 @@ QByteArray qUncompress(const uchar* data, int nbytes)
|
|||
operator[](). On non-const byte arrays, operator[]() returns a reference to
|
||||
a byte that can be used on the left side of an assignment. For example:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 1
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 1
|
||||
|
||||
For read-only access, an alternative syntax is to use at():
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 2
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 2
|
||||
|
||||
at() can be faster than operator[](), because it never causes a
|
||||
\l{deep copy} to occur.
|
||||
|
|
@ -834,7 +834,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
|
|||
bytes, but excluding the terminating '\\0' added by QByteArray.
|
||||
For example:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 48
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 48
|
||||
|
||||
If you want to obtain the length of the data up to and
|
||||
excluding the first '\\0' character, call qstrlen() on the byte
|
||||
|
|
@ -855,7 +855,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
|
|||
the byte data: append(), prepend(), insert(), replace(), and
|
||||
remove(). For example:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 3
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 3
|
||||
|
||||
The replace() and remove() functions' first two arguments are the
|
||||
position from which to start erasing and the number of bytes that
|
||||
|
|
@ -883,7 +883,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
|
|||
For example, here's a typical loop that finds all occurrences of a
|
||||
particular substring:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 4
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 4
|
||||
|
||||
If you simply want to check whether a QByteArray contains a
|
||||
particular character or substring, use contains(). If you want to
|
||||
|
|
@ -907,7 +907,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
|
|||
array is always empty, but an empty byte array isn't necessarily
|
||||
null:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 5
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 5
|
||||
|
||||
All functions except isNull() treat null byte arrays the same as
|
||||
empty byte arrays. For example, data() returns a valid pointer
|
||||
|
|
@ -1240,7 +1240,7 @@ QByteArray &QByteArray::operator=(const char *str)
|
|||
automaticall unless the \l{deep copy} is created.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 6
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 6
|
||||
|
||||
\sa isEmpty(), resize()
|
||||
*/
|
||||
|
|
@ -1250,7 +1250,7 @@ QByteArray &QByteArray::operator=(const char *str)
|
|||
Returns \c true if the byte array has size 0; otherwise returns \c false.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 7
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 7
|
||||
|
||||
\sa size()
|
||||
*/
|
||||
|
|
@ -1340,7 +1340,7 @@ QByteArray &QByteArray::operator=(const char *str)
|
|||
'\\0' terminator.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 8
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 8
|
||||
|
||||
The pointer remains valid as long as the byte array isn't
|
||||
reallocated or destroyed. For read-only access, constData() is
|
||||
|
|
@ -1353,11 +1353,11 @@ QByteArray &QByteArray::operator=(const char *str)
|
|||
data(), but it will corrupt the heap and cause a crash because it
|
||||
does not allocate a byte for the '\\0' at the end:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 46
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 46
|
||||
|
||||
This one allocates the correct amount of space:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 47
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 47
|
||||
|
||||
Note: A QByteArray can store any byte values including '\\0's,
|
||||
but most functions that take \c{char *} arguments assume that the
|
||||
|
|
@ -1423,7 +1423,7 @@ QByteArray &QByteArray::operator=(const char *str)
|
|||
place.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 9
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 9
|
||||
|
||||
\sa at()
|
||||
*/
|
||||
|
|
@ -1526,7 +1526,7 @@ QByteArray &QByteArray::operator=(const char *str)
|
|||
If \a pos is beyond the end of the array, nothing happens.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 10
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 10
|
||||
|
||||
\sa chop(), resize(), left()
|
||||
*/
|
||||
|
|
@ -1544,7 +1544,7 @@ void QByteArray::truncate(int pos)
|
|||
array.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 11
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 11
|
||||
|
||||
\sa truncate(), resize(), left()
|
||||
*/
|
||||
|
|
@ -1562,7 +1562,7 @@ void QByteArray::chop(int n)
|
|||
returns a reference to this byte array.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 12
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 12
|
||||
|
||||
Note: QByteArray is an \l{implicitly shared} class. Consequently,
|
||||
if you append to an empty byte array, then the byte array will just
|
||||
|
|
@ -1620,7 +1620,7 @@ void QByteArray::chop(int n)
|
|||
Returns \c true if this byte array is null; otherwise returns \c false.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 13
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 13
|
||||
|
||||
Qt makes a distinction between null byte arrays and empty byte
|
||||
arrays for historical reasons. For most applications, what
|
||||
|
|
@ -1726,7 +1726,7 @@ void QByteArray::resize(int size)
|
|||
size \a size beforehand.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 14
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 14
|
||||
|
||||
\sa resize()
|
||||
*/
|
||||
|
|
@ -1781,7 +1781,7 @@ QByteArray QByteArray::nulTerminated() const
|
|||
reference to this byte array.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 15
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 15
|
||||
|
||||
This is the same as insert(0, \a ba).
|
||||
|
||||
|
|
@ -1869,7 +1869,7 @@ QByteArray &QByteArray::prepend(char ch)
|
|||
Appends the byte array \a ba onto the end of this byte array.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 16
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 16
|
||||
|
||||
This is the same as insert(size(), \a ba).
|
||||
|
||||
|
|
@ -2015,7 +2015,7 @@ static inline QByteArray &qbytearray_insert(QByteArray *ba,
|
|||
reference to this byte array.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 17
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 17
|
||||
|
||||
\sa append(), prepend(), replace(), remove()
|
||||
*/
|
||||
|
|
@ -2123,7 +2123,7 @@ QByteArray &QByteArray::insert(int i, int count, char ch)
|
|||
array is truncated at position \a pos.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 18
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 18
|
||||
|
||||
\sa insert(), replace()
|
||||
*/
|
||||
|
|
@ -2147,7 +2147,7 @@ QByteArray &QByteArray::remove(int pos, int len)
|
|||
array \a after, and returns a reference to this byte array.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 19
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 19
|
||||
|
||||
\sa insert(), remove()
|
||||
*/
|
||||
|
|
@ -2211,7 +2211,7 @@ QByteArray &QByteArray::replace(int pos, int len, const char *after, int alen)
|
|||
byte array \a after.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 20
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 20
|
||||
*/
|
||||
|
||||
QByteArray &QByteArray::replace(const QByteArray &before, const QByteArray &after)
|
||||
|
|
@ -2477,7 +2477,7 @@ QList<QByteArray> QByteArray::split(char sep) const
|
|||
|
||||
Example:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 49
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 49
|
||||
*/
|
||||
QByteArray QByteArray::repeated(int times) const
|
||||
{
|
||||
|
|
@ -2525,7 +2525,7 @@ QByteArray QByteArray::repeated(int times) const
|
|||
position \a from. Returns -1 if \a ba could not be found.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 21
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 21
|
||||
|
||||
\sa lastIndexOf(), contains(), count()
|
||||
*/
|
||||
|
|
@ -2593,7 +2593,7 @@ int QByteArray::indexOf(const char *c, int from) const
|
|||
position \a from. Returns -1 if \a ch could not be found.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 22
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 22
|
||||
|
||||
\sa lastIndexOf(), contains()
|
||||
*/
|
||||
|
|
@ -2655,7 +2655,7 @@ static int lastIndexOfHelper(const char *haystack, int l, const char *needle, in
|
|||
starts at the last byte. Returns -1 if \a ba could not be found.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 23
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 23
|
||||
|
||||
\sa indexOf(), contains(), count()
|
||||
*/
|
||||
|
|
@ -2713,7 +2713,7 @@ int QByteArray::lastIndexOf(const char *str, int from) const
|
|||
last (size() - 1) byte. Returns -1 if \a ch could not be found.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 24
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 24
|
||||
|
||||
\sa indexOf(), contains()
|
||||
*/
|
||||
|
|
@ -2825,7 +2825,7 @@ int QByteArray::count(char ch) const
|
|||
otherwise returns \c false.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 25
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 25
|
||||
|
||||
\sa endsWith(), left()
|
||||
*/
|
||||
|
|
@ -2870,7 +2870,7 @@ bool QByteArray::startsWith(char ch) const
|
|||
otherwise returns \c false.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 26
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 26
|
||||
|
||||
\sa startsWith(), right()
|
||||
*/
|
||||
|
|
@ -2990,7 +2990,7 @@ bool QByteArray::endsWith(char ch) const
|
|||
size().
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 27
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 27
|
||||
|
||||
\sa startsWith(), right(), mid(), chopped(), chop(), truncate()
|
||||
*/
|
||||
|
|
@ -3012,7 +3012,7 @@ QByteArray QByteArray::left(int len) const
|
|||
size().
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 28
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 28
|
||||
|
||||
\sa endsWith(), left(), mid(), chopped(), chop(), truncate()
|
||||
*/
|
||||
|
|
@ -3035,7 +3035,7 @@ QByteArray QByteArray::right(int len) const
|
|||
pos until the end of the byte array.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 29
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 29
|
||||
|
||||
\sa left(), right(), chopped(), chop(), truncate()
|
||||
*/
|
||||
|
|
@ -3080,7 +3080,7 @@ QByteArray QByteArray::mid(int pos, int len) const
|
|||
interpreted as a Latin-1 encoded string.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 30
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 30
|
||||
|
||||
\sa isLower(), toUpper(), {8-bit Character Comparisons}
|
||||
*/
|
||||
|
|
@ -3134,7 +3134,7 @@ QByteArray QByteArray::toLower_helper(QByteArray &a)
|
|||
interpreted as a Latin-1 encoded string.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 31
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 31
|
||||
|
||||
\sa isUpper(), toLower(), {8-bit Character Comparisons}
|
||||
*/
|
||||
|
|
@ -3572,7 +3572,7 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba)
|
|||
characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 32
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 32
|
||||
|
||||
\sa trimmed()
|
||||
*/
|
||||
|
|
@ -3597,7 +3597,7 @@ QByteArray QByteArray::simplified_helper(QByteArray &a)
|
|||
characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 33
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 33
|
||||
|
||||
Unlike simplified(), \l {QByteArray::trimmed()}{trimmed()} leaves internal whitespace alone.
|
||||
|
||||
|
|
@ -3627,7 +3627,7 @@ QByteArray QByteArray::trimmed_helper(QByteArray &a)
|
|||
after position \a width are removed, and the copy is returned.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 34
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 34
|
||||
|
||||
\sa rightJustified()
|
||||
*/
|
||||
|
|
@ -3664,7 +3664,7 @@ QByteArray QByteArray::leftJustified(int width, char fill, bool truncate) const
|
|||
position \a width.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 35
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 35
|
||||
|
||||
\sa leftJustified()
|
||||
*/
|
||||
|
|
@ -3790,7 +3790,7 @@ qulonglong QByteArray::toULongLong(bool *ok, int base) const
|
|||
If \a ok is not \nullptr, failure is reported by setting *\a{ok}
|
||||
to \c false, and success by setting *\a{ok} to \c true.
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 36
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 36
|
||||
|
||||
\note The conversion of the number is performed in the default C locale,
|
||||
irrespective of the user's locale.
|
||||
|
|
@ -3844,7 +3844,7 @@ uint QByteArray::toUInt(bool *ok, int base) const
|
|||
If \a ok is not \nullptr, failure is reported by setting *\a{ok}
|
||||
to \c false, and success by setting *\a{ok} to \c true.
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 37
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 37
|
||||
|
||||
\note The conversion of the number is performed in the default C locale,
|
||||
irrespective of the user's locale.
|
||||
|
|
@ -3942,7 +3942,7 @@ ushort QByteArray::toUShort(bool *ok, int base) const
|
|||
If \a ok is not \nullptr, failure is reported by setting *\a{ok}
|
||||
to \c false, and success by setting *\a{ok} to \c true.
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 38
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 38
|
||||
|
||||
\warning The QByteArray content may only contain valid numerical characters
|
||||
which includes the plus/minus sign, the character e used in scientific
|
||||
|
|
@ -3977,7 +3977,7 @@ double QByteArray::toDouble(bool *ok) const
|
|||
If \a ok is not \nullptr, failure is reported by setting *\a{ok}
|
||||
to \c false, and success by setting *\a{ok} to \c true.
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 38float
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 38float
|
||||
|
||||
\warning The QByteArray content may only contain valid numerical characters
|
||||
which includes the plus/minus sign, the character e used in scientific
|
||||
|
|
@ -4002,7 +4002,7 @@ float QByteArray::toFloat(bool *ok) const
|
|||
|
||||
Returns a copy of the byte array, encoded using the options \a options.
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 39
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 39
|
||||
|
||||
The algorithm used to encode Base64-encoded data is defined in \l{RFC 4648}.
|
||||
|
||||
|
|
@ -4071,7 +4071,7 @@ QByteArray QByteArray::toBase64(Base64Options options) const
|
|||
as an unsigned integer.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 40
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 40
|
||||
|
||||
\note The format of the number is not localized; the default C locale
|
||||
is used irrespective of the user's locale.
|
||||
|
|
@ -4251,7 +4251,7 @@ QByteArray &QByteArray::setNum(double n, char f, int prec)
|
|||
any value between 2 and 36.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 41
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 41
|
||||
|
||||
\note The format of the number is not localized; the default C locale
|
||||
is used irrespective of the user's locale.
|
||||
|
|
@ -4347,7 +4347,7 @@ QByteArray QByteArray::number(qulonglong n, int base)
|
|||
decimal point. With 'g' and 'G', \a prec is the maximum number of
|
||||
significant digits (trailing zeroes are omitted).
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 42
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 42
|
||||
|
||||
\note The format of the number is not localized; the default C locale
|
||||
is used irrespective of the user's locale.
|
||||
|
|
@ -4384,7 +4384,7 @@ QByteArray QByteArray::number(double n, char f, int prec)
|
|||
Here is an example of how to read data using a QDataStream on raw
|
||||
data in memory without copying the raw data into a QByteArray:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 43
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 43
|
||||
|
||||
\warning A byte array created with fromRawData() is \e not
|
||||
'\\0'-terminated, unless the raw data contains a 0 character at
|
||||
|
|
@ -4527,7 +4527,7 @@ fromBase64_helper_result fromBase64_helper(const char *input, qsizetype inputSiz
|
|||
|
||||
For example:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 44ter
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 44ter
|
||||
|
||||
The algorithm used to decode Base64-encoded data is defined in \l{RFC 4648}.
|
||||
|
||||
|
|
@ -4580,7 +4580,7 @@ QByteArray::FromBase64Result QByteArray::fromBase64Encoding(const QByteArray &ba
|
|||
|
||||
For example:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 44
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 44
|
||||
|
||||
The algorithm used to decode Base64-encoded data is defined in \l{RFC 4648}.
|
||||
|
||||
|
|
@ -4605,7 +4605,7 @@ QByteArray QByteArray::fromBase64(const QByteArray &base64, Base64Options option
|
|||
|
||||
For example:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 45
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 45
|
||||
|
||||
\sa toHex()
|
||||
*/
|
||||
|
|
@ -4640,7 +4640,7 @@ QByteArray QByteArray::fromHex(const QByteArray &hexEncoded)
|
|||
If \a separator is not '\0', the separator character is inserted between the hex bytes.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 50
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 50
|
||||
|
||||
\since 5.9
|
||||
\sa fromHex()
|
||||
|
|
@ -4717,7 +4717,7 @@ void q_fromPercentEncoding(QByteArray *ba)
|
|||
another (for instance, '_' or '=').
|
||||
|
||||
For example:
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 51
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 51
|
||||
|
||||
\note Given invalid input (such as a string containing the sequence "%G5",
|
||||
which is not a valid hexadecimal number) the output will be invalid as
|
||||
|
|
@ -4839,7 +4839,7 @@ void q_normalizePercentEncoding(QByteArray *ba, const char *exclude)
|
|||
|
||||
Example:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 52
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 52
|
||||
|
||||
The hex encoding uses the numbers 0-9 and the uppercase letters A-F.
|
||||
|
||||
|
|
@ -4957,7 +4957,7 @@ QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteA
|
|||
|
||||
For instance:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 53
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 53
|
||||
|
||||
Using QByteArrayLiteral instead of a double quoted plain C++ string literal
|
||||
can significantly speed up creation of QByteArray instances from data known
|
||||
|
|
@ -4980,12 +4980,12 @@ QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteA
|
|||
conversion operators defined for QByteArray::FromBase64Result make
|
||||
its usage straightforward:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 44ter
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 44ter
|
||||
|
||||
Alternatively, it is possible to access the conversion status
|
||||
and the decoded data directly:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearray.cpp 44quater
|
||||
\snippet code/src_corelib_text_qbytearray.cpp 44quater
|
||||
|
||||
\sa QByteArray::fromBase64
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ int qFindByteArray(
|
|||
value of that function in a \c{static const auto} variable, so you don't need
|
||||
to pass the \c{N} template parameter explicitly:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearraymatcher.cpp 0
|
||||
\snippet code/src_corelib_text_qbytearraymatcher.cpp 0
|
||||
|
||||
Then call indexIn() on the QByteArray in which you want to search, just like
|
||||
with QByteArrayMatcher.
|
||||
|
|
@ -428,7 +428,7 @@ int QStaticByteArrayMatcherBase::indexOfIn(const char *needle, uint nlen, const
|
|||
To take full advantage of this function, assign the result to an
|
||||
\c{auto} variable:
|
||||
|
||||
\snippet code/src_corelib_tools_qbytearraymatcher.cpp 1
|
||||
\snippet code/src_corelib_text_qbytearraymatcher.cpp 1
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1562,7 +1562,7 @@ float QLocale::toFloat(const QString &s, bool *ok) const
|
|||
This function does not fall back to the 'C' locale if the string
|
||||
cannot be interpreted in this locale.
|
||||
|
||||
\snippet code/src_corelib_tools_qlocale.cpp 3
|
||||
\snippet code/src_corelib_text_qlocale.cpp 3
|
||||
|
||||
Notice that the last conversion returns 1234.0, because '.' is the
|
||||
thousands group separator in the German locale.
|
||||
|
|
@ -1777,7 +1777,7 @@ float QLocale::toFloat(const QStringRef &s, bool *ok) const
|
|||
This function does not fall back to the 'C' locale if the string
|
||||
cannot be interpreted in this locale.
|
||||
|
||||
\snippet code/src_corelib_tools_qlocale.cpp 3
|
||||
\snippet code/src_corelib_text_qlocale.cpp 3
|
||||
|
||||
Notice that the last conversion returns 1234.0, because '.' is the
|
||||
thousands group separator in the German locale.
|
||||
|
|
@ -1993,7 +1993,7 @@ float QLocale::toFloat(QStringView s, bool *ok) const
|
|||
the "C" locale if the string cannot be interpreted in this
|
||||
locale.
|
||||
|
||||
\snippet code/src_corelib_tools_qlocale.cpp 3-qstringview
|
||||
\snippet code/src_corelib_text_qlocale.cpp 3-qstringview
|
||||
|
||||
Notice that the last conversion returns 1234.0, because '.' is the
|
||||
thousands group separator in the German locale.
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
Example:
|
||||
|
||||
\snippet code/src_corelib_tools_qlocale.cpp 0
|
||||
\snippet code/src_corelib_text_qlocale.cpp 0
|
||||
|
||||
QLocale supports the concept of a default locale, which is
|
||||
determined from the system's locale settings at application
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
The following example illustrates how to use QLocale directly:
|
||||
|
||||
\snippet code/src_corelib_tools_qlocale.cpp 1
|
||||
\snippet code/src_corelib_text_qlocale.cpp 1
|
||||
|
||||
When a language/country pair is specified in the constructor, one
|
||||
of three things can happen:
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
An alternative method for constructing a QLocale object is by
|
||||
specifying the locale name.
|
||||
|
||||
\snippet code/src_corelib_tools_qlocale.cpp 2
|
||||
\snippet code/src_corelib_text_qlocale.cpp 2
|
||||
|
||||
This constructor converts the locale name to a language/country
|
||||
pair; it does not use the system locale database.
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ QT_BEGIN_NAMESPACE
|
|||
When the number of matches cannot be determined in advance, a
|
||||
common idiom is to use cap() in a loop. For example:
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 0
|
||||
\snippet code/src_corelib_text_qregexp.cpp 0
|
||||
|
||||
\target assertions
|
||||
\section1 Assertions
|
||||
|
|
@ -538,7 +538,7 @@ QT_BEGIN_NAMESPACE
|
|||
To test a string against a wildcard expression, use exactMatch().
|
||||
For example:
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 1
|
||||
\snippet code/src_corelib_text_qregexp.cpp 1
|
||||
|
||||
\target perl-users
|
||||
\section1 Notes for Perl Users
|
||||
|
|
@ -560,7 +560,7 @@ QT_BEGIN_NAMESPACE
|
|||
applied to all the quantifiers in the pattern. For example, to
|
||||
match the Perl regexp \b{ro+?m} requires:
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 2
|
||||
\snippet code/src_corelib_text_qregexp.cpp 2
|
||||
|
||||
The equivalent of Perl's \c{/i} option is
|
||||
setCaseSensitivity(Qt::CaseInsensitive).
|
||||
|
|
@ -589,7 +589,7 @@ QT_BEGIN_NAMESPACE
|
|||
the other hand, C++'s rules for literal strings can be used to
|
||||
achieve the same:
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 3
|
||||
\snippet code/src_corelib_text_qregexp.cpp 3
|
||||
|
||||
Both zero-width positive and zero-width negative lookahead
|
||||
assertions (?=pattern) and (?!pattern) are supported with the same
|
||||
|
|
@ -608,12 +608,12 @@ QT_BEGIN_NAMESPACE
|
|||
\target code-examples
|
||||
\section1 Code Examples
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 4
|
||||
\snippet code/src_corelib_text_qregexp.cpp 4
|
||||
|
||||
The third string matches '\underline{6}'. This is a simple validation
|
||||
regexp for integers in the range 0 to 99.
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 5
|
||||
\snippet code/src_corelib_text_qregexp.cpp 5
|
||||
|
||||
The second string matches '\underline{This_is-OK}'. We've used the
|
||||
character set abbreviation '\\S' (non-whitespace) and the anchors
|
||||
|
|
@ -623,25 +623,25 @@ QT_BEGIN_NAMESPACE
|
|||
'letter' or 'correspondence' but only match whole words i.e. not
|
||||
'email'
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 6
|
||||
\snippet code/src_corelib_text_qregexp.cpp 6
|
||||
|
||||
The second string matches "Please write the \underline{letter}". The
|
||||
word 'letter' is also captured (because of the parentheses). We
|
||||
can see what text we've captured like this:
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 7
|
||||
\snippet code/src_corelib_text_qregexp.cpp 7
|
||||
|
||||
This will capture the text from the first set of capturing
|
||||
parentheses (counting capturing left parentheses from left to
|
||||
right). The parentheses are counted from 1 since cap(0) is the
|
||||
whole matched regexp (equivalent to '&' in most regexp engines).
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 8
|
||||
\snippet code/src_corelib_text_qregexp.cpp 8
|
||||
|
||||
Here we've passed the QRegExp to QString's replace() function to
|
||||
replace the matched text with new text.
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 9
|
||||
\snippet code/src_corelib_text_qregexp.cpp 9
|
||||
|
||||
We've used the indexIn() function to repeatedly match the regexp in
|
||||
the string. Note that instead of moving forward by one character
|
||||
|
|
@ -655,7 +655,7 @@ QT_BEGIN_NAMESPACE
|
|||
One common use of regexps is to split lines of delimited data into
|
||||
their component fields.
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 10
|
||||
\snippet code/src_corelib_text_qregexp.cpp 10
|
||||
|
||||
In this example our input lines have the format company name, web
|
||||
address and country. Unfortunately the regexp is rather long and
|
||||
|
|
@ -665,13 +665,13 @@ QT_BEGIN_NAMESPACE
|
|||
QString::split() function can take a separator string or regexp
|
||||
as an argument and split a string accordingly.
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 11
|
||||
\snippet code/src_corelib_text_qregexp.cpp 11
|
||||
|
||||
Here field[0] is the company, field[1] the web address and so on.
|
||||
|
||||
To imitate the matching of a shell we can use wildcard mode.
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 12
|
||||
\snippet code/src_corelib_text_qregexp.cpp 12
|
||||
|
||||
Wildcard matching can be convenient because of its simplicity, but
|
||||
any wildcard regexp can be defined using full regexps, e.g.
|
||||
|
|
@ -766,7 +766,7 @@ QT_BEGIN_NAMESPACE
|
|||
exactly, you can wrap the pattern using the QRegularExpression::anchoredPattern()
|
||||
function:
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 21
|
||||
\snippet code/src_corelib_text_qregexp.cpp 21
|
||||
|
||||
\section3 Porting from QRegExp's Partial Matching
|
||||
|
||||
|
|
@ -4417,7 +4417,7 @@ QT_WARNING_POP
|
|||
QString::replace().
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 13
|
||||
\snippet code/src_corelib_text_qregexp.cpp 13
|
||||
|
||||
Although const, this function sets matchedLength(),
|
||||
capturedTexts() and pos().
|
||||
|
|
@ -4803,17 +4803,17 @@ int QRegExp::captureCount() const
|
|||
(capturing) subexpression of the regexp.
|
||||
|
||||
For example:
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 14
|
||||
\snippet code/src_corelib_text_qregexp.cpp 14
|
||||
|
||||
The above example also captures elements that may be present but
|
||||
which we have no interest in. This problem can be solved by using
|
||||
non-capturing parentheses:
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 15
|
||||
\snippet code/src_corelib_text_qregexp.cpp 15
|
||||
|
||||
Note that if you want to iterate over the list, you should iterate
|
||||
over a copy, e.g.
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 16
|
||||
\snippet code/src_corelib_text_qregexp.cpp 16
|
||||
|
||||
Some regexps can match an indeterminate number of times. For
|
||||
example if the input string is "Offsets: 12 14 99 231 7" and the
|
||||
|
|
@ -4866,7 +4866,7 @@ QStringList QRegExp::capturedTexts()
|
|||
match has index 0 and the parenthesized subexpressions have
|
||||
indexes starting from 1 (excluding non-capturing parentheses).
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 17
|
||||
\snippet code/src_corelib_text_qregexp.cpp 17
|
||||
|
||||
The order of elements matched by cap() is as follows. The first
|
||||
element, cap(0), is the entire matching string. Each subsequent
|
||||
|
|
@ -4895,7 +4895,7 @@ QString QRegExp::cap(int nth)
|
|||
of the whole match.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 18
|
||||
\snippet code/src_corelib_text_qregexp.cpp 18
|
||||
|
||||
For zero-length matches, pos() always returns -1. (For example, if
|
||||
cap(4) would return an empty string, pos(4) returns -1.) This is
|
||||
|
|
@ -4951,11 +4951,11 @@ QString QRegExp::errorString()
|
|||
|
||||
Example:
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 19
|
||||
\snippet code/src_corelib_text_qregexp.cpp 19
|
||||
|
||||
This function is useful to construct regexp patterns dynamically:
|
||||
|
||||
\snippet code/src_corelib_tools_qregexp.cpp 20
|
||||
\snippet code/src_corelib_text_qregexp.cpp 20
|
||||
|
||||
\sa setPatternSyntax()
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -127,23 +127,23 @@ QT_BEGIN_NAMESPACE
|
|||
You can set the pattern string by passing a string to the QRegularExpression
|
||||
constructor:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 0
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 0
|
||||
|
||||
This sets the pattern string to \c{a pattern}. You can also use the
|
||||
setPattern() function to set a pattern on an existing QRegularExpression
|
||||
object:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 1
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 1
|
||||
|
||||
Note that due to C++ literal strings rules, you must escape all backslashes
|
||||
inside the pattern string with another backslash:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 2
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 2
|
||||
|
||||
The pattern() function returns the pattern that is currently set for a
|
||||
QRegularExpression object:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 3
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 3
|
||||
|
||||
\section1 Pattern Options
|
||||
|
||||
|
|
@ -154,17 +154,17 @@ QT_BEGIN_NAMESPACE
|
|||
You can set the options by passing them to the QRegularExpression
|
||||
constructor, as in:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 4
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 4
|
||||
|
||||
Alternatively, you can use the setPatternOptions() function on an existing
|
||||
QRegularExpressionObject:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 5
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 5
|
||||
|
||||
It is possible to get the pattern options currently set on a
|
||||
QRegularExpression object by using the patternOptions() function:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 6
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 6
|
||||
|
||||
Please refer to the QRegularExpression::PatternOption enum documentation for
|
||||
more information about each pattern option.
|
||||
|
|
@ -192,20 +192,20 @@ QT_BEGIN_NAMESPACE
|
|||
QRegularExpressionMatch object that can be used to inspect the results of
|
||||
the match. For instance:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 7
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 7
|
||||
|
||||
If a match is successful, the (implicit) capturing group number 0 can be
|
||||
used to retrieve the substring matched by the entire pattern (see also the
|
||||
section about \l{extracting captured substrings}):
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 8
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 8
|
||||
|
||||
It's also possible to start a match at an arbitrary offset inside the
|
||||
subject string by passing the offset as an argument of the
|
||||
match() function. In the following example \c{"12 abc"}
|
||||
is not matched because the match is started at offset 1:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 9
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 9
|
||||
|
||||
\target extracting captured substrings
|
||||
\section2 Extracting captured substrings
|
||||
|
|
@ -215,7 +215,7 @@ QT_BEGIN_NAMESPACE
|
|||
\l{QRegularExpressionMatch::}{captured()} function will return the string
|
||||
captured by the n-th capturing group:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 10
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 10
|
||||
|
||||
Capturing groups in the pattern are numbered starting from 1, and the
|
||||
implicit capturing group 0 is used to capture the substring that matched
|
||||
|
|
@ -226,12 +226,12 @@ QT_BEGIN_NAMESPACE
|
|||
\l{QRegularExpressionMatch::}{capturedStart()} and the
|
||||
\l{QRegularExpressionMatch::}{capturedEnd()} functions:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 11
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 11
|
||||
|
||||
All of these functions have an overload taking a QString as a parameter
|
||||
in order to extract \e{named} captured substrings. For instance:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 12
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 12
|
||||
|
||||
\target global matching
|
||||
\section1 Global Matching
|
||||
|
|
@ -245,7 +245,7 @@ QT_BEGIN_NAMESPACE
|
|||
which is a Java-like forward iterator that can be used to iterate over the
|
||||
results. For instance:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 13
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 13
|
||||
|
||||
Since it's a Java-like iterator, the QRegularExpressionMatchIterator will
|
||||
point immediately before the first result. Every result is returned as a
|
||||
|
|
@ -255,7 +255,7 @@ QT_BEGIN_NAMESPACE
|
|||
\l{QRegularExpressionMatchIterator::}{next()} will return the next result
|
||||
and advance the iterator. Continuing from the previous example:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 14
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 14
|
||||
|
||||
You can also use \l{QRegularExpressionMatchIterator::}{peekNext()} to get
|
||||
the next result without advancing the iterator.
|
||||
|
|
@ -331,17 +331,17 @@ QT_BEGIN_NAMESPACE
|
|||
This behavior is implemented by the PartialPreferCompleteMatch match type.
|
||||
For instance:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 15
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 15
|
||||
|
||||
If matching the same regular expression against the subject string leads to
|
||||
a complete match, it is reported as usual:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 16
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 16
|
||||
|
||||
Another example with a different pattern, showing the behavior of
|
||||
preferring a complete match over a partial one:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 17
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 17
|
||||
|
||||
In this case, the subpattern \c{abc\\w+X} partially matches the subject
|
||||
string; however, the subpattern \c{def} matches the subject string
|
||||
|
|
@ -351,7 +351,7 @@ QT_BEGIN_NAMESPACE
|
|||
match), then the QRegularExpressionMatch object will report the first one
|
||||
that is found. For instance:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 18
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 18
|
||||
|
||||
\section2 Incremental/multi-segment matching
|
||||
|
||||
|
|
@ -374,13 +374,13 @@ QT_BEGIN_NAMESPACE
|
|||
as soon as it is found, and other match alternatives are not tried
|
||||
(even if they could lead to a complete match). For instance:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 19
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 19
|
||||
|
||||
This happens because when matching the first branch of the alternation
|
||||
operator a partial match is found, and therefore matching stops, without
|
||||
trying the second branch. Another example:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 20
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 20
|
||||
|
||||
This shows what could seem a counterintuitive behavior of quantifiers:
|
||||
since \c{?} is greedy, then the engine tries first to continue the match
|
||||
|
|
@ -388,7 +388,7 @@ QT_BEGIN_NAMESPACE
|
|||
subject string, and therefore a partial match is reported. This is
|
||||
even more surprising in the following example:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 21
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 21
|
||||
|
||||
It's easy to understand this behavior if we remember that the engine
|
||||
expects the subject string to be only a substring of the whole text we're
|
||||
|
|
@ -409,13 +409,13 @@ QT_BEGIN_NAMESPACE
|
|||
syntax errors in the pattern string. The isValid() function will return
|
||||
true if the regular expression is valid, or false otherwise:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 22
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 22
|
||||
|
||||
You can get more information about the specific error by calling the
|
||||
errorString() function; moreover, the patternErrorOffset() function
|
||||
will return the offset inside the pattern string
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 23
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 23
|
||||
|
||||
If a match is attempted with an invalid QRegularExpression, then the
|
||||
returned QRegularExpressionMatch object will be invalid as well (that is,
|
||||
|
|
@ -479,7 +479,7 @@ QT_BEGIN_NAMESPACE
|
|||
returns each substring captured, either by the capturing group's index or
|
||||
by its name:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 29
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 29
|
||||
|
||||
For each captured substring it is possible to query its starting and ending
|
||||
offsets in the subject string by calling the capturedStart() and the
|
||||
|
|
@ -530,7 +530,7 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
For instance:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 30
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 30
|
||||
|
||||
Moreover, QRegularExpressionMatchIterator offers a peekNext() function
|
||||
to get the next result \e{without} advancing the iterator.
|
||||
|
|
@ -1441,11 +1441,11 @@ int QRegularExpression::captureCount() const
|
|||
|
||||
For instance, given the regular expression
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 32
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 32
|
||||
|
||||
namedCaptureGroups() will return the following list:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 33
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 33
|
||||
|
||||
which corresponds to the fact that the capturing group #0 (corresponding to
|
||||
the whole match) has no name, the capturing group #1 has name "day", the
|
||||
|
|
@ -1731,11 +1731,11 @@ size_t qHash(const QRegularExpression &key, size_t seed) noexcept
|
|||
meaning when used as a regular expression pattern string, and returns
|
||||
the escaped string. For instance:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 26
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 26
|
||||
|
||||
This is very convenient in order to build patterns from arbitrary strings:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 27
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 27
|
||||
|
||||
\note This function implements Perl's quotemeta algorithm and escapes with
|
||||
a backslash all characters in \a str, except for the characters in the
|
||||
|
|
@ -1810,7 +1810,7 @@ QString QRegularExpression::escape(QStringView str)
|
|||
that path separators receive special treatment. This implies that it is not
|
||||
just a basic translation from "*" to ".*".
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 31
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 31
|
||||
|
||||
By default, the returned regular expression is fully anchored. In other
|
||||
words, there is no need of calling anchoredPattern() again on the
|
||||
|
|
@ -2086,7 +2086,7 @@ QRegularExpression::MatchOptions QRegularExpressionMatch::matchOptions() const
|
|||
including the implicit capturing group 0. This can be used to extract all
|
||||
the substrings that were captured:
|
||||
|
||||
\snippet code/src_corelib_tools_qregularexpression.cpp 28
|
||||
\snippet code/src_corelib_text_qregularexpression.cpp 28
|
||||
|
||||
Note that some of the capturing groups with an index less than
|
||||
lastCapturedIndex() could have not matched, and therefore captured nothing.
|
||||
|
|
|
|||
|
|
@ -1601,14 +1601,14 @@ const QString::Null QString::null = { };
|
|||
One way to define these preprocessor symbols globally for your
|
||||
application is to add the following entry to your \l {Creating Project Files}{qmake project file}:
|
||||
|
||||
\snippet code/src_corelib_tools_qstring.cpp 0
|
||||
\snippet code/src_corelib_text_qstring.cpp 0
|
||||
|
||||
You then need to explicitly call fromUtf8(), fromLatin1(),
|
||||
or fromLocal8Bit() to construct a QString from an
|
||||
8-bit string, or use the lightweight QLatin1String class, for
|
||||
example:
|
||||
|
||||
\snippet code/src_corelib_tools_qstring.cpp 1
|
||||
\snippet code/src_corelib_text_qstring.cpp 1
|
||||
|
||||
Similarly, you must call toLatin1(), toUtf8(), or
|
||||
toLocal8Bit() explicitly to convert the QString to an 8-bit
|
||||
|
|
@ -7555,7 +7555,7 @@ QVector<QStringRef> QString::splitRef(const QRegularExpression &re, SplitBehavio
|
|||
|
||||
Example:
|
||||
|
||||
\snippet code/src_corelib_tools_qstring.cpp 8
|
||||
\snippet code/src_corelib_text_qstring.cpp 8
|
||||
*/
|
||||
QString QString::repeated(int times) const
|
||||
{
|
||||
|
|
@ -8269,7 +8269,7 @@ QString QString::arg(char a, int fieldWidth, QChar fillChar) const
|
|||
value produces right-aligned text; a negative value produces
|
||||
left-aligned text.
|
||||
|
||||
\snippet code/src_corelib_tools_qstring.cpp 2
|
||||
\snippet code/src_corelib_text_qstring.cpp 2
|
||||
|
||||
The '%' can be followed by an 'L', in which case the sequence is
|
||||
replaced with a localized representation of \a a. The conversion
|
||||
|
|
@ -8838,11 +8838,11 @@ QString &QString::setRawData(const QChar *unicode, int size)
|
|||
the \c{const char *} data. For example, assuming \c str is a
|
||||
QString,
|
||||
|
||||
\snippet code/src_corelib_tools_qstring.cpp 3
|
||||
\snippet code/src_corelib_text_qstring.cpp 3
|
||||
|
||||
is much faster than
|
||||
|
||||
\snippet code/src_corelib_tools_qstring.cpp 4
|
||||
\snippet code/src_corelib_text_qstring.cpp 4
|
||||
|
||||
because it doesn't construct four temporary QString objects and
|
||||
make a deep copy of the character data.
|
||||
|
|
@ -8854,7 +8854,7 @@ QString &QString::setRawData(const QChar *unicode, int size)
|
|||
just a very thin wrapper around a \c{const char *}. Using
|
||||
QLatin1String, the example code above becomes
|
||||
|
||||
\snippet code/src_corelib_tools_qstring.cpp 5
|
||||
\snippet code/src_corelib_text_qstring.cpp 5
|
||||
|
||||
This is a bit longer to type, but it provides exactly the same
|
||||
benefits as the first version of the code, and is faster than
|
||||
|
|
@ -8864,7 +8864,7 @@ QString &QString::setRawData(const QChar *unicode, int size)
|
|||
QLatin1String can be used everywhere a QString is expected. For
|
||||
example:
|
||||
|
||||
\snippet code/src_corelib_tools_qstring.cpp 6
|
||||
\snippet code/src_corelib_text_qstring.cpp 6
|
||||
|
||||
\note If the function you're calling with a QLatin1String
|
||||
argument isn't actually overloaded to take QLatin1String, the
|
||||
|
|
@ -12093,7 +12093,7 @@ float QStringRef::toFloat(bool *ok) const
|
|||
|
||||
Example:
|
||||
|
||||
\snippet code/src_corelib_tools_qstring.cpp 7
|
||||
\snippet code/src_corelib_text_qstring.cpp 7
|
||||
*/
|
||||
QString QString::toHtmlEscaped() const
|
||||
{
|
||||
|
|
@ -12127,7 +12127,7 @@ QString QString::toHtmlEscaped() const
|
|||
|
||||
If you have code that looks like this:
|
||||
|
||||
\snippet code/src_corelib_tools_qstring.cpp 9
|
||||
\snippet code/src_corelib_text_qstring.cpp 9
|
||||
|
||||
then a temporary QString will be created to be passed as the \c{hasAttribute}
|
||||
function parameter. This can be quite expensive, as it involves a memory
|
||||
|
|
@ -12136,7 +12136,7 @@ QString QString::toHtmlEscaped() const
|
|||
|
||||
This cost can be avoided by using QStringLiteral instead:
|
||||
|
||||
\snippet code/src_corelib_tools_qstring.cpp 10
|
||||
\snippet code/src_corelib_text_qstring.cpp 10
|
||||
|
||||
In this case, QString's internal data will be generated at compile time; no
|
||||
conversion or allocation will occur at runtime.
|
||||
|
|
@ -12151,7 +12151,7 @@ QString QString::toHtmlEscaped() const
|
|||
instance, QString::operator==() can compare to a QLatin1String
|
||||
directly:
|
||||
|
||||
\snippet code/src_corelib_tools_qstring.cpp 11
|
||||
\snippet code/src_corelib_text_qstring.cpp 11
|
||||
|
||||
\note Some compilers have bugs encoding strings containing characters outside
|
||||
the US-ASCII character set. Make sure you prefix your string with \c{u} in
|
||||
|
|
|
|||
|
|
@ -45,14 +45,14 @@
|
|||
You can create a QStringIterator that iterates over a given
|
||||
QStringView by passing the string to the QStringIterator's constructor:
|
||||
|
||||
\snippet code/src_corelib_tools_qstringiterator.cpp 0
|
||||
\snippet code/src_corelib_text_qstringiterator.cpp 0
|
||||
|
||||
A newly created QStringIterator will point before the first position in the
|
||||
string. It is possible to check whether the iterator can be advanced by
|
||||
calling hasNext(), and actually advance it (and obtain the next code point)
|
||||
by calling next():
|
||||
|
||||
\snippet code/src_corelib_tools_qstringiterator.cpp 1
|
||||
\snippet code/src_corelib_text_qstringiterator.cpp 1
|
||||
|
||||
Similarly, the hasPrevious() and previous() functions can be used to iterate backwards.
|
||||
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
|
||||
For instance:
|
||||
|
||||
\snippet code/src_corelib_tools_qstringiterator.cpp 2
|
||||
\snippet code/src_corelib_text_qstringiterator.cpp 2
|
||||
|
||||
If the iterator is not able to decode the next code point (or the previous
|
||||
one, when iterating backwards), then it will return \c{0xFFFD}, that is,
|
||||
|
|
|
|||
|
|
@ -75,14 +75,14 @@ QT_BEGIN_NAMESPACE
|
|||
string literal.
|
||||
|
||||
QStringViews should be passed by value, not by reference-to-const:
|
||||
\snippet code/src_corelib_tools_qstringview.cpp 0
|
||||
\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_tools_qstringview.cpp 1
|
||||
\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
|
||||
|
|
@ -286,7 +286,7 @@ QT_BEGIN_NAMESPACE
|
|||
If you need the full array, use the constructor from pointer and
|
||||
size instead:
|
||||
|
||||
\snippet code/src_corelib_tools_qstringview.cpp 2
|
||||
\snippet code/src_corelib_text_qstringview.cpp 2
|
||||
|
||||
\a string must remain valid for the lifetime of this string view
|
||||
object.
|
||||
|
|
|
|||
|
|
@ -1369,7 +1369,7 @@ QDate QDate::addYears(int nyears) const
|
|||
Returns 0 if either date is invalid.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 0
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 0
|
||||
|
||||
\sa addDays()
|
||||
*/
|
||||
|
|
@ -1548,7 +1548,7 @@ QDate QDate::fromString(const QString &string, Qt::DateFormat format)
|
|||
of characters enclosed in single quotes will also be treated (stripped of
|
||||
the quotes) as text and not be interpreted as expressions. For example:
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 1
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 1
|
||||
|
||||
If the format is not satisfied, an invalid QDate is returned. The
|
||||
expressions that don't expect leading zeroes (d, M) will be
|
||||
|
|
@ -1558,7 +1558,7 @@ QDate QDate::fromString(const QString &string, Qt::DateFormat format)
|
|||
string could have meant January 30 but the M will grab two
|
||||
digits, resulting in an invalid date:
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 2
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 2
|
||||
|
||||
For any field that is not represented in the format the following
|
||||
defaults are used:
|
||||
|
|
@ -1572,7 +1572,7 @@ QDate QDate::fromString(const QString &string, Qt::DateFormat format)
|
|||
|
||||
The following examples demonstrate the default values:
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 3
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 3
|
||||
|
||||
\note If localized month and day names are used, please switch to using
|
||||
QLocale::system().toDate() as QDate methods shall change to only recognize
|
||||
|
|
@ -1606,7 +1606,7 @@ QDate QDate::fromString(const QString &string, const QString &format, QCalendar
|
|||
valid in the Gregorian calendar; otherwise returns \c false.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 4
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 4
|
||||
|
||||
\sa isNull(), setDate(), QCalendar::isDateValid()
|
||||
*/
|
||||
|
|
@ -1958,7 +1958,7 @@ bool QTime::setHMS(int h, int m, int s, int ms)
|
|||
|
||||
Example:
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 5
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 5
|
||||
|
||||
\sa addMSecs(), secsTo(), QDateTime::addSecs()
|
||||
*/
|
||||
|
|
@ -2264,7 +2264,7 @@ QTime QTime::fromString(const QString &string, Qt::DateFormat format)
|
|||
of characters enclosed in single quotes will also be treated (stripped of
|
||||
the quotes) as text and not be interpreted as expressions.
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 6
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 6
|
||||
|
||||
If the format is not satisfied, an invalid QTime is returned.
|
||||
Expressions that do not expect leading zeroes to be given (h, m, s
|
||||
|
|
@ -2274,12 +2274,12 @@ QTime QTime::fromString(const QString &string, Qt::DateFormat format)
|
|||
could have meant 00:07:10, but the m will grab two digits, resulting
|
||||
in an invalid time:
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 7
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 7
|
||||
|
||||
Any field that is not represented in the format will be set to zero.
|
||||
For example:
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 8
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 8
|
||||
|
||||
\note If localized forms of am or pm (the AP, ap, A or a formats) are used,
|
||||
please switch to using QLocale::system().toTime() as QTime methods shall
|
||||
|
|
@ -2318,7 +2318,7 @@ QTime QTime::fromString(const QString &string, const QString &format)
|
|||
|
||||
Example:
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 9
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 9
|
||||
*/
|
||||
|
||||
bool QTime::isValid(int h, int m, int s, int ms)
|
||||
|
|
@ -3671,7 +3671,7 @@ void QDateTime::setTime(QTime time)
|
|||
i.e. the current system time zone.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 19
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 19
|
||||
|
||||
\sa timeSpec(), setDate(), setTime(), setTimeZone(), Qt::TimeSpec
|
||||
*/
|
||||
|
|
@ -4207,7 +4207,7 @@ QDateTime QDateTime::addMSecs(qint64 msecs) const
|
|||
the value returned is negative.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 15
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 15
|
||||
|
||||
\sa addDays(), secsTo(), msecsTo()
|
||||
*/
|
||||
|
|
@ -4229,7 +4229,7 @@ qint64 QDateTime::daysTo(const QDateTime &other) const
|
|||
Returns 0 if either datetime is invalid.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 11
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 11
|
||||
|
||||
\sa addSecs(), daysTo(), QTime::secsTo()
|
||||
*/
|
||||
|
|
@ -4274,7 +4274,7 @@ qint64 QDateTime::msecsTo(const QDateTime &other) const
|
|||
i.e. the local Time Zone.
|
||||
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 16
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 16
|
||||
|
||||
\sa timeSpec(), toTimeZone(), toOffsetFromUtc()
|
||||
*/
|
||||
|
|
@ -4883,7 +4883,7 @@ QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format)
|
|||
of characters enclosed in single quotes will also be treated (stripped of
|
||||
the quotes) as text and not be interpreted as expressions.
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 12
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 12
|
||||
|
||||
If the format is not satisfied, an invalid QDateTime is returned.
|
||||
The expressions that don't have leading zeroes (d, M, h, m, s, z) will be
|
||||
|
|
@ -4891,7 +4891,7 @@ QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format)
|
|||
put them outside the range and/or leave too few digits for other
|
||||
sections.
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 13
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 13
|
||||
|
||||
This could have meant 1 January 00:30.00 but the M will grab
|
||||
two digits.
|
||||
|
|
@ -4902,11 +4902,11 @@ QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format)
|
|||
field defaults); the resulting datetime is invalid because 23 April 1912
|
||||
was a Tuesday, not a Monday:
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 20
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 20
|
||||
|
||||
The correct code is:
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 21
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 21
|
||||
|
||||
For any field that is not represented in the format, the following
|
||||
defaults are used:
|
||||
|
|
@ -4923,7 +4923,7 @@ QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format)
|
|||
|
||||
For example:
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 14
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 14
|
||||
|
||||
\note If localized month and day names are used, please switch to using
|
||||
QLocale::system().toDateTime() as QDateTime methods shall change to only
|
||||
|
|
@ -4959,7 +4959,7 @@ QDateTime QDateTime::fromString(const QString &string, const QString &format, QC
|
|||
|
||||
Example:
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 17
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 17
|
||||
|
||||
\sa toTimeSpec()
|
||||
*/
|
||||
|
|
@ -4972,7 +4972,7 @@ QDateTime QDateTime::fromString(const QString &string, const QString &format, QC
|
|||
|
||||
Example:
|
||||
|
||||
\snippet code/src_corelib_tools_qdatetime.cpp 18
|
||||
\snippet code/src_corelib_time_qdatetime.cpp 18
|
||||
|
||||
\sa toTimeSpec()
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue