Qt 4.8
|
The QByteArray class provides an array of bytes. More...
#include <qbytearray.h>
Classes | |
struct | Data |
Public Types | |
typedef const char * | const_iterator |
typedef const char & | const_reference |
typedef const_iterator | ConstIterator |
typedef Data * | DataPtr |
typedef char * | iterator |
typedef iterator | Iterator |
typedef char & | reference |
typedef char | value_type |
Public Functions | |
QByteArray & | append (char c) |
Appends the character ch to this byte array. More... | |
QByteArray & | append (const char *s) |
Appends the string str to this byte array. More... | |
QByteArray & | append (const char *s, int len) |
QByteArray & | append (const QByteArray &a) |
Appends the byte array ba onto the end of this byte array. More... | |
QT_ASCII_CAST_WARN QByteArray & | append (const QString &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 string str to this byte array. More... | |
char | at (int i) const |
Returns the character at index position i in the byte array. More... | |
iterator | begin () |
const_iterator | begin () const |
int | capacity () const |
Returns the maximum number of bytes that can be stored in the byte array without forcing a reallocation. More... | |
void | chop (int n) |
Removes n bytes from the end of the byte array. More... | |
void | clear () |
Clears the contents of the byte array and makes it empty. More... | |
const_iterator | constBegin () const |
const char * | constData () const |
Returns a pointer to the data stored in the byte array. More... | |
const_iterator | constEnd () const |
QBool | contains (char c) const |
Returns true if the byte array contains the character ch; otherwise returns false. More... | |
QBool | contains (const char *a) 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 string str; otherwise returns false. More... | |
QBool | contains (const QByteArray &a) const |
Returns true if the byte array contains an occurrence of the byte array ba; otherwise returns false. More... | |
int | count (char c) const |
Returns the number of occurrences of character ch in the byte array. More... | |
int | count (const char *a) const |
Returns the number of (potentially overlapping) occurrences of string str in the byte array. More... | |
int | count (const QByteArray &a) const |
Returns the number of (potentially overlapping) occurrences of byte array ba in this byte array. More... | |
int | count () const |
Same as size(). More... | |
char * | data () |
Returns a pointer to the data stored in the byte array. More... | |
const char * | data () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
DataPtr & | data_ptr () |
void | detach () |
iterator | end () |
const_iterator | end () const |
bool | endsWith (const QByteArray &a) const |
Returns true if this byte array ends with byte array ba; otherwise returns false. More... | |
bool | endsWith (char c) const |
Returns true if this byte array ends with character ch; otherwise returns false. More... | |
bool | endsWith (const char *c) const |
Returns true if this byte array ends with string str; otherwise returns false. More... | |
QByteArray & | fill (char c, int size=-1) |
Sets every byte in the byte array to character ch. More... | |
int | indexOf (char c, int from=0) const |
Returns the index position of the first occurrence of the character ch in the byte array, searching forward from index position from. More... | |
int | indexOf (const char *c, int 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 first occurrence of the string str in the byte array, searching forward from index position from. More... | |
int | indexOf (const QByteArray &a, int from=0) const |
Returns the index position of the first occurrence of the byte array ba in this byte array, searching forward from index position from. More... | |
QT_ASCII_CAST_WARN int | indexOf (const QString &s, int 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 first occurrence of the string str in the byte array, searching forward from index position from. More... | |
QByteArray & | insert (int i, char c) |
Inserts character ch at index position i in the byte array. More... | |
QByteArray & | insert (int i, const char *s) |
Inserts the string str at position i in the byte array. More... | |
QByteArray & | insert (int i, const char *s, int len) |
Inserts len bytes of the string str at position i in the byte array. More... | |
QByteArray & | insert (int i, const QByteArray &a) |
Inserts the byte array ba at index position i and returns a reference to this byte array. More... | |
QT_ASCII_CAST_WARN QByteArray & | insert (int i, const QString &s) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Inserts the string str at index position i in the byte array. More... | |
bool | isDetached () const |
bool | isEmpty () const |
Returns true if the byte array has size 0; otherwise returns false. More... | |
bool | isNull () const |
Returns true if this byte array is null; otherwise returns false. More... | |
bool | isSharedWith (const QByteArray &other) const |
int | lastIndexOf (char c, int from=-1) const |
Returns the index position of the last occurrence of character ch in the byte array, searching backward from index position from. More... | |
int | lastIndexOf (const char *c, int 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 last occurrence of the string str in the byte array, searching backward from index position from. More... | |
int | lastIndexOf (const QByteArray &a, int from=-1) const |
Returns the index position of the last occurrence of the byte array ba in this byte array, searching backward from index position from. More... | |
QT_ASCII_CAST_WARN int | lastIndexOf (const QString &s, int 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 last occurrence of the string str in the byte array, searching backward from index position from. More... | |
QByteArray | left (int len) const |
Returns a byte array that contains the leftmost len bytes of this byte array. More... | |
QByteArray | leftJustified (int width, char fill=' ', bool truncate=false) const |
Returns a byte array of size width that contains this byte array padded by the fill character. More... | |
int | length () const |
Same as size(). More... | |
QByteArray | mid (int index, int len=-1) const |
Returns a byte array containing len bytes from this byte array, starting at position pos. More... | |
operator const char * () const | |
QT_ASCII_CAST_WARN bool | operator!= (const QString &s2) const |
Returns true if this byte array is not equal to string str; otherwise returns false. More... | |
QByteArray & | operator+= (char c) |
Appends the character ch onto the end of this byte array and returns a reference to this byte array. More... | |
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 string str onto the end of this byte array and returns a reference to this byte array. More... | |
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. More... | |
QT_ASCII_CAST_WARN QByteArray & | operator+= (const QString &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 string str onto the end of this byte array and returns a reference to this byte array. More... | |
QT_ASCII_CAST_WARN bool | operator< (const QString &s2) const |
Returns true if this byte array is lexically less than string str; otherwise returns false. More... | |
QT_ASCII_CAST_WARN bool | operator<= (const QString &s2) const |
Returns true if this byte array is lexically less than or equal to string str; otherwise returns false. More... | |
QByteArray & | operator= (const QByteArray &) |
Assigns other to this byte array and returns a reference to this byte array. More... | |
QByteArray & | operator= (const char *str) |
Assigns str to this byte array. More... | |
QT_ASCII_CAST_WARN bool | operator== (const QString &s2) const |
Returns true if this byte array is equal to string str; otherwise returns false. More... | |
QT_ASCII_CAST_WARN bool | operator> (const QString &s2) const |
Returns true if this byte array is lexically greater than string str; otherwise returns false. More... | |
QT_ASCII_CAST_WARN bool | operator>= (const QString &s2) const |
Returns true if this byte array is greater than or equal to string str; otherwise returns false. More... | |
char | operator[] (int i) const |
Same as at(i). More... | |
char | operator[] (uint i) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
QByteRef | operator[] (int i) |
Returns the byte at index position i as a modifiable reference. More... | |
QByteRef | operator[] (uint i) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
QByteArray & | prepend (char c) |
Prepends the character ch to this byte array. More... | |
QByteArray & | prepend (const char *s) |
Prepends the string str to this byte array. More... | |
QByteArray & | prepend (const char *s, int len) |
Prepends len bytes of the string str to this byte array. More... | |
QByteArray & | prepend (const QByteArray &a) |
Prepends the byte array ba to this byte array and returns a reference to this byte array. More... | |
void | push_back (char c) |
Same as append(ch). More... | |
void | push_back (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 append(str). More... | |
void | push_back (const QByteArray &a) |
This function is provided for STL compatibility. More... | |
void | push_front (char c) |
Same as prepend(ch). More... | |
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). More... | |
void | push_front (const QByteArray &a) |
This function is provided for STL compatibility. More... | |
QByteArray () | |
Constructs an empty byte array. More... | |
QByteArray (const char *) | |
Constructs a byte array initialized with the string str. More... | |
QByteArray (const char *, int size) | |
Constructs a byte array containing the first size bytes of array data. More... | |
QByteArray (int size, char c) | |
Constructs a byte array of size size with every byte set to character ch. More... | |
QByteArray (int size, Qt::Initialization) | |
Constructs a byte array of size size with uninitialized contents. More... | |
QByteArray (const QByteArray &) | |
Constructs a copy of other. More... | |
QByteArray & | remove (int index, int len) |
Removes len bytes from the array, starting at index position pos, and returns a reference to the array. More... | |
QByteArray | repeated (int times) const |
Returns a copy of this byte array repeated the specified number of times. More... | |
QByteArray & | replace (int index, int len, 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.Replaces len bytes from index position pos with the zero terminated string after. More... | |
QByteArray & | replace (int index, int len, const char *s, int 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 from the string after. More... | |
QByteArray & | replace (int index, int len, const QByteArray &s) |
Replaces len bytes from index position pos with the byte array after, and returns a reference to this byte array. More... | |
QByteArray & | replace (char before, const 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 character before with the string after. More... | |
QByteArray & | replace (char before, const QByteArray &after) |
Replaces every occurrence of the character before with the byte array after. More... | |
QByteArray & | replace (const char *before, const 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 string before with the string after. More... | |
QByteArray & | replace (const char *before, int bsize, const char *after, int 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 string before with the string after. More... | |
QByteArray & | replace (const QByteArray &before, const QByteArray &after) |
Replaces every occurrence of the byte array before with the byte array after. More... | |
QByteArray & | replace (const QByteArray &before, const 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 array before with the string after. More... | |
QByteArray & | replace (const char *before, const QByteArray &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 string before with the byte array after. More... | |
QByteArray & | replace (char before, char after) |
Replaces every occurrence of the character before with the character after. More... | |
QT_ASCII_CAST_WARN QByteArray & | replace (const QString &before, const 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 string before with the string after. More... | |
QT_ASCII_CAST_WARN QByteArray & | replace (char c, const QString &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 character before with the string after. More... | |
QT_ASCII_CAST_WARN QByteArray & | replace (const QString &before, const QByteArray &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 string before with the byte array after. More... | |
void | reserve (int size) |
Attempts to allocate memory for at least size bytes. More... | |
void | resize (int size) |
Sets the size of the byte array to size bytes. More... | |
QByteArray | right (int len) const |
Returns a byte array that contains the rightmost len bytes of this byte array. More... | |
QByteArray | rightJustified (int width, char fill=' ', bool truncate=false) const |
Returns a byte array of size width that contains the fill character followed by this byte array. More... | |
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. More... | |
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. More... | |
QByteArray & | setNum (int, int base=10) |
Sets the byte array to the printed value of n in base base (10 by default) and returns a reference to the byte array. More... | |
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. More... | |
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. More... | |
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. More... | |
QByteArray & | setNum (float, char f='g', int prec=6) |
Sets the byte array to the printed value of n, formatted in format f with precision prec, and returns a reference to the byte array. More... | |
QByteArray & | setNum (double, char f='g', int prec=6) |
Sets the byte array to the printed value of n, formatted in format f with precision prec, and returns a reference to the byte array. More... | |
QByteArray & | setRawData (const char *a, uint n) |
Resets the QByteArray to use the first size bytes of the data array. More... | |
QByteArray | simplified () const |
Returns a byte array that has whitespace removed from the start and the end, and which has each sequence of internal whitespace replaced with a single space. More... | |
int | size () const |
Returns the number of bytes in this byte array. More... | |
QList< QByteArray > | split (char sep) const |
Splits the byte array into subarrays wherever sep occurs, and returns the list of those arrays. More... | |
void | squeeze () |
Releases any memory not required to store the array's data. More... | |
bool | startsWith (const QByteArray &a) const |
Returns true if this byte array starts with byte array ba; otherwise returns false. More... | |
bool | startsWith (char c) const |
Returns true if this byte array starts with character ch; otherwise returns false. More... | |
bool | startsWith (const char *c) const |
Returns true if this byte array starts with string str; otherwise returns false. More... | |
void | swap (QByteArray &other) |
Swaps byte array other with this byte array. More... | |
QByteArray | toBase64 () const |
Returns a copy of the byte array, encoded as Base64. More... | |
double | toDouble (bool *ok=0) const |
Returns the byte array converted to a double value. More... | |
float | toFloat (bool *ok=0) const |
Returns the byte array converted to a float value. More... | |
QByteArray | toHex () const |
Returns a hex encoded copy of the byte array. More... | |
int | toInt (bool *ok=0, int base=10) const |
Returns the byte array converted to an int using base base, which is 10 by default and must be between 2 and 36, or 0. More... | |
long | toLong (bool *ok=0, int base=10) const |
qlonglong | toLongLong (bool *ok=0, int base=10) const |
Returns the byte array converted to a {long long} using base base, which is 10 by default and must be between 2 and 36, or 0. More... | |
QByteArray | toLower () const |
Returns a lowercase copy of the byte array. More... | |
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. More... | |
short | toShort (bool *ok=0, int base=10) const |
Returns the byte array converted to a short using base base, which is 10 by default and must be between 2 and 36, or 0. More... | |
uint | toUInt (bool *ok=0, int base=10) const |
Returns the byte array converted to an {unsigned int} using base base, which is 10 by default and must be between 2 and 36, or 0. More... | |
ulong | toULong (bool *ok=0, int base=10) const |
qulonglong | toULongLong (bool *ok=0, int base=10) const |
Returns the byte array converted to an {unsigned long long} using base base, which is 10 by default and must be between 2 and 36, or 0. More... | |
QByteArray | toUpper () const |
Returns an uppercase copy of the byte array. More... | |
ushort | toUShort (bool *ok=0, int base=10) const |
Returns the byte array converted to an {unsigned short} using base base, which is 10 by default and must be between 2 and 36, or 0. More... | |
QByteArray | trimmed () const |
Returns a byte array that has whitespace removed from the start and the end. More... | |
void | truncate (int pos) |
Truncates the byte array at index position pos. More... | |
~QByteArray () | |
Destroys the byte array. More... | |
Static Public Functions | |
static QByteArray | fromBase64 (const QByteArray &base64) |
Returns a decoded copy of the Base64 array base64. More... | |
static QByteArray | fromHex (const QByteArray &hexEncoded) |
Returns a decoded copy of the hex encoded array hexEncoded. More... | |
static QByteArray | fromPercentEncoding (const QByteArray &pctEncoded, char percent='%') |
Returns a decoded copy of the URI/URL-style percent-encoded input. More... | |
static QByteArray | fromRawData (const char *, int size) |
Constructs a QByteArray that uses the first size bytes of the data array. More... | |
static QByteArray | number (int, int base=10) |
Returns a byte array containing the string equivalent of the number n to base base (10 by default). More... | |
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. More... | |
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. More... | |
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. More... | |
static QByteArray | number (double, char f='g', int prec=6) |
Returns a byte array that contains the printed value of n, formatted in format f with precision prec. More... | |
Private Functions | |
void | expand (int i) |
QByteArray | nulTerminated () const |
Return a QByteArray that is sure to be NUL-terminated. More... | |
operator QNoImplicitBoolCast () const | |
QByteArray (Data *dd, int, int) | |
void | realloc (int alloc) |
Properties | |
Data * | d |
Static Private Attributes | |
static Data | shared_empty |
static Data | shared_null |
Friends | |
class | QByteRef |
class | QString |
Q_CORE_EXPORT QByteArray | qUncompress (const uchar *data, int nbytes) |
Uncompresses the first nbytes of data and returns a new byte array with the uncompressed data. More... | |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator!= (const QByteArray &a1, const QByteArray &a2) |
Returns true if byte array a1 is not equal to byte array a2; otherwise returns false. More... | |
bool | operator!= (const QByteArray &a1, const char *a2) |
bool | operator!= (const char *a1, const QByteArray &a2) |
const 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. More... | |
const QByteArray | operator+ (const QByteArray &a1, const char *a2) |
const QByteArray | operator+ (const QByteArray &a1, char a2) |
Returns a byte array that is the result of concatenating byte array a1 and character a2. More... | |
const QByteArray | operator+ (const char *a1, const QByteArray &a2) |
const QByteArray | operator+ (char a1, const QByteArray &a2) |
Returns a byte array that is the result of concatenating character a1 and byte array a2. More... | |
bool | operator< (const QByteArray &a1, const QByteArray &a2) |
Returns true if byte array a1 is lexically less than byte array a2; otherwise returns false. More... | |
bool | operator< (const QByteArray &a1, const char *a2) |
bool | operator< (const char *a1, const QByteArray &a2) |
QDataStream & | operator<< (QDataStream &out, const QByteArray &ba) |
Writes byte array ba to the stream out and returns a reference to the stream. More... | |
bool | operator<= (const QByteArray &a1, const QByteArray &a2) |
Returns true if byte array a1 is lexically less than or equal to byte array a2; otherwise returns false. More... | |
bool | operator<= (const QByteArray &a1, const char *a2) |
bool | operator<= (const char *a1, const QByteArray &a2) |
bool | operator== (const QByteArray &a1, const QByteArray &a2) |
Returns true if byte array a1 is equal to byte array a2; otherwise returns false. More... | |
bool | operator== (const QByteArray &a1, const char *a2) |
bool | operator== (const char *a1, const QByteArray &a2) |
bool | operator> (const QByteArray &a1, const QByteArray &a2) |
Returns true if byte array a1 is lexically greater than byte array a2; otherwise returns false. More... | |
bool | operator> (const QByteArray &a1, const char *a2) |
bool | operator> (const char *a1, const QByteArray &a2) |
bool | operator>= (const QByteArray &a1, const QByteArray &a2) |
Returns true if byte array a1 is lexically greater than or equal to byte array a2; otherwise returns false. More... | |
bool | operator>= (const QByteArray &a1, const char *a2) |
bool | operator>= (const char *a1, const QByteArray &a2) |
QDataStream & | operator>> (QDataStream &in, QByteArray &ba) |
Reads a byte array into ba from the stream in and returns a reference to the stream. More... | |
quint16 | qChecksum (const char *data, uint len) |
Returns the CRC-16 checksum of the first len bytes of data. More... | |
QByteArray | qCompress (const QByteArray &data, int compressionLevel) |
Compresses the data byte array and returns the compressed data in a new byte array. More... | |
QByteArray | qCompress (const uchar *data, int nbytes, int compressionLevel) |
Compresses the first nbytes of data and returns the compressed data in a new byte array. More... | |
int | qsnprintf (char *str, size_t n, const char *fmt,...) |
A portable snprintf() function, calls qvsnprintf. More... | |
int | qstrcmp (const char *str1, const char *str2) |
A safe strcmp() function. More... | |
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. More... | |
char * | qstrdup (const char *src) |
Returns a duplicate string. More... | |
int | qstricmp (const char *str1, const char *str2) |
A safe stricmp() function. More... | |
uint | qstrlen (const char *str) |
int | qstrncmp (const char *str1, const char *str2, uint len) |
char * | qstrncpy (char *dst, const char *src, uint len) |
A safe strncpy() function. More... | |
int | qstrnicmp (const char *str1, const char *str2, uint len) |
A safe strnicmp() function. More... | |
uint | qstrnlen (const char *str, uint maxlen) |
QByteArray | qUncompress (const QByteArray &data) |
Uncompresses the data byte array and returns a new byte array with the uncompressed data. More... | |
int | qvsnprintf (char *str, size_t n, const char *fmt, va_list ap) |
A portable vsnprintf() function. More... | |
The QByteArray class provides an array of bytes.
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 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 stores 16-bit Unicode characters, making it easy to store non-ASCII/non-Latin-1 characters in your application. 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' character 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 performance reasons you don't want to take a deep copy of the character data, use QByteArray::fromRawData() instead.)
Another approach is to set the size of the array using resize() and to initialize the data byte per 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 deep copy to occur.
To extract many bytes at a time, use left(), right(), or mid().
A QByteArray can embed '\0' bytes. The size() function always returns the size of the whole array, including embedded '\0' bytes. If you want to obtain the length of the data up to and excluding the first '\0' character, 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 character data, 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 a 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:
The replace() and remove() functions' first two arguments are the position from which to start erasing and the number of bytes that should be erased.
When you append() data to a non-empty array, the array will be reallocated and the new data copied to it. You can avoid this behavior by calling reserve(), which preallocates a certain amount of memory. You can also call capacity() to find out how much memory QByteArray actually allocated. Data appended to an empty array is not copied.
A frequent requirement is to remove whitespace characters from a byte array ('\n', '\t', ' ', etc.). If you want to remove whitespace from both ends of a QByteArray, use trimmed(). If you want to remove whitespace from both ends and replace multiple consecutive whitespaces with a single space character within the byte array, use simplified().
If you want to find all occurrences of a particular character or substring 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 character or substring if they find it; otherwise, they return -1. For example, here's a typical loop that finds all occurrences of a particular substring:
If you simply want to check whether a QByteArray contains a particular character or substring, use contains(). If you want to find out how many times a particular character or substring 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.
QByteArrays 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 characters 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 pointer to a '\0' character for a null byte array (not a null pointer), and QByteArray() compares equal to QByteArray(""). We recommend that you always use isEmpty() and avoid isNull().
Functions that perform conversions between numeric data types and strings are performed in the C locale, irrespective of the user's locale settings. Use QString to perform locale-aware conversions between numbers and strings.
Definition at line 135 of file qbytearray.h.
Definition at line 334 of file qbytearray.h.
Definition at line 345 of file qbytearray.h.
Definition at line 336 of file qbytearray.h.
Definition at line 396 of file qbytearray.h.
Definition at line 333 of file qbytearray.h.
Definition at line 335 of file qbytearray.h.
Definition at line 346 of file qbytearray.h.
Definition at line 347 of file qbytearray.h.
|
inline |
Constructs an empty byte array.
Definition at line 400 of file qbytearray.h.
Referenced by fromPercentEncoding(), fromRawData(), left(), mid(), operator+(), QByteArray(), repeated(), right(), toPercentEncoding(), and trimmed().
QByteArray::QByteArray | ( | const char * | str | ) |
Constructs a byte array initialized with the string str.
QByteArray makes a deep copy of the string data.
Definition at line 1401 of file qbytearray.cpp.
QByteArray::QByteArray | ( | const char * | data, |
int | size | ||
) |
Constructs a byte array containing the first size bytes of array data.
If data is 0, a null byte array is constructed.
QByteArray makes a deep copy of the string data.
Definition at line 1430 of file qbytearray.cpp.
QByteArray::QByteArray | ( | int | size, |
char | ch | ||
) |
Constructs a byte array of size size with every byte set to character ch.
Definition at line 1455 of file qbytearray.cpp.
QByteArray::QByteArray | ( | int | size, |
Qt::Initialization | |||
) |
Constructs a byte array of size size with uninitialized contents.
Definition at line 1480 of file qbytearray.cpp.
|
inline |
Constructs a copy of other.
This operation takes constant time, because QByteArray is 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 linear time.
Definition at line 439 of file qbytearray.h.
|
inline |
|
inlineprivate |
Definition at line 387 of file qbytearray.h.
QByteArray & QByteArray::append | ( | char | ch | ) |
Appends the character ch to this byte array.
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 1817 of file qbytearray.cpp.
Referenced by _q_dupEnvironment(), QFileSystemEngine::absoluteName(), QScript::QObjectConnectionManager::addSignalHandler(), QHttpNetworkReplyPrivate::appendCompressedReplyData(), QDeclarativeCompiler::buildDynamicMeta(), QUrlPrivate::canonicalHost(), QDeclarativeCompiler::compileAlias(), QDeclarativeListModelParser::compileProperty(), QDeclarativeObjectMethodScriptClass::connect(), QObject::connect(), ShaderEffectItem::connectPropertySignals(), QWindowsMimeURI::convertFromMime(), QDeclarativeObjectMethodScriptClass::disconnect(), QObject::disconnect(), QDeclarativeXMLHttpRequest::downloadProgress(), QDeclarativeCompiler::dumpStats(), QGLEngineSharedShaders::findProgramInCache(), QDeclarativeXMLHttpRequest::finished(), QGLPixmapConvolutionFilter::generateConvolutionShader(), generateGlyphTables(), QHttpNetworkReplyPrivate::getChunkSize(), QRegExpEngine::getEscape(), Maemo::getVariantFromDBusMessage(), QHttpNetworkReplyPrivate::gunzipBodyPartially(), QSslSocketBackendPrivate::initSslContext(), QMetaMethod::invoke(), QTextList::itemText(), QAxServerBase::Load(), QScriptEnginePrivate::newQObject(), QUrlPrivate::normalized(), QIBaseDriver::open(), operator+=(), QDeclarativeCompiledData::pack(), QDBusMetaObjectGenerator::parseMethods(), QDBusMetaObjectGenerator::parseSignals(), QWSDirectPainterSurface::permanentState(), QHttpNetworkConnectionChannel::pipelineInto(), prepend(), QPdfEnginePrivate::printString(), QDeclarativeBindingCompiler::program(), push_back(), qEncodeHmacMd5(), qEncodeLmv2Response(), qEncodeNtlmv2Response(), qGetBinaryData(), QGLEngineSharedShaders::QGLEngineSharedShaders(), QTest::qSignalDumperCallback(), qstring_to_xtp(), qt_socks5_set_host_address_and_port(), qt_socks5_set_host_name_and_port(), read_xpm_body(), QHttpNetworkReplyPrivate::readHeader(), QHttpNetworkReplyPrivate::readStatus(), QPacketProtocolPrivate::readyToRead(), QAuthDevice::recvReadyRead(), QScript::QObjectConnectionManager::removeSignalHandler(), QOstDevicePrivate::RunL(), runlengthEncode(), QWinSettingsPrivate::set(), QDeclarativeParser::Object::setBindingBit(), QNetworkHeadersPrivate::setRawHeaderInternal(), QSslSocketBackendPrivate::startHandshake(), QTest::toString(), QLocalePrivate::validateChars(), Maemo::IAPConfPrivate::valueToVariant(), QWindowsPipeWriter::write(), and write_pbm_image().
QByteArray & QByteArray::append | ( | const char * | str | ) |
Appends the string str to this byte array.
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 1767 of file qbytearray.cpp.
QByteArray & QByteArray::append | ( | const char * | s, |
int | len | ||
) |
Definition at line 1794 of file qbytearray.cpp.
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 implicitly shared class. Consequently, if this is an empty QByteArray, then this will just share the data held in ba. In this case, no copying of data is done, taking constant time. If a shared instance is modified, it will be copied (copy-on-write), taking linear time.
If this is not an empty QByteArray, a deep copy of the data is performed, taking 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 1729 of file qbytearray.cpp.
|
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 string str to this byte array.
The Unicode data is converted into 8-bit characters using QString::toAscii().
If the QString contains non-ASCII Unicode characters, using this function can lead to loss of information. You can disable this function by defining QT_NO_CAST_TO_ASCII
when you compile your applications. You then need to call QString::toAscii() (or QString::toLatin1() or QString::toUtf8() or QString::toLocal8Bit()) explicitly if you want to convert the data to const char *
.
Definition at line 996 of file qstring.h.
|
inline |
Returns the character 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 413 of file qbytearray.h.
Referenced by QFontDatabasePrivate::addQPF2File(), MetaObjectGenerator::addSetterSlot(), QSocks5PasswordAuthenticator::continueAuthenticate(), QWindowsMimeHtml::convertToMime(), QDBusArgumentPrivate::createSignature(), QODBCResult::exec(), QDeclarativeImportedNamespace::find_helper(), fromBase64(), fromHex(), QUrl::fromPunycode(), QXmlInputSource::fromRawData(), QXmlStreamReaderPrivate::getChar_helper(), QSettingsPrivate::iniEscapedString(), QWSDisplay::Data::init(), QSettingsPrivate::iniUnescapedKey(), QSettingsPrivate::iniUnescapedStringList(), QDeclarativeCompiler::isAttachedPropertyName(), QDeclarativeCompiler::isSignalPropertyName(), matchLineFeed(), QXlibMime::mimeConvertToFormat(), nextField(), nextNonWhitespace(), QUrlPrivate::normalized(), normalizeTypeInternal(), QSocks5SocketEnginePrivate::parseAuthenticationMethodReply(), QHttpNetworkReplyPrivate::parseHeader(), parseHeaderName(), parseHttpOptionHeader(), QSocks5SocketEnginePrivate::parseRequestMethodReply(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), QHttpNetworkReplyPrivate::parseStatus(), QPictureIO::pictureFormat(), qax_generateDocumentation(), qDecodeDataUrl(), qHash(), qt_read_xpm_image_or_array(), read_xpm_string(), MetaObjectGenerator::readFuncsInfo(), QConfFileSettingsPrivate::readIniFile(), QConfFileSettingsPrivate::readIniLine(), QConfFileSettingsPrivate::readIniSection(), QPlatformFontDatabase::registerQPF2Font(), QUrl::resolved(), QUrl::setEncodedQueryItems(), QUrlPrivate::setEncodedUrl(), QWSDirectPainterSurface::setPermanentState(), QProcess::setReadChannel(), size(), QPatternist::HexBinary::stringValue(), QChar::toAscii(), toType(), QIntValidator::validate(), variantToString(), and QX11Data::xdndMimeConvertToFormat().
|
inline |
Definition at line 493 of file qbytearray.h.
Referenced by QDeclarativeComponentPrivate::beginCreate().
|
inline |
Definition at line 495 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 446 of file qbytearray.h.
void QByteArray::chop | ( | int | n | ) |
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 1289 of file qbytearray.cpp.
Referenced by MetaObjectGenerator::addProperty(), qDecodeDataUrl(), qErrnoWarning(), QTest::qSignalDumperCallback(), qt_inflateGZipDataFrom(), QMimeDataPrivate::retrieveTypedData(), QSslCertificate::serialNumber(), and QUrlPrivate::toEncoded().
void QByteArray::clear | ( | ) |
Clears the contents of the byte array and makes it empty.
Definition at line 2907 of file qbytearray.cpp.
Referenced by QProgressDialogPrivate::_q_disconnectOnClose(), QSocks5SocketEnginePrivate::_q_emitPendingReadNotification(), QHttpPrivate::_q_slotReadyRead(), QPacketProtocolPrivate::aboutToClose(), QCryptographicHash::addData(), QHttpNetworkReplyPrivate::appendUncompressedReplyData(), QBitArray::clear(), QPacket::clear(), QUrlPrivate::clear(), QNetworkSessionPrivateImpl::clearConfiguration(), QFtpDTP::connectToHost(), QIcdEngine::doRequestUpdate(), QHttpNetworkReplyPrivate::eraseData(), QDeclarativeXMLHttpRequest::error(), QHttpNetworkReplyPrivate::findChallenge(), QGLEngineSharedShaders::findProgramInCache(), QDeclarativeXMLHttpRequest::finished(), QPSPrintEnginePrivate::flushPage(), QNetworkAccessFtpBackend::ftpReadyRead(), QXmlStreamReaderPrivate::getChar_helper(), QHttpNetworkReplyPrivate::getChunkSize(), QXmlStreamReaderPrivate::init(), QXlibMime::mimeAtomForFormat(), QTextStream::operator>>(), operator>>(), QUrlPrivate::parse(), QHttpNetworkConnectionChannel::pipelineFlush(), QPdf::ByteStream::prepareBuffer(), QGLEngineSharedShaders::QGLEngineSharedShaders(), QIODevice::read(), QByteDataBuffer::read(), QFtpDTP::readAll(), QIODevice::readAll(), QHttpNetworkReplyPrivate::readBodyFast(), MetaObjectGenerator::readFuncsInfo(), QHttpNetworkReplyPrivate::readHeader(), QIODevice::readLine(), QNetworkAccessFileBackend::readMoreFromFile(), QHttpNetworkReplyPrivate::readReplyBodyRaw(), QHttpNetworkReplyPrivate::readStatus(), QPacketProtocolPrivate::readyToRead(), QNetworkAccessCache::removeEntry(), QNetworkAccessHttpBackend::replyDownloadData(), QCryptographicHash::reset(), runningUnderDebugger(), QUrlPrivate::setEncodedUserInfo(), QUrl::setFragment(), QUrl::setPassword(), QUrl::setPath(), QUrlPrivate::setUserInfo(), QUrl::setUserName(), QMetaType::unregisterType(), QLocalePrivate::validateChars(), and QX11Data::xdndMimeAtomForFormat().
|
inline |
Definition at line 497 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 unless the QByteArray object was created from raw data. The pointer remains valid as long as the byte array isn't reallocated or destroyed.
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 433 of file qbytearray.h.
Referenced by QAbstractSocketPrivate::_q_connectToNextAddress(), _q_dupEnvironment(), QWSServerPrivate::_q_newConnection(), QProcessPrivate::_q_notified(), QHttpPrivate::_q_slotConnected(), QHttpPrivate::_q_slotReadyRead(), QAbstractSocketPrivate::_q_startConnecting(), QSocks5SocketEnginePrivate::_q_udpSocketReadNotification(), QXmlTestLogger::addBenchmarkResult(), QTestLogger::addBenchmarkResult(), QGraphicsLayoutPrivate::addChildLayoutItem(), QPdfEnginePrivate::addConstantAlphaObject(), QAccessibleWidget::addControllingSignal(), QCryptographicHash::addData(), QNetworkAccessCache::addEntry(), QZipWriterPrivate::addEntry(), QPdfEnginePrivate::addImage(), QDnotifyFileSystemWatcherEngine::addPaths(), QFontDatabasePrivate::addQPF2File(), QGLShaderProgram::addShaderFromSourceCode(), QBasicUnixFontDatabase::addTTFile(), QFontDatabasePrivate::addTTFile(), QDeclarativeWatcher::addWatch(), QUrl::allEncodedQueryItemValues(), QUrl::allQueryItemValues(), QDBusMarshaller::append(), QString::append(), QHttpNetworkReplyPrivate::appendCompressedReplyData(), QDBusMarshaller::appendCrossMarshalling(), QNetworkReplyImplPrivate::appendDownstreamData(), QConcatenable< QByteArray >::appendTo(), QCoreApplication::applicationFilePath(), QTextHtmlParser::applyAttributes(), QMacStylePrivate::aquaSizeConstrain(), QPdf::ascii85Encode(), QWSSharedMemory::attach(), QSharedMemoryPrivate::attach(), QGLShaderProgram::attributeLocation(), QWaylandWindowManagerIntegration::authenticateWithToken(), QAudioDeviceInfoInternal::availableDevices(), QGLShaderProgram::bindAttributeLocation(), QDeclarativeCompiler::buildDynamicMeta(), QDeclarativeCompiler::buildPropertyOnAssignment(), buildString(), QDeclarativeCompiler::buildValueTypeProperty(), QTextCodec::canEncode(), QUrlPrivate::canonicalHost(), QPicturePrivate::checkFormat(), checksum(), childKeysOrGroups(), QFontEngineQPF::cleanUpAfterClientCrash(), QXlibClipboard::clipboardReadIncrementalProperty(), QX11Data::clipboardReadIncrementalProperty(), QPdfBaseEnginePrivate::closePrintDevice(), QDeclarativeListModelParser::compile(), QDeclarativeCompiler::compileAlias(), QGLShader::compileSourceCode(), QGLShader::compileSourceFile(), QVNCScreen::connect(), QMultiScreen::connect(), QTransformedScreen::connect(), QLinuxFbScreen::connect(), QDeclarativeObjectMethodScriptClass::connect(), QProxyScreen::connect(), QLinuxFbIntegration::connect(), QDirectFBScreen::connect(), QDBusConnection::connect(), QObject::connect(), ShaderEffectItem::connectPropertySignals(), QDBusConnectionPrivate::connectSignal(), QDBusConnection::connectToBus(), QAbstractSocket::connectToHost(), QAbstractSocket::connectToHostImplementation(), QWSSocket::connectToLocalFile(), QDBusConnection::connectToPeer(), QDeclarativeEnginePrivate::consoleLog(), QMacPasteboardMimeHTMLText::convertFromMime(), QWindowsMimeHtml::convertFromMime(), QMacPasteboardMimeVCard::convertFromMime(), QGb18030Codec::convertFromUnicode(), QBig5Codec::convertFromUnicode(), QUtf8::convertFromUnicode(), QSimpleTextCodec::convertFromUnicode(), QBig5hkscsCodec::convertFromUnicode(), QGbkCodec::convertFromUnicode(), QEucKrCodec::convertFromUnicode(), QEucJpCodec::convertFromUnicode(), QSjisCodec::convertFromUnicode(), QGb2312Codec::convertFromUnicode(), QTsciiCodec::convertFromUnicode(), QCP949Codec::convertFromUnicode(), QMacPasteboardMime::convertor(), QAbstractConcatenable::convertToAscii(), QMacPasteboardMimePlainText::convertToMime(), QMacPasteboardMimeUnicodeText::convertToMime(), QWindowsMimeURI::convertToMime(), QMacPasteboardMimeTiff::convertToMime(), QIconvCodec::convertToUnicode(), convertTypes(), QScriptEnginePrivate::convertValue(), QBitArray::count(), QWSSharedMemory::create(), QSharedMemoryPrivate::create(), QDeclarativeBinding::createBinding(), QUrlPrivate::createErrorString(), QDBusArgumentPrivate::createSignature(), QBBRootWindow::createWindowGroup(), QFileSystemEngine::currentPath(), data(), QSslKeyPrivate::decodePem(), QTest::defaultKeyVerbose(), QScript::QMetaObjectWrapperObject::deleteProperty(), QWSSharedMemory::detach(), QSharedMemoryPrivate::detach(), QDeclarativeObjectMethodScriptClass::disconnect(), QObject::disconnect(), QDBusConnectionPrivate::disconnectSignal(), QNetworkSessionPrivateImpl::do_open(), QPainter::drawText(), QPdfEnginePrivate::drawTextItem(), QDeclarativeBindingCompiler::dump(), ModelNode::dump(), QGraphicsAnchorLayoutPrivate::dumpGraph(), QDeclarativeCompiler::dumpStats(), QUrl::encodedQueryItems(), QUrl::encodedQueryItemValue(), QPicturePaintEngine::end(), QtopiaPrintEngine::end(), QApplicationPrivate::enterModal_sys(), QWSClient::errorHandler(), QDeclarativeCompiler::evaluateEnum(), QXmlQuery::evaluateTo(), QDB2Result::exec(), QSQLiteResult::exec(), QSymSQLResult::exec(), QSqlQuery::exec(), QODBCResult::exec(), QPSQLDriverPrivate::exec(), QOCICols::execBatch(), QScript::QObjectConnectionManager::execute(), QAbstractSocketPrivate::fetchConnectionParameters(), QNativeSocketEnginePrivate::fetchConnectionParameters(), QZipReader::fileData(), QBitArray::fill(), QFileSystemEngine::fillMetaData(), QTextStreamPrivate::fillReadBuffer(), findEncoding(), QNetworkHeadersPrivate::findRawHeader(), QDeclarativePropertyPrivate::findSignalByName(), QIntValidator::fixup(), QMacPasteboardMime::flavorToMime(), QMinimalWindowSurface::flush(), QTextStreamPrivate::flushWriteBuffer(), fontExists(), QDropEvent::format(), QTest::formatResult(), QBBClipboard::MimeData::formats(), QImage::fromData(), QDirectFBPixmapData::fromFile(), QDirectFbBlitterPlatformPixmap::fromFile(), QGLPixmapData::fromFile(), fromHex(), QNetworkHeadersPrivate::fromHttpDate(), QString::fromLatin1(), QHostInfo::fromName(), QHostInfoAgent::fromName(), QHostInfoPrivate::fromName(), fromPercentEncodingHelper(), fromPercentEncodingMutable(), QUrl::fromPunycode(), QXmlInputSource::fromRawData(), QMetaObjectBuilder::fromRelocatableData(), QUuid::fromRfc4122(), QDeclarativeCompiler::genObject(), get_named_rgb(), get_network_interface(), QXmlStreamReaderPrivate::getChar_helper(), QFreetypeFace::getFace(), getFamiliesAndSignatures(), getNetWmState(), QScript::QObjectDelegate::getOwnPropertyDescriptor(), QScript::QMetaObjectWrapperObject::getOwnPropertyDescriptor(), QScript::QObjectDelegate::getOwnPropertySlot(), QScript::QMetaObjectWrapperObject::getOwnPropertySlot(), QBBGLContext::getProcAddress(), QWSPropertyManager::getProperty(), QFileIconProviderPrivate::getWinIcon(), QApplicationPrivate::globalEventProcessor(), QFontEngine::glyphCount(), QSystemSemaphorePrivate::handle(), QUrl::hasEncodedQueryItem(), QBBClipboard::MimeData::hasFormat(), QNonContiguousByteDeviceThreadForwardImpl::haveDataSlot(), QHttpNetworkHeaderPrivate::headerFieldValues(), QDeclarativeImportDatabase::importPlugin(), QXmlStreamWriterPrivate::indent(), QByteArrayMatcher::indexIn(), QDeclarativeCompiler::indexOfProperty(), QTestFileLogger::init(), QWSDisplay::Data::init(), QAuServerNAS::init(), QWSServerSocket::init(), init_platform(), QSignalSpy::initArgs(), QImageReaderPrivate::initHandler(), QNativeSocketEngine::initialize(), initializeDb(), QDirectFbIntegration::initializeDirectFB(), QAxBase::initializeLicensedHelper(), QDeclarativePropertyPrivate::initProperty(), QAbstractSocketPrivate::initSocketLayer(), QSslSocketBackendPrivate::initSslContext(), QSettingsPrivate::iniUnescapedStringList(), QDeclarativeJS::integerFromString(), QScript::integerFromString(), QSqlDatabasePrivate::invalidateDb(), QMetaMethod::invoke(), QAxServerBase::Invoke(), QMetaObject::invokeMethod(), QHttpNetworkReplyPrivate::isGzipped(), QDeclarativeMetaType::isModule(), QDBusUtil::isValidSignature(), QDBusUtil::isValidSingleSignature(), QMetaEnum::keysToValue(), launch(), launchWebBrowser(), QApplicationPrivate::leaveModal_sys(), QTcpServer::listen(), QSvgIOHandlerPrivate::load(), QResourcePrivate::load(), QFontDatabasePrivate::loadFromCache(), QPixmap::loadFromData(), QImage::loadFromData(), QFontEngine::loadKerningPairs(), loadSingleEngine(), ShaderEffectItem::lookThroughShaderCode(), QHostInfo::lookupHost(), QPatternist::XQueryTokenizer::lookupKeyword(), QScriptStdMessageHandler::message(), QXlibMime::mimeConvertToFormat(), QXlibMime::mimeStringToAtom(), multicastMembershipHelper(), nameMatch(), QNativeSocketEnginePrivate::nativeBind(), QNativeSocketEnginePrivate::nativeConnect(), QNativeSocketEnginePrivate::nativeListen(), QFSFileEnginePrivate::nativeOpen(), QNativeSocketEnginePrivate::nativeReceiveDatagram(), QBBNativeInterface::nativeResourceForWidget(), QNativeSocketEnginePrivate::nativeSendDatagram(), QMetaObject::newInstance(), QUrlPrivate::normalized(), QIBaseDriver::open(), QSQLiteDriver::open(), QAudioDeviceInfoInternal::open(), QTDSDriver::open(), QMYSQLDriver::open(), QAudioInputPrivate::open(), QPSQLDriver::open(), QWSTslibMouseHandlerPrivate::open(), QAudioOutputPrivate::open(), QWSPcMouseHandlerPrivate::openDevices(), QLinuxFbIntegrationPrivate::openTty(), QLinuxFbScreenPrivate::openTty(), PvrEglScreen::openTty(), QString::operator!=(), operator+(), QString::operator+=(), QString::operator<(), QDeclarativeInfo::operator<<(), QTextStream::operator<<(), operator<<(), QString::operator<=(), QString::operator=(), QString::operator==(), operator==(), QString::operator>(), QString::operator>=(), QUuid::operator>>(), QBitArray::operator^=(), QBitArray::operator|=(), QBitArray::operator~(), QDeclarativeCompiledData::pack(), QDateTimeParser::parse(), QUrlPrivate::parse(), parseDateString(), QAuthenticatorPrivate::parseDigestAuthenticationChallenge(), QDateTimeParser::parseFormat(), parseHeaderName(), parseHttpOptionHeader(), QDeclarativeBindingCompilerPrivate::parseName(), QBBNavigatorEventNotifier::parsePPS(), QBBButtonEventNotifier::parsePPS(), QHttpNetworkReplyPrivate::parseStatus(), QPdf::patternForBrush(), QBufferPrivate::peek(), QIODevicePrivate::peek(), QRingBuffer< T >::peek(), QAuServerNAS::play(), QIBaseResult::prepare(), QSqlQuery::prepare(), QString::prepend(), printHelp(), QFtpPI::processReply(), QDeclarativeBindingCompiler::program(), QMacPasteboard::promiseKeeper(), QScript::QMetaObjectWrapperObject::put(), QTextStreamPrivate::putString(), q_toPercentEncoding(), qax_generateDocumentation(), QByteArrayMatcher::QByteArrayMatcher(), QTest::qCompare(), qCompress(), QDBusError::QDBusError(), QDBusServer::QDBusServer(), QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(), qDecodeOCIType(), qEncodeNtlmv2Response(), qErrnoWarning(), QTest::qExec(), qExtractSecurityPolicyFromString(), QFontEngineQPF::QFontEngineQPF(), qGetBinaryData(), qHash(), QLinuxInputKeyboardHandler::QLinuxInputKeyboardHandler(), QLinuxInputMouseHandler::QLinuxInputMouseHandler(), QLock::QLock(), qMetaTypeCustomType_unlocked(), qmlRegisterCustomType(), qmlRegisterExtendedType(), qmlRegisterInterface(), qmlRegisterRevision(), qmlRegisterType(), qmlRegisterUncreatableType(), QDeclarativePrivate::qmlRegisterUncreatableType(), qmlRegisterValueTypeEnums(), QNonContiguousByteDeviceBufferImpl::QNonContiguousByteDeviceBufferImpl(), qOraOutValue(), qParseOpts(), QTest::qPrintMessage(), QQnxMouseHandler::QQnxMouseHandler(), QTest::qSignalDumperCallback(), QSignalSpy::QSignalSpy(), qSqlWarning(), qstrcmp(), qStreamNtlmBuffer(), qstring_to_xtp(), qStringFromUcs2Le(), qt_addPatternProps(), qt_adopted_thread_watcher_function(), qt_create_commandline(), qt_fill_input_buffer(), qt_get_screen(), qt_initIcu(), QApplicationPrivate::qt_mac_apply_settings(), qt_mac_create_fsref(), qt_mac_display_change_callbk(), qt_mac_execute_apple_script(), qt_message(), qt_nograb(), qt_parse_pattern(), qt_socks5_get_host_address_and_port(), qt_tildeExpansion(), qt_u_strToCase(), qt_x11_set_fallback_font_family(), QTDSResult::QTDSResult(), QTsLibMouseHandler::QTsLibMouseHandler(), queryFont(), QUrl::queryItems(), QDeclarativeValueTypeScriptClass::queryProperty(), QDeclarativeTypeNameScriptClass::queryProperty(), queuedConnectionTypes(), qUncompress(), QUuid::QUuid(), QVariantToVARIANT(), QVFbKeyboardHandler::QVFbKeyboardHandler(), QVFbMouseHandler::QVFbMouseHandler(), QVFbScreenKeyboardHandler::QVFbScreenKeyboardHandler(), QVFbScreenMouseHandler::QVFbScreenMouseHandler(), qvsnprintf(), QWaylandSelection::QWaylandSelection(), qws_dataDir(), QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(), QWSLinuxInputMousePrivate::QWSLinuxInputMousePrivate(), QWSLinuxTPMouseHandlerPrivate::QWSLinuxTPMouseHandlerPrivate(), QWSQnxKeyboardHandler::QWSQnxKeyboardHandler(), QWSTtyKbPrivate::QWSTtyKbPrivate(), QXcbConnection::QXcbConnection(), QXIMInputContext::QXIMInputContext(), QAudioInputPrivate::read(), QByteDataBuffer::read(), read_xpm_body(), QHttpMultiPartIODevice::readData(), QAuthDevice::readData(), QSocks5SocketEngine::readDatagram(), QConfFileSettingsPrivate::readIniFile(), QWinSettingsPrivate::readKey(), QRingBuffer< T >::readPointer(), QNonContiguousByteDeviceByteArrayImpl::readPointer(), QRingBuffer< T >::readPointerAtPosition(), QMYSQLDriver::record(), QAuthDevice::recvReadyRead(), registerComponent(), QDeclarativeEnginePrivate::registerCompositeType(), registerFont(), QPlatformFontDatabase::registerQPF2Font(), QStateMachinePrivate::registerSignalTransition(), QWSDisplay::Data::reinit(), QDBusConnectionPrivate::relaySignal(), QNetworkAccessCache::releaseEntry(), releaseFontData(), QUrl::removeAllEncodedQueryItems(), QHttpNetworkReplyPrivate::removeAutoDecompressHeader(), removeDotsFromPath(), QUrl::removeEncodedQueryItem(), QNetworkAccessCache::removeEntry(), QGraphicsLayoutPrivate::reparentChildItems(), replace(), QBBNavigatorEventNotifier::replyPPS(), QSQLite2Result::reset(), QTDSResult::reset(), QUrl::resolved(), resolveGdi32(), QDeclarativePropertyPrivate::restore(), QWaylandClipboard::retrieveData(), QBBClipboard::MimeData::retrieveData(), QKqueueFileSystemWatcherEngine::run(), QDeclarativeVME::run(), runlengthEncode(), QAxServerBase::Save(), QToolBarAreaLayout::saveState(), QWSServerPrivate::sendFontRemovedEvent(), QKeyMapper::sendKeyEvent(), QWSServerPrivate::sendQCopEvent(), QWinSettingsPrivate::set(), set_text(), QColor::setColorFromString(), QNetworkHeadersPrivate::setCookedHeader(), QTimeLinePrivate::setCurrentTime(), QDeclarativeListModelParser::setCustomData(), QWizard::setField(), QPainter::setFont(), QWSFontCommand::setFontName(), QHttpNetworkHeaderPrivate::setHeaderField(), setOptionFlag(), QByteArrayMatcher::setPattern(), QDirectFBWindowSurface::setPermanentState(), QWSLocalMemSurface::setPermanentState(), QWSSharedMemSurface::setPermanentState(), QWSOnScreenSurface::setPermanentState(), QWSYellowSurface::setPermanentState(), QPrinter::setPrinterName(), QWSDisplay::setProperty(), QNetworkHeadersPrivate::setRawHeaderInternal(), QTextBrowserPrivate::setSource(), QDeclarativeOpenMetaObject::setValue(), QWidgetPrivate::setWindowRole(), QXcbWindow::setWindowTitle(), QXlibWindow::setWindowTitle(), QWidgetPrivate::setWindowTitle_sys(), QBitArray::size(), sm_setProperty(), QFtpDTP::socketReadyRead(), QProcessPrivate::startDetached(), QProcessPrivate::startProcess(), QFontEngineMac::stringToCMap(), QFontEngineXLFD::stringToCMap(), QPatternist::Base64Binary::stringValue(), QIBaseDriver::subscribeToNotificationImplementation(), QDeclarativeCompiler::testQualifiedEnumAssignment(), QAudioDeviceInfoInternal::testSettings(), QSingleShotTimer::timerEvent(), toDouble(), toLongLong(), QUrl::toPercentEncoding(), toPercentEncoding(), QString::toStdString(), QTest::toString(), toULongLong(), QTextCodec::toUnicode(), QTextDecoder::toUnicode(), translateWSAError(), QMetaType::typeName(), QGLShaderProgram::uniformLocation(), ShaderEffectItem::updateEffectState(), QPropertyAnimationPrivate::updateMetaProperty(), QGLContext::updatePaintDevice(), QPropertyAnimationPrivate::updateProperty(), QIntValidator::validate(), QDoubleValidatorPrivate::validateWithLocale(), QSettingsPrivate::variantToString(), Maemo::IAPConfPrivate::variantToValue(), QMYSQLResult::virtual_hook(), QBBScreen::windowGroupName(), WinMain(), QIODevice::write(), QPdfEnginePrivate::write(), QRfbRawEncoder::write(), QRfbHextileEncoder< SRC >::write(), QUnixSocketPrivate::writeActivated(), QPdfEnginePrivate::writeCompressed(), QUdpSocket::writeDatagram(), writeProperty(), QX11Data::xdndMimeConvertToFormat(), QX11Data::xdndMimeStringToAtom(), xic_draw_callback(), and QLock::~QLock().
|
inline |
Definition at line 503 of file qbytearray.h.
|
inline |
Returns true if the byte array contains the character ch; otherwise returns false.
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 525 of file qbytearray.h.
Referenced by addDefaultArguments(), buildSpec(), QAuthenticatorPrivate::calculateResponse(), QSvgIOHandler::canRead(), QByteDataBuffer::canReadLine(), QHttpNetworkConnectionChannel::detectPipeliningSupport(), fontFile(), QScript::QObjectDelegate::getOwnPropertyDescriptor(), QScript::QObjectDelegate::getOwnPropertySlot(), initializeDb(), QUrlPrivate::mergePaths(), QUrlPrivate::normalized(), QBBButtonEventNotifier::parsePPS(), QScript::QObjectDelegate::put(), qDetectCPUFeatures(), QPictureHandler::QPictureHandler(), qt_init(), read_xbm_body(), MetaObjectGenerator::readFuncsInfo(), QHttpNetworkReplyPrivate::readHeader(), setupLocaleMapper(), and QNetworkCookie::toRawForm().
|
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 string str; otherwise returns false.
Definition at line 575 of file qbytearray.h.
|
inline |
Returns true if the byte array contains an occurrence of the byte array ba; otherwise returns false.
Definition at line 523 of file qbytearray.h.
int QByteArray::count | ( | char | ch | ) | const |
Returns the number of occurrences of character ch in the byte array.
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 2654 of file qbytearray.cpp.
Referenced by QFontDatabasePrivate::addQPF2File(), QXmlStreamWriterPrivate::checkIfASCIICompatibleCodec(), QDeclarativeListModelParser::compile(), QDeclarativeListModelParser::compileProperty(), QHttpNetworkReplyPrivate::parseHeader(), QNetworkAccessManagerPrivate::prepareMultipart(), QDeclarativeBindingCompiler::program(), q_fromPercentEncoding(), q_toPercentEncoding(), QHttpMultiPartPrivate::QHttpMultiPartPrivate(), QVariantToVARIANT(), QHttpMultiPartIODevice::readData(), QPlatformFontDatabase::registerQPF2Font(), QPatternist::HexBinary::stringValue(), and variantToString().
int QByteArray::count | ( | const char * | str | ) | const |
Returns the number of (potentially overlapping) occurrences of string str in the byte array.
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 2637 of file qbytearray.cpp.
int QByteArray::count | ( | const QByteArray & | ba | ) | const |
Returns the number of (potentially overlapping) occurrences of byte array ba in this byte array.
Definition at line 2612 of file qbytearray.cpp.
|
inline |
Same as size().
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 355 of file qbytearray.h.
Referenced by QDeclarativeComponentPrivate::beginCreate(), count(), and QDeclarativeComponent::QDeclarativeComponent().
|
inline |
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 in the returned character string is size() + 1 for the '\0' terminator.
Example:
The pointer remains valid as long as the byte array isn't reallocated or destroyed. For read-only access, constData() is faster because it never causes a 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 429 of file qbytearray.h.
Referenced by QProcessPrivate::_q_notified(), QHttpPrivate::_q_slotReadyRead(), QAxClientSite::activateObject(), QTestLogger::addBenchmarkResult(), QLayout::addChildLayout(), QLayout::addChildWidget(), QIcdEngine::addConfiguration(), QSqlDatabasePrivate::addDatabase(), QZipWriterPrivate::addEntry(), QPdfEnginePrivate::addImage(), MetaObjectGenerator::addProperty(), QResource::addSearchPath(), QGridLayout::addWidget(), Maemo::appendVariantToDBusMessage(), QApplicationPrivate::applyX11SpecificCommandLineArguments(), QString::arg(), QPdf::ascii85Encode(), QPatternist::Base64Binary::base64Decode(), QSocks5PasswordAuthenticator::beginAuthenticate(), bindFont(), QOCIResultPrivate::bindValue(), QDeclarativeCompiler::buildDynamicMeta(), QDeclarativeBindingCompilerPrivate::buildExceptionData(), QFileSystemEngine::canonicalName(), QSslCertificatePrivate::certificatesFromDer(), QSslCertificatePrivate::certificatesFromPem(), checkHRESULT(), QCoreApplicationPrivate::checkReceiverThread(), checkSymbolFont(), checkWidget(), childKeysOrGroups(), QGLContext::choosePixelFormat(), QXlibClipboard::clipboardReadIncrementalProperty(), QX11Data::clipboardReadIncrementalProperty(), QXlibClipboard::clipboardReadProperty(), QX11Data::clipboardReadProperty(), QDeclarativeListModelParser::compile(), compressHelper(), QVFbScreen::connect(), QUnixSocket::connect(), QMetaObject::connectSlotsByName(), convertFlags(), QWindowsMimeText::convertFromMime(), QWindowsMimeURI::convertFromMime(), QMacPasteboardMimeTiff::convertFromMime(), QWindowsMimeHtml::convertFromMime(), QBuiltInMimes::convertFromMime(), QFontJis0201Codec::convertFromUnicode(), QGb18030Codec::convertFromUnicode(), QBig5Codec::convertFromUnicode(), QLatin1Codec::convertFromUnicode(), QUtf8::convertFromUnicode(), QFontLaoCodec::convertFromUnicode(), QIsciiCodec::convertFromUnicode(), QSimpleTextCodec::convertFromUnicode(), QUtf16::convertFromUnicode(), QIconvCodec::convertFromUnicode(), QBig5hkscsCodec::convertFromUnicode(), QUtf32::convertFromUnicode(), QGbkCodec::convertFromUnicode(), QLatin15Codec::convertFromUnicode(), QFontJis0208Codec::convertFromUnicode(), QEucKrCodec::convertFromUnicode(), QEucJpCodec::convertFromUnicode(), QSjisCodec::convertFromUnicode(), QGb2312Codec::convertFromUnicode(), QTsciiCodec::convertFromUnicode(), QFontBig5Codec::convertFromUnicode(), QCP949Codec::convertFromUnicode(), QFontGb2312Codec::convertFromUnicode(), QFontBig5hkscsCodec::convertFromUnicode(), QFontKsc5601Codec::convertFromUnicode(), QFontGbkCodec::convertFromUnicode(), QFontGb18030_0Codec::convertFromUnicode(), QWindowsLocalCodec::convertFromUnicode(), QWindowsMimeText::convertToMime(), QWindowsMimeURI::convertToMime(), QBuiltInMimes::convertToMime(), QIconvCodec::convertToUnicode(), QBitArray::count(), create_wm_client_leader(), QLayoutPrivate::createSpacerItem(), decodeMSG(), QSslKeyPrivate::decodePem(), deleteChildGroups(), QIcdEngine::deleteConfiguration(), QNetworkSessionPrivateImpl::do_open(), QIcdEngine::doRequestUpdate(), QRasterPaintEngine::drawTextItem(), dumpRecursive(), QClipboardWatcher::empty(), err_info_about_objects(), QFontEngineMac::faceId(), QFontconfigDatabase::fallbacksForFamily(), QXmlSimpleReader::feature(), QWSSoundServerPrivate::feedDevice(), QIBaseResultPrivate::fetchArray(), QIBaseResultPrivate::fetchBlob(), QXmlInputSource::fetchData(), QZipReader::fileData(), QBitArray::fill(), QFontconfigDatabase::fontEngine(), QXlibClipboardMime::formats_sys(), QMYSQLDriver::formatValue(), QAudioOutputPrivate::freeBlocks(), fromHex(), fromPercentEncoding(), fromRawData(), QFont::fromString(), QXmlStreamReaderPrivate::getChar_helper(), QXlibClipboard::getDataInFormat(), QClipboardWatcher::getDataInFormat(), Maemo::GConfItemFast::getEntries(), getFcPattern(), QGtkStylePrivate::getFilesystemIcon(), getFullPath(), QFileSystemEngine::getLinkTarget(), getNetWmState(), QWaylandReadbackEglContext::getProcAddress(), QWaylandReadbackGlxContext::getProcAddress(), QGLXContext::getProcAddress(), QWaylandXCompositeGLXContext::getProcAddress(), QGLContext::getProcAddress(), QFontEngineMac::getSfntTable(), QFontEngine::getSfntTable(), QNetworkSessionPrivateImpl::getStatistics(), getWinLocaleName(), QXcbNativeInterface::graphicsDeviceForWidget(), QHttpNetworkReplyPrivate::gunzipBodyPartially(), QXlibKeyboard::handleKeyEvent(), QXlibClipboard::handleSelectionRequest(), QBenchmarkValgrindUtils::haveValgrind(), QRingBuffer< T >::indexOf(), QSqlDatabasePrivate::init(), QSslSocketBackendPrivate::initSslContext(), QTextLine::layout_helper(), QUnixSocketServer::listen(), QAxServerBase::Load(), QLibraryPrivate::load_sys(), loadFc(), loadRaw(), loadWin(), QFontDatabase::loadXlfd(), macQueryInternal(), macValue(), QXlibMime::mimeConvertToFormat(), QXlibMime::mimeDataForAtom(), QX11Data::motifdndObtainData(), QTest::mouseEvent(), QNativeSocketEnginePrivate::nativeBind(), normalizeTypeInternal(), QIBaseDriver::open(), QODBCDriver::open(), QWSSoundServerPrivate::openFile(), operator+=(), operator<<(), QUuid::operator<<(), QUuid::operator>>(), operator>>(), QBitArray::operator^=(), QBitArray::operator|=(), QBitArray::operator~(), QPdf::patternForBrush(), QSslSocketPrivate::peek(), QRingBuffer< T >::peek(), QDirectFBWindowSurface::permanentState(), QWSLocalMemSurface::permanentState(), QWSSharedMemSurface::permanentState(), QWSOnScreenSurface::permanentState(), QWSYellowSurface::permanentState(), QODBCDriver::primaryIndex(), QTest::printBenchmarkResult(), QDeclarativeBindingCompiler::program(), q_fromPercentEncoding(), q_toPercentEncoding(), qax_noSuchFunction(), qax_readClassInfo(), QBitArray::QBitArray(), QSslCertificatePrivate::QByteArray_from_X509(), qbytearray_insert(), qCompress(), qCreatev2Hash(), qErrnoWarning(), QTest::qExec(), qExtractServerTime(), qFillBufferWithString(), qGetInterfaceType(), qgl_use_font(), QGLXContext::QGLXContext(), QLayout::QLayout(), qMakeOCINumber(), QTest::qPrintDataTags(), qstring_to_xtp(), qStringFromUcs2Le(), qt_create_commandline(), qt_error_string(), qt_fillFontDef(), qt_getLprPrinters(), qt_inflateGZipDataFrom(), qt_parseEtcLpPrinters(), qt_parsePrintersConf(), qt_parseSpoolInterface(), qt_read_xpm_image_or_array(), qt_x11_apply_settings_in_all_apps(), QFtpDTP::read(), QIODevice::read(), QByteDataBuffer::read(), QRingBuffer< T >::read(), read_xpm_body(), QIODevice::readAll(), QHttp::readAll(), QHttpNetworkReplyPrivate::readBodyFast(), QWinSettingsPrivate::readKey(), QIODevice::readLine(), QNetworkAccessFileBackend::readMoreFromFile(), QOCICols::readPiecewise(), QNonContiguousByteDeviceIoDeviceImpl::readPointer(), QHttpNetworkReplyPrivate::readReplyBodyRaw(), QODBCDriver::record(), QResource::registerResource(), QWinSettingsPrivate::remove(), removeDotsFromPath(), QCoreApplicationPrivate::removePostedEvent(), QInternalMimeData::renderDataHelper(), replace(), QMYSQLResult::reset(), QBitArray::resize(), QMainWindowLayoutState::restoreState(), QCryptographicHash::result(), QInternalMimeData::retrieveData(), rightJustified(), QKqueueFileSystemWatcherEngine::run(), QWindowsPipeWriter::run(), QDomDocumentPrivate::saveDocument(), QZipReaderPrivate::scanFiles(), QTcpServerConnection::send(), QmlOstPlugin::send(), QWaylandSelection::send(), send_selection(), QWSSoundServerClient::sendClientMessage(), QWSServerPrivate::sendQCopEvent(), QXlibClipboard::sendSelection(), QWinSettingsPrivate::set(), QDeclarativeParser::Object::setBindingBit(), QAxBase::setControl(), setData(), QXmlSimpleReader::setFeature(), QWidget::setLayout(), QWSQCopSendCommand::setMessage(), QBBClipboard::setMimeData(), setNum(), setRawData(), QWSIMResponseCommand::setResult(), sm_setProperty(), QSmSocketReceiver::socketActivated(), QFtpDTP::socketReadyRead(), standardLibraryErrorString(), QProcessPrivate::startDetached(), QXmlStreamReaderPrivate::startDocument(), QRawFont::supportedWritingSystems(), QODBCDriver::tables(), toBase64(), QUuid::toByteArray(), toHex(), toLatin1_helper(), toLower(), QSslKey::toPem(), toPercentEncoding(), QMetaObjectBuilder::toRelocatableData(), QUuid::toRfc4122(), toSQLTCHAR(), toUpper(), QXlibKeyboard::translateKeySym(), QXcbKeyboard::translateKeySym(), translateKeySym(), QNetworkDiskCachePrivate::uniqueFileName(), VARIANTToQVariant(), WinMain(), QRfbRawEncoder::write(), QRfbHextileEncoder< SRC >::write(), write_xbm_image(), QIBaseResultPrivate::writeArray(), QIBaseResultPrivate::writeBlob(), QPdfEnginePrivate::writeCompressed(), QPAGenerator::writeGMap(), QPFGenerator::writeGMap(), QClipboardINCRTransaction::x11Event(), QX11Data::xdndHandleSelectionRequest(), QX11Data::xdndMimeConvertToFormat(), QX11Data::xdndMimeDataForAtom(), xdndObtainData(), and QWinSettingsPrivate::~QWinSettingsPrivate().
|
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 431 of file qbytearray.h.
|
inline |
Definition at line 397 of file qbytearray.h.
Referenced by QBitArray::data_ptr().
|
inline |
Definition at line 435 of file qbytearray.h.
Referenced by begin(), data(), QBitArray::detach(), end(), getData(), nulTerminated(), QByteRef::operator=(), remove(), replace(), and QMacPasteboard::retrieveData().
|
inline |
Definition at line 499 of file qbytearray.h.
Referenced by QConcatenable< QByteArray >::appendTo(), lastIndexOfHelper(), repeated(), split(), and trimmed().
|
inline |
Definition at line 501 of file qbytearray.h.
bool QByteArray::endsWith | ( | const QByteArray & | ba | ) | const |
Returns true if this byte array ends with byte array ba; otherwise returns false.
Example:
Definition at line 2735 of file qbytearray.cpp.
Referenced by QFileSystemEngine::absoluteName(), MetaObjectGenerator::addProperty(), QScript::callQtMethod(), QCacheItem::canCompress(), QDeclarativeCompiler::compileAlias(), QDeclarativeListModelParser::compileProperty(), QScriptEnginePrivate::convertToNativeQObject(), convertTypes(), QScriptEnginePrivate::convertValue(), QScriptEnginePrivate::create(), MetaObjectGenerator::createPrototype(), QDeclarativePropertyPrivate::findSignalByName(), QHttpNetworkReplyPrivate::getChunkSize(), QDeclarativeCompiler::indexOfSignal(), QAxServerBase::Invoke(), QAxEventSink::Invoke(), QScriptEnginePrivate::jscValueToVariant(), QDeclarativeObjectMethodScriptClass::matchScore(), QAxMetaObject::paramType(), paramType(), qDBusParametersForMethod(), qDecodeDataUrl(), qErrnoWarning(), QTest::qSignalDumperCallback(), QAxServerBase::qt_metacall(), queuedConnectionTypes(), QVariantToVARIANT(), QDeclarativeXMLHttpRequest::readEncoding(), QHttpNetworkReplyPrivate::readHeader(), QHttpNetworkReplyPrivate::readStatus(), QMimeDataPrivate::retrieveTypedData(), QFtpDTP::socketReadyRead(), QProcessPrivate::startDetached(), QProcessPrivate::startProcess(), QUrlPrivate::toEncoded(), QNetworkCookie::toRawForm(), and QScript::variantFromValue().
bool QByteArray::endsWith | ( | char | ch | ) | const |
Returns true if this byte array ends with character ch; otherwise returns false.
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 2770 of file qbytearray.cpp.
bool QByteArray::endsWith | ( | const char * | str | ) | const |
Returns true if this byte array ends with string str; otherwise returns false.
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 2752 of file qbytearray.cpp.
|
private |
Definition at line 1587 of file qbytearray.cpp.
Referenced by QByteRef::operator=().
QByteArray & QByteArray::fill | ( | char | ch, |
int | size = -1 |
||
) |
Sets every byte in the byte array to character ch.
If size is different from -1 (the default), the byte array is resized to size size beforehand.
Example:
Definition at line 1556 of file qbytearray.cpp.
Referenced by dumpRecursive(), QByteArray(), QTest::qSignalDumperCallback(), QTest::qSignalDumperCallbackSlot(), and qStringFromUcs2Le().
|
static |
Returns a decoded copy of the Base64 array base64.
Input is not checked for validity; invalid characters in the input are skipped, enabling the decoding process to continue with subsequent characters.
For example:
The algorithm used to decode Base64-encoded data is defined in RFC 2045.
Definition at line 4184 of file qbytearray.cpp.
Referenced by QDeclarativeEnginePrivate::atob(), QAuthenticatorPrivate::calculateResponse(), QSslCertificatePrivate::certificatesFromPem(), createImageNode(), QSslKeyPrivate::derFromPem(), and qDecodeDataUrl().
|
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 4234 of file qbytearray.cpp.
|
static |
Returns a decoded copy of the URI/URL-style percent-encoded input.
The percent parameter allows you to replace the '' character for another (for instance, '_' or '=').
For example:
Definition at line 4354 of file qbytearray.cpp.
Referenced by qDecodeDataUrl().
|
static |
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 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 4121 of file qbytearray.cpp.
Referenced by QUrl::allEncodedQueryItemValues(), QUrl::allQueryItemValues(), QTiffHandler::canRead(), QSslCertificatePrivate::certificatesFromPem(), count(), QUrl::encodedQueryItemValue(), QTextStreamPrivate::fillReadBuffer(), QRasterPixmapData::fromData(), QVGPixmapData::fromData(), QPixmapData::fromData(), QGLPixmapData::fromData(), QImage::fromData(), getData(), QUrl::hasEncodedQueryItem(), ICOReader::iconAt(), QTextList::itemText(), QSvgIOHandlerPrivate::load(), QSslCertificatePrivate::QByteArray_from_X509(), QNonContiguousByteDeviceBufferImpl::QNonContiguousByteDeviceBufferImpl(), qt_socks5_set_host_address_and_port(), qt_socks5_set_host_name_and_port(), QXIMInputContext::QXIMInputContext(), read_xbm_body(), QUrl::removeAllEncodedQueryItems(), QUrl::removeEncodedQueryItem(), replace(), QOstDevicePrivate::RunL(), QWSIMEvent::setData(), QWSIMInitEvent::setData(), QWSFontEvent::setData(), QWSIMResponseCommand::setData(), setRawData(), QBBButtonEventNotifier::updateButtonStates(), Maemo::IAPConfPrivate::valueToVariant(), and QSocks5SocketEngine::write().
int QByteArray::indexOf | ( | char | ch, |
int | from = 0 |
||
) | const |
Returns the index position of the first occurrence of the character ch in the byte array, searching forward from index position from.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns -1 if ch could not be found.
Example:
Definition at line 2461 of file qbytearray.cpp.
Referenced by addDefaultArguments(), QAxEventSink::addSignal(), QOpenGLPaintEngine::begin(), buildParameterNames(), QSslCertificatePrivate::certificatesFromPem(), QTextCodec::codecForHtml(), QDeclarativeCompiler::compileAlias(), contains(), QWindowsMimeHtml::convertFromMime(), QWindowsMimeHtml::convertToMime(), count(), QUrlPrivate::createErrorString(), QFileSystemEngine::currentPath(), QSslKeyPrivate::derFromPem(), QDeclarativeCompiler::evaluateEnum(), QGLTextureGlyphCache::fillTexture(), QDeclarativeImportsPrivate::find(), QDeclarativePropertyPrivate::findSignalByName(), findSlot(), fontFile(), for(), QNetworkHeadersPrivate::fromHttpDate(), QScript::functionConnect(), generateInterfaceXml(), QHttpNetworkReplyPrivate::getChunkSize(), indexOf(), init_plugins(), QAxServerBase::Invoke(), QAxServerBase::Load(), QHostInfo::localDomainName(), QTest::memberName(), QWindowsLocalCodec::mibEnum(), QJpUnicodeConv::newConverter(), QUrlPrivate::normalized(), QAudioInputPrivate::open(), QAudioOutputPrivate::open(), MetaObjectGenerator::paramList(), parseHttpOptionHeader(), QBBNavigatorEventNotifier::parsePPS(), QBBButtonEventNotifier::parsePPS(), QAxMetaObject::parsePrototype(), QHttpNetworkReplyPrivate::parseStatus(), QNetworkAccessHttpBackend::postRequest(), QDBusConnectionPrivate::prepareHook(), QApplicationPrivate::process_cmdline(), qDecodeDataUrl(), QMetaMethod_name(), qt_read_xpm_image_or_array(), QUrlPrivate::queryItem(), QXIMInputContext::QXIMInputContext(), read_xbm_body(), MetaObjectGenerator::readFuncsInfo(), QConfFileSettingsPrivate::readIniFile(), QDBusConnectionPrivate::relaySignal(), MetaObjectGenerator::replacePrototype(), MetaObjectGenerator::replaceType(), QUrlPrivate::setEncodedUrl(), setupDBusInterface(), setupLocaleMapper(), and split().
int QByteArray::indexOf | ( | const char * | str, |
int | 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 first occurrence of the string str in the byte array, searching forward from index position from.
Returns -1 if str could not be found.
Definition at line 2430 of file qbytearray.cpp.
int QByteArray::indexOf | ( | const QByteArray & | ba, |
int | from = 0 |
||
) | const |
Returns the index position of the first occurrence of the byte array ba in this byte array, searching forward from index position from.
Returns -1 if ba could not be found.
Example:
Definition at line 2388 of file qbytearray.cpp.
|
inline |
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 first occurrence of the string str in the byte array, searching forward from index position from.
Returns -1 if str could not be found.
The Unicode data is converted into 8-bit characters using QString::toAscii().
If the QString contains non-ASCII Unicode characters, using this function can lead to loss of information. You can disable this function by defining QT_NO_CAST_TO_ASCII
when you compile your applications. You then need to call QString::toAscii() (or QString::toLatin1() or QString::toUtf8() or QString::toLocal8Bit()) explicitly if you want to convert the data to const char *
.
Definition at line 1008 of file qstring.h.
QByteArray & QByteArray::insert | ( | int | i, |
char | ch | ||
) |
Inserts character ch at index position i in the byte array.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
If i is greater than size(), the array is first extended using resize().
Definition at line 1936 of file qbytearray.cpp.
Referenced by charString(), QCoreWlanEngine::connectToId(), QSettingsPrivate::iniEscapedString(), replace(), and write_pbm_image().
QByteArray & QByteArray::insert | ( | int | i, |
const char * | str | ||
) |
Inserts the string str at position i in the byte array.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
If i is greater than size(), the array is first extended using resize().
Definition at line 1901 of file qbytearray.cpp.
QByteArray & QByteArray::insert | ( | int | i, |
const char * | str, | ||
int | len | ||
) |
Inserts len bytes of the string str at position i in the byte array.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
If i is greater than size(), the array is first extended using resize().
Definition at line 1920 of file qbytearray.cpp.
QByteArray & QByteArray::insert | ( | int | i, |
const QByteArray & | ba | ||
) |
Inserts the byte array ba at index position i and returns a reference to this byte array.
Example:
Definition at line 1863 of file qbytearray.cpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Inserts the string str at index position i in the byte array.
The Unicode data is converted into 8-bit characters using QString::toAscii().
If i is greater than size(), the array is first extended using resize().
If the QString contains non-ASCII Unicode characters, using this function can lead to loss of information. You can disable this function by defining QT_NO_CAST_TO_ASCII
when you compile your applications. You then need to call QString::toAscii() (or QString::toLatin1() or QString::toUtf8() or QString::toLocal8Bit()) explicitly if you want to convert the data to const char *
.
Definition at line 998 of file qstring.h.
|
inline |
Definition at line 437 of file qbytearray.h.
Referenced by QBitArray::isDetached().
|
inline |
Returns true if the byte array has size 0; otherwise returns false.
Example:
Definition at line 421 of file qbytearray.h.
Referenced by _q_dupEnvironment(), QFileSystemEngine::absoluteName(), QFontDatabasePrivate::addAppFont(), QPdfEnginePrivate::addBrushPattern(), QIcdEngine::addConfiguration(), QUrl::addEncodedQueryItem(), QNetworkAccessCache::addEntry(), QWizardPrivate::addField(), MetaObjectGenerator::addProperty(), QUrl::addQueryItem(), QBasicUnixFontDatabase::addTTFile(), QFontDatabasePrivate::addTTFile(), QByteDataBuffer::append(), QDBusMarshaller::append(), QDBusMarshaller::appendCrossMarshalling(), QWaylandWindowManagerIntegration::authenticateWithToken(), QJSDebuggerAgent::backtrace(), QPatternist::Base64Binary::base64Decode(), QTest::benchmarkResult2String(), QDeclarativeCompiler::buildPropertyOnAssignment(), QNetworkAccessAuthenticationManager::cacheProxyCredentials(), QGraphicsAnchorLayoutPrivate::calculateGraphs(), QAuthenticatorPrivate::calculateResponse(), QScript::callQtMethod(), QTiffPlugin::capabilities(), QJpegPlugin::capabilities(), QICOPlugin::capabilities(), QTgaPlugin::capabilities(), QSvgPlugin::capabilities(), QMngPlugin::capabilities(), checkSymbolFont(), classIDL(), QWSServerPrivate::cleanupFonts(), cleanupFontsDir(), QTextCodec::codecForName(), QDataWidgetMapperPrivate::commit(), QDeclarativeListModelParser::compile(), QDeclarativeListModelParser::compileProperty(), QDeclarativeCompiler::compileTree(), QVNCScreen::connect(), QUnixSocket::connect(), QDeclarativeEnginePrivate::consoleLog(), QMetaType::construct(), convertFlags(), QWindowsMimeText::convertToMime(), QWindowsMimeURI::convertToMime(), QBuiltInMimes::convertToMime(), QLastResortMimes::convertToMime(), QScriptEnginePrivate::convertValue(), create_wm_client_leader(), createContext(), MetaObjectGenerator::createPrototype(), createReadHandlerHelper(), QDBusArgumentPrivate::createSignature(), data(), QSslKeyPrivate::decodePem(), QEgl::defaultConfig(), QMetaType::destroy(), QWidget::destroy(), QAuthenticatorPrivate::digestMd5Response(), QIcdEngine::doRequestUpdate(), QDeclarativeXMLHttpRequest::downloadProgress(), QPdfBaseEnginePrivate::drawTextItem(), QDeclarativeCompiler::dumpStats(), QPSPrintEnginePrivate::emitPages(), enableHarfBuzz(), QHttpNetworkConnectionChannel::ensureConnection(), QDeclarativeObjectMethodScriptClass::enumType(), envVarLocale(), QNetworkAccessAuthenticationManager::fetchCachedProxyCredentials(), QNetworkAccessHttpBackend::fetchCacheMetaData(), QHttpNetworkReplyPrivate::findChallenge(), QDeclarativeXMLHttpRequest::findTextCodec(), QDBusMetaObjectGenerator::findType(), QDeclarativeXMLHttpRequest::finished(), QRasterWindowSurface::flush(), fontFile(), QImageReader::format(), QPatternist::HexBinary::fromLexical(), QHostInfoAgent::fromName(), fromPercentEncoding(), QUuid::fromRfc4122(), QDeclarativeCompiler::genComponent(), generateInterfaceXml(), QDeclarativeCompiler::genObject(), QDeclarativeCompiler::genObjectBody(), QFreetypeFace::getFace(), QIcdEngine::getIcdInitialState(), getMacLocaleName(), getWinLocaleName(), MetaObjectGenerator::guessTypes(), QHttpNetworkRequestPrivate::header(), huntAndEmit(), if(), QTest::incidentType2String(), QScript::indexOfMetaEnum(), QSslCertificatePrivate::init(), QSslSocketBackendPrivate::initSslContext(), QAxServerBase::Invoke(), QAxEventSink::Invoke(), QDeclarativeCompiler::isAttachedPropertyName(), QBitArray::isEmpty(), QPacket::isEmpty(), QUrl::isEmpty(), QLibraryPrivate::isPlugin(), QMetaType::isRegistered(), QSignalSpy::isValid(), QUnixSocketMessage::isValid(), QDeclarativeKeysAttached::keyPressed(), QBBSystemLocaleData::languageLocale(), QCoreApplication::libraryPaths(), QUnixSocketServer::listen(), QSvgIOHandlerPrivate::load(), QAxServerBase::Load(), QSvgIconEnginePrivate::loadDataForModeAndState(), QNetworkAccessHttpBackend::loadFromCacheIfAllowed(), QFontEngine::loadKerningPairs(), loadSingleEngine(), QMenuBarPrivate::macCreateMenuBar(), macQueryInternal(), QDataWidgetMapper::mappedPropertyName(), QUrlPrivate::mergePaths(), QTest::messageType2String(), QDeclarativeParser::Object::metaObject(), MetaObjectGenerator::metaObject(), QXlibMime::mimeConvertToFormat(), QX11Data::motifdndObtainData(), QPpmHandler::name(), nextField(), QAxEventSink::OnChanged(), QAxEventSink::OnRequestEdit(), QIBaseDriver::open(), QWSPcMouseHandlerPrivate::openDevices(), operator!=(), operator==(), QBlittablePixmapData::paintEngine(), QUrlPrivate::parse(), QAuthenticatorPrivate::parseDigestAuthenticationChallenge(), QFtpDTP::parseDir(), QHttpNetworkReplyPrivate::parseHeader(), parseHeaderName(), QDBusMetaObjectGenerator::parseMethods(), QAxMetaObject::parsePrototype(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), QDBusMetaObjectGenerator::parseSignals(), QIODevicePrivate::peek(), QHttpNetworkConnectionChannel::pipelineFlush(), QDataWidgetMapperPrivate::populate(), QHttpNetworkConnectionPrivate::prepareRequest(), QByteDataBuffer::prepend(), QTest::printBenchmarkResult(), QFontEngineFT::properties(), QDeclarativeDomProperty::propertyNameParts(), q_fromPercentEncoding(), q_toPercentEncoding(), qax_readClassInfo(), qDBusReplyFill(), QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(), QDeclarativeGridScaledImage::QDeclarativeGridScaledImage(), QDeclarativeImportDatabase::QDeclarativeImportDatabase(), qDecodeDataUrl(), qDetectCPUFeatures(), QEglFSScreen::QEglFSScreen(), qEncodeHmacMd5(), qstrcmp(), qt_adopted_thread_watcher_function(), qt_create_commandline(), qt_getLprPrinters(), qt_inflateGZipDataFrom(), qt_init(), qt_mac_can_clickThrough(), QAxServerBase::qt_metacall(), queryFont(), QAxBase::querySubObject(), QVariantToVARIANT(), QVideoFrame::QVideoFrame(), read_xpm_body(), read_xpm_string(), QDeclarativeXMLHttpRequest::readEncoding(), MetaObjectGenerator::readFuncsInfo(), QHttpNetworkReplyPrivate::readHeader(), QHttpNetworkReplyPrivate::readStatus(), QBBSystemLocaleData::regionLocale(), registerFont(), registerInterface(), registerType(), QWizardPrivate::removeFieldAt(), QInternalMimeData::renderDataHelper(), QNetworkAccessHttpBackend::replyDownloadMetaData(), QBBNavigatorEventNotifier::replyPPS(), QDeclarativeXmlListModel::requestFinished(), QDeclarativeXMLHttpRequest::requestFromUrl(), QWizardField::resolve(), QUrl::resolved(), QDeclarativePropertyPrivate::restore(), QHeaderView::restoreState(), QMainWindow::restoreState(), QCryptographicHash::result(), QInternalMimeData::retrieveData(), QMacPasteboard::retrieveData(), QMimeDataPrivate::retrieveTypedData(), QWindowsPipeWriter::run(), QAxServerBase::Save(), QPacketProtocol::send(), QWaylandSelection::send(), send_selection(), QSslCertificate::serialNumber(), QNetworkHeadersPrivate::setCookedHeader(), QTimeLinePrivate::setCurrentTime(), QStyledItemDelegate::setEditorData(), QItemDelegate::setEditorData(), QBBClipboard::setMimeData(), QMacPasteboard::setMimeData(), QStyledItemDelegate::setModelData(), QItemDelegate::setModelData(), QNetworkHeadersPrivate::setRawHeader(), setupDBusInterface(), setupLocaleMapper(), QSmSocketReceiver::socketActivated(), QProcessPrivate::startDetached(), QUrl::swap(), QNetworkSessionPrivateImpl::syncStateWithInterface(), QDeclarativeCompiler::testQualifiedEnumAssignment(), QImage::text(), QUrlPrivate::toEncoded(), QTextHtmlExporter::toHtml(), QSslKey::toPem(), toPercentEncoding(), QNetworkCookie::toRawForm(), QFontSubset::toTruetype(), QFontSubset::toType1(), QXlibKeyboard::translateKeySym(), QXcbKeyboard::translateKeySym(), translateKeySym(), translateWSAError(), QMetaType::typeName(), QSystemLocaleData::updateLocale(), QPropertyAnimationPrivate::updateMetaProperty(), QHttpNetworkRequestPrivate::uri(), MetaObjectGenerator::usertypeToString(), QIntValidator::validate(), QUrlPrivate::validate(), QDoubleValidatorPrivate::validateWithLocale(), QMetaEnum::valueToKeys(), VARIANTToQVariant(), variantToString(), QSslCertificate::version(), QTextDocumentWriter::write(), QSvgIconEngine::write(), QX11Data::xdndMimeConvertToFormat(), QHttpThreadDelegate::~QHttpThreadDelegate(), and QPacketAutoSend::~QPacketAutoSend().
bool QByteArray::isNull | ( | ) | const |
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().
Definition at line 3485 of file qbytearray.cpp.
Referenced by digestMd5ResponseHelper(), QUrlPrivate::ensureEncodedParts(), QUrlPrivate::fragmentImpl(), fromPercentEncoding(), fromPercentEncodingHelper(), fromPercentEncodingMutable(), get_device_info(), QBitArray::isNull(), QUrlPrivate::mergePaths(), QJpUnicodeConv::newConverter(), nextField(), operator<<(), QNetworkHeadersPrivate::parseAndSetHeader(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), QGLWindowSurface::QGLWindowSurface(), qt_aqua_guess_size(), qt_init(), replace(), QUrl::resolved(), QUrl::setEncodedFragment(), QUrl::setEncodedQuery(), QNetworkHeadersPrivate::setRawHeaderInternal(), toPercentEncoding(), QDBusMetaType::typeToSignature(), and QXmlSerializer::write().
|
inline |
Definition at line 185 of file qbytearray.h.
int QByteArray::lastIndexOf | ( | char | ch, |
int | from = -1 |
||
) | const |
Returns the index position of the last occurrence of character ch in the byte array, searching backward from index position from.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
If from is -1 (the default), the search starts at the last (size() - 1) byte. Returns -1 if ch could not be found.
Example:
Definition at line 2589 of file qbytearray.cpp.
Referenced by addDefaultArguments(), QAxBase::asVariant(), cacheForNamespace(), QTextCodec::codecForHtml(), QDeclarativeObjectMethodScriptClass::enumType(), fontFile(), QUrl::fromPunycode(), QScript::indexOfMetaEnum(), lastIndexOf(), QUrlPrivate::mergePaths(), QMetaObject::newInstance(), QMetaObject::property(), QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(), MetaObjectGenerator::readFuncsInfo(), QDeclarativeCompiler::rewriteBinding(), and VARIANTToQVariant().
int QByteArray::lastIndexOf | ( | const char * | str, |
int | 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 last occurrence of the string str in the byte array, searching backward from index position from.
If from is -1 (the default), the search starts at the last (size() - 1) byte. Returns -1 if str could not be found.
Definition at line 2563 of file qbytearray.cpp.
int QByteArray::lastIndexOf | ( | const QByteArray & | ba, |
int | from = -1 |
||
) | const |
Returns the index position of the last occurrence of the byte array ba in this byte array, searching backward from index position from.
If from is -1 (the default), the search starts at the last byte. Returns -1 if ba could not be found.
Example:
Definition at line 2526 of file qbytearray.cpp.
|
inline |
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 last occurrence of the string str in the byte array, searching backward from index position from.
If from is -1 (the default), the search starts at the last (size() - 1) byte. Returns -1 if str could not be found.
The Unicode data is converted into 8-bit characters using QString::toAscii().
If the QString contains non-ASCII Unicode characters, using this function can lead to loss of information. You can disable this function by defining QT_NO_CAST_TO_ASCII
when you compile your applications. You then need to call QString::toAscii() (or QString::toLatin1() or QString::toUtf8() or QString::toLocal8Bit()) explicitly if you want to convert the data to const char *
.
Definition at line 1010 of file qstring.h.
QByteArray QByteArray::left | ( | int | len | ) | const |
Returns a byte array that contains the leftmost len bytes of this byte array.
The entire byte array is returned if len is greater than size().
Example:
Definition at line 2790 of file qbytearray.cpp.
Referenced by QZipWriterPrivate::addEntry(), QScript::callQtMethod(), QTextCodec::codecForHtml(), QDeclarativeCompiler::compileAlias(), convertTypes(), QScriptEnginePrivate::convertValue(), QDeclarativeObjectMethodScriptClass::enumType(), QDeclarativeCompiler::evaluateEnum(), QDeclarativeImportsPrivate::find(), QDeclarativePropertyPrivate::findSignalByName(), fontFile(), for(), QScript::functionConnect(), generateInterfaceXml(), QScript::indexOfMetaEnum(), QAxServerBase::Invoke(), QScriptEnginePrivate::jscValueToVariant(), QXIMInputContext::language(), leftJustified(), QAxServerBase::Load(), QTest::memberName(), QUrlPrivate::mergePaths(), QWindowsLocalCodec::mibEnum(), operator<<(), QBBNavigatorEventNotifier::parsePPS(), QNetworkAccessHttpBackend::postRequest(), QMetaObject::property(), QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(), QHttpMultiPartPrivate::QHttpMultiPartPrivate(), QMetaMethod_name(), qt_init(), read_xpm_body(), rightJustified(), setupDBusInterface(), QScript::variantFromValue(), VARIANTToQVariant(), wrapDSC(), and write_pbm_image().
QByteArray QByteArray::leftJustified | ( | int | width, |
char | fill = ' ' , |
||
bool | truncate = false |
||
) | const |
Returns a byte array of size width that contains this byte array padded by the fill character.
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 3429 of file qbytearray.cpp.
Referenced by qEncodeHmacMd5(), and qFillBufferWithString().
|
inline |
Same as size().
Definition at line 356 of file qbytearray.h.
Referenced by _q_dupEnvironment(), QFileSystemEngine::absoluteName(), QAxClientSite::activateObject(), QPdfEnginePrivate::addBrushPattern(), QCryptographicHash::addData(), addDefaultArguments(), QZipWriterPrivate::addEntry(), QDBusMarshaller::append(), cacheForNamespace(), QTextCodec::canEncode(), QUrlPrivate::canonicalHost(), charString(), QPatternist::XsdTypeChecker::checkConstrainingFacetsBinary(), checkStaticArray(), QZipWriter::close(), QDeclarativeListModelParser::compileProperty(), QMetaObject::connectSlotsByName(), convertFlags(), QWindowsMimeHtml::convertFromMime(), QAbstractConcatenable::convertToAscii(), convertTypes(), MetaObjectGenerator::createPrototype(), QAuthenticatorPrivate::digestMd5Response(), QAxBase::dynamicCallHelper(), QPdfEnginePrivate::embedFont(), QDB2Result::exec(), QSymSQLResult::exec(), QODBCResult::exec(), QWSSoundServerPrivate::feedDevice(), QNetworkAccessHttpBackend::fetchCacheMetaData(), QDeclarativePropertyPrivate::findSignalByName(), findSlot(), fromPercentEncodingHelper(), fromPercentEncodingMutable(), QUuid::fromRfc4122(), QTextEncoder::fromUnicode(), getNetWmState(), QScript::QObjectDelegate::getOwnPropertyDescriptor(), QScript::QObjectDelegate::getOwnPropertySlot(), QWSPropertyManager::getProperty(), QFontEngineMac::getSfntTable(), QXmlStreamWriterPrivate::indent(), QDeclarativeCompiler::indexOfSignal(), QSettingsPrivate::iniEscapedKey(), QTestFileLogger::init(), QMetaMethod::invoke(), QAxServerBase::Invoke(), QDeclarativeCompiler::isSignalPropertyName(), QLibraryPrivate::load_sys(), MetaObjectGenerator::metaObject(), QJpUnicodeConv::newConverter(), QMetaObject::newInstance(), nextField(), nextNonWhitespace(), QUrlPrivate::normalized(), normalizeTypeInternal(), QIBaseDriver::open(), QTextStream::operator<<(), MetaObjectGenerator::paramList(), paramType(), parseDateString(), QAuthenticatorPrivate::parseDigestAuthenticationChallenge(), parseHttpOptionHeader(), QDBusMetaObjectGenerator::parseMethods(), QAxMetaObject::parsePrototype(), QSocks5SocketEnginePrivate::parseRequestMethodReply(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), QDBusMetaObjectGenerator::parseSignals(), QHttpNetworkReplyPrivate::parseStatus(), QPdf::patternForBrush(), QSslSocketPrivate::peek(), QApplicationPrivate::process_cmdline(), QCoreApplicationPrivate::processCommandLineArguments(), q_toPercentEncoding(), QByteArrayMatcher::QByteArrayMatcher(), qDBusParametersForMethod(), qEncodeHmacMd5(), qExtractSecurityPolicyFromString(), qFillBufferWithString(), qstrcmp(), qstring_to_xtp(), qStringFromUcs2Le(), qt_socks5_set_host_name_and_port(), QUuid::QUuid(), QVariantToVARIANT(), qvsnprintf(), QRingBuffer< T >::read(), read_xpm_body(), QHttpNetworkReplyPrivate::readHeader(), QConfFileSettingsPrivate::readIniFile(), QConfFileSettingsPrivate::readIniLine(), QHttpNetworkReplyPrivate::readStatus(), QMYSQLResult::reset(), runlengthEncode(), QZipReaderPrivate::scanFiles(), QTcpServerConnection::send(), QmlOstPlugin::send(), QWSSoundServerClient::sendClientMessage(), QWSServerPrivate::sendFontRemovedEvent(), QUrlPrivate::setEncodedUrl(), QWidgetPrivate::setWindowRole(), QXcbWindow::setWindowTitle(), QXlibWindow::setWindowTitle(), sm_setProperty(), QFontEngineXLFD::stringToCMap(), QString::toStdString(), QTest::toString(), QTextCodec::toUnicode(), QTextDecoder::toUnicode(), QMYSQLResult::virtual_hook(), wrapDSC(), QDBusMetaObjectGenerator::write(), write_pbm_image(), QPdfEnginePrivate::writeCompressed(), QPdfEnginePrivate::writeImage(), and QPdfEnginePrivate::~QPdfEnginePrivate().
QByteArray QByteArray::mid | ( | int | pos, |
int | len = -1 |
||
) | const |
Returns a byte array containing len bytes from this byte array, starting at position pos.
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.
Example:
Definition at line 2835 of file qbytearray.cpp.
Referenced by addDefaultArguments(), RequestAnalyzer::analyze(), QAxBase::asVariant(), QAuthDevice::authorizeMessage(), QOpenGLPaintEngine::begin(), cacheForNamespace(), QTextCodec::codecForHtml(), QDeclarativeListModelParser::compileProperty(), QWindowsMimeHtml::convertToMime(), QScriptEnginePrivate::convertToNativeQObject(), QSslKeyPrivate::derFromPem(), QDeclarativeObjectMethodScriptClass::enumType(), QDeclarativeImportsPrivate::find(), QDeclarativePropertyPrivate::findSignalByName(), fontFile(), QHttpNetworkReplyPrivate::getChunkSize(), QScript::indexOfMetaEnum(), QDeclarativeCompiler::indexOfSignal(), QSettingsPrivate::iniUnescapedKey(), QAxServerBase::Invoke(), QTextList::itemText(), QHostInfo::localDomainName(), QJpUnicodeConv::newConverter(), nextField(), QAudioInputPrivate::open(), QAudioOutputPrivate::open(), MetaObjectGenerator::paramList(), parseDateString(), QHttpNetworkReplyPrivate::parseHeader(), QAuthenticatorPrivate::parseHttpResponse(), QBBNavigatorEventNotifier::parsePPS(), QBBButtonEventNotifier::parsePPS(), QAxMetaObject::parsePrototype(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), QHttpNetworkReplyPrivate::parseStatus(), QNetworkAccessHttpBackend::postRequest(), QMetaObject::property(), QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(), qDecodeDataUrl(), qNtlmDecodePhase2(), qt_init(), read_xpm_body(), QAuthDevice::readData(), QConfFileSettingsPrivate::readIniFile(), QAuthDevice::recvReadyRead(), QDeclarativeCompiler::rewriteBinding(), setupLocaleMapper(), split(), QSettingsPrivate::stringToVariant(), toType(), wrapDSC(), and QCoreApplicationData::~QCoreApplicationData().
|
private |
Return a QByteArray that is sure to be NUL-terminated.
By default, all QByteArray have an extra NUL at the end, guaranteeing that assumption. However, if QByteArray::fromRawData is used, then the NUL is there only if the user put it there. We can't be sure.
Definition at line 1604 of file qbytearray.cpp.
Referenced by toDouble(), toLongLong(), toPercentEncoding(), and toULongLong().
|
static |
Returns a byte array containing the string equivalent of the number n to base base (10 by default).
The base can be any value between 2 and 36.
Example:
Definition at line 4004 of file qbytearray.cpp.
Referenced by QXmlTestLogger::addBenchmarkResult(), QTestLogger::addBenchmarkResult(), QDeclarativeCompiler::buildDynamicMeta(), classIDL(), QTextCodec::codecForMib(), convert(), QDeclarativeOpenMetaObjectType::createProperty(), QAuthenticatorPrivate::digestMd5Response(), QDeclarativeCompiledData::dump(), QDeclarativeCompiler::dumpStats(), QPSPrintEnginePrivate::flushPage(), QGLPixmapConvolutionFilter::generateConvolutionShader(), MetaObjectGenerator::guessTypes(), QHttpNetworkRequestPrivate::header(), QSettingsPrivate::iniEscapedString(), QFontDatabase::loadXlfd(), operator<<(), QNetworkAccessHttpBackend::postRequest(), QHttpNetworkConnectionPrivate::prepareRequest(), QFontEngine::properties(), prototype(), QAuthenticatorPrivate::QAuthenticatorPrivate(), qax_generateDocumentation(), qax_readClassInfo(), QHttpMultiPartPrivate::QHttpMultiPartPrivate(), QTest::qSignalDumperCallback(), QTest::qSignalDumperCallbackSlot(), QWSLock::QWSLock(), MetaObjectGenerator::readClassInfo(), MetaObjectGenerator::readEnumInfo(), MetaObjectGenerator::readEventInfo(), MetaObjectGenerator::readInterfaceInfo(), QBBSystemLocaleData::readPpsValue(), renameOverloads(), QSslCertificate::serialNumber(), QHttpNetworkHeaderPrivate::setContentLength(), QTimeLinePrivate::setCurrentTime(), QAxEventSink::signalHasReceivers(), QHttpSocketEngine::slotSocketConnected(), QTest::toString(), QFontSubset::toType1(), QFontSubset::type1AddedGlyphs(), QNetworkDiskCachePrivate::uniqueFileName(), QSslCertificate::version(), write_pbm_image(), and QWSLock::~QWSLock().
|
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 4016 of file qbytearray.cpp.
|
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 4028 of file qbytearray.cpp.
|
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 4040 of file qbytearray.cpp.
|
static |
Returns a byte array that contains the printed value of n, formatted in format f with precision prec.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Argument n is formatted according to the f format specified, which is g
by default, and can be any of the following:
Format | Meaning |
e | format as [-]9.9e[+|-]999 |
E | format as [-]9.9E[+|-]999 |
f | format as [-]9.9 |
g | use e or f format, whichever is the most concise |
G | use E or f format, whichever is the most concise |
With 'e', 'E', and 'f', prec is the number of digits after the decimal point. With 'g' and 'G', prec is the maximum number of significant digits (trailing zeroes are omitted).
Definition at line 4079 of file qbytearray.cpp.
|
inline |
Definition at line 424 of file qbytearray.h.
|
private |
|
inline |
Returns true if this byte array is not equal to string str; otherwise returns false.
The Unicode data is converted into 8-bit characters using QString::toAscii().
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::fromAscii(), QString::fromLatin1(), QString::fromUtf8(), or QString::fromLocal8Bit() explicitly if you want to convert the byte array to a QString before doing the comparison.
Definition at line 983 of file qstring.h.
|
inline |
Appends the character ch onto the end of this byte array and returns a reference to this byte array.
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 505 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.Appends the string str onto the end of this byte array and returns a reference to this byte array.
Definition at line 507 of file qbytearray.h.
|
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 implicitly shared class. Consequently, if this is an empty QByteArray, then this will just share the data held in ba. In this case, no copying of data is done, taking constant time. If a shared instance is modified, it will be copied (copy-on-write), taking linear time.
If this is not an empty QByteArray, a deep copy of the data is performed, taking 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 509 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.Appends the string str onto the end of this byte array and returns a reference to this byte array.
The Unicode data is converted into 8-bit characters using QString::toAscii().
If the QString contains non-ASCII Unicode characters, using this operator can lead to loss of information. You can disable this operator by defining QT_NO_CAST_TO_ASCII
when you compile your applications. You then need to call QString::toAscii() (or QString::toLatin1() or QString::toUtf8() or QString::toLocal8Bit()) explicitly if you want to convert the data to const char *
.
Definition at line 1006 of file qstring.h.
|
inline |
Returns true if this byte array is lexically less than string str; otherwise returns false.
The Unicode data is converted into 8-bit characters using QString::toAscii().
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::fromAscii(), QString::fromLatin1(), QString::fromUtf8(), or QString::fromLocal8Bit() explicitly if you want to convert the byte array to a QString before doing the comparison.
Definition at line 985 of file qstring.h.
|
inline |
Returns true if this byte array is lexically less than or equal to string str; otherwise returns false.
The Unicode data is converted into 8-bit characters using QString::toAscii().
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::fromAscii(), QString::fromLatin1(), QString::fromUtf8(), or QString::fromLocal8Bit() explicitly if you want to convert the byte array to a QString before doing the comparison.
Definition at line 989 of file qstring.h.
QByteArray & QByteArray::operator= | ( | const QByteArray & | other | ) |
Assigns other to this byte array and returns a reference to this byte array.
Definition at line 935 of file qbytearray.cpp.
QByteArray & QByteArray::operator= | ( | const char * | str | ) |
Assigns str to this byte array.
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 954 of file qbytearray.cpp.
|
inline |
Returns true if this byte array is equal to string str; otherwise returns false.
The Unicode data is converted into 8-bit characters using QString::toAscii().
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::fromAscii(), QString::fromLatin1(), QString::fromUtf8(), or QString::fromLocal8Bit() explicitly if you want to convert the byte array to a QString before doing the comparison.
Definition at line 981 of file qstring.h.
|
inline |
Returns true if this byte array is lexically greater than string str; otherwise returns false.
The Unicode data is converted into 8-bit characters using QString::toAscii().
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::fromAscii(), QString::fromLatin1(), QString::fromUtf8(), or QString::fromLocal8Bit() explicitly if you want to convert the byte array to a QString before doing the comparison.
Definition at line 987 of file qstring.h.
|
inline |
Returns true if this byte array is greater than or equal to string str; otherwise returns false.
The Unicode data is converted into 8-bit characters using QString::toAscii().
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::fromAscii(), QString::fromLatin1(), QString::fromUtf8(), or QString::fromLocal8Bit() explicitly if you want to convert the byte array to a QString before doing the comparison.
Definition at line 991 of file qstring.h.
|
inline |
Same as at(i).
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 415 of file qbytearray.h.
Referenced by size().
|
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 417 of file qbytearray.h.
|
inline |
Returns the byte at index position i as a modifiable reference.
If an assignment is made beyond the end of the byte array, the array is extended with resize() before the assignment takes place.
Example:
The return value is of type QByteRef, a helper class for QByteArray. When you get an object of type QByteRef, you can use it as if it were a char &. If you assign to it, the assignment will apply to the character in the QByteArray from which you got the reference.
Definition at line 489 of file qbytearray.h.
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 491 of file qbytearray.h.
QByteArray & QByteArray::prepend | ( | char | ch | ) |
Prepends the character ch to this byte array.
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 1694 of file qbytearray.cpp.
Referenced by QUrlPrivate::canonicalHost(), QCoreWlanEngine::connectToId(), QAuthenticatorPrivate::digestMd5Response(), QSettingsPrivate::iniEscapedKey(), normalizeTypeInternal(), prepend(), push_front(), qDecodeDataUrl(), qDetectCPUFeatures(), QXIMInputContext::QXIMInputContext(), QDeclarativeBindingCompilerPrivate::registerString(), QDBusAbstractAdaptor::setAutoRelaySignals(), and WinMain().
QByteArray & QByteArray::prepend | ( | const char * | str | ) |
Prepends the string str to this byte array.
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 1657 of file qbytearray.cpp.
QByteArray & QByteArray::prepend | ( | const char * | str, |
int | len | ||
) |
Prepends len bytes of the string str to this byte array.
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 1672 of file qbytearray.cpp.
QByteArray & QByteArray::prepend | ( | const QByteArray & | ba | ) |
Prepends the byte array ba to this byte array and returns a reference to this byte array.
Example:
This is the same as insert(0, ba).
Note: QByteArray is an implicitly shared class. Consequently, if this is an empty QByteArray, then this will just share the data held in ba. In this case, no copying of data is done, taking constant time. If a shared instance is modified, it will be copied (copy-on-write), taking linear time.
If this is not an empty QByteArray, a deep copy of the data is performed, taking linear time.
Definition at line 1636 of file qbytearray.cpp.
|
inline |
Same as append(ch).
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 511 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(str).
Definition at line 513 of file qbytearray.h.
|
inline |
This function is provided for STL compatibility.
It is equivalent to append(other).
Definition at line 515 of file qbytearray.h.
|
inline |
Same as prepend(ch).
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 517 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 prepend(str).
Definition at line 519 of file qbytearray.h.
|
inline |
This function is provided for STL compatibility.
It is equivalent to prepend(other).
Definition at line 521 of file qbytearray.h.
|
private |
Definition at line 1564 of file qbytearray.cpp.
Referenced by append(), detach(), operator=(), prepend(), reserve(), and squeeze().
QByteArray & QByteArray::remove | ( | int | pos, |
int | 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:
Definition at line 1955 of file qbytearray.cpp.
Referenced by QFileSystemEngine::currentPath(), fromHex(), QFreetypeFace::getFace(), QHttpNetworkReplyPrivate::gunzipBodyPartially(), QX11Data::motifdndObtainData(), QMetaObject::newInstance(), normalizeTypeInternal(), QSocks5SocketEnginePrivate::parseRequestMethodReply(), qDecodeDataUrl(), QFtpDTP::read(), read_xpm_string(), QStateMachinePrivate::registerSignalTransition(), QUrl::removeAllEncodedQueryItems(), QUrl::removeEncodedQueryItem(), and QWindowsPipeWriter::run().
QByteArray QByteArray::repeated | ( | int | 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 2337 of file qbytearray.cpp.
QByteArray & QByteArray::replace | ( | int | pos, |
int | len, | ||
const 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 len bytes from index position pos with the zero terminated string after.
Notice: this can change the length of the byte array.
Definition at line 2002 of file qbytearray.cpp.
Referenced by addDefaultArguments(), QAxEventSink::addSignal(), QWindowsMimeHtml::convertToMime(), QFontEngine::convertToPostscriptFontFamilyName(), MetaObjectGenerator::guessTypes(), QLibraryPrivate::isPlugin(), MetaObjectGenerator::readFuncsInfo(), replace(), MetaObjectGenerator::replacePrototype(), MetaObjectGenerator::replaceType(), QUrlPrivate::setEncodedUrl(), QNetworkCookie::toRawForm(), and QFontSubset::toType1().
QByteArray & QByteArray::replace | ( | int | pos, |
int | len, | ||
const char * | after, | ||
int | 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 from the string after.
after is allowed to have '\0' characters.
Definition at line 2016 of file qbytearray.cpp.
QByteArray & QByteArray::replace | ( | int | pos, |
int | len, | ||
const QByteArray & | 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 1979 of file qbytearray.cpp.
|
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 character before with the string after.
Definition at line 577 of file qbytearray.h.
QByteArray & QByteArray::replace | ( | char | before, |
const QByteArray & | after | ||
) |
Replaces every occurrence of the character before with the byte array after.
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 2247 of file qbytearray.cpp.
|
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 string before with the string after.
Definition at line 581 of file qbytearray.h.
QByteArray & QByteArray::replace | ( | const char * | before, |
int | bsize, | ||
const char * | after, | ||
int | 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 string before with the string after.
Since the sizes of the strings are given by bsize and asize, they may contain zero characters and do not need to be zero-terminated.
Definition at line 2082 of file qbytearray.cpp.
QByteArray & QByteArray::replace | ( | const QByteArray & | before, |
const QByteArray & | after | ||
) |
Replaces every occurrence of the byte array before with the byte array after.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Example:
Definition at line 2044 of file qbytearray.cpp.
|
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 array before with the string after.
Definition at line 579 of file qbytearray.h.
QByteArray & QByteArray::replace | ( | const char * | before, |
const QByteArray & | 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 string before with the byte array after.
Definition at line 2064 of file qbytearray.cpp.
QByteArray & QByteArray::replace | ( | char | before, |
char | after | ||
) |
Replaces every occurrence of the character before with the character after.
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 2288 of file qbytearray.cpp.
|
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 string before with the string after.
Definition at line 1002 of file qstring.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 character before with the string after.
The Unicode data is converted into 8-bit characters using QString::toAscii().
If the QString contains non-ASCII Unicode characters, using this function can lead to loss of information. You can disable this function by defining QT_NO_CAST_TO_ASCII
when you compile your applications. You then need to call QString::toAscii() (or QString::toLatin1() or QString::toUtf8() or QString::toLocal8Bit()) explicitly if you want to convert the data to const char *
.
Definition at line 1000 of file qstring.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 string before with the byte array after.
The Unicode data is converted into 8-bit characters using QString::toAscii().
If the QString contains non-ASCII Unicode characters, using this function can lead to loss of information. You can disable this function by defining QT_NO_CAST_TO_ASCII
when you compile your applications. You then need to call QString::toAscii() (or QString::toLatin1() or QString::toUtf8() or QString::toLocal8Bit()) explicitly if you want to convert the data to const char *
.
Definition at line 1004 of file qstring.h.
|
inline |
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 size is an underestimate, the worst that will happen is that the QByteArray will be a bit slower.
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 change the size of the byte array, call resize().
Definition at line 449 of file qbytearray.h.
Referenced by _q_dupEnvironment(), QOCIResultPrivate::bindValue(), QUrlPrivate::canonicalHost(), QObject::connect(), QObject::disconnect(), QHttpNetworkRequestPrivate::header(), QSettingsPrivate::iniEscapedKey(), QSettingsPrivate::iniEscapedString(), QMetaMethod::invoke(), MetaObjectGenerator::metaObject(), nextField(), QUrlPrivate::normalized(), QMetaObject::normalizedSignature(), normalizeTypeInternal(), QIBaseDriver::open(), operator+=(), operator<<(), parseHttpOptionHeader(), QSslSocketPrivate::peek(), QNetworkAccessManagerPrivate::prepareMultipart(), QHttpNetworkReplyPrivate::readHeader(), QNetworkAccessFileBackend::readMoreFromFile(), QHttpNetworkReplyPrivate::readStatus(), repeated(), QSocks5SocketEnginePrivate::sendRequestMethod(), QSslCertificate::serialNumber(), QDBusPendingCallPrivate::setMetaTypes(), QLocalePrivate::validateChars(), QDBusMetaObjectGenerator::write(), and QSocks5SocketEngine::writeDatagram().
void QByteArray::resize | ( | int | size | ) |
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 are removed from the end.
Definition at line 1508 of file qbytearray.cpp.
Referenced by QNetworkReplyImplPrivate::_q_copyReadyRead(), QHttpPrivate::_q_slotReadyRead(), QZipWriterPrivate::addEntry(), QPdfEnginePrivate::addImage(), QPdf::ascii85Encode(), QPatternist::Base64Binary::base64Decode(), bindFont(), QDeclarativeBindingCompilerPrivate::buildExceptionData(), buildReverseMap(), chop(), QXlibClipboard::clipboardReadIncrementalProperty(), QX11Data::clipboardReadIncrementalProperty(), QXlibClipboard::clipboardReadProperty(), QX11Data::clipboardReadProperty(), QDeclarativeListModelParser::compile(), compressHelper(), QCoreWlanEngine::connectToId(), convertFlags(), QWindowsMimeText::convertFromMime(), QFontJis0201Codec::convertFromUnicode(), QGb18030Codec::convertFromUnicode(), QBig5Codec::convertFromUnicode(), QUtf8::convertFromUnicode(), QUtf16::convertFromUnicode(), QIconvCodec::convertFromUnicode(), QBig5hkscsCodec::convertFromUnicode(), QGbkCodec::convertFromUnicode(), QFontJis0208Codec::convertFromUnicode(), QEucKrCodec::convertFromUnicode(), QEucJpCodec::convertFromUnicode(), QSjisCodec::convertFromUnicode(), QGb2312Codec::convertFromUnicode(), QTsciiCodec::convertFromUnicode(), QFontBig5Codec::convertFromUnicode(), QCP949Codec::convertFromUnicode(), QFontGb2312Codec::convertFromUnicode(), QFontBig5hkscsCodec::convertFromUnicode(), QFontKsc5601Codec::convertFromUnicode(), QFontGbkCodec::convertFromUnicode(), QFontGb18030_0Codec::convertFromUnicode(), QWindowsLocalCodec::convertFromUnicode(), QIconvCodec::convertToUnicode(), QDB2Result::exec(), QODBCResult::exec(), expand(), QIBaseResultPrivate::fetchArray(), QIBaseResultPrivate::fetchBlob(), QXmlInputSource::fetchData(), QZipReader::fileData(), fill(), QAudioOutputPrivate::freeBlocks(), QPatternist::HexBinary::fromLexical(), generateGlyphTables(), generateHead(), generateHhea(), generateMaxp(), generateName(), QXmlStreamReaderPrivate::getChar_helper(), getGlyphData(), QFontEngine::getSfntTable(), QXlibKeyboard::handleKeyEvent(), leftJustified(), QAxServerBase::Load(), nextField(), normalizeTypeInternal(), operator+=(), operator>>(), QPdf::patternForBrush(), QSslSocketPrivate::peek(), QRingBuffer< T >::peek(), QHttpPrivate::postMoreData(), QDeclarativeBindingCompiler::program(), q_toPercentEncoding(), QBitArray::QBitArray(), QSslCertificatePrivate::QByteArray_from_X509(), qbytearray_insert(), qCompress(), qErrnoWarning(), qExtractServerTime(), qGetBinaryData(), qMakeOraDate(), qt_create_commandline(), qt_getLprPrinters(), qt_inflateGZipDataFrom(), qt_parseSpoolInterface(), QVideoFrame::QVideoFrame(), QIODevice::read(), QByteDataBuffer::read(), QRingBuffer< T >::read(), QIODevice::readAll(), QHttp::readAll(), QHttpNetworkReplyPrivate::readBodyFast(), QIODevice::readLine(), QNetworkAccessFileBackend::readMoreFromFile(), QOCICols::readPiecewise(), QHttpNetworkReplyPrivate::readReplyBodyRaw(), remove(), QInternalMimeData::renderDataHelper(), replace(), QBitArray::resize(), QMainWindowLayoutState::restoreState(), QCryptographicHash::result(), rightJustified(), QKqueueFileSystemWatcherEngine::run(), simplified(), QFtpDTP::socketReadyRead(), toLatin1_helper(), QMetaObjectBuilder::toRelocatableData(), QXlibKeyboard::translateKeySym(), QXcbKeyboard::translateKeySym(), translateKeySym(), truncate(), VARIANTToQVariant(), QRfbRawEncoder::write(), QRfbHextileEncoder< SRC >::write(), QIBaseResultPrivate::writeArray(), QPdfEnginePrivate::writeCompressed(), QPAGenerator::writeGMap(), QPFGenerator::writeGMap(), and QXIMInputContext::x11FilterEvent().
QByteArray QByteArray::right | ( | int | len | ) | const |
Returns a byte array that contains the rightmost len bytes of this byte array.
The entire byte array is returned if len is greater than size().
Example:
Definition at line 2812 of file qbytearray.cpp.
Referenced by clientChallenge(), QApplicationPrivate::process_cmdline(), and QCoreApplicationPrivate::processCommandLineArguments().
QByteArray QByteArray::rightJustified | ( | int | width, |
char | fill = ' ' , |
||
bool | truncate = false |
||
) | const |
Returns a byte array of size width that contains the fill character 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 3466 of file qbytearray.cpp.
Referenced by classIDL(), and QSslCertificate::serialNumber().
|
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 584 of file qbytearray.h.
Referenced by QPdfEnginePrivate::drawTextItem(), number(), 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 586 of file qbytearray.h.
|
inline |
Sets the byte array to the printed value of n in base base (10 by default) and returns a reference to the byte array.
The base can be any value between 2 and 36.
Example:
Definition at line 588 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.
Definition at line 590 of file qbytearray.h.
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 3880 of file qbytearray.cpp.
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 3899 of file qbytearray.cpp.
|
inline |
Sets the byte array to the printed value of n, formatted in format f with precision prec, and returns a reference to the byte array.
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 592 of file qbytearray.h.
QByteArray & QByteArray::setNum | ( | double | n, |
char | f = 'g' , |
||
int | prec = 6 |
||
) |
Sets the byte array to the printed value of n, formatted in format f with precision prec, and returns a reference to the byte array.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The format f can be any of the following:
Format | Meaning |
e | format as [-]9.9e[+|-]999 |
E | format as [-]9.9E[+|-]999 |
f | format as [-]9.9 |
g | use e or f format, whichever is the most concise |
G | use E or f format, whichever is the most concise |
With 'e', 'E', and 'f', prec is the number of digits after the decimal point. With 'g' and 'G', prec is the maximum number of significant digits (trailing zeroes are omitted).
Definition at line 3943 of file qbytearray.cpp.
QByteArray & QByteArray::setRawData | ( | const char * | data, |
uint | 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 existings QByteArray objects to save memory re-allocations.
Definition at line 4154 of file qbytearray.cpp.
QByteArray QByteArray::simplified | ( | ) | const |
Returns a byte array that has whitespace removed from the start and the end, and which has each sequence of internal whitespace replaced with a single space.
Whitespace means any character for which the standard C++ isspace() function returns true. This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.
Example:
Definition at line 3348 of file qbytearray.cpp.
Referenced by read_xpm_body(), and wrapDSC().
|
inline |
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 raw data that didn't include the trailing null-termination character then QByteArray doesn't add it automaticall unless the deep copy is created.
Example:
Definition at line 402 of file qbytearray.h.
Referenced by QSocks5SocketEnginePrivate::_q_controlSocketReadNotification(), QHttpPrivate::_q_slotConnected(), QHttpPrivate::_q_slotReadyRead(), QFtpPrivate::_q_startNextCommand(), QSocks5SocketEnginePrivate::_q_udpSocketReadNotification(), QZipWriterPrivate::addEntry(), QBasicUnixFontDatabase::addTTFile(), QFontDatabasePrivate::addTTFile(), QByteDataBuffer::append(), QString::append(), QHttpNetworkReplyPrivate::appendCompressedReplyData(), QNetworkReplyImplPrivate::appendDownstreamData(), QConcatenable< QByteArray >::appendTo(), Maemo::appendVariantToDBusMessage(), QApplicationPrivate::applyX11SpecificCommandLineArguments(), QPdf::ascii85Encode(), at(), QAuthDevice::authorizeMessage(), QPatternist::Base64Binary::base64Decode(), QSocks5PasswordAuthenticator::beginAuthenticate(), bindFont(), QOCIResultPrivate::bindValue(), QDeclarativeCompiler::buildDynamicMeta(), QDeclarativeBindingCompilerPrivate::buildExceptionData(), buildParameterNames(), buildString(), QFtpDTP::bytesAvailable(), QHttpNetworkReplyPrivate::bytesAvailable(), QScript::callQtMethod(), QTextCodec::canEncode(), QSslCertificatePrivate::certificatesFromDer(), QSslCertificatePrivate::certificatesFromPem(), QPicturePrivate::checkFormat(), checksum(), childKeysOrGroups(), QRingBuffer< T >::chop(), clientChallenge(), QXlibClipboard::clipboardReadIncrementalProperty(), QX11Data::clipboardReadIncrementalProperty(), QXlibClipboard::clipboardReadProperty(), QX11Data::clipboardReadProperty(), QTextCodec::codecForUtfText(), QUnixSocket::connect(), convertFlags(), QWindowsMimeText::convertFromMime(), QMacPasteboardMimeHTMLText::convertFromMime(), QMacPasteboardMimeTiff::convertFromMime(), QWindowsMimeHtml::convertFromMime(), QSimpleTextCodec::convertFromUnicode(), QIconvCodec::convertFromUnicode(), QWindowsLocalCodec::convertFromUnicode(), QAbstractConcatenable::convertToAscii(), QMacPasteboardMimePlainText::convertToMime(), QMacPasteboardMimeUnicodeText::convertToMime(), QWindowsMimeText::convertToMime(), QMacPasteboardMimeTiff::convertToMime(), QScriptEnginePrivate::convertToNativeQObject(), QIconvCodec::convertToUnicode(), QScriptEnginePrivate::convertValue(), QBitArray::count(), create_wm_client_leader(), QSslKeyPrivate::decodePem(), QSslKeyPrivate::derFromPem(), QIcdEngine::doRequestUpdate(), QPainterPrivate::draw_helper(), QPSPrintEnginePrivate::drawImageHelper(), QPdfEnginePrivate::embedFont(), QClipboardWatcher::empty(), QDB2Result::exec(), QSQLiteResult::exec(), QODBCResult::exec(), QOCICols::execBatch(), QHttpNetworkConnectionChannel::expand(), QFontEngineMac::faceId(), QZipReader::fileData(), QBitArray::fill(), QFileSystemEngine::fillMetaData(), QTextStreamPrivate::flushWriteBuffer(), QXlibClipboardMime::formats_sys(), QDB2Driver::formatValue(), QSqlDriver::formatValue(), QTDSDriver::formatValue(), QMYSQLDriver::formatValue(), QODBCDriver::formatValue(), QRingBuffer< T >::free(), fromBase64(), QImage::fromData(), QDirectFBPixmapData::fromFile(), QGLPixmapData::fromFile(), fromHex(), QUrl::fromPunycode(), QXmlInputSource::fromRawData(), fromRawData(), generateGlyphTables(), QDeclarativeCompiler::genObject(), QXmlStreamReaderPrivate::getChar_helper(), QHttpNetworkReplyPrivate::getChunkSize(), QXlibClipboard::getDataInFormat(), QClipboardWatcher::getDataInFormat(), QFreetypeFace::getFace(), getFullPath(), QFontEngine::glyphCount(), QHttpNetworkReplyPrivate::gunzipBodyPartially(), QHttpNetworkReplyPrivate::gzipCheckHeader(), QXlibKeyboard::handleKeyEvent(), QXlibClipboard::handleSelectionRequest(), QNonContiguousByteDeviceThreadForwardImpl::haveDataSlot(), QHttpNetworkRequestPrivate::header(), ICOReader::iconAt(), QByteArrayMatcher::indexIn(), indexOf(), QRingBuffer< T >::indexOf(), QSettingsPrivate::iniEscapedString(), QTestLiteStaticInfoPrivate::initializeSupportedAtoms(), QDeclarativeJS::integerFromString(), QScript::integerFromString(), QScriptEnginePrivate::jscValueToVariant(), QUnixSocketServer::listen(), QSvgIOHandlerPrivate::load(), QAxScriptManager::load(), QAxServerBase::Load(), QPixmap::loadFromData(), QImage::loadFromData(), QFontEngine::loadKerningPairs(), macQueryInternal(), macValue(), matchLineFeed(), QXlibMime::mimeConvertToFormat(), QXlibMime::mimeDataForAtom(), QRingBuffer< T >::nextDataBlockSize(), normalizeTypeInternal(), QIBaseDriver::open(), operator+(), operator+=(), QString::operator+=(), QString::operator<(), operator<<(), operator<<(), QString::operator<=(), operator=(), QString::operator=(), operator==(), QString::operator>(), QString::operator>=(), operator[](), QBitArray::operator^=(), QBitArray::operator|=(), QBitArray::operator~(), QDeclarativeCompiledData::pack(), QSocks5SocketEnginePrivate::parseRequestMethodReply(), QBufferPrivate::peek(), QIODevicePrivate::peek(), QRingBuffer< T >::peek(), QSslKeyPrivate::pemFromDer(), QByteDataBuffer::prepend(), QString::prepend(), QDeclarativeBindingCompiler::program(), QMacPasteboard::promiseKeeper(), QFtp::put(), QTextStreamPrivate::putString(), QBitArray::QBitArray(), QByteArray(), QSslCertificatePrivate::QByteArray_from_X509(), qbytearray_insert(), QByteArrayMatcher::QByteArrayMatcher(), QClipboardINCRTransaction::QClipboardINCRTransaction(), qCompress(), qCreatev2Hash(), qEncodeHmacMd5(), qEncodeNtlmBuffer(), qEncodeNtlmv2Response(), QFontEngineQPF::QFontEngineQPF(), qGetBinaryData(), qHash(), qMetaTypeCustomType_unlocked(), qNtlmDecodePhase2(), qStreamNtlmBuffer(), qStringFromUcs2Le(), qt_create_commandline(), qt_error_string(), qt_fill_input_buffer(), qt_get_net_supported(), qt_get_net_virtual_roots(), qt_inflateGZipDataFrom(), qt_mac_execute_apple_script(), qt_parse_pattern(), qt_read_xpm_image_or_array(), qt_socks5_get_host_address_and_port(), qt_x11_apply_settings_in_all_apps(), queryFont(), QUrlPrivate::queryItem(), qUncompress(), QFtpDTP::read(), QByteDataBuffer::read(), QIODevice::read(), QRingBuffer< T >::read(), read_xpm_body(), read_xpm_string(), QFtpDTP::readAll(), QIODevice::readAll(), QAuthDevice::readData(), QSocks5SocketEngine::readDatagram(), QConfFileSettingsPrivate::readIniFile(), QWinSettingsPrivate::readKey(), QIODevice::readLine(), QOCICols::readPiecewise(), QHttpNetworkReplyPrivate::readReplyBodyRaw(), QHttpNetworkReplyPrivate::readStatus(), QPacketProtocolPrivate::readyToRead(), QAuthDevice::recvReadyRead(), registerFont(), QPlatformFontDatabase::registerQPF2Font(), releaseFontData(), removeDotsFromPath(), replace(), QBBNavigatorEventNotifier::replyPPS(), QRingBuffer< T >::reserve(), QBitArray::resize(), resize(), resolveGdi32(), QWidget::restoreGeometry(), QMainWindowLayoutState::restoreState(), QInternalMimeData::retrieveData(), QKqueueFileSystemWatcherEngine::run(), QDeclarativeVME::run(), QWindowsPipeWriter::run(), runlengthEncode(), QAxServerBase::Save(), QPacketProtocol::send(), send_selection(), QWSServerPrivate::sendQCopEvent(), QXlibClipboard::sendSelection(), QWinSettingsPrivate::set(), set_text(), QDeclarativeParser::Object::setBindingBit(), setData(), QWSRegionCommand::setData(), QUrlPrivate::setEncodedUrl(), QWSFontCommand::setFontName(), QWSQCopSendCommand::setMessage(), QBBClipboard::setMimeData(), QByteArrayMatcher::setPattern(), QWSDirectPainterSurface::setPermanentState(), QWSDisplay::setProperty(), setRawData(), QProcess::setReadChannel(), QWSIMResponseCommand::setResult(), QBitArray::size(), QNonContiguousByteDeviceByteArrayImpl::size(), QConcatenable< QByteArray >::size(), QByteDataBuffer::sizeNextBlock(), QFtpDTP::socketReadyRead(), standardLibraryErrorString(), QFontEngineMac::stringToCMap(), QRawFont::supportedWritingSystems(), toBase64(), toInt(), QSslKey::toPem(), QXlibKeyboard::translateKeySym(), QXcbKeyboard::translateKeySym(), translateKeySym(), truncate(), QIntValidator::validate(), QScript::variantFromValue(), VARIANTToQVariant(), QSettingsPrivate::variantToString(), Maemo::IAPConfPrivate::variantToValue(), QMYSQLResult::virtual_hook(), QIODevice::write(), QPdfEnginePrivate::write(), QRfbRawEncoder::write(), QXmlStreamWriterPrivate::write(), QUnixSocketPrivate::writeActivated(), QIBaseResultPrivate::writeBlob(), QPAGenerator::writeBlock(), QPFGenerator::writeBlock(), QPdfEnginePrivate::writeCompressed(), QUdpSocket::writeDatagram(), QSocks5SocketEngine::writeDatagram(), QPAGenerator::writeGMap(), QPFGenerator::writeGMap(), QClipboardINCRTransaction::x11Event(), QX11Data::xdndHandleSelectionRequest(), QX11Data::xdndMimeConvertToFormat(), QX11Data::xdndMimeDataForAtom(), and xdndObtainData().
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 2307 of file qbytearray.cpp.
Referenced by QGLXContext::getProcAddress(), QEgl::hasExtension(), QAxServerBase::Invoke(), QXlibMime::mimeDataForAtom(), MetaObjectGenerator::paramList(), parseCookieHeader(), QNetworkCookie::parseCookies(), QAuthenticatorPrivate::parseDigestAuthenticationChallenge(), QBBNavigatorEventNotifier::parsePPS(), QBBButtonEventNotifier::parsePPS(), QAxMetaObject::parsePrototype(), QDeclarativeDomProperty::propertyNameParts(), q_hasEglExtension(), QGLXContext::QGLXContext(), qt_init(), QXIMInputContext::QXIMInputContext(), read_xpm_body(), QMimeDataPrivate::retrieveTypedData(), WinMain(), and QX11Data::xdndMimeDataForAtom().
|
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 452 of file qbytearray.h.
bool QByteArray::startsWith | ( | const QByteArray & | ba | ) | const |
Returns true if this byte array starts with byte array ba; otherwise returns false.
Example:
Definition at line 2684 of file qbytearray.cpp.
Referenced by QFileSystemEngine::absoluteName(), QCoreApplication::arguments(), QHttpNetworkReplyPrivate::authenticationMethod(), cacheForNamespace(), QCacheItem::canCompress(), QUrlPrivate::canonicalHost(), QSvgIOHandler::canRead(), QNetworkAccessHttpBackend::canResume(), QDeclarativeListModelParser::compileProperty(), QScriptEnginePrivate::convertToNativeQObject(), QHttpNetworkConnectionChannel::detectPipeliningSupport(), QHttpNetworkReplyPrivate::findChallenge(), findSlot(), QUrl::fromPunycode(), QRegExpEngine::getEscape(), QFreetypeFace::getFace(), QDeclarativeCompiler::isSignalPropertyName(), QXIMInputContext::language(), QSvgTinyDocument::load(), QHostInfo::localDomainName(), QX11Data::motifdndObtainData(), QUrlPrivate::normalized(), QAuthenticatorPrivate::parseHttpResponse(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), QHttpNetworkReplyPrivate::parseStatus(), QCoreApplicationPrivate::processCommandLineArguments(), qax_noSuchFunction(), qDecodeDataUrl(), QHttpNetworkReplyPrivate::readStatus(), QStateMachinePrivate::registerSignalTransition(), QUrlPrivate::toEncoded(), QNetworkCookie::toRawForm(), QIntValidator::validate(), QDoubleValidatorPrivate::validateWithLocale(), and QCoreApplicationData::~QCoreApplicationData().
bool QByteArray::startsWith | ( | char | ch | ) | const |
Returns true if this byte array starts with character ch; otherwise returns false.
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 2719 of file qbytearray.cpp.
bool QByteArray::startsWith | ( | const char * | str | ) | const |
Returns true if this byte array starts with string str; otherwise returns false.
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 2701 of file qbytearray.cpp.
|
inline |
Swaps byte array other with this byte array.
This operation is very fast and never fails.
Definition at line 164 of file qbytearray.h.
QByteArray QByteArray::toBase64 | ( | ) | const |
Returns a copy of the byte array, encoded as Base64.
The algorithm used to encode Base64-encoded data is defined in RFC 2045.
Definition at line 3796 of file qbytearray.cpp.
Referenced by QDeclarativeEnginePrivate::btoa(), QAuthenticatorPrivate::calculateResponse(), QSvgPaintEngine::drawImage(), operator<<(), QSslKeyPrivate::pemFromDer(), QSslCertificatePrivate::QByteArray_from_X509(), QHttpMultiPartPrivate::QHttpMultiPartPrivate(), and QPatternist::Base64Binary::stringValue().
double QByteArray::toDouble | ( | bool * | ok = 0 | ) | const |
Returns the byte array converted to a double
value.
Returns 0.0 if the conversion fails.
If ok is not 0: if a conversion error occurs, *{ok} is set to false; otherwise *{ok} is set to true.
Definition at line 3763 of file qbytearray.cpp.
Referenced by getXDefault(), and toFloat().
float QByteArray::toFloat | ( | bool * | ok = 0 | ) | const |
Returns the byte array converted to a float
value.
Returns 0.0 if the conversion fails.
If ok is not 0: if a conversion error occurs, *{ok} is set to false; otherwise *{ok} is set to true.
Definition at line 3782 of file qbytearray.cpp.
Referenced by QOpenGLPaintEngine::begin().
QByteArray QByteArray::toHex | ( | ) | const |
Returns a hex encoded copy of the byte array.
The hex encoding uses the numbers 0-9 and the letters a-f.
Definition at line 4271 of file qbytearray.cpp.
Referenced by digestMd5ResponseHelper(), QDBusMetaObjectGenerator::findType(), QDeclarativeEnginePrivate::md5(), QAuthenticatorPrivate::QAuthenticatorPrivate(), qmlsqldatabase_open_sync(), and QSslSocketBackendPrivate::startHandshake().
int QByteArray::toInt | ( | bool * | ok = 0 , |
int | base = 10 |
||
) | const |
Returns the byte array converted to an int
using base base, which is 10 by default and must be between 2 and 36, or 0.
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; if it begins with "0", it is assumed to be octal; otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not 0: if a conversion error occurs, *{ok} is set to false; otherwise *{ok} is set to true.
Definition at line 3576 of file qbytearray.cpp.
Referenced by QBBScreen::adjustOrientation(), buttonChange(), QVNCScreen::connect(), QWSDisplay::Data::connectToPipe(), QWindowsMimeHtml::convertToMime(), QWidget::create(), QEglFSScreen::createAndSetPlatformContext(), createContext(), QEgl::defaultConfig(), defaultDepth(), do_size_hints(), QGraphicsScenePrivate::draw(), QNetworkAccessHttpBackend::fetchCacheMetaData(), QWidgetBackingStore::flushPaint(), flushUpdate(), QFreetypeFace::getFace(), QBBNavigatorEventNotifier::handleMessage(), QSettingsPrivate::iniUnescapedKey(), QGtkStylePrivate::isKDE4Session(), QScreen::isWidgetPaintOnScreen(), layoutDebug(), QWidgetPrivate::moveRect(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), QHttpNetworkReplyPrivate::parseStatus(), QDBusConnectionPrivate::QDBusConnectionPrivate(), QEglFSScreen::QEglFSScreen(), qt_flush(), qt_grab_cursor(), qt_graphicsLayoutDebug(), QVNCDirtyMap::QVNCDirtyMap(), QVNCScreenPrivate::QVNCScreenPrivate(), QRfbSingleColorHextile< SRC >::read(), read_int_env_var(), QWidgetPrivate::scroll_sys(), QWidgetPrivate::scrollRect(), QDirectFBPaintEnginePrivate::setCompositionMode(), QVNCDirtyMapOptimized< T >::setDirty(), QPainter::setRenderHint(), QWidgetPrivate::subtractOpaqueSiblings(), and QETWidget::translateConfigEvent().
long QByteArray::toLong | ( | bool * | ok = 0 , |
int | base = 10 |
||
) | const |
Returns the byte array converted to a long
int using base base, which is 10 by default and must be between 2 and 36, or 0.
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; if it begins with "0", it is assumed to be octal; otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not 0: if a conversion error occurs, *{ok} is set to false; otherwise *{ok} is set to true.
Definition at line 3641 of file qbytearray.cpp.
Referenced by QHttpNetworkReplyPrivate::getChunkSize().
qlonglong QByteArray::toLongLong | ( | bool * | ok = 0 , |
int | base = 10 |
||
) | const |
Returns the byte array converted to a {long
long} using base base, which is 10 by default and must be between 2 and 36, or 0.
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; if it begins with "0", it is assumed to be octal; otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not 0: if a conversion error occurs, *{ok} is set to false; otherwise *{ok} is set to true.
Definition at line 3508 of file qbytearray.cpp.
Referenced by parseHeaderValue(), toInt(), toLong(), and toShort().
QByteArray QByteArray::toLower | ( | ) | const |
Returns a lowercase copy of the byte array.
The bytearray is interpreted as a Latin-1 encoded string.
Example:
Definition at line 2861 of file qbytearray.cpp.
Referenced by QHttpNetworkReplyPrivate::authenticationMethod(), QUrlPrivate::canonicalHost(), QTextCodec::codecForHtml(), createReadHandlerHelper(), digestMd5ResponseHelper(), QNetworkAccessHttpBackend::fetchCacheMetaData(), QDeclarativeXMLHttpRequest::fillHeadersList(), QHttpNetworkReplyPrivate::findChallenge(), fontFile(), get_named_rgb(), if(), imageReadMimeFormats(), imageWriteMimeFormats(), QWaylandNativeInterface::nativeResourceForWidget(), QAuthenticatorPrivate::parseHttpResponse(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), qax_noSuchFunction(), qDecodeDataUrl(), qt_fillFontDef(), read_xpm_body(), QHttpNetworkReplyPrivate::readHeader(), QPpmHandler::setOption(), WinMain(), 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 characters that are not one of the following:
ALPHA ("a" to "z" and "A" to "Z") / DIGIT (0 to 9) / "-" / "." / "_" / "~"
To prevent characters from being encoded pass them to exclude. To force characters 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 4467 of file qbytearray.cpp.
short QByteArray::toShort | ( | bool * | ok = 0 , |
int | base = 10 |
||
) | const |
Returns the byte array converted to a short
using base base, which is 10 by default and must be between 2 and 36, or 0.
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; if it begins with "0", it is assumed to be octal; otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not 0: if a conversion error occurs, *{ok} is set to false; otherwise *{ok} is set to true.
Definition at line 3704 of file qbytearray.cpp.
uint QByteArray::toUInt | ( | bool * | ok = 0 , |
int | base = 10 |
||
) | const |
Returns the byte array converted to an {unsigned
int} using base base, which is 10 by default and must be between 2 and 36, or 0.
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; if it begins with "0", it is assumed to be octal; otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not 0: if a conversion error occurs, *{ok} is set to false; otherwise *{ok} is set to true.
Definition at line 3607 of file qbytearray.cpp.
Referenced by qt_parse_pattern().
ulong QByteArray::toULong | ( | bool * | ok = 0 , |
int | base = 10 |
||
) | const |
Returns the byte array converted to an {unsigned
long int} using base base, which is 10 by default and must be between 2 and 36, or 0.
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; if it begins with "0", it is assumed to be octal; otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not 0: if a conversion error occurs, *{ok} is set to false; otherwise *{ok} is set to true.
Definition at line 3673 of file qbytearray.cpp.
qulonglong QByteArray::toULongLong | ( | bool * | ok = 0 , |
int | base = 10 |
||
) | const |
Returns the byte array converted to an {unsigned
long long} using base base, which is 10 by default and must be between 2 and 36, or 0.
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; if it begins with "0", it is assumed to be octal; otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not 0: if a conversion error occurs, *{ok} is set to false; otherwise *{ok} is set to true.
Definition at line 3541 of file qbytearray.cpp.
Referenced by QHttpNetworkHeaderPrivate::contentLength(), QNetworkAccessHttpBackend::postRequest(), toUInt(), toULong(), and toUShort().
QByteArray QByteArray::toUpper | ( | ) | const |
Returns an uppercase copy of the byte array.
The bytearray is interpreted as a Latin-1 encoded string.
Example:
Definition at line 2884 of file qbytearray.cpp.
Referenced by QSslSocketBackendPrivate::startHandshake().
ushort QByteArray::toUShort | ( | bool * | ok = 0 , |
int | base = 10 |
||
) | const |
Returns the byte array converted to an {unsigned
short} using base base, which is 10 by default and must be between 2 and 36, or 0.
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; if it begins with "0", it is assumed to be octal; otherwise it is assumed to be decimal.
Returns 0 if the conversion fails.
If ok is not 0: if a conversion error occurs, *{ok} is set to false; otherwise *{ok} is set to true.
Definition at line 3735 of file qbytearray.cpp.
QByteArray QByteArray::trimmed | ( | ) | const |
Returns a byte array that has whitespace removed from the start and the end.
Whitespace means any character for which the standard C++ isspace() function returns true. This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.
Example:
Unlike simplified(), trimmed() leaves internal whitespace alone.
Definition at line 3388 of file qbytearray.cpp.
Referenced by QHttpNetworkReplyPrivate::authenticationMethod(), QHostInfo::localDomainName(), QJpUnicodeConv::newConverter(), nextField(), parseCookieHeader(), QHttpNetworkReplyPrivate::parseHeader(), parseHeaderValue(), QAuthenticatorPrivate::parseHttpResponse(), QNetworkCookiePrivate::parseSetCookieHeaderLine(), QDeclarativeGridScaledImage::QDeclarativeGridScaledImage(), qDecodeDataUrl(), read_xpm_body(), QConfFileSettingsPrivate::readIniFile(), QMimeDataPrivate::retrieveTypedData(), and QCoreApplicationData::~QCoreApplicationData().
void QByteArray::truncate | ( | int | pos | ) |
Truncates the byte array at index position pos.
If pos is beyond the end of the array, nothing happens.
Example:
Definition at line 1270 of file qbytearray.cpp.
Referenced by QIsciiCodec::convertFromUnicode(), MetaObjectGenerator::createPrototype(), QZipReader::fileData(), fromBase64(), QMetaMethod::invoke(), QAxServerBase::Invoke(), QHostInfo::localDomainName(), QIBaseDriver::open(), MetaObjectGenerator::paramList(), paramType(), QDBusMetaObjectGenerator::parseMethods(), QAxMetaObject::parsePrototype(), QDBusMetaObjectGenerator::parseSignals(), QDBusConnectionPrivate::prepareHook(), q_fromPercentEncoding(), q_toPercentEncoding(), qDBusParametersForMethod(), qDecodeDataUrl(), QVariantToVARIANT(), QXIMInputContext::QXIMInputContext(), read_xpm_body(), MetaObjectGenerator::readFuncsInfo(), QHttpNetworkReplyPrivate::readStatus(), QDBusConnectionPrivate::relaySignal(), removeDotsFromPath(), and toBase64().
|
related |
Returns true if byte array a1 is not equal to byte array a2; otherwise returns false.
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 533 of file qbytearray.h.
|
related |
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 string a2; otherwise returns false.
Definition at line 535 of file qbytearray.h.
|
related |
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 string a1 is not equal to byte array a2; otherwise returns false.
Definition at line 537 of file qbytearray.h.
|
related |
Returns a byte array that is the result of concatenating byte array a1 and byte array a2.
Definition at line 564 of file qbytearray.h.
|
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 string a2.
Definition at line 566 of file qbytearray.h.
|
related |
Returns a byte array that is the result of concatenating byte array a1 and character a2.
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 568 of file qbytearray.h.
|
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 string a1 and byte array a2.
Definition at line 570 of file qbytearray.h.
|
related |
Returns a byte array that is the result of concatenating character a1 and byte array a2.
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 572 of file qbytearray.h.
|
related |
Returns true if byte array a1 is lexically less than byte array a2; otherwise returns false.
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 539 of file qbytearray.h.
Referenced by QElapsedTimer::operator!=().
|
related |
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 string a2; otherwise returns false.
Definition at line 541 of file qbytearray.h.
|
related |
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 string a1 is lexically less than byte array a2; otherwise returns false.
Definition at line 543 of file qbytearray.h.
|
related |
Writes byte array ba to the stream out and returns a reference to the stream.
Definition at line 2928 of file qbytearray.cpp.
Referenced by setNum().
|
related |
Returns true if byte array a1 is lexically less than or equal to byte array a2; otherwise returns false.
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 545 of file qbytearray.h.
|
related |
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 string a2; otherwise returns false.
Definition at line 547 of file qbytearray.h.
|
related |
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 string a1 is lexically less than or equal to byte array a2; otherwise returns false.
Definition at line 549 of file qbytearray.h.
|
related |
Returns true if byte array a1 is equal to byte array a2; otherwise returns false.
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 527 of file qbytearray.h.
|
related |
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 string a2; otherwise returns false.
Definition at line 529 of file qbytearray.h.
|
related |
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 string a1 is equal to byte array a2; otherwise returns false.
Definition at line 531 of file qbytearray.h.
|
related |
Returns true if byte array a1 is lexically greater than byte array a2; otherwise returns false.
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 551 of file qbytearray.h.
|
related |
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 string a2; otherwise returns false.
Definition at line 553 of file qbytearray.h.
|
related |
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 string a1 is lexically greater than byte array a2; otherwise returns false.
Definition at line 555 of file qbytearray.h.
|
related |
Returns true if byte array a1 is lexically greater than or equal to byte array a2; otherwise returns false.
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 557 of file qbytearray.h.
|
related |
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 string a2; otherwise returns false.
Definition at line 559 of file qbytearray.h.
|
related |
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 string a1 is lexically greater than or equal to byte array a2; otherwise returns false.
Definition at line 561 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 2948 of file qbytearray.cpp.
Referenced by setNum().
Definition at line 392 of file qbytearray.h.
Referenced by operator[]().
Returns the CRC-16 checksum of the first len bytes of data.
The checksum is independent of the byte order (endianness).
Definition at line 434 of file qbytearray.cpp.
Referenced by qstrncmp().
|
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 604 of file qbytearray.h.
Referenced by qCompress(), and setNum().
|
related |
Compresses the first nbytes of data and returns the compressed data in a new byte array.
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 483 of file qbytearray.cpp.
|
related |
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 128 of file qvsnprintf.cpp.
Referenced by fromPercentEncodingMutable(), qstrncmp(), qt_x_errhandler(), and write_xbm_image().
|
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.
Special case 1: Returns 0 if str1 and str2 are both 0.
Special case 2: Returns an arbitrary non-zero value if str1 is 0 or str2 is 0 (but not both).
Definition at line 231 of file qbytearray.cpp.
Referenced by convert(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), qstrcmp(), qstrnlen(), and QVariantToVARIANT().
|
related |
Copies all the characters up to and including the '\0' from src into dst and returns a pointer to dst.
If src is 0, it immediately returns 0.
This function assumes that dst is large enough to hold the contents of src.
Definition at line 137 of file qbytearray.cpp.
Referenced by qstrdup(), qstrncmp(), and qstrnlen().
|
related |
Returns a duplicate string.
Allocates space for a copy of src, copies it, and returns a pointer to the copy. If src is 0, it immediately returns 0.
Ownership is passed to the caller, so the returned string must be deleted using delete
[].
Definition at line 114 of file qbytearray.cpp.
|
related |
A safe stricmp()
function.
Compares str1 and str2 ignoring the case of the characters. The encoding of the strings is assumed to be Latin-1.
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.
Special case 1: Returns 0 if str1 and str2 are both 0.
Special case 2: Returns a random non-zero value if str1 is 0 or str2 is 0 (but not both).
Definition at line 279 of file qbytearray.cpp.
Referenced by classIDL(), nameMatch(), and qstrncmp().
Definition at line 393 of file qbytearray.h.
|
related |
A safe strlen()
function.
Returns the number of characters that precede the terminating '\0', or 0 if str is 0.
Definition at line 79 of file qbytearray.h.
Referenced by append(), compare(), containsTLDEntry(), count(), endsWith(), indexOf(), insert(), lastIndexOf(), operator=(), prepend(), QByteArray(), qstrcpy(), qsvg_get_hex_rgb(), qt_get_hex_rgb(), removeGroupSeparators(), replace(), startsWith(), and write_xbm_image().
|
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.
Special case 1: Returns 0 if str1 and str2 are both 0.
Special case 2: Returns a random non-zero value if str1 is 0 or str2 is 0 (but not both).
Definition at line 101 of file qbytearray.h.
Referenced by endsWith(), read_dib_fileheader(), and startsWith().
|
related |
A safe strncpy()
function.
Copies at most len bytes from src (stopping at len or the terminating '\0' whichever comes first) into dst and returns a pointer to dst. Guarantees that dst is '\0'-terminated. If src or dst is 0, returns 0 immediately.
This function assumes that dst is at least len characters long.
Definition at line 175 of file qbytearray.cpp.
Referenced by qstrnlen().
|
related |
A safe strnicmp()
function.
Compares at most len bytes of str1 and str2 ignoring the case of the characters. The encoding of the strings is assumed to be Latin-1.
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.
Special case 1: Returns 0 if str1 and str2 are both 0.
Special case 2: Returns a random non-zero value if str1 is 0 or str2 is 0 (but not both).
Definition at line 316 of file qbytearray.cpp.
Referenced by qstrncmp().
A safe strnlen()
function.
Returns the number of characters that precede the terminating '\0', but at most maxlen. If str is 0, returns 0.
Definition at line 82 of file qbytearray.h.
|
friend |
Uncompresses the first nbytes of data and returns a new byte array with the uncompressed data.
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 562 of file qbytearray.cpp.
Referenced by qUncompress(), and setNum().
|
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.
Definition at line 606 of file qbytearray.h.
|
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::sprintf() instead.
Definition at line 78 of file qvsnprintf.cpp.
Referenced by backtrace_command(), qsnprintf(), and qstrncmp().
|
private |
Definition at line 386 of file qbytearray.h.
Referenced by append(), at(), begin(), capacity(), chop(), clear(), constBegin(), constData(), constEnd(), count(), data(), detach(), end(), endsWith(), expand(), fill(), QAxEventSink::findProperty(), fromBase64(), indexOf(), insert(), isDetached(), isEmpty(), isNull(), isSharedWith(), lastIndexOf(), left(), leftJustified(), mid(), nulTerminated(), QByteRef::operator char(), operator const char *(), QByteRef::operator!=(), QByteRef::operator<(), QByteRef::operator<=(), QBitArray::operator=(), operator=(), QByteRef::operator=(), QByteRef::operator==(), QByteRef::operator>(), QByteRef::operator>=(), operator[](), prepend(), QByteArray(), realloc(), remove(), repeated(), replace(), reserve(), resize(), right(), rightJustified(), setRawData(), simplified(), size(), squeeze(), startsWith(), swap(), toBase64(), toHex(), trimmed(), QMetaEnum::valueToKeys(), and ~QByteArray().
|
staticprivate |
Definition at line 385 of file qbytearray.h.
Referenced by append(), mid(), operator=(), prepend(), QByteArray(), qToLower(), resize(), and trimmed().
|
staticprivate |
Definition at line 384 of file qbytearray.h.
Referenced by append(), clear(), isNull(), mid(), operator=(), prepend(), QByteArray(), qToLower(), and resize().