diff options
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 31cf65b78d..42150efd63 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -648,7 +648,7 @@ static inline char qToLower(char c) char *} to its constructor. For example, the following code creates a byte array of size 5 containing the data "Hello": - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 0 + \snippet code/src_corelib_tools_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 @@ -668,11 +668,11 @@ static inline char qToLower(char c) arrays, operator[]() returns a reference to a byte that can be used on the left side of an assignment. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 1 + \snippet code/src_corelib_tools_qbytearray.cpp 1 For read-only access, an alternative syntax is to use at(): - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 2 + \snippet code/src_corelib_tools_qbytearray.cpp 2 at() can be faster than operator[](), because it never causes a \l{deep copy} to occur. @@ -700,7 +700,7 @@ static inline char qToLower(char c) the byte data: append(), prepend(), insert(), replace(), and remove(). For example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 3 + \snippet code/src_corelib_tools_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 @@ -728,7 +728,7 @@ static inline char qToLower(char c) For example, here's a typical loop that finds all occurrences of a particular substring: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 4 + \snippet code/src_corelib_tools_qbytearray.cpp 4 If you simply want to check whether a QByteArray contains a particular character or substring, use contains(). If you want to @@ -752,7 +752,7 @@ static inline char qToLower(char c) array is always empty, but an empty byte array isn't necessarily null: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 5 + \snippet code/src_corelib_tools_qbytearray.cpp 5 All functions except isNull() treat null byte arrays the same as empty byte arrays. For example, data() returns a pointer to a @@ -949,7 +949,7 @@ QByteArray &QByteArray::operator=(const char *str) automaticall unless the \l{deep copy} is created. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 6 + \snippet code/src_corelib_tools_qbytearray.cpp 6 \sa isEmpty(), resize() */ @@ -959,7 +959,7 @@ QByteArray &QByteArray::operator=(const char *str) Returns true if the byte array has size 0; otherwise returns false. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 7 + \snippet code/src_corelib_tools_qbytearray.cpp 7 \sa size() */ @@ -1046,7 +1046,7 @@ QByteArray &QByteArray::operator=(const char *str) '\\0' terminator. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 8 + \snippet code/src_corelib_tools_qbytearray.cpp 8 The pointer remains valid as long as the byte array isn't reallocated or destroyed. For read-only access, constData() is @@ -1059,11 +1059,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 doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 46 + \snippet code/src_corelib_tools_qbytearray.cpp 46 This one allocates the correct amount of space: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 47 + \snippet code/src_corelib_tools_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 @@ -1129,7 +1129,7 @@ QByteArray &QByteArray::operator=(const char *str) place. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 9 + \snippet code/src_corelib_tools_qbytearray.cpp 9 The return value is of type QByteRef, a helper class for QByteArray. When you get an object of type QByteRef, you can use @@ -1188,7 +1188,7 @@ QByteArray &QByteArray::operator=(const char *str) If \a pos is beyond the end of the array, nothing happens. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 10 + \snippet code/src_corelib_tools_qbytearray.cpp 10 \sa chop(), resize(), left() */ @@ -1206,7 +1206,7 @@ void QByteArray::truncate(int pos) array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 11 + \snippet code/src_corelib_tools_qbytearray.cpp 11 \sa truncate(), resize(), left() */ @@ -1224,7 +1224,7 @@ void QByteArray::chop(int n) returns a reference to this byte array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 12 + \snippet code/src_corelib_tools_qbytearray.cpp 12 Note: QByteArray is an \l{implicitly shared} class. Consequently, if \e this is an empty QByteArray, then \e this will just share @@ -1284,7 +1284,7 @@ void QByteArray::chop(int n) Returns true if this byte array is null; otherwise returns false. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 13 + \snippet code/src_corelib_tools_qbytearray.cpp 13 Qt makes a distinction between null byte arrays and empty byte arrays for historical reasons. For most applications, what @@ -1428,7 +1428,7 @@ void QByteArray::resize(int size) size \a size beforehand. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 14 + \snippet code/src_corelib_tools_qbytearray.cpp 14 \sa resize() */ @@ -1493,7 +1493,7 @@ QByteArray QByteArray::nulTerminated() const reference to this byte array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 15 + \snippet code/src_corelib_tools_qbytearray.cpp 15 This is the same as insert(0, \a ba). @@ -1573,7 +1573,7 @@ QByteArray &QByteArray::prepend(char ch) Appends the byte array \a ba onto the end of this byte array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 16 + \snippet code/src_corelib_tools_qbytearray.cpp 16 This is the same as insert(size(), \a ba). @@ -1710,7 +1710,7 @@ static inline QByteArray &qbytearray_insert(QByteArray *ba, reference to this byte array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 17 + \snippet code/src_corelib_tools_qbytearray.cpp 17 \sa append(), prepend(), replace(), remove() */ @@ -1793,7 +1793,7 @@ QByteArray &QByteArray::insert(int i, char ch) array is truncated at position \a pos. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 18 + \snippet code/src_corelib_tools_qbytearray.cpp 18 \sa insert(), replace() */ @@ -1817,7 +1817,7 @@ QByteArray &QByteArray::remove(int pos, int len) array \a after, and returns a reference to this byte array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 19 + \snippet code/src_corelib_tools_qbytearray.cpp 19 \sa insert(), remove() */ @@ -1855,7 +1855,7 @@ QByteArray &QByteArray::replace(int pos, int len, const char *after) \overload Replaces \a len bytes from index position \a pos with \a alen bytes - from the string \a after. \a after is allowed to have '\0' characters. + from the string \a after. \a after is allowed to have '\\0' characters. \since 4.7 */ @@ -1881,7 +1881,7 @@ QByteArray &QByteArray::replace(int pos, int len, const char *after, int alen) byte array \a after. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 20 + \snippet code/src_corelib_tools_qbytearray.cpp 20 */ QByteArray &QByteArray::replace(const QByteArray &before, const QByteArray &after) @@ -2214,7 +2214,7 @@ QByteArray QByteArray::repeated(int times) const position \a from. Returns -1 if \a ba could not be found. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 21 + \snippet code/src_corelib_tools_qbytearray.cpp 21 \sa lastIndexOf(), contains(), count() */ @@ -2284,7 +2284,7 @@ int QByteArray::indexOf(const char *c, int from) const position \a from. Returns -1 if \a ch could not be found. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 22 + \snippet code/src_corelib_tools_qbytearray.cpp 22 \sa lastIndexOf(), contains() */ @@ -2346,7 +2346,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 doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 23 + \snippet code/src_corelib_tools_qbytearray.cpp 23 \sa indexOf(), contains(), count() */ @@ -2406,7 +2406,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 doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 24 + \snippet code/src_corelib_tools_qbytearray.cpp 24 \sa indexOf(), contains() */ @@ -2493,7 +2493,7 @@ int QByteArray::count(char ch) const otherwise returns false. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 25 + \snippet code/src_corelib_tools_qbytearray.cpp 25 \sa endsWith(), left() */ @@ -2538,7 +2538,7 @@ bool QByteArray::startsWith(char ch) const otherwise returns false. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 26 + \snippet code/src_corelib_tools_qbytearray.cpp 26 \sa startsWith(), right() */ @@ -2586,7 +2586,7 @@ bool QByteArray::endsWith(char ch) const size(). Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 27 + \snippet code/src_corelib_tools_qbytearray.cpp 27 \sa right(), mid(), startsWith(), truncate() */ @@ -2608,7 +2608,7 @@ QByteArray QByteArray::left(int len) const size(). Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 28 + \snippet code/src_corelib_tools_qbytearray.cpp 28 \sa endsWith(), left(), mid() */ @@ -2631,7 +2631,7 @@ QByteArray QByteArray::right(int len) const pos until the end of the byte array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 29 + \snippet code/src_corelib_tools_qbytearray.cpp 29 \sa left(), right() */ @@ -2658,7 +2658,7 @@ QByteArray QByteArray::mid(int pos, int len) const interpreted as a Latin-1 encoded string. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 30 + \snippet code/src_corelib_tools_qbytearray.cpp 30 \sa toUpper(), {8-bit Character Comparisons} */ @@ -2680,7 +2680,7 @@ QByteArray QByteArray::toLower() const interpreted as a Latin-1 encoded string. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 31 + \snippet code/src_corelib_tools_qbytearray.cpp 31 \sa toLower(), {8-bit Character Comparisons} */ @@ -3090,7 +3090,7 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba) characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 32 + \snippet code/src_corelib_tools_qbytearray.cpp 32 \sa trimmed() */ @@ -3128,7 +3128,7 @@ QByteArray QByteArray::simplified() const characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 33 + \snippet code/src_corelib_tools_qbytearray.cpp 33 Unlike simplified(), trimmed() leaves internal whitespace alone. @@ -3170,7 +3170,7 @@ QByteArray QByteArray::trimmed() const after position \a width are removed, and the copy is returned. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 34 + \snippet code/src_corelib_tools_qbytearray.cpp 34 \sa rightJustified() */ @@ -3207,7 +3207,7 @@ QByteArray QByteArray::leftJustified(int width, char fill, bool truncate) const position \a width. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 35 + \snippet code/src_corelib_tools_qbytearray.cpp 35 \sa leftJustified() */ @@ -3314,7 +3314,7 @@ qulonglong QByteArray::toULongLong(bool *ok, int base) const If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to false; otherwise *\a{ok} is set to true. - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 36 + \snippet code/src_corelib_tools_qbytearray.cpp 36 \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. @@ -3380,7 +3380,7 @@ uint QByteArray::toUInt(bool *ok, int base) const If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to false; otherwise *\a{ok} is set to true. - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 37 + \snippet code/src_corelib_tools_qbytearray.cpp 37 \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. @@ -3501,7 +3501,7 @@ ushort QByteArray::toUShort(bool *ok, int base) const If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to false; otherwise *\a{ok} is set to true. - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 38 + \snippet code/src_corelib_tools_qbytearray.cpp 38 \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. @@ -3536,7 +3536,7 @@ float QByteArray::toFloat(bool *ok) const /*! Returns a copy of the byte array, encoded as Base64. - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 39 + \snippet code/src_corelib_tools_qbytearray.cpp 39 The algorithm used to encode Base64-encoded data is defined in \l{RFC 2045}. @@ -3588,7 +3588,7 @@ QByteArray QByteArray::toBase64() const be any value between 2 and 36. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 40 + \snippet code/src_corelib_tools_qbytearray.cpp 40 \note The format of the number is not localized; the default C locale is used irrespective of the user's locale. @@ -3734,7 +3734,7 @@ QByteArray &QByteArray::setNum(double n, char f, int prec) any value between 2 and 36. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 41 + \snippet code/src_corelib_tools_qbytearray.cpp 41 \note The format of the number is not localized; the default C locale is used irrespective of the user's locale. @@ -3806,7 +3806,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 doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 42 + \snippet code/src_corelib_tools_qbytearray.cpp 42 \note The format of the number is not localized; the default C locale is used irrespective of the user's locale. @@ -3843,7 +3843,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 doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 43 + \snippet code/src_corelib_tools_qbytearray.cpp 43 \warning A byte array created with fromRawData() is \e not null-terminated, unless the raw data contains a 0 character at @@ -3908,7 +3908,7 @@ QByteArray &QByteArray::setRawData(const char *data, uint size) For example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 44 + \snippet code/src_corelib_tools_qbytearray.cpp 44 The algorithm used to decode Base64-encoded data is defined in \l{RFC 2045}. @@ -3960,7 +3960,7 @@ QByteArray QByteArray::fromBase64(const QByteArray &base64) For example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 45 + \snippet code/src_corelib_tools_qbytearray.cpp 45 \sa toHex() */ |