![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtCore More...
#include <qbytearray.h>
Classes | |
class | FromBase64Result |
\inmodule QtCore More... | |
Public Types | |
enum | Base64Option { Base64Encoding = 0 , Base64UrlEncoding = 1 , KeepTrailingEquals = 0 , OmitTrailingEquals = 2 , IgnoreBase64DecodingErrors = 0 , AbortOnBase64DecodingErrors = 4 } |
enum class | Base64DecodingStatus { Ok , IllegalInputLength , IllegalCharacter , IllegalPadding } |
using | DataPointer = QByteArrayData |
typedef char * | iterator |
This typedef provides an STL-style non-const iterator for QByteArray. | |
typedef const char * | const_iterator |
This typedef provides an STL-style const iterator for QByteArray. | |
typedef iterator | Iterator |
typedef const_iterator | ConstIterator |
typedef std::reverse_iterator< iterator > | reverse_iterator |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
typedef qsizetype | size_type |
typedef qptrdiff | difference_type |
typedef const char & | const_reference |
typedef char & | reference |
typedef char * | pointer |
typedef const char * | const_pointer |
typedef char | value_type |
Public Member Functions | |
constexpr | QByteArray () noexcept |
Constructs an empty byte array. | |
QByteArray (const char *, qsizetype size=-1) | |
Constructs a byte array containing the first size bytes of array data. | |
QByteArray (qsizetype size, char c) | |
Constructs a byte array of size size with every byte set to ch. | |
QByteArray (qsizetype size, Qt::Initialization) | |
Constructs a byte array of size size with uninitialized contents. | |
QByteArray (const QByteArray &) noexcept | |
Constructs a copy of other. | |
~QByteArray () | |
Destroys the byte array. | |
QByteArray & | operator= (const QByteArray &) noexcept |
Assigns other to this byte array and returns a reference to this byte array. | |
QByteArray & | operator= (const char *str) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Assigns str to this byte array. | |
QByteArray (QByteArray &&other) noexcept=default | |
Move-constructs a QByteArray instance, making it point at the same object that other was pointing to. | |
void | swap (QByteArray &other) noexcept |
bool | isEmpty () const noexcept |
Returns true if the byte array has size 0; otherwise returns false . | |
void | resize (qsizetype size) |
Sets the size of the byte array to size bytes. | |
void | resize (qsizetype size, char c) |
QByteArray & | fill (char c, qsizetype size=-1) |
Sets every byte in the byte array to ch. | |
qsizetype | capacity () const |
Returns the maximum number of bytes that can be stored in the byte array without forcing a reallocation. | |
void | reserve (qsizetype size) |
Attempts to allocate memory for at least size bytes. | |
void | squeeze () |
Releases any memory not required to store the array's data. | |
operator const char * () const | |
operator const void * () const | |
char * | data () |
\macro QT_NO_CAST_FROM_BYTEARRAY | |
const char * | data () const noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const char * | constData () const noexcept |
Returns a pointer to the const data stored in the byte array. | |
void | detach () |
bool | isDetached () const |
bool | isSharedWith (const QByteArray &other) const noexcept |
void | clear () |
Clears the contents of the byte array and makes it null. | |
char | at (qsizetype i) const |
Returns the byte at index position i in the byte array. | |
char | operator[] (qsizetype i) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as at(i). | |
char & | operator[] (qsizetype i) |
Returns the byte at index position i as a modifiable reference. | |
char | front () const |
char & | front () |
char | back () const |
char & | back () |
qsizetype | indexOf (char c, qsizetype from=0) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the index position of the start of the first occurrence of the byte ch in this byte array, searching forward from index position from. | |
qsizetype | indexOf (QByteArrayView bv, qsizetype from=0) const |
qsizetype | lastIndexOf (char c, qsizetype from=-1) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the index position of the start of the last occurrence of byte ch in this byte array, searching backward from index position from. | |
qsizetype | lastIndexOf (QByteArrayView bv) const |
qsizetype | lastIndexOf (QByteArrayView bv, qsizetype from) const |
bool | contains (char c) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if the byte array contains the byte ch; otherwise returns false . | |
bool | contains (QByteArrayView bv) const |
qsizetype | count (char c) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the number of occurrences of byte ch in the byte array. | |
qsizetype | count (QByteArrayView bv) const |
int | compare (QByteArrayView a, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
QByteArray | left (qsizetype len) const |
Returns a byte array that contains the first len bytes of this byte array. | |
QByteArray | right (qsizetype len) const |
Returns a byte array that contains the last len bytes of this byte array. | |
QByteArray | mid (qsizetype index, qsizetype len=-1) const |
Returns a byte array containing len bytes from this byte array, starting at position pos. | |
QByteArray | first (qsizetype n) const |
QByteArray | last (qsizetype n) const |
QByteArray | sliced (qsizetype pos) const |
QByteArray | sliced (qsizetype pos, qsizetype n) const |
QByteArray | chopped (qsizetype len) const |
bool | startsWith (QByteArrayView bv) const |
bool | startsWith (char c) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if this byte array starts with byte ch; otherwise returns false . | |
bool | endsWith (char c) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if this byte array ends with byte ch; otherwise returns false . | |
bool | endsWith (QByteArrayView bv) const |
bool | isUpper () const |
Returns true if this byte array is uppercase, that is, if it's identical to its toUpper() folding. | |
bool | isLower () const |
Returns true if this byte array is lowercase, that is, if it's identical to its toLower() folding. | |
bool | isValidUtf8 () const noexcept |
Returns true if this byte array contains valid UTF-8 encoded data, or false otherwise. | |
void | truncate (qsizetype pos) |
Truncates the byte array at index position pos. | |
void | chop (qsizetype n) |
Removes n bytes from the end of the byte array. | |
QByteArray | toLower () const & |
QByteArray | toLower () && |
QByteArray | toUpper () const & |
QByteArray | toUpper () && |
QByteArray | trimmed () const & |
QByteArray | trimmed () && |
QByteArray | simplified () const & |
QByteArray | simplified () && |
QByteArray | leftJustified (qsizetype width, char fill=' ', bool truncate=false) const |
Returns a byte array of size width that contains this byte array padded with the fill byte. | |
QByteArray | rightJustified (qsizetype width, char fill=' ', bool truncate=false) const |
Returns a byte array of size width that contains the fill byte followed by this byte array. | |
QByteArray & | prepend (char c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Prepends the byte ch to this byte array. | |
QByteArray & | prepend (qsizetype count, char c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | prepend (const char *s) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Prepends the '\0'-terminated string str to this byte array. | |
QByteArray & | prepend (const char *s, qsizetype len) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | prepend (const QByteArray &a) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Prepends ba to this byte array. | |
QByteArray & | prepend (QByteArrayView a) |
Prepends the byte array view ba to this byte array and returns a reference to this byte array. | |
QByteArray & | append (char c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends the byte ch to this byte array. | |
QByteArray & | append (qsizetype count, char c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | append (const char *s) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends the '\0'-terminated string str to this byte array. | |
QByteArray & | append (const char *s, qsizetype len) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends the first len bytes starting at str to this byte array and returns a reference to this byte array. | |
QByteArray & | append (const QByteArray &a) |
Appends the byte array ba onto the end of this byte array. | |
QByteArray & | append (QByteArrayView a) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends data to this byte array. | |
QByteArray & | assign (QByteArrayView v) |
QByteArray & | assign (qsizetype n, char c) |
template<typename InputIterator , if_input_iterator< InputIterator > = true> | |
QByteArray & | assign (InputIterator first, InputIterator last) |
QByteArray & | insert (qsizetype i, QByteArrayView data) |
QByteArray & | insert (qsizetype i, const char *s) |
Inserts s at index position i and returns a reference to this byte array. | |
QByteArray & | insert (qsizetype i, const QByteArray &data) |
Inserts data at index position i and returns a reference to this byte array. | |
QByteArray & | insert (qsizetype i, qsizetype count, char c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | insert (qsizetype i, char c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Inserts byte ch at index position i in the byte array. | |
QByteArray & | insert (qsizetype i, const char *s, qsizetype len) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | remove (qsizetype index, qsizetype len) |
Removes len bytes from the array, starting at index position pos, and returns a reference to the array. | |
QByteArray & | removeAt (qsizetype pos) |
QByteArray & | removeFirst () |
QByteArray & | removeLast () |
template<typename Predicate > | |
QByteArray & | removeIf (Predicate pred) |
QByteArray & | replace (qsizetype index, qsizetype len, const char *s, qsizetype alen) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Replaces len bytes from index position pos with alen bytes starting at position after. | |
QByteArray & | replace (qsizetype index, qsizetype len, QByteArrayView s) |
Replaces len bytes from index position pos with the byte array after, and returns a reference to this byte array. | |
QByteArray & | replace (char before, QByteArrayView after) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Replaces every occurrence of the byte before with the byte array after. | |
QByteArray & | replace (const char *before, qsizetype bsize, const char *after, qsizetype asize) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Replaces every occurrence of the bsize bytes starting at before with the asize bytes starting at after. | |
QByteArray & | replace (QByteArrayView before, QByteArrayView after) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | replace (char before, char after) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Replaces every occurrence of the byte before with the byte after. | |
QByteArray & | operator+= (char c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends the byte ch onto the end of this byte array and returns a reference to this byte array. | |
QByteArray & | operator+= (const char *s) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends the '\0'-terminated string str onto the end of this byte array and returns a reference to this byte array. | |
QByteArray & | operator+= (const QByteArray &a) |
Appends the byte array ba onto the end of this byte array and returns a reference to this byte array. | |
QByteArray & | operator+= (QByteArrayView a) |
QList< QByteArray > | split (char sep) const |
Splits the byte array into subarrays wherever sep occurs, and returns the list of those arrays. | |
QByteArray | repeated (qsizetype times) const |
QT_ASCII_CAST_WARN bool | operator== (const QString &s2) const |
Returns true if this byte array is equal to the UTF-8 encoding of str; otherwise returns false . | |
QT_ASCII_CAST_WARN bool | operator!= (const QString &s2) const |
Returns true if this byte array is not equal to the UTF-8 encoding of str; otherwise returns false . | |
QT_ASCII_CAST_WARN bool | operator< (const QString &s2) const |
Returns true if this byte array is lexically less than the UTF-8 encoding of str; otherwise returns false . | |
QT_ASCII_CAST_WARN bool | operator> (const QString &s2) const |
Returns true if this byte array is lexically greater than the UTF-8 encoding of str; otherwise returns false . | |
QT_ASCII_CAST_WARN bool | operator<= (const QString &s2) const |
Returns true if this byte array is lexically less than or equal to the UTF-8 encoding of str; otherwise returns false . | |
QT_ASCII_CAST_WARN bool | operator>= (const QString &s2) const |
Returns true if this byte array is greater than or equal to the UTF-8 encoding of str; otherwise returns false . | |
short | toShort (bool *ok=nullptr, int base=10) const |
Returns the byte array converted to a short using base base, which is ten by default. | |
ushort | toUShort (bool *ok=nullptr, int base=10) const |
Returns the byte array converted to an {unsigned short} using base base, which is ten by default. | |
int | toInt (bool *ok=nullptr, int base=10) const |
Returns the byte array converted to an int using base base, which is ten by default. | |
uint | toUInt (bool *ok=nullptr, int base=10) const |
Returns the byte array converted to an {unsigned int} using base base, which is ten by default. | |
long | toLong (bool *ok=nullptr, int base=10) const |
ulong | toULong (bool *ok=nullptr, int base=10) const |
qlonglong | toLongLong (bool *ok=nullptr, int base=10) const |
Returns the byte array converted to a {long long} using base base, which is ten by default. | |
qulonglong | toULongLong (bool *ok=nullptr, int base=10) const |
Returns the byte array converted to an {unsigned long long} using base base, which is ten by default. | |
float | toFloat (bool *ok=nullptr) const |
Returns the byte array converted to a float value. | |
double | toDouble (bool *ok=nullptr) const |
Returns the byte array converted to a double value. | |
QByteArray | toBase64 (Base64Options options=Base64Encoding) const |
QByteArray | toHex (char separator='\0') const |
Returns a hex encoded copy of the byte array. | |
QByteArray | toPercentEncoding (const QByteArray &exclude=QByteArray(), const QByteArray &include=QByteArray(), char percent='%') const |
QByteArray | percentDecoded (char percent='%') const |
QByteArray & | setNum (short, int base=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | setNum (ushort, int base=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | setNum (int, int base=10) |
Represent the whole number n as text. | |
QByteArray & | setNum (uint, int base=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | setNum (long, int base=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | setNum (ulong, int base=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | setNum (qlonglong, int base=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | setNum (qulonglong, int base=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QByteArray & | setNum (float, char format='g', int precision=6) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Represent the floating-point number n as text. | |
QByteArray & | setNum (double, char format='g', int precision=6) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Represent the floating-point number n as text. | |
QByteArray & | setRawData (const char *a, qsizetype n) |
iterator | begin () |
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first byte in the byte-array. | |
const_iterator | begin () const noexcept |
const_iterator | cbegin () const noexcept |
const_iterator | constBegin () const noexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first byte in the byte-array. | |
iterator | end () |
Returns an \l{STL-style iterators}{STL-style iterator} pointing just after the last byte in the byte-array. | |
const_iterator | end () const noexcept |
const_iterator | cend () const noexcept |
const_iterator | constEnd () const noexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing just after the last byte in the byte-array. | |
reverse_iterator | rbegin () |
reverse_iterator | rend () |
const_reverse_iterator | rbegin () const noexcept |
const_reverse_iterator | rend () const noexcept |
const_reverse_iterator | crbegin () const noexcept |
const_reverse_iterator | crend () const noexcept |
void | push_back (char c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as append(ch). | |
void | push_back (const char *s) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as append(str). | |
void | push_back (const QByteArray &a) |
This function is provided for STL compatibility. | |
void | push_back (QByteArrayView a) |
void | push_front (char c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as prepend(ch). | |
void | push_front (const char *c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as prepend(str). | |
void | push_front (const QByteArray &a) |
This function is provided for STL compatibility. | |
void | push_front (QByteArrayView a) |
void | shrink_to_fit () |
iterator | erase (const_iterator first, const_iterator last) |
iterator | erase (const_iterator it) |
std::string | toStdString () const |
qsizetype | size () const noexcept |
Returns the number of bytes in this byte array. | |
qsizetype | length () const noexcept |
Same as size(). | |
bool | isNull () const noexcept |
Returns true if this byte array is null; otherwise returns false . | |
DataPointer & | data_ptr () |
QByteArray (DataPointer &&dd) | |
Static Public Member Functions | |
static QByteArray | number (int, int base=10) |
Returns a byte-array representing the whole number n as text. | |
static QByteArray | number (uint, int base=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
static QByteArray | number (long, int base=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
static QByteArray | number (ulong, int base=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
static QByteArray | number (qlonglong, int base=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
static QByteArray | number (qulonglong, int base=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
static QByteArray | number (double, char format='g', int precision=6) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a byte-array representing the floating-point number n as text. | |
static QByteArray | fromRawData (const char *data, qsizetype size) |
Constructs a QByteArray that uses the first size bytes of the data array. | |
static FromBase64Result | fromBase64Encoding (QByteArray &&base64, Base64Options options=Base64Encoding) |
static FromBase64Result | fromBase64Encoding (const QByteArray &base64, Base64Options options=Base64Encoding) |
static QByteArray | fromBase64 (const QByteArray &base64, Base64Options options=Base64Encoding) |
static QByteArray | fromHex (const QByteArray &hexEncoded) |
Returns a decoded copy of the hex encoded array hexEncoded. | |
static QByteArray | fromPercentEncoding (const QByteArray &pctEncoded, char percent='%') |
static QByteArray | fromStdString (const std::string &s) |
Friends | |
class | ::tst_QByteArray |
class | QString |
bool | operator== (const QByteArray &a1, const QByteArray &a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if byte array a1 is equal to byte array a2; otherwise returns false . | |
bool | operator== (const QByteArray &a1, const char *a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if byte array a1 is equal to the '\0'-terminated string a2; otherwise returns false . | |
bool | operator== (const char *a1, const QByteArray &a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if '\0'-terminated string a1 is equal to byte array a2; otherwise returns false . | |
bool | operator!= (const QByteArray &a1, const QByteArray &a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if byte array a1 is not equal to byte array a2; otherwise returns false . | |
bool | operator!= (const QByteArray &a1, const char *a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if byte array a1 is not equal to the '\0'-terminated string a2; otherwise returns false . | |
bool | operator!= (const char *a1, const QByteArray &a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if '\0'-terminated string a1 is not equal to byte array a2; otherwise returns false . | |
bool | operator< (const QByteArray &a1, const QByteArray &a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if byte array a1 is lexically less than byte array a2; otherwise returns false . | |
bool | operator< (const QByteArray &a1, const char *a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if byte array a1 is lexically less than the '\0'-terminated string a2; otherwise returns false . | |
bool | operator< (const char *a1, const QByteArray &a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if '\0'-terminated string a1 is lexically less than byte array a2; otherwise returns false . | |
bool | operator<= (const QByteArray &a1, const QByteArray &a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if byte array a1 is lexically less than or equal to byte array a2; otherwise returns false . | |
bool | operator<= (const QByteArray &a1, const char *a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if byte array a1 is lexically less than or equal to the '\0'-terminated string a2; otherwise returns false . | |
bool | operator<= (const char *a1, const QByteArray &a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if '\0'-terminated string a1 is lexically less than or equal to byte array a2; otherwise returns false . | |
bool | operator> (const QByteArray &a1, const QByteArray &a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if byte array a1 is lexically greater than byte array a2; otherwise returns false . | |
bool | operator> (const QByteArray &a1, const char *a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if byte array a1 is lexically greater than the '\0'-terminated string a2; otherwise returns false . | |
bool | operator> (const char *a1, const QByteArray &a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if '\0'-terminated string a1 is lexically greater than byte array a2; otherwise returns false . | |
bool | operator>= (const QByteArray &a1, const QByteArray &a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if byte array a1 is lexically greater than or equal to byte array a2; otherwise returns false . | |
bool | operator>= (const QByteArray &a1, const char *a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if byte array a1 is lexically greater than or equal to the '\0'-terminated string a2; otherwise returns false . | |
bool | operator>= (const char *a1, const QByteArray &a2) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if '\0'-terminated string a1 is lexically greater than or equal to byte array a2; otherwise returns false . | |
bool | operator== (const QByteArray &a1, std::nullptr_t) noexcept |
bool | operator!= (const QByteArray &a1, std::nullptr_t) noexcept |
bool | operator< (const QByteArray &, std::nullptr_t) noexcept |
bool | operator> (const QByteArray &a1, std::nullptr_t) noexcept |
bool | operator<= (const QByteArray &a1, std::nullptr_t) noexcept |
bool | operator>= (const QByteArray &, std::nullptr_t) noexcept |
bool | operator== (std::nullptr_t, const QByteArray &a2) noexcept |
bool | operator!= (std::nullptr_t, const QByteArray &a2) noexcept |
bool | operator< (std::nullptr_t, const QByteArray &a2) noexcept |
bool | operator> (std::nullptr_t, const QByteArray &a2) noexcept |
bool | operator<= (std::nullptr_t, const QByteArray &a2) noexcept |
bool | operator>= (std::nullptr_t, const QByteArray &a2) noexcept |
Q_CORE_EXPORT QByteArray | qUncompress (const uchar *data, qsizetype nbytes) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Uncompresses the first nbytes of data and returns a new byte array with the uncompressed data. | |
template<typename T > | |
qsizetype | erase (QByteArray &ba, const T &t) |
template<typename Predicate > | |
qsizetype | erase_if (QByteArray &ba, Predicate pred) |
Related Symbols | |
(Note that these are not member symbols.) | |
char * | qstrdup (const char *src) |
Returns a duplicate string. | |
char * | qstrcpy (char *dst, const char *src) |
Copies all the characters up to and including the '\0' from src into dst and returns a pointer to dst. | |
char * | qstrncpy (char *dst, const char *src, size_t len) |
A safe strncpy() function. | |
size_t | qstrlen (const char *str) |
A safe strlen() function. | |
size_t | qstrnlen (const char *str, size_t maxlen) |
int | qstrcmp (const char *str1, const char *str2) |
A safe strcmp() function. | |
int | qstrncmp (const char *str1, const char *str2, size_t len) |
A safe strncmp() function. | |
int | qstricmp (const char *str1, const char *str2) |
A safe stricmp() function. | |
int | qstrnicmp (const char *str1, const char *str2, size_t len) |
A safe strnicmp() function. | |
quint16 | qChecksum (QByteArrayView data, Qt::ChecksumType standard) |
QByteArray | qCompress (const QByteArray &data, int compressionLevel) |
Compresses the data byte array and returns the compressed data in a new byte array. | |
QByteArray | qCompress (const uchar *data, qsizetype nbytes, int compressionLevel) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compresses the first nbytes of data at compression level compressionLevel and returns the compressed data in a new byte array. | |
QByteArray | qUncompress (const QByteArray &data) |
Uncompresses the data byte array and returns a new byte array with the uncompressed data. | |
QByteArray | qUncompress (const uchar *data, qsizetype nbytes) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Uncompresses the first nbytes of data and returns a new byte array with the uncompressed data. | |
char * | data () |
\macro QT_NO_CAST_FROM_BYTEARRAY | |
QDataStream & | operator<< (QDataStream &out, const QByteArray &ba) |
Writes byte array ba to the stream out and returns a reference to the stream. | |
QDataStream & | operator>> (QDataStream &in, QByteArray &ba) |
Reads a byte array into ba from the stream in and returns a reference to the stream. | |
QByteArray | operator+ (const QByteArray &a1, const QByteArray &a2) |
Returns a byte array that is the result of concatenating byte array a1 and byte array a2. | |
QByteArray | operator+ (const QByteArray &a1, const char *a2) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a byte array that is the result of concatenating byte array a1 and '\0'-terminated string a2. | |
QByteArray | operator+ (const QByteArray &a1, char a2) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a byte array that is the result of concatenating byte array a1 and byte a2. | |
QByteArray | operator+ (const char *a1, const QByteArray &a2) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a byte array that is the result of concatenating '\0'-terminated string a1 and byte array a2. | |
QByteArray | operator+ (char a1, const QByteArray &a2) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a byte array that is the result of concatenating byte a1 and byte array a2. | |
operator""_ba (const char *str, size_t size) | |
\macro QByteArrayLiteral(ba) | |
template< typename T > qsizetype | erase (QByteArray &ba, const T &t) |
template< typename Predicate > qsizetype | erase_if (QByteArray &ba, Predicate pred) |
QT_BEGIN_NAMESPACE int | qvsnprintf (char *str, size_t n, const char *fmt, va_list ap) |
A portable vsnprintf() function. | |
int | qsnprintf (char *str, size_t n, const char *fmt,...) |
\target bytearray-qsnprintf | |
\inmodule QtCore
The QByteArray class provides an array of bytes.
\reentrant
QByteArray can be used to store both raw bytes (including '\0's) and traditional 8-bit '\0'-terminated strings. Using QByteArray is much more convenient than using {const char *}. Behind the scenes, it always ensures that the data is followed by a '\0' terminator, and uses \l{implicit sharing} (copy-on-write) to reduce memory usage and avoid needless copying of data.
In addition to QByteArray, Qt also provides the QString class to store string data. For most purposes, QString is the class you want to use. It understands its content as Unicode text (encoded using UTF-16) where QByteArray aims to avoid assumptions about the encoding or semantics of the bytes it stores (aside from a few legacy cases where it uses ASCII). Furthermore, QString is used throughout in the Qt API. The two main cases where QByteArray is appropriate are when you need to store raw binary data, and when memory conservation is critical (e.g., with Qt for Embedded Linux).
One way to initialize a QByteArray is simply to pass a {const char *} to its constructor. For example, the following code creates a byte array of size 5 containing the data "Hello":
Although the size() is 5, the byte array also maintains an extra '\0' byte at the end so that if a function is used that asks for a pointer to the underlying data (e.g. a call to data()), the data pointed to is guaranteed to be '\0'-terminated.
QByteArray makes a deep copy of the {const char *} data, so you can modify it later without experiencing side effects. (If, for example for performance reasons, you don't want to take a deep copy of the data, use QByteArray::fromRawData() instead.)
Another approach is to set the size of the array using resize() and to initialize the data byte by byte. QByteArray uses 0-based indexes, just like C++ arrays. To access the byte at a particular index position, you can use 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:
For read-only access, an alternative syntax is to use at():
at() can be faster than operator[](), because it never causes a \l{deep copy} to occur.
To extract many bytes at a time, use first(), last(), or sliced().
A QByteArray can embed '\0' bytes. The size() function always returns the size of the whole array, including embedded '\0' bytes, but excluding the terminating '\0' added by QByteArray. For example:
If you want to obtain the length of the data up to and excluding the first '\0' byte, call qstrlen() on the byte array.
After a call to resize(), newly allocated bytes have undefined values. To set all the bytes to a particular value, call fill().
To obtain a pointer to the actual bytes, call data() or constData(). These functions return a pointer to the beginning of the data. The pointer is guaranteed to remain valid until a non-const function is called on the QByteArray. It is also guaranteed that the data ends with a '\0' byte unless the QByteArray was created from \l{fromRawData()}{raw data}. This '\0' byte is automatically provided by QByteArray and is not counted in size().
QByteArray provides the following basic functions for modifying the byte data: append(), prepend(), insert(), replace(), and remove(). For example:
In the above example the replace() function's first two arguments are the position from which to start replacing and the number of bytes that should be replaced.
When data-modifying functions increase the size of the array, they may lead to reallocation of memory for the QByteArray object. When this happens, QByteArray expands by more than it immediately needs so as to have space for further expansion without reallocation until the size of the array has greatly increased.
The insert(), remove() and, when replacing a sub-array with one of different size, replace() functions can be slow (\l{linear time}) for large arrays, because they require moving many bytes in the array by at least one position in memory.
If you are building a QByteArray gradually and know in advance approximately how many bytes the QByteArray will contain, you can call reserve(), asking QByteArray to preallocate a certain amount of memory. You can also call capacity() to find out how much memory the QByteArray actually has allocated.
Note that using non-const operators and functions can cause QByteArray to do a deep copy of the data, due to \l{implicit sharing}.
QByteArray provides \l{STL-style iterators} (QByteArray::const_iterator and QByteArray::iterator). In practice, iterators are handy when working with generic algorithms provided by the C++ standard library.
If you want to find all occurrences of a particular byte or sequence of bytes in a QByteArray, use indexOf() or lastIndexOf(). The former searches forward starting from a given index position, the latter searches backward. Both return the index position of the byte sequence if they find it; otherwise, they return -1. For example, here's a typical loop that finds all occurrences of a particular string:
If you simply want to check whether a QByteArray contains a particular byte sequence, use contains(). If you want to find out how many times a particular byte sequence occurs in the byte array, use count(). If you want to replace all occurrences of a particular value with another, use one of the two-parameter replace() overloads.
\l{QByteArray}s can be compared using overloaded operators such as operator<(), operator<=(), operator==(), operator>=(), and so on. The comparison is based exclusively on the numeric values of the bytes and is very fast, but is not what a human would expect. QString::localeAwareCompare() is a better choice for sorting user-interface strings.
For historical reasons, QByteArray distinguishes between a null byte array and an empty byte array. A null byte array is a byte array that is initialized using QByteArray's default constructor or by passing (const char *)0 to the constructor. An empty byte array is any byte array with size 0. A null byte array is always empty, but an empty byte array isn't necessarily null:
All functions except isNull() treat null byte arrays the same as empty byte arrays. For example, data() returns a valid pointer (not nullptr) to a '\0' byte for a null byte array and QByteArray() compares equal to QByteArray(""). We recommend that you always use isEmpty() and avoid isNull().
Definition at line 56 of file qbytearray.h.
This typedef provides an STL-style const iterator for QByteArray.
Definition at line 423 of file qbytearray.h.
Definition at line 449 of file qbytearray.h.
Definition at line 446 of file qbytearray.h.
This typedef provides an STL-style const reverse iterator for QByteArray.
Definition at line 427 of file qbytearray.h.
Definition at line 425 of file qbytearray.h.
Definition at line 59 of file qbytearray.h.
Definition at line 445 of file qbytearray.h.
This typedef provides an STL-style non-const iterator for QByteArray.
Definition at line 422 of file qbytearray.h.
Definition at line 424 of file qbytearray.h.
Definition at line 448 of file qbytearray.h.
Definition at line 447 of file qbytearray.h.
This typedef provides an STL-style non-const reverse iterator for QByteArray.
Definition at line 426 of file qbytearray.h.
Definition at line 444 of file qbytearray.h.
Definition at line 450 of file qbytearray.h.
|
strong |
Enumerator | |
---|---|
Ok | |
IllegalInputLength | |
IllegalCharacter | |
IllegalPadding |
Definition at line 84 of file qbytearray.h.
This enum contains the options available for encoding and decoding Base64. Base64 is defined by \l{RFC 4648}, with the following options:
\value Base64Encoding (default) The regular Base64 alphabet, called simply "base64" \value Base64UrlEncoding An alternate alphabet, called "base64url", which replaces two characters in the alphabet to be more friendly to URLs. \value KeepTrailingEquals (default) Keeps the trailing padding equal signs at the end of the encoded data, so the data is always a size multiple of four. \value OmitTrailingEquals Omits adding the padding equal signs at the end of the encoded data. \value IgnoreBase64DecodingErrors When decoding Base64-encoded data, ignores errors in the input; invalid characters are simply skipped. This enum value has been added in Qt 5.15. \value AbortOnBase64DecodingErrors When decoding Base64-encoded data, stops at the first decoding error. This enum value has been added in Qt 5.15.
QByteArray::fromBase64Encoding() and QByteArray::fromBase64() ignore the KeepTrailingEquals and OmitTrailingEquals options. If the IgnoreBase64DecodingErrors option is specified, they will not flag errors in case trailing equal signs are missing or if there are too many of them. If instead the AbortOnBase64DecodingErrors is specified, then the input must either have no padding or have the correct amount of equal signs.
Enumerator | |
---|---|
Base64Encoding | |
Base64UrlEncoding | |
KeepTrailingEquals | |
OmitTrailingEquals | |
IgnoreBase64DecodingErrors | |
AbortOnBase64DecodingErrors |
Definition at line 72 of file qbytearray.h.
|
inlineconstexprnoexcept |
Constructs an empty byte array.
Definition at line 520 of file qbytearray.h.
Referenced by fromBase64(), fromStdString(), left(), mid(), repeated(), right(), toHex(), and toPercentEncoding().
QByteArray::QByteArray | ( | const char * | data, |
qsizetype | size = -1 |
||
) |
Constructs a byte array containing the first size bytes of array data.
If data is 0, a null byte array is constructed.
If size is negative, data is assumed to point to a '\0'-terminated string and its length is determined dynamically.
QByteArray makes a deep copy of the string data.
Definition at line 1793 of file qbytearray.cpp.
References QTypedArrayData< T >::allocate(), QArrayDataPointer< T >::data(), QArrayDataPointer< T >::fromRawData(), Q_CHECK_PTR(), and qstrlen().
QByteArray::QByteArray | ( | qsizetype | size, |
char | ch | ||
) |
Constructs a byte array of size size with every byte set to ch.
Definition at line 1817 of file qbytearray.cpp.
References QTypedArrayData< T >::allocate(), ch, QArrayDataPointer< T >::data(), QArrayDataPointer< T >::fromRawData(), and Q_CHECK_PTR().
QByteArray::QByteArray | ( | qsizetype | size, |
Qt::Initialization | |||
) |
Constructs a byte array of size size with uninitialized contents.
Definition at line 1833 of file qbytearray.cpp.
References QTypedArrayData< T >::allocate(), QArrayDataPointer< T >::data(), QArrayDataPointer< T >::fromRawData(), and Q_CHECK_PTR().
|
inlinenoexcept |
Constructs a copy of other.
This operation takes \l{constant time}, because QByteArray is \l{implicitly shared}. This makes returning a QByteArray from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), taking \l{linear time}.
Definition at line 552 of file qbytearray.h.
|
inline |
Destroys the byte array.
Definition at line 521 of file qbytearray.h.
|
inlinedefaultnoexcept |
Move-constructs a QByteArray instance, making it point at the same object that other was pointing to.
|
inlineexplicit |
Definition at line 487 of file qbytearray.h.
QByteArray & QByteArray::append | ( | char | c | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends the byte ch to this byte array.
Definition at line 2099 of file qbytearray.cpp.
References ch, QtPrivate::QGenericArrayOps< T >::copyAppend(), QArrayDataPointer< T >::data(), QArrayDataPointer< T >::detachAndGrow(), QArrayData::GrowsAtEnd, and QArrayDataPointer< T >::size.
Referenced by QFileSystemIterator::QFileSystemIterator(), QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(), QXcbXSettings::QXcbXSettings(), QFileSystemEngine::absoluteName(), QCborStreamReader::addData(), QQuick3DParticleInstanceTable::addInstance(), QSSGStageGeneratorBase::addShaderConstantBufferItemMap(), QSSGStageGeneratorBase::addShaderItemMap(), QSSGStageGeneratorBase::addShaderPass2Marker(), append(), QSSGStageGeneratorBase::append(), QSSGStageGeneratorBase::appendShaderCode(), QCommandApdu::build(), QmlLsp::QQmlCodeModel::buildPathsForFileUrl(), QSSGStageGeneratorBase::buildShaderSourcePass1(), checkLightxml(), QmlLsp::codeActionHandler(), QTlsPrivate::TlsCryptographOpenSSL::continueHandshake(), QSSGMesh::Mesh::createLightmapUVChannel(), QQmlPropertyCacheCreator< ObjectContainer >::createMetaObject(), QSslContext::createSsl(), QMimerSQLResult::data(), QNetworkReplyWasmImplPrivate::dataReceived(), HPack::HuffmanDecoder::decodeStream(), deployWebEngineCore(), QSSGRenderEffect::finalizeShaders(), QOpenGLEngineSharedShaders::findProgramInCache(), QTest::formatResult(), QSSGMesh::Mesh::fromAssetData(), QNdefMessage::fromByteArray(), generateDirections(), generateGlyphTables(), generateMainLightCalculation(), QWaylandMimeHelper::getByteArray(), QHttpNetworkReplyPrivate::getChunkSize(), QSSGShaderLibraryManager::getIncludeContents(), handleSpotLight(), QSSGShaderKeyPropertyBase::internalToString(), QSSGShaderKeyPropertyBase::internalToString(), QTextList::itemText(), QQuick3DFileInstancing::loadFromXmlFile(), QOpenGLDebugLogger::logMessage(), Preprocessor::macroExpandIdentifier(), mergeStringLiterals(), QIBaseDriver::open(), QSSGStageGeneratorBase::operator<<(), operator<<(), QQmlError::operator<<(), parseAttribute(), parseAttributeValues(), parseSdpRecord(), parseTzAbbreviations(), QTlsPrivate::TlsKeyBase::pemFromDer(), QHttpNetworkConnectionChannel::pipelineInto(), QDtlsPrivateOpenSSL::pskClientCallback(), QOpenGLDebugLogger::pushGroup(), qEncodeHmacMd5(), qEncodeLmv2Response(), qEncodeNtlmv2Response(), qGetBinaryData(), qt_socks5_set_host_address_and_port(), qt_socks5_set_host_name_and_port(), QAsn1Element::read(), QHttpNetworkReplyPrivate::readHeader(), QJpegHandlerPrivate::readJpegHeader(), QHttpNetworkReplyPrivate::readStatus(), QSSGShaderUtils::resolveShader(), QHttpProtocolHandler::sendRequest(), QWinSettingsPrivate::set(), QMacPasteboard::setMimeData(), setNum(), setNum(), setupLightVariableNames(), trace::toByteArray(), trace::toByteArray(), trace::toByteArray(), trace::toByteArray(), QQuickStyledTextPrivate::toRoman(), QTest::toString(), QSSGShaderKeyTextureChannel::toString(), QSSGShaderKeyImageMap::toString(), QSSGShaderKeySpecularModel::toString(), QSSGShaderKeyAlphaMode::toString(), QSSGShaderKeyVertexAttribute::toString(), QQuick3DCustomMaterial::updateSpatialNode(), QLocaleData::validateChars(), QSSGShaderDefaultMaterialKey::StringVisitor::visit(), TestHTTPServer::wait(), QFFmpeg::AudioSourceIO::writeData(), and QSocks5SocketEngine::writeDatagram().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends the '\0'-terminated string str to this byte array.
Definition at line 229 of file qbytearray.h.
References append().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends the first len bytes starting at str to this byte array and returns a reference to this byte array.
The bytes appended may include '\0' bytes.
If len is negative, str will be assumed to be a '\0'-terminated string and the length to be copied will be determined automatically using qstrlen().
If len is zero or str is null, nothing is appended to the byte array. Ensure that len is not longer than str.
Definition at line 231 of file qbytearray.h.
References append(), and qstrlen().
QByteArray & QByteArray::append | ( | const QByteArray & | ba | ) |
Appends the byte array ba onto the end of this byte array.
Example:
This is the same as insert(size(), ba).
Note: QByteArray is an \l{implicitly shared} class. Consequently, if you append to an empty byte array, then the byte array will just share the data held in ba. In this case, no copying of data is done, taking \l{constant time}. If a shared instance is modified, it will be copied (copy-on-write), taking \l{linear time}.
If the byte array being appended to is not empty, a deep copy of the data is performed, taking \l{linear time}.
The append() function is typically very fast (\l{constant time}), because QByteArray preallocates extra space at the end of the data, so it can grow without reallocating the entire array each time.
Definition at line 2045 of file qbytearray.cpp.
References append(), ba, QArrayDataPointer< T >::freeSpaceAtEnd(), QArrayDataPointer< T >::isMutable(), and size().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends data to this byte array.
Definition at line 234 of file qbytearray.h.
References insert().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Appends count copies of byte ch to this byte array and returns a reference to this byte array.
If count is negative or zero nothing is appended to the byte array.
Definition at line 579 of file qbytearray.h.
|
inline |
Definition at line 244 of file qbytearray.h.
References d.
QByteArray & QByteArray::assign | ( | QByteArrayView | v | ) |
Replaces the contents of this byte array with a copy of v and returns a reference to this byte array.
The size of this byte array will be equal to the size of v.
This function only allocates memory if the size of v exceeds the capacity of this byte array or this byte array is shared.
Definition at line 2157 of file qbytearray.cpp.
References QArrayDataPointer< T >::begin(), capacity(), QArrayDataPointer< T >::data(), QArrayDataPointer< T >::freeSpaceAtBegin(), isDetached(), QArrayDataPointer< T >::setBegin(), size(), and QArrayDataPointer< T >::size.
|
inline |
Replaces the contents of this byte array with n copies of c and returns a reference to this byte array.
The size of this byte array will be equal to n, which has to be non-negative.
This function will only allocate memory if n exceeds the capacity of this byte array or this byte array is shared.
Definition at line 238 of file qbytearray.h.
References fill(), and Q_ASSERT.
|
inline |
Returns the byte at index position i in the byte array.
i must be a valid index position in the byte array (i.e., 0 <= i < size()).
Definition at line 523 of file qbytearray.h.
References d, i, and Q_ASSERT.
Referenced by QOscMessage::QOscMessage(), QPpdPrintDevice::QPpdPrintDevice(), QmlLsp::QQmlCodeModel::buildPathsForFileUrl(), calculatePosixDate(), calculatePosixTransitions(), QMacMimeFileUri::convertToMime(), QWindowsMimeHtml::convertToMime(), QQmlOpenMetaObjectType::createProperties(), QTlsPrivate::TlsKeyOpenSSL::derFromPem(), QTlsPrivate::TlsKeyGeneric::derFromPem(), QWidget::event(), QDB2Result::exec(), QTest::formatResult(), fromHex(), QTlsPrivate::X509CertificateBase::matchLineFeed(), QTlsPrivate::X509CertificateGeneric::parse(), QAuthenticatorPrivate::parseHttpResponse(), QSocks5SocketEnginePrivate::parseRequestMethodReply(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), QXcbXSettingsPrivate::populateSettings(), QWavefrontMesh::readData(), QOCICols::readPiecewise(), QSGBatchRenderer::Allocator< Type, PageSize >::releaseExplicit(), QAsn1Element::toInteger(), QAsn1Element::toObjectId(), QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(), validatePosixRule(), TestHTTPServer::wait(), and wrapInFunction().
|
inline |
Returns a reference to the last byte in the byte array. Same as {operator[](size() - 1)}.
This function is provided for STL compatibility.
Definition at line 578 of file qbytearray.h.
References operator[]().
|
inline |
Returns the last byte in the byte array. Same as {at(size() - 1)}.
This function is provided for STL compatibility.
Definition at line 134 of file qbytearray.h.
References at.
Referenced by QTlsPrivate::Q_GLOBAL_STATIC_WITH_ARGS(), and QAsn1Element::toDateTime().
|
inline |
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first byte in the byte-array.
! [iterator-invalidation-func-desc]
\sa constBegin(), end()
Definition at line 428 of file qbytearray.h.
Referenced by LeCmacCalculator::calculateMac(), copyToUnindexedVertices(), QPasswordDigestor::deriveKeyPbkdf2(), erase(), isLower(), isUpper(), QTimeZonePrivate::isValidId(), remove(), and validatePosixRule().
|
inlinenoexcept |
Definition at line 429 of file qbytearray.h.
|
inline |
Returns the maximum number of bytes that can be stored in the byte array without forcing a reallocation.
The sole purpose of this function is to provide a means of fine tuning QByteArray's memory usage. In general, you will rarely ever need to call this function. If you want to know how many bytes are in the byte array, call size().
Definition at line 555 of file qbytearray.h.
References d.
Referenced by assign(), QOCIResultPrivate::bindValue(), QOCICols::execBatch(), reserve(), resize(), and squeeze().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first byte in the byte-array.
iterator-invalidation-func-desc
Definition at line 430 of file qbytearray.h.
References begin().
Referenced by language::_formatString(), QPasswordDigestor::deriveKeyPbkdf2(), doParseMountInfo(), and erase().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing just after the last byte in the byte-array.
iterator-invalidation-func-desc
Definition at line 434 of file qbytearray.h.
Referenced by language::_formatString(), QPasswordDigestor::deriveKeyPbkdf2(), and doParseMountInfo().
Removes n bytes from the end of the byte array.
If n is greater than size(), the result is an empty byte array.
Example:
Definition at line 1705 of file qbytearray.cpp.
References resize().
Referenced by QTlsPrivate::X509CertificateOpenSSL::certificateFromX509(), Moc::checkProperties(), QTest::formatResult(), getLockInfo_helper(), metaEnumFromType(), Moc::parseMocInclude(), Moc::parseRevision(), printMethodNotFoundWarning(), QMimeData::setData(), QTest::toString(), and wrapInFunction().
|
inline |
Returns a byte array that contains the leftmost size() - len bytes of this byte array.
Definition at line 167 of file qbytearray.h.
References Q_ASSERT.
Referenced by QQmlTypeData::done(), and QV4::ExecutionEngine::metaTypeFromJS().
void QByteArray::clear | ( | ) |
Clears the contents of the byte array and makes it null.
Definition at line 3251 of file qbytearray.cpp.
References QArrayDataPointer< T >::clear().
Referenced by QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(), QMessageBoxPrivate::_q_buttonClicked(), QProgressDialogPrivate::_q_disconnectOnClose(), QSSGStageGeneratorBase::begin(), QSctpSocketPrivate::canReadNotification(), QNetworkDatagram::clear(), QNdefRecord::clear(), QNmeaSatelliteInfoUpdate::clear(), QQuick3DParticleInstanceTable::clear(), QTlsPrivate::TlsKeyGeneric::clear(), QPdfDocument::close(), QGuiApplicationPrivate::createPlatformIntegration(), QSslContext::createSsl(), debugBinaryString(), QDtlsPrivateOpenSSL::decryptDatagram(), QHttpNetworkReplyPrivate::findChallenge(), QNdefMessage::fromByteArray(), QHttpNetworkReplyPrivate::getChunkSize(), QNfcTagType4NdefFsm::getMessage(), QTlsPrivate::TlsCryptographOpenSSL::init(), QQmlPreviewFileLoader::load(), operator>>(), QSocks5SocketEnginePrivate::parseRequestMethodReply(), QHttpNetworkConnectionChannel::pipelineFlush(), QSGMaterialShaderPrivate::prepare(), QSSGShaderCustomMaterialAdapter::prepareCustomShader(), processSentence(), QDtlsPrivateOpenSSL::pskClientCallback(), QPulseAudioSource::read(), QHttpNetworkReplyPrivate::readBodyFast(), QHttpNetworkReplyPrivate::readHeader(), QHttpNetworkReplyPrivate::readReplyBodyRaw(), QHttpNetworkReplyPrivate::readStatus(), QNetworkAccessCache::removeEntry(), QNetworkReplyHttpImplPrivate::replyDownloadMetaData(), QNonContiguousByteDeviceThreadForwardImpl::reset(), QSSGShaderLibraryManager::resolveIncludeFiles(), QSSGParticleRenderer::rhiPrepareRenderable(), setNum(), setNum(), setRawData(), QAndroidAudioSource::start(), QLocaleData::validateChars(), QDtlsClientVerifierOpenSSL::verifyClient(), TestHTTPServer::wait(), and writeDib().
|
inlinenoexcept |
Returns an integer less than, equal to, or greater than zero depending on whether this QByteArray sorts before, at the same position as, or after the QByteArrayView bv. The comparison is performed according to case sensitivity cs.
Definition at line 587 of file qbytearray.h.
References Qt::CaseSensitive, QtPrivate::compareMemory(), and qstrnicmp().
Referenced by QX11SurfaceCapture::isSupported(), QEglFSIntegration::nativeResourceFunctionForContext(), QQuickColorDialogImpl::setOptions(), and QHttpSocketEngine::slotSocketReadNotification().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first byte in the byte-array.
iterator-invalidation-func-desc
Definition at line 431 of file qbytearray.h.
References begin().
Referenced by calculatePosixTransitions(), normalizeType(), parsePosixTransitionTime(), and toCase_template().
|
inlinenoexcept |
Returns a pointer to the const data stored in the byte array.
The pointer can be used to access the bytes that compose the array. The data is '\0'-terminated unless the QByteArray object was created from raw data.
pointer-invalidation-desc
This function is mostly useful to pass a byte array to a function that accepts a {const char *}.
Note: A QByteArray can store any byte values including '\0's, but most functions that take {char *} arguments assume that the data ends at the first '\0' they encounter.
Definition at line 122 of file qbytearray.h.
Referenced by QCborValue::QCborValue(), QDarwinFormatInfo::QDarwinFormatInfo(), QDBusError::QDBusError(), QEglFSKmsScreen::QEglFSKmsScreen(), QFileSystemIterator::QFileSystemIterator(), QGstreamerVideoOverlay::QGstreamerVideoOverlay(), QMimeMagicRule::QMimeMagicRule(), QPpdPrintDevice::QPpdPrintDevice(), QQnxIntegration::QQnxIntegration(), QQnxWindow::QQnxWindow(), QResponseApdu::QResponseApdu(), QSignalSpy::QSignalSpy(), QXcbBasicConnection::QXcbBasicConnection(), QXcbVirtualDesktop::QXcbVirtualDesktop(), QXcbXSettings::QXcbXSettings(), QAbstractSocketPrivate::_q_connectToNextAddress(), QLocalSocketPrivate::_q_connectToSocket(), QSocks5SocketEnginePrivate::_q_udpSocketReadNotification(), QPdfEnginePrivate::addConstantAlphaObject(), QZipWriterPrivate::addEntry(), addFunction(), QPdfEnginePrivate::addImage(), QCborStreamWriter::append(), QDBusMarshaller::append(), QCborStreamWriter::append(), QDBusMarshaller::appendCrossMarshalling(), QConcatenable< QByteArray >::appendTo(), appendVariant(), QMacStylePrivate::aquaSizeConstrain(), RingBuffer::availableData(), QRhiGles2::bindShaderResources(), LeCmacCalculator::calculateMac(), QSSGMesh::MeshInternal::calculateSubsetBounds(), QKtxHandler::canRead(), QSctpSocketPrivate::canReadNotification(), QWindowsFontEngine::capHeight(), QEglFSKmsGbmCursor::changeCursor(), Moc::checkProperties(), Moc::checkSuperClasses(), checkXdgRuntimeDir(), childKeysOrGroups(), QQmlPropertyCache::className(), QXcbConnection::clientLeader(), QXcbClipboard::clipboardReadIncrementalProperty(), QCupsPrintEnginePrivate::closePrintDevice(), QSGCompressedTexture::commitTextureOperations(), commonCopyEvent(), QuickTestResult::compare(), QRhiD3D11::compileHlslShaderSource(), QRhiGles2::compileShader(), QOpenGLShader::compileSourceCode(), QQmlLoggingCategory::componentComplete(), computeFaceIndex(), QObject::connect(), QMetaObject::connectSlotsByName(), QLowEnergyControllerPrivateWinRT::connectToDevice(), QAbstractSocket::connectToHost(), QOpenGLDebugLoggerPrivate::controlDebugMessages(), QUtf32::convertFromUnicode(), QMacMimePlainTextFallback::convertToMime(), QMacMimeTraditionalMacPlainText::convertToMime(), QQuick3DPhysicsMesh::convexMesh(), QXcbWindow::create(), QD3D11Buffer::create(), QD3D11RenderBuffer::create(), QD3D11Texture::create(), QD3D11GraphicsPipeline::create(), QD3D11ComputePipeline::create(), QMetalBuffer::create(), QMetalRenderBuffer::create(), QMetalTexture::create(), QMetalComputePipeline::create(), QVkGraphicsPipeline::create(), QVkComputePipeline::create(), QXcbSystemTrayTracker::create(), createDirectoryWithParents(), QSSGMesh::Mesh::createLightmapUVChannel(), QRhiMetalData::createMetalLib(), QQuickDragAttachedPrivate::createMimeData(), QRhiMetalData::createMSLShaderFunction(), QKmsDevice::createScreenForConnector(), QRhiVulkan::createShader(), QSslContext::createSsl(), QMetalGraphicsPipeline::createTessellationPipelines(), QMetalGraphicsPipeline::createVertexFragmentPipeline(), QRingChunk::data(), QQmlFile::data(), data(), DarwinBluetooth::data_from_bytearray(), QtWaylandClient::QWaylandDataSource::data_source_send(), QQuickScriptActionPrivate::debugAction(), QAnimationGroupJob::debugChildren(), debugFocusTree(), QRhiD3D11::debugMarkMsg(), QRhiMetal::debugMarkMsg(), QRhiVulkan::debugMarkMsg(), QQuickAnimationPropertyUpdater::debugUpdater(), QTest::defaultEventDelay(), QTest::defaultKeyDelay(), QTest::defaultMouseDelay(), deploy(), deployPlugin(), deployWebEngineCore(), QAVFCameraBase::device(), QObject::disconnect(), AVFImageCapture::doCapture(), QTlsPrivate::doCrypt(), QNetworkReplyWasmImplPrivate::doSendRequest(), QPainter::drawText(), QPainter::drawText(), QPainter::drawText(), QPainter::drawText(), QPdfEnginePrivate::drawTextItem(), dumpAttributeVariant(), QV4::Moth::dumpBytecode(), dumpErrorInformation(), QObject::dumpObjectInfo(), QQmlNativeDebugServiceImpl::emitAsynchronousMessageToClient(), encodeEntity(), encodeFileName(), QRhiGles2::enqueueResourceUpdates(), QRhiMetal::enqueueSubresUpload(), enumForSingleton(), escapedString(), QQmlCustomParser::evaluateEnum(), QWidget::event(), QDB2Result::exec(), QMimerSQLResult::exec(), QMYSQLResult::exec(), QODBCResult::exec(), QSQLiteResult::exec(), QPSQLDriverPrivate::exec(), QOCICols::execBatch(), execCommand(), QRhiGles2::executeCommandBuffer(), QuickTestResult::expectFail(), QuickTestResult::expectFailContinue(), extractServiceData(), QQuickDialogTestUtils::DialogTestHelper< DialogType, QuickDialogType >::failureMessage(), QQuickVisualTestUtils::QQuickApplicationHelper::failureMessage(), QAbstractSocketPrivate::fetchConnectionParameters(), QNativeSocketEnginePrivate::fetchConnectionParameters(), QZipReader::fileData(), QGtk3Interface::fileIcon(), QTextStreamPrivate::fillReadBuffer(), QStandardPaths::findExecutable(), findPatternUnloaded(), QOpenGLEngineSharedShaders::findProgramInCache(), QQmlPropertyPrivate::findSignalByName(), QMinimalBackingStore::flush(), QTextStreamPrivate::flushWriteBuffer(), QWindowsFontDatabase::fontEngine(), QPSQLDriver::formatValue(), freeDesktopTrashLocation(), QDirectFbBlitterPlatformPixmap::fromFile(), QJsonDocument::fromJson(), QHostInfoAgent::fromName(), Moc::generate(), Generator::generateCode(), generateInterfaceXml(), genVulkanFunctionsH(), genVulkanFunctionsPC(), genVulkanFunctionsPH(), QWindowsFontEngine::getCMap(), QTextureFileData::getDataView(), QFileSystemEngine::getLinkTarget(), QXcbScreen::getName(), QOpenGLContext::getProcAddress(), QLibProxyWrapper::getProxies(), QFileSystemEngine::getRawLinkPath(), getRhiImplementation(), QSSGShaderLibraryManager::getShaderMetaData(), QSSGShaderLibraryManager::getShaderSource(), QNearFieldTargetPrivateImpl::getTagTechnology(), QFontEngine::glyphCount(), QQuickWidgetPrivate::grabFramebuffer(), QQnxClipboard::MimeData::hasFormat(), QNonContiguousByteDeviceThreadForwardImpl::haveDataSlot(), QTextMarkdownImporter::import(), QTlsPrivate::X509CertificateOpenSSL::importPkcs12(), QMetaObjectPrivate::indexOfSignalRelative(), QCoreTextFontEngine::init(), QWaylandCompositorPrivate::init(), QWindowsOpengl32DLL::init(), QGeoSatelliteInfoSourceGypsy::init(), init_plugins(), QHighDpiScaling::initHighDpiScaling(), QNativeSocketEngine::initialize(), QBasicPlatformVulkanInstance::initInstance(), QCoreApplicationPrivate::initLocale(), QAbstractSocketPrivate::initSocketLayer(), InstanceModel::instanceData(), QDBusUtil::isValidSignature(), QDBusUtil::isValidSingleSignature(), QIODevicePrivate::isWriteChunkCached(), QXcbKeyboard::keymapFromCore(), QOpenGLShaderProgramPrivate::linkBinary(), QRhiGles2::linkProgram(), QDefaultOutputMapping::load(), QSvgIOHandlerPrivate::load(), QSSGShaderCache::loadBuiltinForRhi(), QFontEngine::loadKerningPairs(), loadRulesFromFile(), QOpenGLDebugLogger::loggedMessages(), QOpenGLDebugLogger::logMessage(), QHostInfoAgent::lookup(), main(), ElfMapper::map(), QV4DebugServiceImpl::messageReceived(), QQmlNativeDebugServiceImpl::messageReceived(), QPdfDocument::metaData(), QV4::GlobalFunctions::method_parseFloat(), QV4::ConsoleObject::method_profile(), QV4::ConsoleObject::method_profileEnd(), QXcbMime::mimeAtomToString(), QMimeDatabasePrivate::mimeTypeForFile(), QFontEngine::minRightBearing(), DarwinBluetooth::mutable_data_from_bytearray(), myMessageOutput(), nameToOSType(), QNativeSocketEnginePrivate::nativeReceiveDatagram(), QWindowsDirect2DNativeInterface::nativeResourceForBackingStore(), QWindowsGdiNativeInterface::nativeResourceForBackingStore(), QWindowsNativeInterface::nativeResourceForContext(), QWindowsNativeInterface::nativeResourceForScreen(), QQnxNativeInterface::nativeResourceForWindow(), QWindowsNativeInterface::nativeResourceForWindow(), QNativeSocketEnginePrivate::nativeSendDatagram(), QMetaProperty::notifySignalIndex(), obtainSDKVersion(), QtWayland::DataDeviceManager::offerFromCompositorToClient(), QDB2Driver::open(), QIBaseDriver::open(), QMimerSQLDriver::open(), QMYSQLDriver::open(), QHaikuServices::openDocument(), openFramebufferDevice(), openFramebufferDevice(), openProcess(), QHaikuServices::openUrl(), operator!=(), operator<(), operator<<(), operator<<(), QQmlError::operator<<(), operator<=(), QDBusError::operator=(), operator==(), operator>(), operator>=(), QBitArray::operator~(), RCCResourceLibrary::output(), QEdidParser::parse(), QDateTimeParser::parse(), parseDateString(), Preprocessor::parseDefineArguments(), QDateTimeParser::parseFormat(), Moc::parseFunction(), Moc::parseMaybeFunction(), Moc::parsePluginData(), Moc::parsePropertyAttributes(), QRhiD3D11::pipelineCacheData(), QRhiGles2::pipelineCacheData(), QRhiMetal::pipelineCacheData(), QEglFSDeviceIntegration::platformInit(), QSSGParticleBuffer::pointer(), QByteDataBuffer::popFront(), QXcbXSettingsPrivate::populateSettings(), QMYSQLResult::prepare(), QSGMaterialShaderPrivate::prepare(), QSSGShaderCustomMaterialAdapter::prepareCustomShader(), QSSGDebugDrawSystem::prepareGeometry(), QSSGLayerRenderData::prepareModelsForRender(), QRhiVulkan::prepareUploadSubres(), printMethodNotFoundWarning(), printRenderPassDetails(), Scanner::printUsage(), Scanner::process(), QAndroidAudioSource::processBuffer(), QFontEngine::processHheaTable(), QFontEngine::processOS2Table(), QDtlsPrivateOpenSSL::pskClientCallback(), QTlsPrivate::TlsCryptographOpenSSL::pskClientTlsCallback(), QDtlsPrivateOpenSSL::pskServerCallback(), QTlsPrivate::TlsCryptographOpenSSL::pskServerTlsCallback(), QPcscSlotName::ptr(), QOpenGLDebugLogger::pushGroup(), Q_LOGGING_CATEGORY(), qDecodeOCIType(), qEncodeNtlmv2Response(), qGetBinaryData(), qOraOutValue(), QTest::qPrintDataTags(), QTest::qPrintMessage(), qRegisterNormalizedMetaTypeImplementation(), QTest::qRun(), qSaveQmlJSUnitAsCpp(), QSGBatchRenderer::qsg_dumpShadowRoots(), QSGBatchRenderer::qsg_dumpShadowRoots(), qt_convert_to_latin1(), qtValue(), qvsnprintf(), QAstcHandler::read(), QPkmHandler::read(), QAlsaAudioSource::read(), QPulseAudioSource::read(), QICNSHandler::read(), QWebpHandler::read(), read32bitIcon(), QHttpPartPrivate::readData(), QHttpMultiPartIODevice::readData(), QSocks5SocketEngine::readDatagram(), QAbstractSocketPrivate::readFromSocket(), readMask(), QSSGMesh::MeshInternal::readMeshData(), QNonContiguousByteDeviceByteArrayImpl::readPointer(), QGstreamerMediaEncoder::record(), QQmlMetaType::registerPluginTypes(), QtQuickControls2Plugin::registerTypes(), QDBusAdaptorConnector::relay(), QDBusConnectionPrivate::relaySignal(), QFileSystemEngine::removeDirectory(), QVideoWindowPrivate::render(), QFontconfigDatabase::resolveFontFamilyAlias(), QSSGShaderLibraryManager::resolveIncludeFiles(), QD3D11CommandBuffer::retainData(), QGles2CommandBuffer::retainData(), QQnxClipboard::MimeData::retrieveData(), QQmlJSBasicBlocks::run(), QQmlJSCodeGenerator::run(), QQmlJSTypePropagator::run(), QSSGLightmapUVGenerator::run(), QQmlJSShadowCheck::run(), runAdb(), runMoc(), runUic(), QDomDocumentPrivate::saveDocument(), QToolBarAreaLayout::saveState(), scanImports(), QQmlType::scopedEnumValue(), searchIncludePaths(), QV4DebugServiceImpl::send(), HciManager::sendCommand(), QPSQLDriverPrivate::sendQuery(), QWinSettingsPrivate::set(), set_text(), QDBusAbstractAdaptor::setAutoRelaySignals(), QTimeLinePrivate::setCurrentTime(), QGstreamerMediaPlayer::setMedia(), QGstreamerMetaData::setMetaData(), QRhiVulkan::setObjectName(), QMessagePattern::setPattern(), QRhiGles2::setPipelineCacheData(), QRhiMetal::setPipelineCacheData(), QEglFSKmsGbmCursor::setPos(), QWaylandSurface::setRole(), QWasmAudioOutput::setSource(), QTextBrowserPrivate::setSource(), QWasmWindow::setWindowCursor(), QXcbWindow::setWindowIconText(), QHaikuWindow::setWindowTitle(), QXcbWindow::setWindowTitle(), QWindowsCaRootFetcher::start(), QGstreamerAudioDecoder::start(), stderr_message_handler(), QSSGRhiContextStats::stop(), QV4::RuntimeHelpers::stringToNumber(), QRawFont::supportedWritingSystems(), QWindowsFontDatabaseBase::EmbeddedFont::tableDirectoryEntry(), QQuickWheelHandlerPrivate::targetMetaProperty(), QQuickCanvasItem::toDataURL(), QIcc::toIccProfile(), ClassDef::toJson(), QSSGMesh::MeshInternal::Subset::toMeshSubset(), QTest::toString(), QTest::toString(), QTest::toString(), QTest::toString(), QTest::Internal::toString(), VDMListDelegateDataType::toUtf8(), QQuickPropertyAction::transition(), QQuick3DPhysicsMesh::triangleMesh(), QRhiGles2::tryLoadFromDiskOrPipelineCache(), QLockFilePrivate::tryLock_sys(), QSSGShaderCache::tryNewPipelineFromPersistentCache(), QRhiGles2::trySaveToDiskCache(), QtQuickControls2Plugin::unregisterTypes(), QXcbClipboardTransaction::updateIncrementalProperty(), uuidToByteArray(), QQmlObjectModel::variantValue(), QSGNodeDumper::visitNode(), waitToFinish(), QQnxScreen::windowGroupName(), wrapInFunction(), QSocks5SocketEngine::write(), QICNSHandler::write(), QTiffHandler::write(), QWebpHandler::write(), Jpeg2000JasperReader::write(), write_icc_profile(), writeAttribute(), QLowEnergyControllerPrivateAndroid::writeCharacteristic(), RCCFileInfo::writeDataBlob(), QUdpSocket::writeDatagram(), QSctpSocket::writeDatagram(), QUdpSocket::writeDatagram(), QDtlsPrivateOpenSSL::writeDatagramEncrypted(), QLowEnergyControllerPrivateAndroid::writeDescriptor(), QV4::Compiler::JSUnitGenerator::writeFunction(), QPNGImageWriter::writeImage(), writeInstanceTable(), QSSGMesh::MeshInternal::writeMeshData(), writeProperty(), writeToConsole(), QSctpSocketPrivate::writeToSocket(), QWaylandXdgShellPrivate::xdg_wm_base_get_xdg_surface(), and QtWaylandClient::QWaylandPrimarySelectionSourceV1::zwp_primary_selection_source_v1_send().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing just after the last byte in the byte-array.
iterator-invalidation-func-desc
Definition at line 435 of file qbytearray.h.
Referenced by calculatePosixTransitions(), normalizeType(), and parsePosixTransitionTime().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if the byte array contains the byte ch; otherwise returns false
.
Definition at line 583 of file qbytearray.h.
References indexOf().
Referenced by QTlsPrivate::TlsKeyOpenSSL::derFromPem(), QTlsPrivate::TlsKeyGeneric::derFromPem(), QHttpNetworkConnectionChannel::detectPipeliningSupport(), QDoubleValidatorPrivate::fixupWithLocale(), QQuickDesignerSupportProperties::isPropertyBlackListed(), matches(), EnumDef::qualifiedType(), QHttpNetworkReplyPrivate::readHeader(), QSSGRhiContextStats::rendererDebugEnabled(), and toPercentEncoding().
|
inline |
Returns true
if this byte array contains an occurrence of the sequence of bytes viewed by bv; otherwise returns false
.
Definition at line 585 of file qbytearray.h.
References indexOf().
qsizetype QByteArray::count | ( | char | ch | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the number of occurrences of byte ch in the byte array.
Definition at line 2882 of file qbytearray.cpp.
References ch, and countCharHelper().
Referenced by QQuickDesignerSupportProperties::isPropertyBlackListed().
|
inline |
Returns the number of (potentially overlapping) occurrences of the sequence of bytes viewed by bv in this byte array.
Definition at line 150 of file qbytearray.h.
References QtPrivate::count(), and qToByteArrayViewIgnoringNull().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first byte in the byte-array, in reverse order.
iterator-invalidation-func-desc
Definition at line 440 of file qbytearray.h.
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing just after the last byte in the byte-array, in reverse order.
iterator-invalidation-func-desc
Definition at line 441 of file qbytearray.h.
|
inline |
\macro QT_NO_CAST_FROM_BYTEARRAY
Disables automatic conversions from QByteArray to const char * or const void *.
Returns a pointer to the data stored in the byte array. The pointer can be used to access and modify the bytes that compose the array. The data is '\0'-terminated, i.e. the number of bytes you can access following the returned pointer is size() + 1, including the '\0' terminator.
Example:
pointer-invalidation-desc
For read-only access, constData() is faster because it never causes a \l{deep copy} to occur.
This function is mostly useful to pass a byte array to a function that accepts a {const char *}.
The following example makes a copy of the char* returned by data(), but it will corrupt the heap and cause a crash because it does not allocate a byte for the '\0' at the end:
This one allocates the correct amount of space:
Note: A QByteArray can store any byte values including '\0's, but most functions that take {char *} arguments assume that the data ends at the first '\0' they encounter.
Definition at line 534 of file qbytearray.h.
References d, detach(), and Q_ASSERT.
Referenced by QBitArray::QBitArray(), QQnxIntegration::QQnxIntegration(), QQnxWindow::QQnxWindow(), QXcbSessionManager::QXcbSessionManager(), _q_lower(), _q_PKCS12_keygen(), QSocks5SocketEnginePrivate::_q_udpSocketReadNotification(), _q_upper(), QPdfEnginePrivate::addImage(), QLowEnergyControllerPrivateAndroid::addToGenericAttributeList(), QGridLayout::addWidget(), QSocks5PasswordAuthenticator::beginAuthenticate(), QOCIResultPrivate::bindValue(), byteArrayFromBuffer(), QSslContext::cacheSession(), QSctpSocketPrivate::canReadNotification(), QTlsPrivate::X509CertificateOpenSSL::certificateFromX509(), QTlsPrivate::X509CertificateOpenSSL::certificatesFromDer(), QTlsPrivate::X509CertificateOpenSSL::certificatesFromPem(), QTlsPrivate::X509CertificateGeneric::certificatesFromPem(), QWindowsFontDatabaseBase::EmbeddedFont::changeFamilyName(), QCoreApplicationPrivate::checkReceiverThread(), QODBCDriverPrivate::checkUnicode(), childKeysOrGroups(), QTlsPrivate::TlsKeyGeneric::clear(), collectBoneTransforms(), QRhiGles2::compileShader(), QTlsPrivate::TlsCryptographOpenSSL::continueHandshake(), QUtf8::convertFromUnicode(), QUtf32::convertFromUnicode(), convertParticleData(), dtlsutil::cookie_for_peer(), qstdweb::Uint8Array::copyToQByteArray(), copyToUnindexedVertices(), QBitArray::count(), LeCmacCalculator::createFullMessage(), QSSGMesh::Mesh::createLightmapUVChannel(), QSslContext::createSsl(), createUnnamedFile(), cullLodInstances(), QTlsBackendOpenSSL::curveIdFromLongName(), QTlsBackendOpenSSL::curveIdFromShortName(), QRingChunk::data(), QPacket::data(), InstanceModel::data(), QMimerSQLResult::data(), QTlsPrivate::TlsKeyOpenSSL::decodePem(), QDtlsPrivateOpenSSL::decryptDatagram(), Parser::defaultErrorMsg(), QTlsBackendOpenSSL::dhParametersFromDer(), QTlsBackendOpenSSL::dhParametersFromPem(), QNetworkReplyWasmImplPrivate::doSendRequest(), QRasterPaintEngine::drawTextItem(), QAbstractItemModel::dropMimeData(), QAbstractTableModel::dropMimeData(), QAbstractListModel::dropMimeData(), QStandardItemModel::dropMimeData(), DragDropListModel::dropMimeData(), QRhiD3D11::enqueueResourceUpdates(), QRhiGles2::enqueueResourceUpdates(), QRhiVulkan::enqueueResourceUpdates(), escapedString(), QMimerSQLResult::exec(), QODBCResult::exec(), QRhiGles2::executeCommandBuffer(), QFontconfigDatabase::fallbacksForFamily(), QIBaseResultPrivate::fetchArray(), QIBaseResultPrivate::fetchBlob(), AndroidCameraPrivate::fetchLastPreviewFrame(), QZipReader::fileData(), QBitArray::fill(), fillVertexData(), QStandardPaths::findExecutable(), QRhiD3D11::finishActiveReadbacks(), QRhiMetal::finishActiveReadbacks(), QRhiVulkan::finishActiveReadbacks(), QXcbClipboardMime::formats_sys(), QMYSQLDriver::formatValue(), QSSGMesh::Mesh::fromAssetData(), fromBase64Encoding(), QString::fromLatin1(), QSSGMesh::Mesh::fromRuntimeData(), QFont::fromString(), Generator::generateCode(), QQuickDragEvent::getDataAsArrayBuffer(), QFileSystemEngine::getLinkTarget(), QFileDialog::getOpenFileContent(), getVertexCenterData(), QTlsPrivate::TlsCryptographOpenSSL::handleNewSessionTicket(), QXcbClipboard::handleSelectionRequest(), iconToQXdgDBusImageVector(), QTlsPrivate::X509CertificateSchannel::importPkcs12(), QStaticByteArrayMatcher< N >::indexIn(), QNearFieldTargetPrivateImpl::jbyteArrayToQByteArray(), left(), QRhiGles2::linkProgram(), QSvgIOHandlerPrivate::load(), QWasmIDBSettingsPrivate::loadLocal(), QSSGLoadedTexture::loadTextureData(), QOpenGLDebugLogger::loggedMessages(), LowEnergyNotificationHub::lowEnergy_characteristicWritten(), macQueryInternal(), macValue(), notifyNewPreviewFrame(), notifyPictureCaptured(), QWinRTLowEnergyServiceHandler::obtainCharList(), QIBaseDriver::open(), QODBCDriver::open(), QHaikuServices::openUrl(), QBitArray::operator&=(), QUuid::operator<<(), operator>>(), operator[](), QBitArray::operator^=(), QBitArray::operator|=(), QPdfDocument::pageLabel(), QTlsPrivate::X509CertificateGeneric::parse(), QAuthenticatorPrivate::parseDigestAuthenticationChallenge(), parseHeaderName(), parseHeaderName(), QSSGParticleBuffer::pointer(), QODBCResult::prepare(), QAndroidAudioSource::processBuffer(), processSentence(), QPcscSlotName::ptr(), q_fromPercentEncoding(), QTlsPrivate::Q_GLOBAL_STATIC_WITH_ARGS(), qExtractServerTime(), qMakeOCINumber(), qMakeOCINumber(), QTest::qPrintDataTags(), qStringAsUcs2Le(), qt_string_SQLSetConnectAttr(), QPulseAudioSource::read(), QWindowsAudioSource::read(), Jpeg2000JasperReader::read(), QByteDataBuffer::read(), QHttpNetworkReplyPrivate::readBodyFast(), QSSGMesh::MeshInternal::readMeshData(), QOCICols::readPiecewise(), QNonContiguousByteDeviceIoDeviceImpl::readPointer(), QHttpNetworkReplyPrivate::readReplyBodyRaw(), QSGBatchRenderer::Allocator< Type, PageSize >::release(), QInternalMimeData::renderDataHelper(), replace(), replace(), QMYSQLResult::reset(), QODBCResult::reset(), QBitArray::resize(), QMainWindowLayoutState::restoreState(), QInternalMimeData::retrieveData(), QXcbClipboardMime::retrieveData_sys(), QOpenGLProgramBinaryCache::save(), QNearFieldTargetPrivateImpl::sendCommand(), QQuick3DSkin::setInverseBindPoses(), QWidget::setLayout(), QHaikuClipboard::setMimeData(), QQnxClipboard::setMimeData(), setMonitorDataFromSetupApi(), QRhiD3D11::setPipelineCacheData(), QQuick3DParticleInstanceTable::sort(), sortInstances(), QWasmAudioSink::start(), QWasmAudioSource::start(), startQtAndroidPlugin(), QWasmIDBSettingsPrivate::sync(), QWindowsFontDatabaseBase::EmbeddedFont::tableDirectoryEntry(), QTimeZonePrivate::territory(), QClipboard::text(), toBase64(), toHex(), QIcc::toIccProfile(), QTlsPrivate::TlsKeyOpenSSL::toPem(), toPercentEncoding(), toStdString(), QTest::toString(), QTlsPrivate::TlsCryptographSchannel::transmit(), QRhiGles2::trySaveToPipelineCache(), QXcbKeyboard::updateVModMapping(), uuidToByteArray(), winIso639LangName(), wrapInFunction(), RingBuffer::write(), QAsn1Element::write(), QIBaseResultPrivate::writeArray(), QIBaseResultPrivate::writeBlob(), QPNGImageWriter::writeImage(), and QNearFieldTargetPrivateImpl::writeNdefMessages().
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 540 of file qbytearray.h.
References d.
|
inline |
Definition at line 483 of file qbytearray.h.
References d.
Referenced by QV4::Heap::SharedArrayBuffer::init().
|
inline |
Definition at line 548 of file qbytearray.h.
References d, and QArrayData::KeepSize.
Referenced by data(), qtValue(), QWebpHandler::read(), and replace().
|
inline |
Returns an \l{STL-style iterators}{STL-style iterator} pointing just after the last byte in the byte-array.
iterator-invalidation-func-desc
Definition at line 432 of file qbytearray.h.
Referenced by QConcatenable< QByteArray >::appendTo(), QBitArray::count(), isLower(), isUpper(), QTimeZonePrivate::isValidId(), right(), split(), and validatePosixRule().
|
inlinenoexcept |
Definition at line 433 of file qbytearray.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if this byte array ends with byte ch; otherwise returns false
.
Definition at line 174 of file qbytearray.h.
Referenced by QFileSystemIterator::QFileSystemIterator(), Moc::checkProperties(), Moc::generate(), QHttpNetworkReplyPrivate::getChunkSize(), QSSGRenderShaderMetadata::getShaderMetaData(), metaEnumFromType(), Moc::parsePropertyAttributes(), QHttpNetworkReplyPrivate::readHeader(), QHttpNetworkReplyPrivate::readStatus(), QMimeData::setData(), and TestHTTPServer::wait().
|
inline |
Returns true
if this byte array ends with the sequence of bytes viewed by bv; otherwise returns false
.
Example:
Definition at line 175 of file qbytearray.h.
References QtPrivate::endsWith(), and qToByteArrayViewIgnoringNull().
QByteArray::iterator QByteArray::erase | ( | QByteArray::const_iterator | first, |
QByteArray::const_iterator | last | ||
) |
Removes from the byte array the characters in the half-open range [ first , last ). Returns an iterator to the character referred to by last before the erase.
Definition at line 1266 of file qbytearray.cpp.
References begin(), cbegin(), last(), and remove().
|
inline |
Removes the character denoted by it
from the byte array. Returns an iterator to the character immediately after the erased character.
Definition at line 469 of file qbytearray.h.
Referenced by erase().
QByteArray & QByteArray::fill | ( | char | ch, |
qsizetype | size = -1 |
||
) |
Sets every byte in the byte array to ch.
If size is different from -1 (the default), the byte array is resized to size size beforehand.
Example:
Definition at line 1907 of file qbytearray.cpp.
References ch, QArrayDataPointer< T >::data(), and resize().
Referenced by QMimeMagicRule::QMimeMagicRule(), leftJustified(), QSGMaterialShaderPrivate::prepare(), rightJustified(), and wrapInFunction().
|
inline |
Returns the first n bytes of the byte array.
Example:
Definition at line 159 of file qbytearray.h.
References Q_ASSERT.
Referenced by QMacMimePlainTextFallback::convertToMime(), QMacMimeUnicodeText::convertToMime(), QMacMimeTraditionalMacPlainText::convertToMime(), QByteDataBuffer::read(), QThreadPoolPrivate::tryToStartMoreThreads(), QQuick3DCustomMaterial::updateSpatialNode(), and wrapInFunction().
|
static |
Returns a decoded copy of the Base64 array base64, using the options defined by options. If options contains {IgnoreBase64DecodingErrors} (the default), the input is not checked for validity; invalid characters in the input are skipped, enabling the decoding process to continue with subsequent characters. If options contains
{AbortOnBase64DecodingErrors}, then decoding will stop at the first invalid character.
For example:
The algorithm used to decode Base64-encoded data is defined in \l{RFC 4648}.
Returns the decoded data, or, if the {AbortOnBase64DecodingErrors} option was passed and the input data was invalid, an empty byte array.
Definition at line 4646 of file qbytearray.cpp.
References QByteArray(), and fromBase64Encoding().
Referenced by QtObject::atob(), QAuthenticatorPrivate::calculateResponse(), QTlsPrivate::X509CertificateOpenSSL::certificatesFromPem(), QTlsPrivate::X509CertificateGeneric::certificatesFromPem(), createImageNode(), QSslDiffieHellmanParameters::defaultParameters(), QTlsPrivate::TlsKeyOpenSSL::derFromPem(), QTlsPrivate::TlsKeyGeneric::derFromPem(), qDecodeDataUrl(), and wrapInFunction().
|
static |
Decodes the Base64 array base64, using the options defined by options. If options contains {IgnoreBase64DecodingErrors} (the default), the input is not checked for validity; invalid characters in the input are skipped, enabling the decoding process to continue with subsequent characters. If options contains
{AbortOnBase64DecodingErrors}, then decoding will stop at the first invalid character.
For example:
The algorithm used to decode Base64-encoded data is defined in \l{RFC 4648}.
Returns a QByteArrayFromBase64Result object, containing the decoded data and a flag telling whether decoding was successful. If the {AbortOnBase64DecodingErrors} option was passed and the input data was invalid, it is unspecified what the decoded data contains.
Definition at line 4610 of file qbytearray.cpp.
References data(), size(), and Qt::Uninitialized.
|
static |
Definition at line 4593 of file qbytearray.cpp.
References fromBase64Encoding().
Referenced by fromBase64(), fromBase64Encoding(), and wrapInFunction().
|
static |
Returns a decoded copy of the hex encoded array hexEncoded.
Input is not checked for validity; invalid characters in the input are skipped, enabling the decoding process to continue with subsequent characters.
For example:
Definition at line 4664 of file qbytearray.cpp.
References at(), ch, QtMiscUtils::fromHex(), i, size(), and Qt::Uninitialized.
Referenced by QMimeMagicRule::QMimeMagicRule(), decodeFrame(), QTlsPrivate::TlsKeyGeneric::decodePem(), MyClass::enableCharNotifications(), QMimerSQLResult::exec(), qt_qmlDebugSendDataToService(), settings_key_to_host_name(), wrapInFunction(), and QLowEnergyControllerPrivateBluezDBus::writeDescriptor().
|
static |
Decodes input from URI/URL-style percent-encoding.
Returns a byte array containing the decoded text. The percent parameter allows use of a different character than '' (for instance, '_' or '=') as the escape character. Equivalent to input.percentDecoded(percent).
For example:
Definition at line 4804 of file qbytearray.cpp.
References percentDecoded().
Referenced by QUrl::fromPercentEncoding(), qDecodeDataUrl(), and wrapInFunction().
|
inlinestatic |
Constructs a QByteArray that uses the first size bytes of the data array.
The bytes are not copied. The QByteArray will contain the data pointer. The caller guarantees that data will not be deleted or modified as long as this QByteArray and any copies of it exist that have not been modified. In other words, because QByteArray is an \l{implicitly shared} class and the instance returned by this function contains the data pointer, the caller must not delete data or modify it directly as long as the returned QByteArray and any copies exist. However, QByteArray does not take ownership of data, so the QByteArray destructor will never delete the raw data, even when the last QByteArray referring to data is destroyed.
A subsequent attempt to modify the contents of the returned QByteArray or any copy made from it will cause it to create a deep copy of the data array before doing the modification. This ensures that the raw data array itself will never be modified by QByteArray.
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:
{const char *} expected to be '\0'-terminated will fail.Definition at line 394 of file qbytearray.h.
Referenced by QHttpMultiPartPrivate::QHttpMultiPartPrivate(), QMimeMagicRule::QMimeMagicRule(), QNonContiguousByteDeviceBufferImpl::QNonContiguousByteDeviceBufferImpl(), QT_BEGIN_NAMESPACE::VertexBufferDataExt::addVertexAttributeData(), QtCbor::ByteData::asByteArrayView(), QSSGRhiShaderPipeline::bindingForTexture(), QAuthenticatorPrivate::calculateResponse(), QTlsPrivate::X509CertificateOpenSSL::certificatesFromPem(), QTlsPrivate::X509CertificateGeneric::certificatesFromPem(), QMimerSQLResult::data(), QPSQLResult::data(), QMetaObjectPrivate::decodeMethodSignature(), QTranslatorPrivate::do_load(), AVFImageCapture::doCapture(), encodeByteArray(), QtWaylandClient::QWaylandExtendedSurface::extended_surface_set_generic_property(), fileArchitecture(), QPlatformPixmap::fromData(), QRasterPlatformPixmap::fromData(), QImage::fromData(), getData(), getQtLibsFromElf(), QLocationUtils::getSatInfoFromNmea(), ICOReader::iconAt(), isPossiblySvg(), QTextList::itemText(), QOpenGLProgramBinaryCache::load(), QSvgIOHandlerPrivate::load(), QQuick3DFileInstancing::loadFromBinaryFile(), QPSQLResult::numRowsAffected(), QPluginParsedMetaData::parse(), parseAttributeValues(), QSSGShaderCustomMaterialAdapter::prepareCustomShader(), dtlsbio::q_dgram_write(), qAppFileName(), qlocationutils_readGga(), qlocationutils_readGll(), qlocationutils_readGsa(), qlocationutils_readGsa(), qlocationutils_readRmc(), qlocationutils_readVtg(), qlocationutils_readZda(), qMetaTypeCustomType_unlocked(), qt_socks5_set_host_address_and_port(), qt_socks5_set_host_name_and_port(), QWebpHandler::read(), readOrMapFile(), readStr(), HciManager::sendConnectionUpdateCommand(), QWaylandKeyboardPrivate::sendEnter(), setRawData(), Http2::settingsFrameToBase64(), QSSGRhiShaderPipeline::setUniform(), QSSGRhiShaderPipeline::setUniformArray(), QTlsBackend::setupClientPskAuth(), stringData(), stringData(), toDouble(), QTlsPrivate::X509CertificateGeneric::toPem(), QTlsPrivate::TlsKeyGeneric::toPem(), QQuickStyledTextPrivate::toRoman(), QResource::uncompressedData(), QSslSocketPrivate::unixRootCertDirectories(), QVideoTextureHelper::updateTextureWithMap(), wrapInFunction(), QSocks5SocketEngine::write(), QtWaylandClient::QWaylandTextInputv1::zwp_text_input_v1_modifiers_map(), and QtWaylandClient::QWaylandTextInputv2::zwp_text_input_v2_modifiers_map().
|
static |
Returns a copy of the str string as a QByteArray.
Definition at line 4816 of file qbytearray.cpp.
References QByteArray().
|
inline |
Returns a reference to the first byte in the byte array. Same as {operator[](0)}.
This function is provided for STL compatibility.
Definition at line 577 of file qbytearray.h.
References operator[]().
|
inline |
Returns the first byte in the byte array. Same as {at(0)}.
This function is provided for STL compatibility.
Definition at line 132 of file qbytearray.h.
References at.
Referenced by parseHeaderName(), parseHeaderName(), and QAsn1Element::toInfo().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the index position of the start of the first occurrence of the byte ch in this byte array, searching forward from index position from.
Returns -1 if no match is found.
Example:
Definition at line 2705 of file qbytearray.cpp.
References ch, QByteArrayView::indexOf(), and qToByteArrayViewIgnoringNull().
Referenced by QSSGStageGeneratorBase::buildShaderSourcePass2(), QTlsPrivate::X509CertificateOpenSSL::certificatesFromPem(), QTlsPrivate::X509CertificateGeneric::certificatesFromPem(), QMetaObject::connectSlotsByName(), contains(), contains(), QTlsPrivate::TlsKeyOpenSSL::derFromPem(), QTlsPrivate::TlsKeyGeneric::derFromPem(), QDoubleValidatorPrivate::fixupWithLocale(), QSSGShaderKeyUnsigned< TBitWidth >::fromString(), QSSGShaderKeyTextureChannel::fromString(), QSSGShaderKeySpecularModel::fromString(), QSSGShaderKeyAlphaMode::fromString(), QSSGShaderKeyVertexAttribute::fromString(), QHttpNetworkReplyPrivate::getChunkSize(), init_plugins(), QCoreApplicationPrivate::initLocale(), insertProcessorArgs(), insertVertexMainArgs(), QHostInfo::localDomainName(), QMetaMethodBuilderPrivate::name(), patchQtCore(), QNetworkReplyHttpImplPrivate::postRequest(), QDBusConnectionPrivate::prepareHook(), qualifiedNameEquals(), QSSGShaderLibraryManager::resolveIncludeFiles(), searchIncludePaths(), split(), tryDriveUNCFallback(), and wrapInFunction().
|
inline |
Returns the index position of the start of the first occurrence of the sequence of bytes viewed by bv in this byte array, searching forward from index position from. Returns -1 if no match is found.
Example:
Definition at line 138 of file qbytearray.h.
References QtPrivate::findByteArray(), and qToByteArrayViewIgnoringNull().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Inserts byte ch at index position i in the byte array.
array-grow-at-insertion
Definition at line 257 of file qbytearray.h.
|
inline |
Inserts s at index position i and returns a reference to this byte array.
array-grow-at-insertion
The function is equivalent to {insert(i, QByteArrayView(s))}
Definition at line 252 of file qbytearray.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Inserts len bytes, starting at data, at position i in the byte array.
array-grow-at-insertion
Definition at line 259 of file qbytearray.h.
|
inline |
QByteArray & QByteArray::insert | ( | qsizetype | i, |
QByteArrayView | data | ||
) |
Inserts \a data at index position \a i and returns a reference to this byte array. Example: \snippet code/src_corelib_text_qbytearray.cpp 17 \since 6.0 For large byte arrays, this operation can be slow (\l{linear time}), because it requires moving all the bytes at indexes \a i and above by at least one position further in memory.
! [array-grow-at-insertion] This array grows to accommodate the insertion. If i is beyond the end of the array, the array is first extended with space characters to reach this i. ! [array-grow-at-insertion]
\sa append(), prepend(), replace(), remove()
Definition at line 2194 of file qbytearray.cpp.
References QtPrivate::QGenericArrayOps< T >::copyAppend(), QString::data(), QArrayDataPointer< T >::data(), QArrayDataPointer< T >::detachAndGrow(), QArrayData::GrowsAtEnd, i, QtPrivate::QGenericArrayOps< T >::insert(), insert(), QArrayDataPointer< T >::needsDetach(), Q_CHECK_PTR(), QtPrivate::q_points_into_range(), QArrayDataPointer< T >::size, and str.
Referenced by activeConditions(), append(), QTest::formatResult(), insert(), QTlsPrivate::TlsKeyBase::pemFromDer(), prepend(), replace(), TestHTTPServer::wait(), and wrapInFunction().
QByteArray & QByteArray::insert | ( | qsizetype | i, |
qsizetype | count, | ||
char | ch | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Inserts count copies of byte ch at index position i in the byte array.
array-grow-at-insertion
Definition at line 2279 of file qbytearray.cpp.
References ch, QtPrivate::QGenericArrayOps< T >::copyAppend(), QArrayDataPointer< T >::data(), QArrayDataPointer< T >::detachAndGrow(), QArrayData::GrowsAtEnd, i, QtPrivate::QGenericArrayOps< T >::insert(), Q_CHECK_PTR(), and QArrayDataPointer< T >::size.
|
inline |
Definition at line 550 of file qbytearray.h.
References d.
Referenced by assign(), and QRingChunk::isShared().
|
inlinenoexcept |
Returns true
if the byte array has size 0; otherwise returns false
.
Example:
Definition at line 106 of file qbytearray.h.
Referenced by DBusConnection::DBusConnection(), QT_BEGIN_NAMESPACE::DeviceIntegration::DeviceIntegration(), QDBusBlockingCallWatcher::QDBusBlockingCallWatcher(), QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(), QFontEngineFT::QFontEngineFT(), QGstreamerVideoOverlay::QGstreamerVideoOverlay(), QMimeMagicRule::QMimeMagicRule(), QPdfSearchModel::QPdfSearchModel(), QQuickGridScaledImage::QQuickGridScaledImage(), QTextureFileHandler::QTextureFileHandler(), QWindowsContext::QWindowsContext(), QHttpThreadDelegate::~QHttpThreadDelegate(), QFileSystemEngine::absoluteName(), activeConditions(), QWindowsDirectWriteFontDatabase::addApplicationFont(), QWizardPrivate::addField(), addFunction(), QDBusMarshaller::append(), QDBusMarshaller::append(), QDBusMarshaller::appendCrossMarshalling(), QSGRhiSupport::applySwapChainFormat(), AVFMediaPlayer::audioOutputChanged(), buildAndroidProject(), QmlLsp::QQmlCodeModel::buildPathsForFileUrl(), QProcEnvValue::bytes(), QNetworkAccessAuthenticationManager::cacheProxyCredentials(), calculatePosixDate(), calculatePosixTransitions(), QAuthenticatorPrivate::calculateResponse(), QQmlXMLHttpRequest::charset(), QXcbConnection::clientLeader(), QPdfDocument::close(), codesignBundle(), codesignFile(), commonCopyEvent(), QSSGShaderCache::compileForRhi(), QRhiD3D11::compileHlslShaderSource(), QMetaObject::connectSlotsByName(), QWindowsMimeImage::convertFromMime(), QXcbWindow::create(), QD3D11Buffer::create(), QD3D11RenderBuffer::create(), QD3D11Texture::create(), QD3D11GraphicsPipeline::create(), QD3D11ComputePipeline::create(), QMetalBuffer::create(), QMetalRenderBuffer::create(), QMetalTexture::create(), QVkGraphicsPipeline::create(), QVkComputePipeline::create(), QtWaylandClient::QWaylandWindow::createDecoration(), QSSGMesh::Mesh::createLightmapUVChannel(), QRhiMetalData::createMetalLib(), QQmlPropertyCacheCreator< ObjectContainer >::createMetaObject(), QFontEngineMulti::createMultiFontEngine(), QOffscreenIntegration::createOffscreenIntegration(), QGuiApplicationPrivate::createPlatformIntegration(), createReadHandlerHelper(), QKmsDevice::createScreenForConnector(), createWriteHandlerHelper(), data(), QtWaylandClient::QWaylandDataSource::data_source_send(), QTlsPrivate::TlsKeyOpenSSL::decodeDer(), QTlsPrivate::TlsKeyGeneric::decodeDer(), QTlsPrivate::TlsKeyOpenSSL::decodePem(), QStringDecoder::decoderForHtml(), QTest::defaultEventDelay(), QTest::defaultKeyDelay(), QTest::defaultMouseDelay(), deployQmlImports(), QAVFCameraBase::device(), QTlsBackendOpenSSL::dhParametersFromDer(), QTlsBackendOpenSSL::dhParametersFromPem(), QAuthenticatorPrivate::digestMd5Response(), QNetworkReplyWasmImplPrivate::doSendRequest(), QPdfEnginePrivate::drawTextItem(), QStringConverter::encodingForHtml(), QRhiD3D11::enqueueSubresUpload(), QRhiGles2::enqueueSubresUpload(), QRhiMetal::enqueueSubresUpload(), SharedTextureImageResponse::fallbackPath(), QEglFSDeviceIntegration::fbDeviceName(), QNetworkAccessAuthenticationManager::fetchCachedProxyCredentials(), QNetworkReplyHttpImplPrivate::fetchCacheMetaData(), QSSGRenderEffect::finalizeShaders(), QHttpNetworkReplyPrivate::findChallenge(), QSGDefaultRenderContext::fontKey(), QImageReader::format(), QTest::formatResult(), QNdefMessage::fromByteArray(), QString::fromLocal8Bit(), QString::fromUtf8(), Generator::generateCode(), Preamble::get(), QFreetypeFace::getFace(), QSSGQmlUtilities::getIdForAnimation(), getLockInfo_helper(), QXcbScreen::getName(), getRequestedDisplays(), getRhiImplementation(), QQuickWidgetPrivate::grabFramebuffer(), QNdefNfcSmartPosterRecord::hasIcon(), QNetworkReplyWasmImplPrivate::headersReceived(), QColorSpace::iccProfile(), QNdefNfcSmartPosterRecord::icon(), ignoreProxyFor(), QWaylandCompositorPrivate::init(), QWindowsOpengl32DLL::init(), QQuickMaterialStyle::initGlobals(), QQuickUniversalStyle::initGlobals(), QtWaylandClient::QWaylandEglClientBufferIntegration::initialize(), LinuxDmabufClientBufferIntegration::initializeHardware(), WaylandEglClientBufferIntegration::initializeHardware(), WaylandEglStreamClientBufferIntegration::initializeHardware(), QFontEngine::initializeHeightMetrics(), QLoggingRegistry::initializeRules(), QBasicPlatformVulkanInstance::initInstance(), QCoreApplicationPrivate::initLocale(), QGeoFileTileCache::insert(), QLockFilePrivate::isApparentlyStale(), QFileSystemEntry::isEmpty(), QNdefRecord::isEmpty(), isJitEnabled(), QTimeZonePrivate::isValid(), QTextureFileData::isValid(), QSignalSpy::isValid(), QSSGLightmapUVGeneratorResult::isValid(), QQnxWindow::joinWindowGroup(), QXcbKeyboard::keymapFromCore(), QQuickKeysAttached::keyPressed(), QDefaultOutputMapping::load(), loadAndroidStyle(), QWaylandCompositorPrivate::loadClientBufferIntegration(), QKmsScreenConfig::loadConfig(), QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(), QFontEngine::loadKerningPairs(), QV4::ExecutableCompilationUnit::localCacheFilePath(), QHostInfoAgent::lookup(), macQueryInternal(), Preprocessor::macroExpand(), main(), make_user_path_without_qstandard_paths(), QOpenGLContext::makeCurrent(), matches(), QQmlXMLHttpRequest::mimeType(), moc(), QArgumentType::name(), QIBaseDriver::open(), QProcEnvValue::operator==(), QSSGQmlUtilities::outputTextureAsset(), Moc::parse(), QTlsPrivate::X509CertificateGeneric::parse(), QAuthenticatorPrivate::parseDigestAuthenticationChallenge(), Moc::parseFunction(), parseHeaderName(), parseHeaderName(), Moc::parseInterfaces(), Moc::parseMaybeFunction(), Moc::parsePluginData(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), patchQtCore(), percentDecoded(), QHttpNetworkConnectionChannel::pipelineFlush(), QSSGShaderCustomMaterialAdapter::prepareCustomShader(), QSSGLayerRenderData::prepareModelsForRender(), QProcessEnvironmentPrivate::prepareName(), QRhiVulkan::prepareUploadSubres(), printMethodNotFoundWarning(), Scanner::process(), processSentence(), QDtlsPrivateOpenSSL::pskClientCallback(), QTlsPrivate::TlsCryptographOpenSSL::pskClientTlsCallback(), QDtlsPrivateOpenSSL::pskServerCallback(), QTlsPrivate::TlsCryptographOpenSSL::pskServerTlsCallback(), QIOPipePrivate::pushData(), q_fromPercentEncoding(), Q_TRACE_INSTRUMENT(), qDBusReplyFill(), qlocationutils_readGsa(), QPulseAudioSource::read(), QWindowsAudioSource::read(), QJpegHandlerPrivate::read(), read32bitIcon(), QIOPipePrivate::readAvailableData(), QSystemLocaleData::readEnvironment(), QHttpNetworkReplyPrivate::readHeader(), QJpegHandlerPrivate::readJpegHeader(), QHttpNetworkReplyPrivate::readStatus(), QSGCompressedAtlasTexture::Texture::removedFromAtlas(), QWizardPrivate::removeFieldAt(), QInternalMimeData::renderDataHelper(), repeated(), replace(), QNetworkReplyHttpImplPrivate::replyDownloadMetaData(), requiredQtContainers(), QEglFSKmsEglDeviceWindow::resetSurface(), QWizardField::resolve(), Preprocessor::resolveInclude(), QSSGShaderUtils::resolveShader(), QQuickSplitView::restoreState(), QSSGLightmapUVGenerator::run(), runMoc(), HciManager::sendCommand(), QHttpProtocolHandler::sendRequest(), set_text(), QNetworkHeadersPrivate::setCookedHeader(), QTimeLinePrivate::setCurrentTime(), QMacPasteboard::setMimeData(), QNdefNfcSmartPosterRecord::setPayload(), shouldIncludeFs(), QHttpSocketEngine::slotSocketReadNotification(), QStandardPaths::standardLocations(), QProcEnvValue::string(), QSslKey::toDer(), toHex(), QAsn1Element::toInteger(), FunctionDef::toJson(), PropertyDef::toJson(), EnumDef::toJson(), QQmlPropertyCache::toMetaObjectBuilder(), QAsn1Element::toObjectId(), QTlsPrivate::TlsKeyOpenSSL::toPem(), QTlsPrivate::TlsKeyGeneric::toPem(), toPercentEncoding(), QNetworkCookie::toRawForm(), QFontSubset::toTruetype(), AVFCameraSession::updateAudioOutput(), QQuick3DCustomMaterial::updateSpatialNode(), QIntValidator::validate(), validatePosixRule(), QDoubleValidatorPrivate::validateWithLocale(), QXcbIntegration::wmClass(), wrapInFunction(), QImageWriter::write(), QTextDocumentWriter::write(), write_icc_profile(), QSctpSocket::writeDatagram(), QPdfEnginePrivate::writeHeader(), QPNGImageWriter::writeImage(), and QtWaylandClient::QWaylandPrimarySelectionSourceV1::zwp_primary_selection_source_v1_send().
bool QByteArray::isLower | ( | ) | const |
Returns true
if this byte array is lowercase, that is, if it's identical to its toLower() folding.
Note that this does not mean that the byte array only contains lowercase letters; only that it contains no ASCII uppercase letters.
Definition at line 3010 of file qbytearray.cpp.
References begin(), end(), and isUpperCaseAscii().
|
noexcept |
Returns true
if this byte array is null; otherwise returns false
.
Example:
Qt makes a distinction between null byte arrays and empty byte arrays for historical reasons. For most applications, what matters is whether or not a byte array contains any data, and this can be determined using isEmpty().
Referenced by QMetaMethodBuilderPrivate::QMetaMethodBuilderPrivate(), QPpdPrintDevice::QPpdPrintDevice(), QQmlLoggingCategory::componentComplete(), QStandardPaths::findExecutable(), QString::fromLocal8Bit(), QString::fromUtf8(), QSslDiffieHellmanParameters::isEmpty(), QSslConfiguration::isNull(), keyValueMapsLocation(), QSvgTinyDocument::load(), operator<<(), Moc::parsePropertyAttributes(), QFile::rename(), replace(), QPlatformInputContextFactory::requested(), QMimeDataPrivate::retrieveTypedData(), QQnxWindow::setVisible(), toPercentEncoding(), and wrapInFunction().
|
inlinenoexcept |
Definition at line 125 of file qbytearray.h.
References other().
bool QByteArray::isUpper | ( | ) | const |
Returns true
if this byte array is uppercase, that is, if it's identical to its toUpper() folding.
Note that this does not mean that the byte array only contains uppercase letters; only that it contains no ASCII lowercase letters.
Definition at line 2994 of file qbytearray.cpp.
References begin(), end(), and isLowerCaseAscii().
|
inlinenoexcept |
Returns true
if this byte array contains valid UTF-8 encoded data, or false
otherwise.
Definition at line 181 of file qbytearray.h.
References QtPrivate::isValidUtf8(), and qToByteArrayViewIgnoringNull().
|
inline |
Returns the last n bytes of the byte array.
Example:
Definition at line 161 of file qbytearray.h.
References Q_ASSERT.
Referenced by erase(), and wrapInFunction().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the index position of the start of the last occurrence of byte ch in this byte array, searching backward from index position from.
If from is -1 (the default), the search starts at the last byte (at index size() - 1). Returns -1 if no match is found.
Example:
Definition at line 2829 of file qbytearray.cpp.
References ch, QByteArrayView::lastIndexOf(), and qToByteArrayViewIgnoringNull().
Referenced by QMetaObject::connectSlotsByName(), createDirectoryWithParents(), createUnnamedFile(), Generator::generateCode(), metaEnumFromType(), and wrapInFunction().
|
inline |
Returns the index position of the start of the last occurrence of the sequence of bytes viewed by bv in this byte array, searching backward from the end of the byte array. Returns -1 if no match is found.
Example:
Definition at line 142 of file qbytearray.h.
References lastIndexOf().
|
inline |
Returns the index position of the start of the last occurrence of the sequence of bytes viewed by bv in this byte array, searching backward from index position from.
negative-index-start-search-from-end
Returns -1 if no match is found.
Example:
{-1} is normally thought of as searching from the end of the byte array: the match at the end is after the last character, so it is excluded. To include such a final empty match, either give a positive value for from or omit the from parameter entirely.Definition at line 144 of file qbytearray.h.
References QtPrivate::lastIndexOf(), and qToByteArrayViewIgnoringNull().
QByteArray QByteArray::left | ( | qsizetype | len | ) | const |
Returns a byte array that contains the first len bytes of this byte array.
If you know that len cannot be out of bounds, use first() instead in new code, because it is faster.
The entire byte array is returned if len is greater than size().
Returns an empty QByteArray if len is smaller than 0.
Definition at line 3039 of file qbytearray.cpp.
References QByteArray(), and data().
Referenced by QResponseApdu::QResponseApdu(), Moc::checkProperties(), createDirectoryWithParents(), QPasswordDigestor::deriveKeyPbkdf2(), Generator::generateCode(), QIBusPlatformInputContextPrivate::getSocketPath(), QWaylandInputMethodEventBuilder::indexFromWayland(), insertProcessorArgs(), insertVertexMainArgs(), QMetaMethodBuilderPrivate::name(), noRef(), QTlsPrivate::X509CertificateGeneric::parse(), QNetworkReplyHttpImplPrivate::postRequest(), searchIncludePaths(), QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(), QNetworkDiskCachePrivate::uniqueFileName(), and write_pbm_image().
QByteArray QByteArray::leftJustified | ( | qsizetype | width, |
char | fill = ' ' , |
||
bool | truncate = false |
||
) | const |
Returns a byte array of size width that contains this byte array padded with the fill byte.
If truncate is false and the size() of the byte array is more than width, then the returned byte array is a copy of this byte array.
If truncate is true and the size() of the byte array is more than width, then any bytes in a copy of the byte array after position width are removed, and the copy is returned.
Example:
Definition at line 3684 of file qbytearray.cpp.
References fill(), and truncate().
Referenced by wrapInFunction().
|
inlinenoexcept |
Same as size().
Definition at line 479 of file qbytearray.h.
Referenced by QTlsPrivate::X509CertificateOpenSSL::certificateFromX509(), combinePath(), QTlsPrivate::TlsKeyGeneric::derFromPem(), enquoteByteArray(), QDB2Result::exec(), QODBCResult::exec(), fromAiString(), QIBaseDriver::open(), patchQtCore(), QRhiMetal::pipelineCacheData(), qvsnprintf(), QtBluezPeripheralDescriptor::ReadValue(), QtBluezPeripheralCharacteristic::ReadValue(), QRhiMetal::setPipelineCacheData(), sm_setProperty(), QWindowsCaRootFetcher::start(), QWasmIDBSettingsPrivate::sync(), toPercentEncoding(), and QTlsPrivate::TlsCryptographSchannel::transmit().
QByteArray QByteArray::mid | ( | qsizetype | pos, |
qsizetype | len = -1 |
||
) | const |
Returns a byte array containing len bytes from this byte array, starting at position pos.
If you know that pos and len cannot be out of bounds, use sliced() instead in new code, because it is faster.
If len is -1 (the default), or pos + len >= size(), returns a byte array containing all bytes starting at position pos until the end of the byte array.
Definition at line 3084 of file qbytearray.cpp.
References QByteArray(), QArrayDataPointer< T >::data(), QArrayDataPointer< T >::fromRawData(), and pos.
Referenced by QOscBundle::QOscBundle(), QSSGStageGeneratorBase::buildShaderSourcePass2(), Moc::checkProperties(), composePreprocessorOutput(), QWindowsMimeHtml::convertToMime(), convertToNativeQObject(), QTlsPrivate::TlsKeyGeneric::decodeDer(), QTlsPrivate::TlsKeyOpenSSL::derFromPem(), QTlsPrivate::TlsKeyGeneric::derFromPem(), QQmlPropertyPrivate::findSignalByName(), QSSGShaderKeySpecularModel::fromString(), QSSGShaderKeyAlphaMode::fromString(), QSSGShaderKeyVertexAttribute::fromString(), QHttpNetworkReplyPrivate::getChunkSize(), QSSGRenderShaderMetadata::getShaderMetaData(), QIBusPlatformInputContextPrivate::getSocketPath(), init_plugins(), insertProcessorArgs(), insertVertexMainArgs(), QTextList::itemText(), Symbol::lexem(), QTlsPrivate::X509CertificateGeneric::parse(), Scanner::parseArguments(), parseDateString(), QAuthenticatorPrivate::parseHttpResponse(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), QXcbXSettingsPrivate::populateSettings(), QNetworkReplyHttpImplPrivate::postRequest(), qDecodeDataUrl(), qt_readOscString(), qualifiedNameEquals(), QtBluezPeripheralDescriptor::ReadValue(), QtBluezPeripheralCharacteristic::ReadValue(), QSSGShaderLibraryManager::resolveIncludeFiles(), searchIncludePaths(), split(), Preprocessor::tokenize(), QQuickStyledTextPrivate::toRoman(), Symbol::unquotedLexem(), and write_icc_profile().
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a byte-array representing the floating-point number n as text.
Returns a byte array containing a string representing n, with a given format and precision, with the same meanings as for \l {QString::number(double, char, int)}. For example:
Definition at line 4408 of file qbytearray.cpp.
References QLocaleData::DFDecimal, QLocaleData::DFExponent, QLocaleData::DFSignificantDigits, form, isUpperCaseAscii(), qdtoAscii(), qWarning, and QtMiscUtils::toAsciiLower().
|
static |
Returns a byte-array representing the whole number n as text.
Returns a byte array containing a string representing n, using the specified base (ten by default). Bases 2 through 36 are supported, using letters for digits beyond 9: A is ten, B is eleven and so on.
Example:
Definition at line 4329 of file qbytearray.cpp.
References base.
Referenced by QAuthenticatorPrivate::QAuthenticatorPrivate(), QXcbVirtualDesktop::QXcbVirtualDesktop(), QXcbXSettings::QXcbXSettings(), Python::WriteImports::acceptUI(), activeConditions(), QGstreamerVideoDevices::addDevice(), QQmlAdaptorModelEngineData::addProperty(), QSSGRenderReflectionMap::addReflectionMapEntry(), QSSGStageGeneratorBase::addShaderPass2Marker(), QSSGStageGeneratorBase::addShaderUniformMap(), alignedNumber(), buildDevicePath(), QTlsPrivate::X509CertificateOpenSSL::certificateFromX509(), checkXdgRuntimeDir(), QWindowsMimeHtml::convertFromMime(), QMetalBuffer::create(), QXcbSystemTrayTracker::create(), createCameraDevice(), QQmlPropertyCacheCreatorBase::createClassNameForInlineComponent(), QQmlPropertyCacheCreatorBase::createClassNameTypeByUrl(), QQmlPropertyCacheCreator< ObjectContainer >::createMetaObject(), QQmlOpenMetaObjectType::createProperties(), QQmlDMObjectDataMetaObject::createProperty(), QQmlOpenMetaObjectType::createProperty(), debugShowWindowCmd(), debugWindowPlacementFlags(), debugWinExStyle(), debugWinStyle(), debugWinSwpPos(), QAuthenticatorPrivate::digestMd5Response(), fileIdWin8(), QSSGRenderEffect::finalizeShaders(), QSGDefaultRenderContext::fontKey(), QTest::formatResult(), QRhiGles2::gatherUniforms(), generateFragmentShader(), AndroidCamera::getCameraInfo(), glFormatName(), QHttpNetworkRequestPrivate::header(), QFileSystemEngine::id(), QSettingsPrivate::iniEscapedString(), QXcbKeyboard::keymapFromCore(), QLockFilePrivate::lockFileContents(), QTemporaryFileEngine::materializeUnnamedFile(), nameForCompressedIcon(), nameForConnector(), QTlsPrivate::X509CertificateGeneric::parse(), Moc::parseClassInfo(), QNetworkReplyHttpImplPrivate::postRequest(), prefixMessage(), QHttpNetworkConnectionPrivate::prepareRequest(), QFontEngine::properties(), QTest::qSignalDumperCallback(), QTest::qSignalDumperCallbackSlot(), rawBytes(), QV4DebugServiceImpl::sendSomethingToSomebody(), QHttpNetworkHeaderPrivate::setContentLength(), QTimeLinePrivate::setCurrentTime(), setNum(), QRhiVulkan::setObjectName(), QHttpSocketEngine::slotSocketConnected(), QAsn1Element::toObjectId(), toSecondsFormat(), QTest::toString(), QTest::toString(), QTest::toString(), QTest::toString(), QTest::toString(), QTest::toString(), QTest::Internal::toString(), QTest::Internal::toString(), QRhiGles2::tryLoadFromDiskOrPipelineCache(), QNetworkDiskCachePrivate::uniqueFileName(), unixPermissionsText(), QFFmpegMetaData::value(), valueToJson(), TestHTTPServer::wait(), wrapInFunction(), write_pbm_image(), RCCFileInfo::writeDataInfo(), QQmlJSStreamWriter::writeEnumObjectLiteralBinding(), QQmlJSStreamWriter::writeLibraryImport(), and QQmlJSStreamWriter::writeNumberBinding().
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4353 of file qbytearray.cpp.
References base.
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4377 of file qbytearray.cpp.
References base.
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4389 of file qbytearray.cpp.
References base.
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4341 of file qbytearray.cpp.
References base.
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4365 of file qbytearray.cpp.
References base.
|
inline |
Definition at line 529 of file qbytearray.h.
|
inline |
Returns a pointer to the data stored in the byte array. The pointer can be used to access the bytes that compose the array. The data is '\0'-terminated.
! [pointer-invalidation-desc] The pointer remains valid as long as no detach happens and the QByteArray is not modified. ! [pointer-invalidation-desc]
This operator is mostly useful to pass a byte array to a function that accepts a \c{const char *}. You can disable this operator by defining \c QT_NO_CAST_FROM_BYTEARRAY when you compile your applications. Note: A QByteArray can store any byte values including '\\0's, but most functions that take \c{char *} arguments assume that the data ends at the first '\\0' they encounter. \sa constData()
Definition at line 531 of file qbytearray.h.
|
inline |
Returns true
if this byte array is not equal to the UTF-8 encoding of str; otherwise returns false
.
The comparison is case sensitive.
You can disable this operator by defining QT_NO_CAST_FROM_ASCII
when you compile your applications. You then need to call QString::fromUtf8(), QString::fromLatin1(), or QString::fromLocal8Bit() explicitly if you want to convert the byte array to a QString before doing the comparison.
Definition at line 1280 of file qstring.h.
References constData().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends the byte ch onto the end of this byte array and returns a reference to this byte array.
Definition at line 285 of file qbytearray.h.
References append().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends the '\0'-terminated string str onto the end of this byte array and returns a reference to this byte array.
Definition at line 287 of file qbytearray.h.
References append().
|
inline |
Appends the byte array ba onto the end of this byte array and returns a reference to this byte array.
Example:
Note: QByteArray is an \l{implicitly shared} class. Consequently, if you append to an empty byte array, then the byte array will just share the data held in ba. In this case, no copying of data is done, taking \l{constant time}. If a shared instance is modified, it will be copied (copy-on-write), taking \l{linear time}.
If the byte array being appended to is not empty, a deep copy of the data is performed, taking \l{linear time}.
This operation typically does not suffer from allocation overhead, because QByteArray preallocates extra space at the end of the data so that it may grow without reallocating for each append operation.
Definition at line 289 of file qbytearray.h.
References append().
|
inline |
Definition at line 291 of file qbytearray.h.
References append().
|
inline |
Returns true
if this byte array is lexically less than the UTF-8 encoding of str; otherwise returns false
.
The comparison is case sensitive.
You can disable this operator by defining QT_NO_CAST_FROM_ASCII
when you compile your applications. You then need to call QString::fromUtf8(), QString::fromLatin1(), or QString::fromLocal8Bit() explicitly if you want to convert the byte array to a QString before doing the comparison.
Definition at line 1282 of file qstring.h.
References constData().
|
inline |
Returns true
if this byte array is lexically less than or equal to the UTF-8 encoding of str; otherwise returns false
.
The comparison is case sensitive.
You can disable this operator by defining QT_NO_CAST_FROM_ASCII
when you compile your applications. You then need to call QString::fromUtf8(), QString::fromLatin1(), or QString::fromLocal8Bit() explicitly if you want to convert the byte array to a QString before doing the comparison.
Definition at line 1286 of file qstring.h.
References constData().
QByteArray & QByteArray::operator= | ( | const char * | str | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Assigns str to this byte array.
Definition at line 1338 of file qbytearray.cpp.
References QArrayDataPointer< T >::allocatedCapacity(), QArrayDataPointer< T >::clear(), QArrayDataPointer< T >::data(), QArrayDataPointer< T >::freeSpaceAtBegin(), QArrayDataPointer< T >::fromRawData(), QArrayData::KeepSize, QArrayDataPointer< T >::needsDetach(), QArrayDataPointer< T >::size, and str.
|
noexcept |
Assigns other to this byte array and returns a reference to this byte array.
Definition at line 1325 of file qbytearray.cpp.
|
inline |
Returns true
if this byte array is equal to the UTF-8 encoding of str; otherwise returns false
.
The comparison is case sensitive.
You can disable this operator by defining QT_NO_CAST_FROM_ASCII
when you compile your applications. You then need to call QString::fromUtf8(), QString::fromLatin1(), or QString::fromLocal8Bit() explicitly if you want to convert the byte array to a QString before doing the comparison.
Definition at line 1278 of file qstring.h.
References constData().
|
inline |
Returns true
if this byte array is lexically greater than the UTF-8 encoding of str; otherwise returns false
.
The comparison is case sensitive.
You can disable this operator by defining QT_NO_CAST_FROM_ASCII
when you compile your applications. You then need to call QString::fromUtf8(), QString::fromLatin1(), or QString::fromLocal8Bit() explicitly if you want to convert the byte array to a QString before doing the comparison.
Definition at line 1284 of file qstring.h.
References constData().
|
inline |
Returns true
if this byte array is greater than or equal to the UTF-8 encoding of str; otherwise returns false
.
The comparison is case sensitive.
You can disable this operator by defining QT_NO_CAST_FROM_ASCII
when you compile your applications. You then need to call QString::fromUtf8(), QString::fromLatin1(), or QString::fromLocal8Bit() explicitly if you want to convert the byte array to a QString before doing the comparison.
Definition at line 1288 of file qstring.h.
References constData().
|
inline |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as at(i).
Definition at line 525 of file qbytearray.h.
References d, i, and Q_ASSERT.
Referenced by back(), and front().
QByteArray QByteArray::percentDecoded | ( | char | percent = '%' | ) | const |
Decodes URI/URL-style percent-encoding.
Returns a byte array containing the decoded text. The percent parameter allows use of a different character than '' (for instance, '_' or '=') as the escape character.
For example:
Definition at line 4780 of file qbytearray.cpp.
References isEmpty(), and q_fromPercentEncoding().
Referenced by fromPercentEncoding(), and wrapInFunction().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Prepends the byte ch to this byte array.
Definition at line 216 of file qbytearray.h.
References insert().
Referenced by checkLightxml(), QAuthenticatorPrivate::digestMd5Response(), QAsn1Element::fromInteger(), Moc::generate(), QSettingsPrivate::iniEscapedKey(), Preprocessor::macroExpandIdentifier(), QSocks5SocketEnginePrivate::parseRequestMethodReply(), QTlsPrivate::TlsKeyBase::pemFromDer(), prepend(), Moc::prependNamespaces(), printMethodNotFoundWarning(), QDBusAbstractAdaptor::setAutoRelaySignals(), QSSGQmlUtilities::valueToQml(), and QAsn1Element::write().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Prepends the '\0'-terminated string str to this byte array.
Definition at line 219 of file qbytearray.h.
References insert(), and qstrlen().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Prepends len bytes starting at str to this byte array. The bytes prepended may include '\0' bytes.
Definition at line 221 of file qbytearray.h.
References insert().
QByteArray & QByteArray::prepend | ( | const QByteArray & | a | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Prepends ba to this byte array.
Definition at line 1983 of file qbytearray.cpp.
References ba, QArrayDataPointer< T >::constAllocatedCapacity(), QArrayDataPointer< T >::isMutable(), prepend(), and size().
|
inline |
Prepends the byte array view ba to this byte array and returns a reference to this byte array.
This operation is typically very fast (\l{constant time}), because QByteArray preallocates extra space at the beginning of the data, so it can grow without reallocating the entire array each time.
Example:
This is the same as insert(0, ba).
Definition at line 224 of file qbytearray.h.
References insert().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Prepends count copies of byte ch to this byte array.
Definition at line 581 of file qbytearray.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as append(ch).
Definition at line 451 of file qbytearray.h.
References append().
Referenced by handleNextSampleBuffer(), and Scanner::process().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as append(str).
Definition at line 453 of file qbytearray.h.
References append().
|
inline |
This function is provided for STL compatibility.
It is equivalent to append(other).
Definition at line 455 of file qbytearray.h.
References append().
|
inline |
Same as append(str).
Definition at line 457 of file qbytearray.h.
References append().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as prepend(ch).
Definition at line 459 of file qbytearray.h.
References prepend().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as prepend(str).
Definition at line 461 of file qbytearray.h.
References prepend().
|
inline |
This function is provided for STL compatibility.
It is equivalent to prepend(other).
Definition at line 463 of file qbytearray.h.
References prepend().
|
inline |
Same as prepend(str).
Definition at line 465 of file qbytearray.h.
References prepend().
|
inline |
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first byte in the byte-array, in reverse order.
iterator-invalidation-func-desc
Definition at line 436 of file qbytearray.h.
|
inlinenoexcept |
Definition at line 438 of file qbytearray.h.
QByteArray & QByteArray::remove | ( | qsizetype | pos, |
qsizetype | len | ||
) |
Removes len bytes from the array, starting at index position pos, and returns a reference to the array.
If pos is out of range, nothing happens. If pos is valid, but pos + len is larger than the size of the array, the array is truncated at position pos.
Example:
Element removal will preserve the array's capacity and not reduce the amount of allocated memory. To shed extra capacity and free as much memory as possible, call squeeze() after the last change to the array's size.
Definition at line 2317 of file qbytearray.cpp.
References begin(), QArrayDataPointer< T >::begin(), copy(), QArrayDataPointer< T >::data(), QArrayDataPointer< T >::end(), QtPrivate::QGenericArrayOps< T >::erase(), QArrayDataPointer< T >::isShared(), pos, QArrayDataPointer< T >::size, swap(), and Qt::Uninitialized.
Referenced by erase(), QTest::formatResult(), QFreetypeFace::getFace(), Moc::parseMocInclude(), QSocks5SocketEnginePrivate::parseRequestMethodReply(), Moc::parseRevision(), QPulseAudioSource::read(), replace(), and wrapInFunction().
|
inline |
|
inline |
Removes the first character in this byte array. If the byte array is empty, this function does nothing.
Definition at line 265 of file qbytearray.h.
References remove().
|
inline |
Removes all bytes for which the predicate pred returns true from the byte array. Returns a reference to the byte array.
Definition at line 269 of file qbytearray.h.
|
inline |
Removes the last character in this byte array. If the byte array is empty, this function does nothing.
Definition at line 266 of file qbytearray.h.
References remove().
|
inline |
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing just after the last byte in the byte-array, in reverse order.
iterator-invalidation-func-desc
Definition at line 437 of file qbytearray.h.
References begin().
|
inlinenoexcept |
Definition at line 439 of file qbytearray.h.
References begin().
QByteArray QByteArray::repeated | ( | qsizetype | times | ) | const |
Returns a copy of this byte array repeated the specified number of times.
If times is less than 1, an empty byte array is returned.
Example:
Definition at line 2605 of file qbytearray.cpp.
References QByteArray(), and isEmpty().
Referenced by wrapInFunction().
QByteArray & QByteArray::replace | ( | char | before, |
char | after | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Replaces every occurrence of the byte before with the byte after.
Definition at line 2562 of file qbytearray.cpp.
References data(), e, i, and isEmpty().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Replaces every occurrence of the byte before with the byte array after.
Definition at line 278 of file qbytearray.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Replaces every occurrence of the bsize bytes starting at before with the asize bytes starting at after.
Since the sizes of the strings are given by bsize and asize, they may contain '\0' bytes and do not need to be '\0'-terminated.
Definition at line 280 of file qbytearray.h.
QByteArray & QByteArray::replace | ( | QByteArrayView | before, |
QByteArrayView | after | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Replaces every occurrence of the byte array before with the byte array after.
Example:
Definition at line 2441 of file qbytearray.cpp.
References copy(), d, data(), QByteArrayView::data(), isNull(), matcher, pos, QtPrivate::q_points_into_range(), replace(), resize(), and QByteArrayView::size().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Replaces len bytes from index position pos with alen bytes starting at position after.
The bytes inserted may include '\0' bytes.
Definition at line 275 of file qbytearray.h.
Referenced by argumentTypesFromString(), QSSGStageGeneratorBase::buildShaderSourcePass2(), QWindowsMimeHtml::convertToMime(), QFontEngine::convertToPostscriptFontFamilyName(), encodeEntity(), generateQualifiedClassNameIdentifier(), Preamble::get(), QLoggingRegistry::initializeRules(), Preprocessor::macroExpandIdentifier(), parseAttributeValues(), patchQtCore(), replace(), replace(), QSSGShaderLibraryManager::resolveIncludeFiles(), QSSGQmlUtilities::valueToQml(), and wrapInFunction().
QByteArray & QByteArray::replace | ( | qsizetype | pos, |
qsizetype | len, | ||
QByteArrayView | after | ||
) |
Replaces len bytes from index position pos with the byte array after, and returns a reference to this byte array.
Example:
Definition at line 2390 of file qbytearray.cpp.
References copy(), QByteArrayView::data(), QArrayDataPointer< T >::data(), detach(), insert(), pos, QtPrivate::q_points_into_range(), remove(), replace(), and QByteArrayView::size().
Attempts to allocate memory for at least size bytes.
If you know in advance how large the byte array will be, you can call this function, and if you call resize() often you are likely to get better performance.
If in doubt about how much space shall be needed, it is usually better to use an upper bound as size, or a high estimate of the most likely size, if a strict upper bound would be much bigger than this. If size is an underestimate, the array will grow as needed once the reserved size is exceeded, which may lead to a larger allocation than your best overestimate would have and will slow the operation that triggers it.
The sole purpose of this function is to provide a means of fine tuning QByteArray's memory usage. In general, you will rarely ever need to call this function.
Definition at line 557 of file qbytearray.h.
References capacity(), QArrayData::CapacityReserved, d, QArrayData::KeepSize, and qMax().
Referenced by RCCResourceLibrary::RCCResourceLibrary(), QJsonPrivate::Writer::arrayToJson(), QOCIResultPrivate::bindValue(), QTlsPrivate::X509CertificateOpenSSL::certificateFromX509(), QPacket::clear(), QSSGMesh::Mesh::createLightmapUVChannel(), QMimerSQLResult::data(), QCborContainerPrivate::extractAt_complex(), QODBCDriver::formatValue(), QSqlDriver::formatValue(), QHttpNetworkRequestPrivate::header(), mergeStringLiterals(), QJsonPrivate::Writer::objectToJson(), QIBaseDriver::open(), QQmlError::operator<<(), QHttpNetworkReplyPrivate::readHeader(), QHttpNetworkReplyPrivate::readStatus(), QDBusPendingCallPrivate::setMetaTypes(), QSSGShaderDefaultMaterialKey::toString(), QLocaleData::validateChars(), and QSocks5SocketEngine::writeDatagram().
Sets the size of the byte array to size bytes.
If size is greater than the current size, the byte array is extended to make it size bytes with the extra bytes added to the end. The new bytes are uninitialized.
If size is less than the current size, bytes beyond position size are excluded from the byte array.
Definition at line 1859 of file qbytearray.cpp.
References QArrayDataPointer< T >::allocatedCapacity(), capacity(), QArrayDataPointer< T >::data(), QArrayDataPointer< T >::freeSpaceAtBegin(), QArrayData::Grow, QArrayDataPointer< T >::needsDetach(), and QArrayDataPointer< T >::size.
Referenced by QQnxIntegration::QQnxIntegration(), QQnxWindow::QQnxWindow(), _q_PKCS12_keygen(), _q_PKCS12_salt(), QPdfEnginePrivate::addImage(), QSslContext::cacheSession(), QSctpSocketPrivate::canReadNotification(), chop(), QXcbClipboard::clipboardReadIncrementalProperty(), QRhiGles2::compileShader(), convertParticleData(), dtlsutil::cookie_for_peer(), qstdweb::Uint8Array::copyToQByteArray(), LeCmacCalculator::createFullMessage(), QSSGMesh::Mesh::createLightmapUVChannel(), QMimerSQLResult::data(), QDtlsPrivateOpenSSL::decryptDatagram(), QRhiD3D11::enqueueResourceUpdates(), QRhiGles2::enqueueResourceUpdates(), QRhiVulkan::enqueueResourceUpdates(), escapedString(), QDB2Result::exec(), QODBCResult::exec(), QRhiGles2::executeCommandBuffer(), QIBaseResultPrivate::fetchArray(), QIBaseResultPrivate::fetchBlob(), QZipReader::fileData(), fill(), fillVertexData(), QStandardPaths::findExecutable(), QRhiD3D11::finishActiveReadbacks(), QRhiMetal::finishActiveReadbacks(), QRhiVulkan::finishActiveReadbacks(), QSSGMesh::Mesh::fromAssetData(), QSSGMesh::Mesh::fromRuntimeData(), generateGlyphTables(), ProceduralSkyTextureData::generateRGBA16FTexture(), getGlyphData(), QFileDialog::getOpenFileContent(), QNearFieldTargetPrivateImpl::jbyteArrayToQByteArray(), QRhiGles2::linkProgram(), QOpenGLDebugLogger::loggedMessages(), QOpenGLDebugLogger::logMessage(), LowEnergyNotificationHub::lowEnergy_characteristicWritten(), mergeStringLiterals(), operator>>(), QTlsPrivate::X509CertificateGeneric::parse(), QOpenGLDebugLogger::pushGroup(), qExtractServerTime(), qGetBinaryData(), QTest::qPrintDataTags(), QPulseAudioSource::read(), QByteDataBuffer::read(), QHttpNetworkReplyPrivate::readBodyFast(), QSSGMesh::MeshInternal::readMeshData(), QOCICols::readPiecewise(), QHttpNetworkReplyPrivate::readReplyBodyRaw(), QInternalMimeData::renderDataHelper(), replace(), QSSGParticleBuffer::resize(), RingBuffer::resize(), QBitArray::resize(), resize(), QRhiNull::resourceUpdate(), QMainWindowLayoutState::restoreState(), setMonitorDataFromSetupApi(), QQmlPreviewFileEngine::setSize(), QQuick3DParticleInstanceTable::sort(), QRingChunk::toByteArray(), QTlsPrivate::TlsCryptographSchannel::transmit(), truncate(), QQuick3DSkin::updateSpatialNode(), uuidToByteArray(), QSSGShaderDefaultMaterialKey::StringVisitor::visit(), wrapInFunction(), and QIBaseResultPrivate::writeArray().
Sets the size of the byte array to newSize bytes.
If newSize is greater than the current size, the byte array is extended to make it newSize bytes with the extra bytes added to the end. The new bytes are initialized to c.
If newSize is less than the current size, bytes beyond position newSize are excluded from the byte array.
Definition at line 1889 of file qbytearray.cpp.
References QArrayDataPointer< T >::data(), resize(), and QArrayDataPointer< T >::size.
QByteArray QByteArray::right | ( | qsizetype | len | ) | const |
Returns a byte array that contains the last len bytes of this byte array.
If you know that len cannot be out of bounds, use last() instead in new code, because it is faster.
The entire byte array is returned if len is greater than size().
Returns an empty QByteArray if len is smaller than 0.
Definition at line 3061 of file qbytearray.cpp.
References QByteArray(), and end().
Referenced by clientChallenge(), QSSGShaderKeyUnsigned< TBitWidth >::fromString(), and QTlsPrivate::Q_GLOBAL_STATIC_WITH_ARGS().
QByteArray QByteArray::rightJustified | ( | qsizetype | width, |
char | fill = ' ' , |
||
bool | truncate = false |
||
) | const |
Returns a byte array of size width that contains the fill byte followed by this byte array.
If truncate is false and the size of the byte array is more than width, then the returned byte array is a copy of this byte array.
If truncate is true and the size of the byte array is more than width, then the resulting byte array is truncated at position width.
Example:
Definition at line 3721 of file qbytearray.cpp.
References fill(), and truncate().
Referenced by QTlsPrivate::X509CertificateOpenSSL::certificateFromX509(), QTest::qSignalDumperCallback(), QTest::qSignalDumperCallbackSlot(), and wrapInFunction().
QByteArray & QByteArray::setNum | ( | double | n, |
char | format = 'g' , |
||
int | precision = 6 |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Represent the floating-point number n as text.
Sets this byte array to a string representing n, with a given format and precision (with the same meanings as for \l {QString::number(double, char, int)}), and returns a reference to this byte array.
Definition at line 4295 of file qbytearray.cpp.
References number().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Represent the floating-point number n as text.
Sets this byte array to a string representing n, with a given format and precision (with the same meanings as for \l {QString::number(double, char, int)}), and returns a reference to this byte array.
Definition at line 623 of file qbytearray.h.
References setNum().
|
inline |
Represent the whole number n as text.
Sets this byte array to a string representing n in base base (ten by default) and returns a reference to this byte array. Bases 2 through 36 are supported, using letters for digits beyond 9; A is ten, B is eleven and so on.
Example:
Definition at line 615 of file qbytearray.h.
References base, and setNum().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 619 of file qbytearray.h.
References base, and setNum().
QByteArray & QByteArray::setNum | ( | qlonglong | n, |
int | base = 10 |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4247 of file qbytearray.cpp.
References append(), base, clear(), and qulltoa2().
QByteArray & QByteArray::setNum | ( | qulonglong | n, |
int | base = 10 |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4272 of file qbytearray.cpp.
References append(), base, clear(), and qulltoa2().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 611 of file qbytearray.h.
References base, and setNum().
Referenced by QPdfEnginePrivate::drawTextItem(), setNum(), setNum(), setNum(), setNum(), setNum(), setNum(), setNum(), and wrapInFunction().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 617 of file qbytearray.h.
References base, and setNum().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 621 of file qbytearray.h.
References base, and setNum().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 613 of file qbytearray.h.
References base, and setNum().
QByteArray & QByteArray::setRawData | ( | const char * | data, |
qsizetype | size | ||
) |
Resets the QByteArray to use the first size bytes of the data array. The bytes are not copied. The QByteArray will contain the data pointer. The caller guarantees that data will not be deleted or modified as long as this QByteArray and any copies of it exist that have not been modified.
This function can be used instead of fromRawData() to re-use existing QByteArray objects to save memory re-allocations.
Definition at line 4482 of file qbytearray.cpp.
References clear(), and fromRawData().
|
inline |
This function is provided for STL compatibility. It is equivalent to squeeze().
Definition at line 467 of file qbytearray.h.
|
inline |
Definition at line 204 of file qbytearray.h.
|
inline |
Definition at line 202 of file qbytearray.h.
Referenced by wrapInFunction().
|
inlinenoexcept |
Returns the number of bytes in this byte array.
The last byte in the byte array is at position size() - 1. In addition, QByteArray ensures that the byte at position size() is always '\0', so that you can use the return value of data() and constData() as arguments to functions that expect '\0'-terminated strings. If the QByteArray object was created from a \l{fromRawData()}{raw data} that didn't include the trailing '\0'-termination byte, then QByteArray doesn't add it automatically unless a \l{deep copy} is created.
Example:
Definition at line 474 of file qbytearray.h.
References d.
Referenced by QBitArray::QBitArray(), QCborValue::QCborValue(), QHttpMultiPartPrivate::QHttpMultiPartPrivate(), QMimeMagicRule::QMimeMagicRule(), QNetworkReplyDataImpl::QNetworkReplyDataImpl(), QOscMessage::QOscMessage(), QQnxIntegration::QQnxIntegration(), QQnxWindow::QQnxWindow(), QResponseApdu::QResponseApdu(), QtBluezPeripheralDescriptor::QtBluezPeripheralDescriptor(), QTemporaryFileName::QTemporaryFileName(), QXcbXSettings::QXcbXSettings(), QLocalSocketPrivate::_q_connectToSocket(), _q_lower(), _q_PKCS12_keygen(), _q_PKCS12_salt(), QSocks5SocketEnginePrivate::_q_udpSocketReadNotification(), _q_upper(), QFileSystemEngine::absoluteName(), QQuick3DParticleInstanceTable::addInstance(), QGeoFileTileCache::addToDiskCache(), QLowEnergyControllerPrivateAndroid::addToGenericAttributeList(), QGeoFileTileCache::addToMemoryCache(), QRingChunk::allocate(), append(), QCborStreamWriter::append(), QRingBuffer::append(), QCborStreamWriter::append(), QtStringBuilder::appendToByteArray(), appendVariant(), QJsonPrivate::Writer::arrayToJson(), QPdf::ascii85Encode(), QRingChunk::assign(), QRingChunk::assign(), assign(), QRingChunk::available(), RingBuffer::availableDataBlockSize(), QSocks5PasswordAuthenticator::beginAuthenticate(), QOCIResultPrivate::bindValue(), QSSGParticleBuffer::bufferSize(), QCommandApdu::build(), QmlLsp::QQmlCodeModel::buildPathsForFileUrl(), QSSGMeshBVHBuilder::buildTree(), QAudioBuffer::byteCount(), QHttpPartPrivate::bytesAvailable(), QHttpNetworkReplyPrivate::bytesAvailable(), RingBuffer::bytesOfDataInBuffer(), QWindowsAudioSource::bytesReady(), LeCmacCalculator::calculateMac(), QSSGMesh::MeshInternal::calculateSubsetBounds(), QSctpSocketPrivate::canReadNotification(), QRingChunk::capacity(), QWindowsFontEngine::capHeight(), QTlsPrivate::X509CertificateOpenSSL::certificatesFromDer(), QTlsPrivate::X509CertificateOpenSSL::certificatesFromPem(), QTlsPrivate::X509CertificateGeneric::certificatesFromPem(), QPicturePrivate::checkFormat(), checkStaticArray(), QODBCDriverPrivate::checkUnicode(), childKeysOrGroups(), QTlsPrivate::TlsKeyGeneric::clear(), QXcbConnection::clientLeader(), QZipWriter::close(), QRhiD3D11::compileHlslShaderSource(), QOpenGLShader::compileSourceCode(), QMetaObject::connectSlotsByName(), QTlsPrivate::TlsCryptographOpenSSL::continueHandshake(), QTlsPrivate::TlsCryptographSchannel::continueHandshake(), QWindowsMimeText::convertFromMime(), QUtf8::convertFromUnicode(), convertParticleData(), convertToExtendedType(), QMacMimePlainTextFallback::convertToMime(), QMacMimeTraditionalMacPlainText::convertToMime(), convertToNativeQObject(), QQuick3DPhysicsMesh::convexMesh(), QXcbWindow::create(), QD3D11Buffer::create(), QD3D11RenderBuffer::create(), QD3D11Texture::create(), QD3D11GraphicsPipeline::create(), QD3D11ComputePipeline::create(), QT_BEGIN_NAMESPACE::VertexBufferDataExt::createEntries(), LeCmacCalculator::createFullMessage(), QSSGMesh::Mesh::createLightmapUVChannel(), QRhiMetalData::createMetalLib(), QRhiVulkan::createShader(), QSslContext::createSsl(), DarwinBluetooth::data_from_bytearray(), QtWaylandClient::QWaylandDataSource::data_source_send(), debugBinaryString(), QTlsPrivate::TlsKeyOpenSSL::decodePem(), QDtls::decryptDatagram(), QDtlsPrivateOpenSSL::decryptDatagram(), QTlsPrivate::TlsKeyOpenSSL::derFromPem(), QTlsPrivate::TlsKeyGeneric::derFromPem(), QPasswordDigestor::deriveKeyPbkdf1(), QTlsBackendOpenSSL::dhParametersFromDer(), QTlsBackendOpenSSL::dhParametersFromPem(), QAuthenticatorPrivate::digestMd5Response(), AVFImageCapture::doCapture(), QNetworkReplyWasmImplPrivate::doSendRequest(), QCtfLibImpl::doTracepoint(), QPdfEngine::drawHyperlink(), QV4::Moth::dumpBytecode(), dumpErrorInformation(), encodeEntity(), encodeFileName(), QRhiGles2::enqueueSubresUpload(), QRhiMetal::enqueueSubresUpload(), escapedString(), QWidget::event(), QDB2Result::exec(), QMimerSQLResult::exec(), QMYSQLResult::exec(), QODBCResult::exec(), QSQLiteResult::exec(), QOCICols::execBatch(), extractServiceData(), QZipReader::fileData(), QStandardPaths::findExecutable(), QDoubleValidatorPrivate::fixupWithLocale(), QWindowsFontDatabase::fontEngine(), QTest::formatResult(), QXcbClipboardMime::formats_sys(), QDB2Driver::formatValue(), QMYSQLDriver::formatValue(), QODBCDriver::formatValue(), QPSQLDriver::formatValue(), QSqlDriver::formatValue(), QAudioBuffer::frameCount(), RingBuffer::freeBytes(), fromBase64Encoding(), fromHex(), QJsonDocument::fromJson(), QString::fromLatin1(), QUrl::fromPercentEncoding(), QSSGMesh::Mesh::fromRuntimeData(), QSSGShaderKeyUnsigned< TBitWidth >::fromString(), QmlTypesCreator::generate(), Moc::generate(), generateGlyphTables(), AssimpUtils::generateMeshData(), QHttpNetworkReplyPrivate::getChunkSize(), QWindowsFontEngine::getCMap(), QNfcTagType4NdefFsm::getCommand(), getExifOrientation(), QQuick3DParticleInstanceTable::getInstanceBuffer(), QLocationUtils::getNmeaTime(), QSSGRenderShaderMetadata::getShaderMetaData(), QFontEngine::glyphCount(), QXcbClipboard::handleSelectionRequest(), QTlsPrivate::TlsCryptographSchannel::hasUndecryptedData(), QNonContiguousByteDeviceThreadForwardImpl::haveDataSlot(), ICOReader::iconAt(), QTextMarkdownImporter::import(), QTlsPrivate::X509CertificateOpenSSL::importPkcs12(), QTlsPrivate::X509CertificateSchannel::importPkcs12(), QWaylandInputMethodEventBuilder::indexFromWayland(), QStaticByteArrayMatcher< N >::indexIn(), QWaylandInputMethodEventBuilder::indexToWayland(), QCoreTextFontEngine::init(), QGeoFileTileCache::isTileBogus(), QTextureFileData::isValid(), QIODevicePrivate::isWriteChunkCached(), QXcbKeyboard::keymapFromCore(), QOpenGLProgramBinaryCache::load(), QSvgIOHandlerPrivate::load(), QFontEngine::loadKerningPairs(), QSSGLoadedTexture::loadTextureData(), QOpenGLDebugLogger::loggedMessages(), QOpenGLDebugLogger::logMessage(), macQueryInternal(), macValue(), ElfMapper::map(), QTlsPrivate::X509CertificateBase::matchLineFeed(), mergeStringLiterals(), QFontEngine::minRightBearing(), DarwinBluetooth::mutable_data_from_bytearray(), nameToOSType(), normalizeType(), QJsonPrivate::Writer::objectToJson(), QIBaseDriver::open(), QODBCDriver::open(), QBitArray::operator&=(), operator+=(), operator<<(), QBitArray::operator~(), RCCResourceLibrary::output(), QEdidParser::parse(), QTlsPrivate::X509CertificateGeneric::parse(), parseDateString(), Preprocessor::parseDefineArguments(), QAuthenticatorPrivate::parseDigestAuthenticationChallenge(), parseHeaderName(), parseHeaderName(), QSocks5SocketEnginePrivate::parseRequestMethodReply(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), patchQtCore(), QTlsPrivate::TlsKeyBase::pemFromDer(), QRhiD3D11::pipelineCacheData(), QRhiGles2::pipelineCacheData(), QRhiMetal::pipelineCacheData(), QByteDataBuffer::popFront(), QXcbXSettingsPrivate::populateSettings(), QODBCResult::prepare(), QMYSQLResult::prepare(), QSSGDebugDrawSystem::prepareGeometry(), QRhiVulkan::prepareUploadSubres(), prepend(), printMethodNotFoundWarning(), Scanner::process(), QAndroidAudioSource::processBuffer(), QFontEngine::processHheaTable(), QFontEngine::processOS2Table(), processSentence(), QDtlsPrivateOpenSSL::pskClientCallback(), QTlsPrivate::TlsCryptographOpenSSL::pskClientTlsCallback(), QDtlsPrivateOpenSSL::pskServerCallback(), QTlsPrivate::TlsCryptographOpenSSL::pskServerTlsCallback(), QOpenGLDebugLogger::pushGroup(), q_fromPercentEncoding(), dtlscallbacks::q_generate_cookie_callback(), QTlsPrivate::Q_GLOBAL_STATIC_WITH_ARGS(), Q_LOGGING_CATEGORY(), qCreatev2Hash(), qEncodeNtlmv2Response(), qGetBinaryData(), QTest::qPrintDataTags(), qQmlJSGenerateLoader(), qRelocateResourceFile(), qt_socks5_set_host_name_and_port(), qt_string_SQLSetConnectAttr(), qtValue(), rawBytes(), QAstcHandler::read(), QPkmHandler::read(), QPulseAudioSource::read(), QWindowsAudioSource::read(), QByteDataBuffer::read(), QImageReader::read(), Jpeg2000JasperReader::read(), QByteDataBuffer::read(), RingBuffer::readBytes(), QHttpPartPrivate::readData(), QHttpMultiPartIODevice::readData(), QSocks5SocketEngine::readDatagram(), QHttpNetworkReplyPrivate::readHeader(), QSSGMesh::MeshInternal::readMeshData(), QOCICols::readPiecewise(), QHttpNetworkReplyPrivate::readReplyBodyRaw(), QHttpNetworkReplyPrivate::readStatus(), QSGCompressedAtlasTexture::Texture::removedFromAtlas(), QVideoWindowPrivate::render(), QMYSQLResult::reset(), QODBCResult::reset(), QBitArray::resize(), QSSGShaderLibraryManager::resolveIncludeFiles(), QMainWindowLayoutState::restoreState(), QInternalMimeData::retrieveData(), QXcbClipboardMime::retrieveData_sys(), QDnsLookupRunnable::run(), QQmlJSBasicBlocks::run(), QQmlJSCodeGenerator::run(), QQmlJSTypePropagator::run(), QQmlJSShadowCheck::run(), QQmlType::scopedEnumValue(), QNearFieldTargetPrivateImpl::sendCommand(), HciManager::sendCommand(), QHttpProtocolHandler::sendRequest(), QWinSettingsPrivate::set(), set_text(), QByteArrayMatcher::setPattern(), QRhiGles2::setPipelineCacheData(), QWasmAudioOutput::setSource(), QSSGRhiShaderPipeline::setUniform(), QSSGRhiShaderPipeline::setUniformArray(), QXcbWindow::setWindowIconText(), QXcbWindow::setWindowTitle(), QHttpPartPrivate::size(), QQmlFile::size(), QNonContiguousByteDeviceByteArrayImpl::size(), QHttpMultiPartIODevice::size(), QConcatenable< QByteArray >::size(), QSGCompressedAtlasTexture::Texture::sizeInBytes(), QQuick3DParticleInstanceTable::sort(), QV4::RuntimeHelpers::stringToNumber(), QRhiMetal::subresUploadByteSize(), QRhiVulkan::subresUploadByteSize(), QRawFont::supportedWritingSystems(), QWindowsFontDatabaseBase::EmbeddedFont::tableDirectoryEntry(), QTimeZonePrivate::territory(), toBase64(), QAsn1Element::toDateTime(), QIcc::toIccProfile(), QAsn1Element::toInteger(), QAsn1Element::toObjectId(), QTlsPrivate::TlsKeyOpenSSL::toPem(), QAsn1Element::toString(), QTest::toString(), QTest::toString(), QQuick3DPhysicsMesh::triangleMesh(), QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(), QLockFilePrivate::tryLock_sys(), ClipWindow::updateClipboard(), QXcbClipboardTransaction::updateIncrementalProperty(), QQuick3DTextureData::updateSpatialNode(), QtWaylandClient::QWaylandTextInputv1::updateState(), QtWaylandClient::QWaylandTextInputv2::updateState(), QtWaylandClient::QWaylandTextInputv4::updateState(), QLowEnergyControllerPrivate::updateValueOfCharacteristic(), QLowEnergyControllerPrivate::updateValueOfDescriptor(), QIntValidator::validate(), QSSGQmlUtilities::valueToQml(), QDtlsClientVerifier::verifyClient(), QDtlsClientVerifierOpenSSL::verifyClient(), verifyDigestMD5(), QSSGShaderDefaultMaterialKey::StringVisitor::visit(), TestHTTPServer::wait(), winIso639LangName(), wrapInFunction(), RingBuffer::write(), QSocks5SocketEngine::write(), QICNSHandler::write(), QTiffHandler::write(), QWebpHandler::write(), QAsn1Element::write(), write_icc_profile(), QIBaseResultPrivate::writeBlob(), QLowEnergyControllerPrivateAndroid::writeCharacteristic(), QFFmpeg::AudioSourceIO::writeData(), RCCFileInfo::writeDataBlob(), QSocks5SocketEngine::writeDatagram(), QUdpSocket::writeDatagram(), QSctpSocket::writeDatagram(), QUdpSocket::writeDatagram(), QDtlsPrivateOpenSSL::writeDatagramEncrypted(), QLowEnergyControllerPrivateAndroid::writeDescriptor(), QV4::Compiler::JSUnitGenerator::writeFunction(), QPNGImageWriter::writeImage(), writeInstanceTable(), QSSGMesh::MeshInternal::writeMeshData(), QNearFieldTargetPrivateImpl::writeNdefMessages(), QSSGQmlUtilities::writeNodeProperties(), and QtWaylandClient::QWaylandPrimarySelectionSourceV1::zwp_primary_selection_source_v1_send().
|
inline |
Returns a byte array containing the bytes starting at position pos in this object, and extending to the end of this object.
Definition at line 163 of file qbytearray.h.
Referenced by QtBluezPeripheralDescriptor::QtBluezPeripheralDescriptor(), calculatePosixDate(), metaEnumFromType(), QRingChunk::toByteArray(), and wrapInFunction().
|
inline |
Returns a byte array containing the n bytes of this object starting at position pos.
Example:
Definition at line 165 of file qbytearray.h.
QList< QByteArray > QByteArray::split | ( | char | sep | ) | const |
Splits the byte array into subarrays wherever sep occurs, and returns the list of those arrays.
If sep does not match anywhere in the byte array, split() returns a single-element list containing this byte array.
Definition at line 2581 of file qbytearray.cpp.
References QList< T >::append(), end(), indexOf(), list, mid(), and sep.
Referenced by QGLXContext::QGLXContext(), QOpenGLExtensionMatcher::QOpenGLExtensionMatcher(), activeConditions(), allSubObjects(), calculatePosixDate(), calculatePosixTransitions(), QDBusAbstractInterface::callWithArgumentList(), QRhiVulkan::create(), QGuiApplicationPrivate::createPlatformIntegration(), QKmsDevice::createScreenForConnector(), gradleBuildFlags(), ignoreProxyFor(), QBasicPlatformVulkanInstance::initInstance(), QWaylandCompositorPrivate::loadClientBufferIntegration(), QGLXContext::makeCurrent(), parseCookieHeader(), QNetworkCookie::parseCookies(), QAuthenticatorPrivate::parseDigestAuthenticationChallenge(), Moc::parseFunction(), parseIfMatch(), parseIfNoneMatch(), QPlatformOpenGLContext::parseOpenGLVersion(), Moc::parseRevision(), q_hasEglExtension(), Q_TRACE_INSTRUMENT(), qlocationutils_readGga(), qlocationutils_readGll(), qlocationutils_readGsa(), qlocationutils_readGsa(), qlocationutils_readRmc(), qlocationutils_readVtg(), qlocationutils_readZda(), readGradleProperties(), runMoc(), QEglFSX11Integration::screenSize(), QWaylandTextInput::sendModifiersMap(), QQuickShaderEffectPrivate::setMesh(), QGenericUnixTheme::themeNames(), transFormDiskCache(), validatePosixRule(), QtWaylandClient::QWaylandTextInputv1::zwp_text_input_v1_modifiers_map(), and QtWaylandClient::QWaylandTextInputv2::zwp_text_input_v2_modifiers_map().
|
inline |
Releases any memory not required to store the array's data.
The sole purpose of this function is to provide a means of fine tuning QByteArray's memory usage. In general, you will rarely ever need to call this function.
Definition at line 565 of file qbytearray.h.
References capacity(), QArrayData::CapacityReserved, d, and QArrayData::KeepSize.
Referenced by QMimeMagicRule::QMimeMagicRule().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if this byte array starts with byte ch; otherwise returns false
.
Definition at line 172 of file qbytearray.h.
|
inline |
Returns true
if this byte array starts with the sequence of bytes viewed by bv; otherwise returns false
.
Example:
Definition at line 170 of file qbytearray.h.
References qToByteArrayViewIgnoringNull(), and QtPrivate::startsWith().
Referenced by QMimeMagicRule::QMimeMagicRule(), QOscBundle::QOscBundle(), QFileSystemEngine::absoluteName(), QmlLsp::QQmlCodeModel::buildPathsForFileUrl(), QAstcHandler::canRead(), QPkmHandler::canRead(), convertToNativeQObject(), QGuiApplicationPrivate::createPlatformIntegration(), QHttpNetworkConnectionChannel::detectPipeliningSupport(), findSlot(), QDoubleValidatorPrivate::fixupWithLocale(), QFreetypeFace::getFace(), QSSGRenderShaderMetadata::getShaderMetaData(), QTlsPrivate::TlsKeyBase::isEncryptedPkcs8(), isPossiblySvg(), make_user_path_without_qstandard_paths(), metaEnumFromType(), Moc::parseClassInfo(), QPlatformOpenGLContext::parseOpenGLVersion(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), qtValue(), QHttpNetworkReplyPrivate::readStatus(), and QDoubleValidatorPrivate::validateWithLocale().
|
inlinenoexcept |
Swaps byte array other with this byte array. This operation is very fast and never fails.
Definition at line 103 of file qbytearray.h.
Referenced by QAsn1Element::read(), remove(), QByteArray::FromBase64Result::swap(), and QRingChunk::swap().
QByteArray QByteArray::toBase64 | ( | Base64Options | options = Base64Encoding | ) | const |
Returns a copy of the byte array, encoded using the options options.
The algorithm used to encode Base64-encoded data is defined in \l{RFC 4648}.
Definition at line 4113 of file qbytearray.cpp.
References Base64UrlEncoding, data(), i, j, OmitTrailingEquals, out, Q_ASSERT, size(), truncate(), and Qt::Uninitialized.
Referenced by Base64IconStore::Base64IconStore(), QHttpMultiPartPrivate::QHttpMultiPartPrivate(), QAuthenticatorPrivate::calculateResponse(), main(), operator<<(), QTlsPrivate::TlsKeyBase::pemFromDer(), QWasmWindow::setWindowIcon(), and QQuickCanvasItem::toDataURL().
double QByteArray::toDouble | ( | bool * | ok = nullptr | ) | const |
Returns the byte array converted to a double
value.
Returns an infinity if the conversion overflows or 0.0 if the conversion fails for other reasons (e.g. underflow).
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 4047 of file qbytearray.cpp.
References ok, and QByteArrayView::toDouble().
Referenced by QFFmpegMetaData::addEntry(), QDoubleValidatorPrivate::fixupWithLocale(), QLocationUtils::getNmeaLatLong(), parseXftDpi(), toDouble(), and toFloat().
float QByteArray::toFloat | ( | bool * | ok = nullptr | ) | const |
Returns the byte array converted to a float
value.
Returns an infinity if the conversion overflows or 0.0 if the conversion fails for other reasons (e.g. underflow).
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 4086 of file qbytearray.cpp.
References QLocaleData::convertDoubleToFloat(), ok, and toDouble().
Referenced by qt_sg_envFloat(), QQuickContext2DTexture::setCanvasWindow(), and QQnxMediaMetaData::update().
QByteArray QByteArray::toHex | ( | char | separator = '\0' | ) | const |
Returns a hex encoded copy of the byte array.
The hex encoding uses the numbers 0-9 and the letters a-f.
If separator is not '\0', the separator character is inserted between the hex bytes.
Example:
Definition at line 4703 of file qbytearray.cpp.
References QByteArray(), data(), hex, i, isEmpty(), o, QtMiscUtils::toHexLower(), and Qt::Uninitialized.
Referenced by QAuthenticatorPrivate::QAuthenticatorPrivate(), bufferFromAttribute(), QOpenGLProgramBinaryCache::ProgramDesc::cacheKey(), LeCmacCalculator::calculateMac(), QTlsPrivate::TlsCryptographOpenSSL::continueHandshake(), digestMd5ResponseHelper(), dumpAttributeVariant(), encodeFrame(), fileIdWin8(), host_name_to_settings_key(), QLowEnergyControllerPrivateBluez::init(), QV4::ExecutableCompilationUnit::localCacheFilePath(), main(), makeCacheKey(), QMimeMagicRule::mask(), QtObject::md5(), QQmlEngine::offlineStorageDatabaseFilePath(), operator<<(), sourceHash(), QTlsPrivate::TlsKeyGeneric::toPem(), wrapInFunction(), writeAttribute(), QLowEnergyControllerPrivateAndroid::writeCharacteristic(), QLowEnergyControllerPrivateAndroid::writeDescriptor(), and QPdfEnginePrivate::writeTail().
int QByteArray::toInt | ( | bool * | ok = nullptr , |
int | base = 10 |
||
) | const |
Returns the byte array converted to an int
using base base, which is ten by default.
Bases 0 and 2 through 36 are supported, using letters for digits beyond 9; A is ten, B is eleven and so on.
If base is 0, the base is determined automatically using the following rules: If the byte array begins with "0x", it is assumed to be hexadecimal (base 16); otherwise, if it begins with "0b", it is assumed to be binary (base 2); otherwise, if it begins with "0", it is assumed to be octal (base 8); otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
Definition at line 3863 of file qbytearray.cpp.
References base, ok, and qToByteArrayViewIgnoringNull().
Referenced by QDBusBlockingCallWatcher::QDBusBlockingCallWatcher(), QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(), QFontEngineFT::QFontEngineFT(), QFFmpegMetaData::addEntry(), buildAndroidProject(), QSSGStageGeneratorBase::buildShaderSourcePass2(), calculatePosixDate(), QWindowsMimeHtml::convertToMime(), QEglFSOpenWFDIntegration::createNativeWindow(), QNetworkReplyHttpImplPrivate::fetchCacheMetaData(), QFreetypeFace::getFace(), LinuxDmabufClientBufferIntegration::initializeHardware(), isJitEnabled(), QtWaylandClient::QWaylandScreen::logicalDpi(), QEGLPlatformContext::makeCurrent(), QPSQLResult::numRowsAffected(), Moc::parseRevision(), parseXftInt(), QEglFSOpenWFDIntegration::platformInit(), PP_Expression::primary_expression(), qlocationutils_readGsa(), read_xbm_header(), QEglFSKmsEglDeviceWindow::resetSurface(), QOpenSLESEngine::setAudioOutput(), AndroidMediaPlayer::setAudioOutput(), QtWaylandClient::QWaylandDisplay::supportsWindowDecoration(), QQnxMediaMetaData::update(), and QtWaylandClient::QWaylandEglWindow::updateSurface().
long QByteArray::toLong | ( | bool * | ok = nullptr , |
int | base = 10 |
||
) | const |
Returns the byte array converted to a long
int using base base, which is ten by default. Bases 0 and 2 through 36 are supported, using letters for digits beyond 9; A is ten, B is eleven and so on.
If base is 0, the base is determined automatically using the following rules: If the byte array begins with "0x", it is assumed to be hexadecimal (base 16); otherwise, if it begins with "0b", it is assumed to be binary (base 2); otherwise, if it begins with "0", it is assumed to be octal (base 8); otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
Definition at line 3926 of file qbytearray.cpp.
References base, ok, and qToByteArrayViewIgnoringNull().
Referenced by QHttpNetworkReplyPrivate::getChunkSize().
Returns the byte array converted to a {long
long} using base base, which is ten by default.
Bases 0 and 2 through 36 are supported, using letters for digits beyond 9; A is ten, B is eleven and so on.
If base is 0, the base is determined automatically using the following rules: If the byte array begins with "0x", it is assumed to be hexadecimal (base 16); otherwise, if it begins with "0b", it is assumed to be binary (base 2); otherwise, if it begins with "0", it is assumed to be octal (base 8); otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
Definition at line 3801 of file qbytearray.cpp.
References base, ok, and qToByteArrayViewIgnoringNull().
Referenced by QFFmpegMetaData::addEntry(), QPSQLResult::data(), getLockInfo_helper(), and QQnxMediaMetaData::update().
|
inline |
Definition at line 192 of file qbytearray.h.
|
inline |
Definition at line 190 of file qbytearray.h.
Referenced by QPdfBookmarkModel::QPdfBookmarkModel(), QPdfLinkModel::QPdfLinkModel(), QSGRhiSupport::applySwapChainFormat(), QKmsDevice::createScreenForConnector(), formatByName(), QSSGInputUtil::getStreamForTextureFile(), QQmlXMLHttpRequest::header(), QWindowsOpengl32DLL::init(), QXcbDrag::move(), QtWaylandClient::QWaylandXdgSurface::nativeResource(), QXcbNativeInterface::nativeResourceForBackingStore(), QXcbNativeInterface::nativeResourceForContext(), QQnxNativeInterface::nativeResourceForIntegration(), QXcbNativeInterface::nativeResourceForIntegration(), QtWaylandClient::QWaylandNativeInterface::nativeResourceForIntegration(), QOffscreenX11PlatformNativeInterface::nativeResourceForScreen(), QXcbNativeInterface::nativeResourceForScreen(), QtWaylandClient::QWaylandNativeInterface::nativeResourceForScreen(), QIOSIntegration::nativeResourceForWindow(), QtWaylandClient::QWaylandWlShellIntegration::nativeResourceForWindow(), QXcbNativeInterface::nativeResourceForWindow(), QtWaylandClient::QWaylandNativeInterface::nativeResourceForWindow(), QXcbNativeInterface::nativeResourceFunctionForBackingStore(), QXcbNativeInterface::nativeResourceFunctionForContext(), QCocoaNativeInterface::nativeResourceFunctionForIntegration(), QXcbNativeInterface::nativeResourceFunctionForIntegration(), QXcbNativeInterface::nativeResourceFunctionForScreen(), QXcbNativeInterface::nativeResourceFunctionForWindow(), QtWaylandClient::QWaylandNativeInterface::nativeResourceFunctionForWindow(), parseHttpOptionHeader(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), probeImageData(), QHttpNetworkReplyPrivate::readHeader(), QPpmHandler::setOption(), wrapInFunction(), and QTextDocumentWriter::write().
QByteArray QByteArray::toPercentEncoding | ( | const QByteArray & | exclude = QByteArray() , |
const QByteArray & | include = QByteArray() , |
||
char | percent = '%' |
||
) | const |
Returns a URI/URL-style percent-encoded copy of this byte array. The percent parameter allows you to override the default '' character for another.
By default, this function will encode all bytes that are not one of the following:
ALPHA ("a" to "z" and "A" to "Z") / DIGIT (0 to 9) / "-" / "." / "_" / "~"
To prevent bytes from being encoded pass them to exclude. To force bytes to be encoded pass them to include. The percent character is always encoded.
Example:
The hex encoding uses the numbers 0-9 and the uppercase letters A-F.
Definition at line 4862 of file qbytearray.cpp.
References QByteArray(), contains(), data(), isEmpty(), isNull(), length(), output, QtMiscUtils::toHexUpper(), and view.
Referenced by QUrl::toPercentEncoding(), and QV4::ExecutableCompilationUnit::verifyHeader().
short QByteArray::toShort | ( | bool * | ok = nullptr , |
int | base = 10 |
||
) | const |
Returns the byte array converted to a short
using base base, which is ten by default.
Bases 0 and 2 through 36 are supported, using letters for digits beyond 9; A is ten, B is eleven and so on.
If base is 0, the base is determined automatically using the following rules: If the byte array begins with "0x", it is assumed to be hexadecimal (base 16); otherwise, if it begins with "0b", it is assumed to be binary (base 2); otherwise, if it begins with "0", it is assumed to be octal (base 8); otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
Definition at line 3987 of file qbytearray.cpp.
References base, ok, and qToByteArrayViewIgnoringNull().
std::string QByteArray::toStdString | ( | ) | const |
Returns a std::string object with the data contained in this QByteArray.
This operator is mostly useful to pass a QByteArray to a function that accepts a std::string object.
Definition at line 4833 of file qbytearray.cpp.
References data().
Referenced by QWasmAudioInput::setAudioDevice(), QWasmAudioOutput::setSource(), QWasmWindow::setWindowIcon(), and QString::toStdString().
Returns the byte array converted to an {unsigned
int} using base base, which is ten by default.
Bases 0 and 2 through 36 are supported, using letters for digits beyond 9; A is ten, B is eleven and so on.
If base is 0, the base is determined automatically using the following rules: If the byte array begins with "0x", it is assumed to be hexadecimal (base 16); otherwise, if it begins with "0b", it is assumed to be binary (base 2); otherwise, if it begins with "0", it is assumed to be octal (base 8); otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
Definition at line 3893 of file qbytearray.cpp.
References base, ok, and qToByteArrayViewIgnoringNull().
Referenced by QMimeMagicRule::QMimeMagicRule(), and QXcbIntegration::QXcbIntegration().
Returns the byte array converted to an {unsigned
long int} using base base, which is ten by default. Bases 0 and 2 through 36 are supported, using letters for digits beyond 9; A is ten, B is eleven and so on.
If base is 0, the base is determined automatically using the following rules: If the byte array begins with "0x", it is assumed to be hexadecimal (base 16); otherwise, if it begins with "0b", it is assumed to be binary (base 2); otherwise, if it begins with "0", it is assumed to be octal (base 8); otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
Definition at line 3957 of file qbytearray.cpp.
References base, ok, and qToByteArrayViewIgnoringNull().
qulonglong QByteArray::toULongLong | ( | bool * | ok = nullptr , |
int | base = 10 |
||
) | const |
Returns the byte array converted to an {unsigned
long long} using base base, which is ten by default.
Bases 0 and 2 through 36 are supported, using letters for digits beyond 9; A is ten, B is eleven and so on.
If base is 0, the base is determined automatically using the following rules: If the byte array begins with "0x", it is assumed to be hexadecimal (base 16); otherwise, if it begins with "0b", it is assumed to be binary (base 2); otherwise, if it begins with "0", it is assumed to be octal (base 8); otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
Definition at line 3831 of file qbytearray.cpp.
References base, ok, and qToByteArrayViewIgnoringNull().
Referenced by QHttpNetworkHeaderPrivate::contentLength(), QPSQLResult::data(), QNetworkReplyHttpImplPrivate::postRequest(), and RCCFileInfo::writeDataInfo().
|
inline |
Definition at line 196 of file qbytearray.h.
|
inline |
Definition at line 194 of file qbytearray.h.
Referenced by QTlsPrivate::TlsCryptographOpenSSL::continueHandshake(), Scanner::process(), QDDSHandler::setOption(), and wrapInFunction().
Returns the byte array converted to an {unsigned
short} using base base, which is ten by default.
Bases 0 and 2 through 36 are supported, using letters for digits beyond 9; A is ten, B is eleven and so on.
If base is 0, the base is determined automatically using the following rules: If the byte array begins with "0x", it is assumed to be hexadecimal (base 16); otherwise, if it begins with "0b", it is assumed to be binary (base 2); otherwise, if it begins with "0", it is assumed to be octal (base 8); otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
Definition at line 4017 of file qbytearray.cpp.
References base, ok, and qToByteArrayViewIgnoringNull().
|
inline |
Definition at line 200 of file qbytearray.h.
|
inline |
Definition at line 198 of file qbytearray.h.
Referenced by QQuickGridScaledImage::QQuickGridScaledImage(), QTlsPrivate::TlsKeyOpenSSL::derFromPem(), QTlsPrivate::TlsKeyGeneric::derFromPem(), QMimerSQLResult::exec(), QHttpNetworkReplyPrivate::getChunkSize(), QSSGRenderShaderMetadata::getShaderMetaData(), ignoreProxyFor(), parseETag(), parseHttpOptionHeader(), QAuthenticatorPrivate::parseHttpResponse(), parseIfMatch(), parseIfNoneMatch(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), QSSGShaderCustomMaterialAdapter::prepareCustomShader(), wrapInFunction(), and QQmlJSStreamWriter::writeEndObject().
Truncates the byte array at index position pos.
If pos is beyond the end of the array, nothing happens.
Example:
Definition at line 1686 of file qbytearray.cpp.
Referenced by QUtf8::convertFromUnicode(), QUtf32::convertFromUnicode(), QZipReader::fileData(), QCoreApplicationPrivate::initLocale(), leftJustified(), QHostInfo::localDomainName(), QIBaseDriver::open(), QDBusConnectionPrivate::prepareHook(), q_fromPercentEncoding(), QTlsPrivate::Q_GLOBAL_STATIC_WITH_ARGS(), qDBusParametersForMethod(), qDecodeDataUrl(), QHttpNetworkReplyPrivate::readStatus(), rightJustified(), set_text(), toBase64(), and wrapInFunction().
|
friend |
Definition at line 66 of file qbytearray.h.
|
related |
\macro QT_NO_CAST_FROM_BYTEARRAY
Disables automatic conversions from QByteArray to const char * or const void *.
Returns a pointer to the data stored in the byte array. The pointer can be used to access and modify the bytes that compose the array. The data is '\0'-terminated, i.e. the number of bytes you can access following the returned pointer is size() + 1, including the '\0' terminator.
Example:
pointer-invalidation-desc
For read-only access, constData() is faster because it never causes a \l{deep copy} to occur.
This function is mostly useful to pass a byte array to a function that accepts a {const char *}.
The following example makes a copy of the char* returned by data(), but it will corrupt the heap and cause a crash because it does not allocate a byte for the '\0' at the end:
This one allocates the correct amount of space:
Note: A QByteArray can store any byte values including '\0's, but most functions that take {char *} arguments assume that the data ends at the first '\0' they encounter.
Definition at line 206 of file qopengles2ext.h.
|
related |
Removes all elements that compare equal to t from the byte array ba. Returns the number of elements removed, if any.
Definition at line 695 of file qbytearray.h.
|
friend |
Removes all elements that compare equal to t from the byte array ba. Returns the number of elements removed, if any.
Definition at line 695 of file qbytearray.h.
|
related |
Removes all elements for which the predicate pred returns true from the byte array ba. Returns the number of elements removed, if any.
Definition at line 701 of file qbytearray.h.
|
friend |
Removes all elements for which the predicate pred returns true from the byte array ba. Returns the number of elements removed, if any.
Definition at line 701 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if '\0'-terminated string a1 is not equal to byte array a2; otherwise returns false
.
Definition at line 316 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if byte array a1 is not equal to the '\0'-terminated string a2; otherwise returns false
.
Definition at line 314 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if byte array a1 is not equal to byte array a2; otherwise returns false
.
Definition at line 312 of file qbytearray.h.
|
friend |
Definition at line 345 of file qbytearray.h.
|
friend |
Definition at line 352 of file qbytearray.h.
|
related |
\macro QByteArrayLiteral(ba)
The macro generates the data for a QByteArray out of the string literal ba at compile time. Creating a QByteArray from it is free in this case, and the generated byte array data is stored in the read-only segment of the compiled object file.
For instance:
Using QByteArrayLiteral instead of a double quoted plain C++ string literal can significantly speed up creation of QByteArray instances from data known at compile time.
Literal operator that creates a QByteArray out of the first size characters in the char string literal str.
The QByteArray is created at compile time, and the generated string data is stored in the read-only segment of the compiled object file. Duplicate literals may share the same read-only memory. This functionality is interchangeable with QByteArrayLiteral, but saves typing when many string literals are present in the code.
The following code creates a QByteArray:
Definition at line 718 of file qbytearray.h.
References str.
|
related |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a byte array that is the result of concatenating byte a1 and byte array a2.
Definition at line 607 of file qbytearray.h.
References a1, a2, and QString::QByteArray.
|
related |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a byte array that is the result of concatenating '\0'-terminated string a1 and byte array a2.
Definition at line 605 of file qbytearray.h.
References a1, a2, and QString::QByteArray.
|
related |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a byte array that is the result of concatenating byte array a1 and byte a2.
Definition at line 601 of file qbytearray.h.
References a1, a2, and QString::QByteArray.
|
related |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a byte array that is the result of concatenating byte array a1 and '\0'-terminated string a2.
Definition at line 597 of file qbytearray.h.
References a1, a2, and QString::QByteArray.
|
related |
Returns a byte array that is the result of concatenating byte array a1 and byte array a2.
Definition at line 593 of file qbytearray.h.
References a1, a2, and QString::QByteArray.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if '\0'-terminated string a1 is lexically less than byte array a2; otherwise returns false
.
Definition at line 322 of file qbytearray.h.
|
friend |
Definition at line 346 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if byte array a1 is lexically less than the '\0'-terminated string a2; otherwise returns false
.
Definition at line 320 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if byte array a1 is lexically less than byte array a2; otherwise returns false
.
Definition at line 318 of file qbytearray.h.
|
friend |
Definition at line 353 of file qbytearray.h.
|
related |
Writes byte array ba to the stream out and returns a reference to the stream.
Definition at line 3266 of file qbytearray.cpp.
References ba, constData(), isNull(), out, and size().
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if '\0'-terminated string a1 is lexically less than or equal to byte array a2; otherwise returns false
.
Definition at line 328 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if byte array a1 is lexically less than or equal to the '\0'-terminated string a2; otherwise returns false
.
Definition at line 326 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if byte array a1 is lexically less than or equal to byte array a2; otherwise returns false
.
Definition at line 324 of file qbytearray.h.
|
friend |
Definition at line 348 of file qbytearray.h.
|
friend |
Definition at line 355 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if '\0'-terminated string a1 is equal to byte array a2; otherwise returns false
.
Definition at line 310 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if byte array a1 is equal to the '\0'-terminated string a2; otherwise returns false
.
Definition at line 308 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if byte array a1 is equal to byte array a2; otherwise returns false
.
Definition at line 306 of file qbytearray.h.
|
friend |
Definition at line 344 of file qbytearray.h.
|
friend |
Definition at line 351 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if '\0'-terminated string a1 is lexically greater than byte array a2; otherwise returns false
.
Definition at line 334 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if byte array a1 is lexically greater than the '\0'-terminated string a2; otherwise returns false
.
Definition at line 332 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if byte array a1 is lexically greater than byte array a2; otherwise returns false
.
Definition at line 330 of file qbytearray.h.
|
friend |
Definition at line 347 of file qbytearray.h.
|
friend |
Definition at line 354 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if '\0'-terminated string a1 is lexically greater than or equal to byte array a2; otherwise returns false
.
Definition at line 340 of file qbytearray.h.
|
friend |
Definition at line 349 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if byte array a1 is lexically greater than or equal to the '\0'-terminated string a2; otherwise returns false
.
Definition at line 338 of file qbytearray.h.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true
if byte array a1 is lexically greater than or equal to byte array a2; otherwise returns false
.
Definition at line 336 of file qbytearray.h.
|
friend |
Definition at line 356 of file qbytearray.h.
|
related |
Reads a byte array into ba from the stream in and returns a reference to the stream.
Definition at line 3283 of file qbytearray.cpp.
References ba, blockSize, clear(), data(), qMin(), QDataStream::ReadPastEnd, and resize().
|
related |
Returns the CRC-16 checksum of data.
The checksum is independent of the byte order (endianness) and will be calculated accorded to the algorithm published in standard. By default the algorithm published in ISO 3309 (Qt::ChecksumIso3309) is used.
Definition at line 462 of file qbytearray.cpp.
References Qt::ChecksumIso3309, Qt::ChecksumItuV41, and crc_tbl.
|
related |
Compresses the data byte array and returns the compressed data in a new byte array.
The compressionLevel parameter specifies how much compression should be used. Valid values are between 0 and 9, with 9 corresponding to the greatest compression (i.e. smaller compressed data) at the cost of using a slower algorithm. Smaller values (8, 7, ..., 1) provide successively less compression at slightly faster speeds. The value 0 corresponds to no compression at all. The default value is -1, which specifies zlib's default compression.
Definition at line 641 of file qbytearray.h.
References qCompress().
|
related |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compresses the first nbytes of data at compression level compressionLevel and returns the compressed data in a new byte array.
Definition at line 664 of file qbytearray.cpp.
References QTypedArrayData< T >::allocate(), capacity, Compression, dataIsNull(), deflate(), QArrayData::Grow, HeaderSize, lengthIsNegative(), out, qToBigEndian(), tooMuchData(), and xxflate().
|
related |
\target bytearray-qsnprintf
A portable snprintf() function, calls qvsnprintf.
fmt is the printf()
format string. The result is put into str, which is a buffer of at least n bytes.
Definition at line 82 of file qvsnprintf.cpp.
References fmt, qvsnprintf(), ret, and str.
|
related |
A safe strcmp()
function.
Compares str1 and str2. Returns a negative value if str1 is less than str2, 0 if str1 is equal to str2 or a positive value if str1 is greater than str2.
If both strings are \nullptr, they are deemed equal; otherwise, if either is \nullptr, it is treated as less than the other (even if the other is an empty string).
Definition at line 180 of file qbytearray.cpp.
|
related |
Copies all the characters up to and including the '\0' from src into dst and returns a pointer to dst.
If src is \nullptr, it immediately returns \nullptr.
This function assumes that dst is large enough to hold the contents of src.
Definition at line 94 of file qbytearray.cpp.
|
related |
Returns a duplicate string.
Allocates space for a copy of src, copies it, and returns a pointer to the copy. If src is \nullptr, it immediately returns \nullptr.
Ownership is passed to the caller, so the returned string must be deleted using delete
[].
Definition at line 72 of file qbytearray.cpp.
References qstrcpy().
|
related |
A safe stricmp()
function.
Compares str1 and str2, ignoring differences in the case of any ASCII characters.
Returns a negative value if str1 is less than str2, 0 if str1 is equal to str2 or a positive value if str1 is greater than str2.
If both strings are \nullptr, they are deemed equal; otherwise, if either is \nullptr, it is treated as less than the other (even if the other is an empty string).
Definition at line 225 of file qbytearray.cpp.
References QtMiscUtils::caseCompareAscii(), forever, qCountLeadingZeroBits(), qCountTrailingZeroBits(), s2, and zero.
|
friend |
Definition at line 511 of file qbytearray.h.
|
related |
A safe strlen()
function.
Returns the number of characters that precede the terminating '\0', or 0 if str is \nullptr.
Definition at line 98 of file qbytearrayalgorithms.h.
References QT_WARNING_DISABLE_GCC, QT_WARNING_POP, QT_WARNING_PUSH, and str.
Referenced by QByteArray().
|
related |
A safe strncmp()
function.
Compares at most len bytes of str1 and str2.
Returns a negative value if str1 is less than str2, 0 if str1 is equal to str2 or a positive value if str1 is greater than str2.
If both strings are \nullptr, they are deemed equal; otherwise, if either is \nullptr, it is treated as less than the other (even if the other is an empty string or len is 0).
Definition at line 124 of file qbytearrayalgorithms.h.
|
related |
A safe strncpy()
function.
Copies at most len bytes from src (stopping at len or the terminating '\0' whichever comes first) into dst. Guarantees that dst is '\0'-terminated, except when dst is \nullptr or len is 0. If src is \nullptr, returns \nullptr, otherwise returns dst.
This function assumes that dst is at least len characters long.
Definition at line 131 of file qbytearray.cpp.
|
related |
A safe strnicmp()
function.
Compares at most len bytes of str1 and str2, ignoring differences in the case of any ASCII characters.
Returns a negative value if str1 is less than str2, 0 if str1 is equal to str2 or a positive value if str1 is greater than str2.
If both strings are \nullptr, they are deemed equal; otherwise, if either is \nullptr, it is treated as less than the other (even if the other is an empty string or len is 0).
Definition at line 315 of file qbytearray.cpp.
References QtMiscUtils::caseCompareAscii(), s1, and s2.
|
related |
A safe strnlen()
function.
Returns the number of characters that precede the terminating '\0', but at most maxlen. If str is \nullptr, returns 0.
Definition at line 110 of file qbytearrayalgorithms.h.
References str.
|
related |
Uncompresses the data byte array and returns a new byte array with the uncompressed data.
Returns an empty QByteArray if the input data was corrupt.
This function will uncompress data compressed with qCompress() from this and any earlier Qt version, back to Qt 3.1 when this feature was added.
{Note:} If you want to use this function to uncompress external data that was compressed using zlib, you first need to prepend a four byte header to the byte array containing the data. The header must contain the expected length (in bytes) of the uncompressed data, expressed as an unsigned, big-endian, 32-bit integer. This number is just a hint for the initial size of the output buffer size, though. If the indicated size is too small to hold the result, the output buffer size will still be increased until either the output fits or the system runs out of memory. So, despite the 32-bit header, this function, on 64-bit platforms, can produce more than 4GiB of output.
Definition at line 643 of file qbytearray.h.
References qUncompress().
|
related |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Uncompresses the first nbytes of data and returns a new byte array with the uncompressed data.
Definition at line 756 of file qbytearray.cpp.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Uncompresses the first nbytes of data and returns a new byte array with the uncompressed data.
Definition at line 756 of file qbytearray.cpp.
|
related |
A portable vsnprintf()
function.
Will call ::vsnprintf()
, ::_vsnprintf()
, or ::vsnprintf_s
depending on the system, or fall back to an internal version.
fmt is the printf()
format string. The result is put into str, which is a buffer of at least n bytes.
The caller is responsible to call va_end()
on ap.
Ideally, you should never call this function but use QString::asprintf() instead.
Definition at line 37 of file qvsnprintf.cpp.
References ba, constData(), fmt, length(), qMin(), str, QString::toLocal8Bit(), and QString::vasprintf().