Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtCore.QByteArray Class Reference

The QByteArray class provides an array of bytes. More...

Inheritance diagram for QtCore.QByteArray:
Collaboration diagram for QtCore.QByteArray:

Public Member Functions

override bool Equals (object o)
 
override int GetHashCode ()
 
 QByteArray ()
 
 
 QByteArray (QByteArray arg1)
 
 
 QByteArray (string arg1)
 
 
 QByteArray (string arg1, int size)
 
 
 QByteArray (int size, sbyte c)
 
 
 QByteArray (int size, Qt.Initialization arg2)
 
 
virtual void CreateProxy ()
 
new QByteArray Append (QByteArray a)
 
 
new QByteArray Append (sbyte c)
 
 
new QByteArray Append (string s)
 
 
new QByteArray Append (string s, int len)
 
 
new sbyte At (int i)
 
 
new Pointer< sbyte > Begin ()
 
new int Capacity ()
 
 
new void Chop (int n)
 
 
new void Clear ()
 
 
new string ConstBegin ()
 
new string ConstData ()
 
 
new string ConstEnd ()
 
new QBool Contains (QByteArray a)
 
 
new QBool Contains (sbyte c)
 
 
new QBool Contains (string a)
 
 
new int Count ()
 
 
new int Count (QByteArray a)
 
 
new int Count (sbyte c)
 
 
new int Count (string a)
 
 
new Pointer< sbyte > Data ()
 
 
new void Detach ()
 
new Pointer< sbyte > End ()
 
new bool EndsWith (QByteArray a)
 
 
new bool EndsWith (sbyte c)
 
 
new bool EndsWith (string c)
 
 
new QByteArray Fill (sbyte c, int size=-1)
 
 
new int IndexOf (QByteArray a, int from=0)
 
 
new int IndexOf (sbyte c, int from=0)
 
 
new int IndexOf (string c, int from=0)
 
 
new QByteArray Insert (int i, QByteArray a)
 
 
new QByteArray Insert (int i, sbyte c)
 
 
new QByteArray Insert (int i, string s)
 
 
new QByteArray Insert (int i, string s, int len)
 
 
new bool IsDetached ()
 
new bool IsEmpty ()
 
 
new bool IsNull ()
 
 
new bool IsSharedWith (QByteArray other)
 
new int LastIndexOf (QByteArray a, int from=-1)
 
 
new int LastIndexOf (sbyte c, int from=-1)
 
 
new int LastIndexOf (string c, int from=-1)
 
 
new QByteArray Left (int len)
 
 
new QByteArray LeftJustified (int width)
 
 
new QByteArray LeftJustified (int width, sbyte fill, bool truncate=false)
 
 
new int Length ()
 
 
new QByteArray Mid (int index, int len=-1)
 
 
new QByteArray Prepend (QByteArray a)
 
 
new QByteArray Prepend (sbyte c)
 
 
new QByteArray Prepend (string s)
 
 
new QByteArray Prepend (string s, int len)
 
 
new void Push_back (QByteArray a)
 
 
new void Push_back (sbyte c)
 
 
new void Push_back (string c)
 
 
new void Push_front (QByteArray a)
 
 
new void Push_front (sbyte c)
 
 
new void Push_front (string c)
 
 
new QByteArray Remove (int index, int len)
 
 
new QByteArray Repeated (int times)
 
 
new QByteArray Replace (QByteArray before, QByteArray after)
 
 
new QByteArray Replace (QByteArray before, string after)
 
 
new QByteArray Replace (sbyte before, QByteArray after)
 
 
new QByteArray Replace (string before, QByteArray after)
 
 
new QByteArray Replace (sbyte before, string after)
 
 
new QByteArray Replace (string before, string after)
 
 
new QByteArray Replace (sbyte before, sbyte after)
 
 
new QByteArray Replace (int index, int len, QByteArray s)
 
 
new QByteArray Replace (int index, int len, string s)
 
 
new QByteArray Replace (int index, int len, string s, int alen)
 
 
new QByteArray Replace (string before, int bsize, string after, int asize)
 
 
new void Reserve (int size)
 
 
new void Resize (int size)
 
 
new QByteArray Right (int len)
 
 
new QByteArray RightJustified (int width)
 
 
new QByteArray RightJustified (int width, sbyte fill, bool truncate=false)
 
 
new QByteArray SetNum (float arg1)
 
 
new QByteArray SetNum (double arg1)
 
 
new QByteArray SetNum (short arg1, int @base=10)
 
 
new QByteArray SetNum (ushort arg1, int @base=10)
 
 
new QByteArray SetNum (int arg1, int @base=10)
 
 
new QByteArray SetNum (uint arg1, int @base=10)
 
 
new QByteArray SetNum (long arg1, int @base=10)
 
 
new QByteArray SetNum (ulong arg1, int @base=10)
 
 
new QByteArray SetNum (float arg1, sbyte f, int prec=6)
 
 
new QByteArray SetNum (double arg1, sbyte f, int prec=6)
 
 
new QByteArray SetRawData (string a, uint n)
 
 
new QByteArray Simplified ()
 
 
new int Size ()
 
 
new
System.Collections.Generic.List
< QByteArray
Split (sbyte sep)
 
 
new void Squeeze ()
 
 
new bool StartsWith (QByteArray a)
 
 
new bool StartsWith (sbyte c)
 
 
new bool StartsWith (string c)
 
 
new void Swap (QByteArray other)
 
 
new QByteArray ToBase64 ()
 
 
new double ToDouble ()
 
 
new double ToDouble (ref bool ok)
 
 
new float ToFloat ()
 
 
new float ToFloat (ref bool ok)
 
 
new QByteArray ToHex ()
 
 
new int ToInt ()
 
 
new int ToInt (ref bool ok, int @base=10)
 
 
new NativeLong ToLong ()
 
 
new NativeLong ToLong (ref bool ok, int @base=10)
 
 
new long ToLongLong ()
 
 
new long ToLongLong (ref bool ok, int @base=10)
 
 
new QByteArray ToLower ()
 
 
new QByteArray ToPercentEncoding ()
 
 
new QByteArray ToPercentEncoding (QByteArray exclude)
 
 
new QByteArray ToPercentEncoding (QByteArray exclude, QByteArray include)
 
 
new QByteArray ToPercentEncoding (QByteArray exclude, QByteArray include, sbyte percent)
 
 
new short ToShort ()
 
 
new short ToShort (ref bool ok, int @base=10)
 
 
new uint ToUInt ()
 
 
new uint ToUInt (ref bool ok, int @base=10)
 
 
new NativeULong ToULong ()
 
 
new NativeULong ToULong (ref bool ok, int @base=10)
 
 
new ulong ToULongLong ()
 
 
new ulong ToULongLong (ref bool ok, int @base=10)
 
 
new ushort ToUShort ()
 
 
new ushort ToUShort (ref bool ok, int @base=10)
 
 
new QByteArray ToUpper ()
 
 
new QByteArray Trimmed ()
 
 
new void Truncate (int pos)
 
 
new void Dispose ()
 

Static Public Member Functions

static QByteArray FromBase64 (QByteArray base64)
 
 
static QByteArray FromHex (QByteArray hexEncoded)
 
 
static QByteArray FromPercentEncoding (QByteArray pctEncoded)
 
 
static QByteArray FromPercentEncoding (QByteArray pctEncoded, sbyte percent)
 
 
static QByteArray FromRawData (string arg1, int size)
 
 
static QByteArray Number (double arg1)
 
 
static QByteArray Number (int arg1, int @base=10)
 
 
static QByteArray Number (uint arg1, int @base=10)
 
 
static QByteArray Number (long arg1, int @base=10)
 
 
static QByteArray Number (ulong arg1, int @base=10)
 
 
static QByteArray Number (double arg1, sbyte f, int prec=6)
 
 
static operator System.String (QByteArray arg1)
 
static bool operator!= (QByteArray arg1, QByteArray arg2)
 
 
static bool operator!= (QByteArray arg1, string arg2)
 
 
static QByteArray operator+ (QByteArray arg1, QByteArray arg2)
 
 
static QByteArray operator+ (QByteArray arg1, string arg2)
 
 
static QByteArray operator+ (QByteArray arg1, sbyte arg2)
 
 
static bool operator< (QByteArray arg1, QByteArray arg2)
 
 
static bool operator< (QByteArray arg1, string arg2)
 
 
static bool operator<= (QByteArray arg1, QByteArray arg2)
 
 
static bool operator<= (QByteArray arg1, string arg2)
 
 
static bool operator== (QByteArray arg1, QByteArray arg2)
 
 
static bool operator== (QByteArray arg1, string arg2)
 
 
static bool operator> (QByteArray arg1, QByteArray arg2)
 
 
static bool operator> (QByteArray arg1, string arg2)
 
 
static bool operator>= (QByteArray arg1, QByteArray arg2)
 
 
static bool operator>= (QByteArray arg1, string arg2)
 
 

Protected Member Functions

 QByteArray (System.Type dummy)
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

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":

QByteArray ba("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:

QByteArray ba;

ba.resize(5);

ba[0] = 0x3c;

ba[1] = 0xb8;

ba[2] = 0x64;

ba[3] = 0x18;

ba[4] = 0xca;

For read-only access, an alternative syntax is to use at():

for (int i = 0; i < ba.size(); ++i) {

if (ba.at(i) >= 'a' && ba.at(i) <= 'f')

cout << "Found character in range [a-f]" << endl;

}

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:

QByteArray x("and");

x.prepend("rock "); // x == "rock and"

x.append(" roll"); // x == "rock and roll"

x.replace(5, 3, "&"); // x == "rock & roll"

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:

QByteArray ba("We must be <b>bold</b>, very <b>bold</b>");

int j = 0;

while ((j = ba.indexOf("<b>", j)) != -1) {

cout << "Found <b> tag at index position " << j << endl;

++j;

}

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:

QByteArray().isNull(); // returns true

QByteArray().isEmpty(); // returns true

QByteArray("").isNull(); // returns false

QByteArray("").isEmpty(); // returns true

QByteArray("abc").isNull(); // returns false

QByteArray("abc").isEmpty(); // returns false

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().

Notes on Locale

Number-String Conversions

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.

8-bit Character Comparisons

In QByteArray, the notion of uppercase and lowercase and of which character is greater than or less than another character is locale dependent. This affects functions that support a case insensitive option or that compare or lowercase or uppercase their arguments. Case insensitive operations and comparisons will be accurate if both strings contain only ASCII characters. (If $LC_CTYPE is set, most Unix systems do "the right thing".) Functions that this affects include contains(), indexOf(), lastIndexOf(), operator<(), operator<=(), operator>(), operator>=(), toLower() and toUpper().

This issue does not apply to QStrings since they represent characters using Unicode.

See also QString and QBitArray.

Constructor & Destructor Documentation

QtCore.QByteArray.QByteArray ( System.Type  dummy)
protected
QtCore.QByteArray.QByteArray ( )

Constructs an empty byte array.

See also isEmpty().

QtCore.QByteArray.QByteArray ( QByteArray  arg1)

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.

See also operator=().

QtCore.QByteArray.QByteArray ( string  arg1)

Constructs a byte array initialized with the string str.

QByteArray makes a deep copy of the string data.

QtCore.QByteArray.QByteArray ( string  arg1,
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.

See also fromRawData().

QtCore.QByteArray.QByteArray ( int  size,
sbyte  c 
)

Constructs a byte array of size size with every byte set to character ch.

See also fill().

QtCore.QByteArray.QByteArray ( int  size,
Qt.Initialization  arg2 
)

Constructs an empty byte array.

See also isEmpty().

Member Function Documentation

new QByteArray QtCore.QByteArray.Append ( QByteArray  a)

Appends the byte array ba onto the end of this byte array.

Example:

QByteArray x("free");

QByteArray y("dom");

x.append(y);

// x == "freedom"

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.

See also operator+=(), prepend(), and insert().

new QByteArray QtCore.QByteArray.Append ( sbyte  c)

This is an overloaded function.

Appends the character ch to this byte array.

new QByteArray QtCore.QByteArray.Append ( string  s)

This is an overloaded function.

Appends the string str to this byte array.

new QByteArray QtCore.QByteArray.Append ( string  s,
int  len 
)

This function overloads append().

Appends the first len characters of the string str to this byte array and returns a reference to this byte array.

If len is negative, the length of the string will be determined automatically using qstrlen(). If len is zero or str is null, nothing is appended to the byte array. Ensure that len is not longer than str.

new sbyte QtCore.QByteArray.At ( int  i)

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()).

See also operator[]().

new Pointer<sbyte> QtCore.QByteArray.Begin ( )
new int QtCore.QByteArray.Capacity ( )

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().

See also reserve() and squeeze().

new void QtCore.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:

QByteArray ba("STARTTLS\r\n");

ba.chop(2); // ba == "STARTTLS"

See also truncate(), resize(), and left().

new void QtCore.QByteArray.Clear ( )

Clears the contents of the byte array and makes it empty.

See also resize() and isEmpty().

new string QtCore.QByteArray.ConstBegin ( )
new string QtCore.QByteArray.ConstData ( )

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.

See also data(), operator[](), and fromRawData().

new string QtCore.QByteArray.ConstEnd ( )
new QBool QtCore.QByteArray.Contains ( QByteArray  a)

Returns true if the byte array contains an occurrence of the byte array ba; otherwise returns false.

See also indexOf() and count().

new QBool QtCore.QByteArray.Contains ( sbyte  c)

This is an overloaded function.

Returns true if the byte array contains the character ch; otherwise returns false.

new QBool QtCore.QByteArray.Contains ( string  a)

This is an overloaded function.

Returns true if the byte array contains the string str; otherwise returns false.

new int QtCore.QByteArray.Count ( )

This is an overloaded function.

Same as size().

new int QtCore.QByteArray.Count ( QByteArray  a)

Returns the number of (potentially overlapping) occurrences of byte array ba in this byte array.

See also contains() and indexOf().

new int QtCore.QByteArray.Count ( sbyte  c)

This is an overloaded function.

Returns the number of occurrences of character ch in the byte array.

See also contains() and indexOf().

new int QtCore.QByteArray.Count ( string  a)

This is an overloaded function.

Returns the number of (potentially overlapping) occurrences of string str in the byte array.

virtual void QtCore.QByteArray.CreateProxy ( )
virtual
new Pointer<sbyte> QtCore.QByteArray.Data ( )

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:

QByteArray ba("Hello world");

char data = ba.data();

while (*data) {

cout << "[" << *data << "]" << endl;

++data;

}

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:

QString tmp = "test";

QByteArray text = tmp.toLocal8Bit();

char *data = new char[text.size()]

strcpy(data, text.data());

delete [] data;

This one allocates the correct amount of space:

QString tmp = "test";

QByteArray text = tmp.toLocal8Bit();

char *data = new char[text.size() + 1]

strcpy(data, text.data());

delete [] data;

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.

See also constData() and operator[]().

new void QtCore.QByteArray.Detach ( )
new void QtCore.QByteArray.Dispose ( )
new Pointer<sbyte> QtCore.QByteArray.End ( )
new bool QtCore.QByteArray.EndsWith ( QByteArray  a)

Returns true if this byte array ends with byte array ba; otherwise returns false.

Example:

QByteArray url("http://qt.nokia.com/index.html&quot;);

if (url.endsWith(".html"))

...

See also startsWith() and right().

new bool QtCore.QByteArray.EndsWith ( sbyte  c)

This is an overloaded function.

Returns true if this byte array ends with character ch; otherwise returns false.

new bool QtCore.QByteArray.EndsWith ( string  c)

This is an overloaded function.

Returns true if this byte array ends with string str; otherwise returns false.

override bool QtCore.QByteArray.Equals ( object  o)
new QByteArray QtCore.QByteArray.Fill ( sbyte  c,
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:

QByteArray ba("Istambul");

ba.fill('o');

// ba == "oooooooo"

ba.fill('X', 2);

// ba == "XX"

See also resize().

static QByteArray QtCore.QByteArray.FromBase64 ( QByteArray  base64)
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:

QByteArray text = QByteArray::fromBase64("UXQgaXMgZ3JlYXQh");

text.data(); // returns "Qt is great!"

The algorithm used to decode Base64-encoded data is defined in RFC 2045.

See also toBase64().

static QByteArray QtCore.QByteArray.FromHex ( QByteArray  hexEncoded)
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:

QByteArray text = QByteArray::fromHex("517420697320677265617421");

text.data(); // returns "Qt is great!"

See also toHex().

static QByteArray QtCore.QByteArray.FromPercentEncoding ( QByteArray  pctEncoded)
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:

QByteArray text = QByteArray::fromPercentEncoding("Qt%20is%20great%33");

text.data(); // returns "Qt is great!"

This function was introduced in Qt 4.4.

See also toPercentEncoding() and QUrl::fromPercentEncoding().

static QByteArray QtCore.QByteArray.FromPercentEncoding ( QByteArray  pctEncoded,
sbyte  percent 
)
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:

QByteArray text = QByteArray::fromPercentEncoding("Qt%20is%20great%33");

text.data(); // returns "Qt is great!"

This function was introduced in Qt 4.4.

See also toPercentEncoding() and QUrl::fromPercentEncoding().

static QByteArray QtCore.QByteArray.FromRawData ( string  arg1,
int  size 
)
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:

static const char mydata[] = {

0x00, 0x00, 0x03, 0x84, 0x78, 0x9c, 0x3b, 0x76,

0xec, 0x18, 0xc3, 0x31, 0x0a, 0xf1, 0xcc, 0x99,

...

0x6d, 0x5b

};

QByteArray data = QByteArray::fromRawData(mydata, sizeof(mydata));

QDataStream in(&data, QIODevice::ReadOnly);

...

Warning: A byte array created with fromRawData() is not null-terminated, unless the raw data contains a 0 character at position size. While that does not matter for QDataStream or functions like indexOf(), passing the byte array to a function accepting a const char * expected to be '\0'-terminated will fail.

See also setRawData(), data(), and constData().

override int QtCore.QByteArray.GetHashCode ( )
new int QtCore.QByteArray.IndexOf ( QByteArray  a,
int  from = 0 
)

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:

QByteArray x("sticky question");

QByteArray y("sti");

x.indexOf(y); // returns 0

x.indexOf(y, 1); // returns 10

x.indexOf(y, 10); // returns 10

x.indexOf(y, 11); // returns -1

See also lastIndexOf(), contains(), and count().

new int QtCore.QByteArray.IndexOf ( sbyte  c,
int  from = 0 
)

This is an overloaded function.

Returns the index position of the first occurrence of the character ch in the byte array, searching forward from index position from. Returns -1 if ch could not be found.

Example:

QByteArray ba("ABCBA");

ba.indexOf("B"); // returns 1

ba.indexOf("B", 1); // returns 1

ba.indexOf("B", 2); // returns 3

ba.indexOf("X"); // returns -1

See also lastIndexOf() and contains().

new int QtCore.QByteArray.IndexOf ( string  c,
int  from = 0 
)

This is an overloaded function.

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.

new QByteArray QtCore.QByteArray.Insert ( int  i,
QByteArray  a 
)

Inserts the byte array ba at index position i and returns a reference to this byte array.

Example:

QByteArray ba("Meal");

ba.insert(1, QByteArray("ontr"));

// ba == "Montreal"

See also append(), prepend(), replace(), and remove().

new QByteArray QtCore.QByteArray.Insert ( int  i,
sbyte  c 
)

This is an overloaded function.

Inserts character ch at index position i in the byte array. If i is greater than size(), the array is first extended using resize().

new QByteArray QtCore.QByteArray.Insert ( int  i,
string  s 
)

This is an overloaded function.

Inserts the string str at position i in the byte array.

If i is greater than size(), the array is first extended using resize().

new QByteArray QtCore.QByteArray.Insert ( int  i,
string  s,
int  len 
)

This is an overloaded function.

Inserts len bytes of the string str at position i in the byte array.

If i is greater than size(), the array is first extended using resize().

This function was introduced in Qt 4.6.

new bool QtCore.QByteArray.IsDetached ( )
new bool QtCore.QByteArray.IsEmpty ( )

Returns true if the byte array has size 0; otherwise returns false.

Example:

QByteArray().isEmpty(); // returns true

QByteArray("").isEmpty(); // returns true

QByteArray("abc").isEmpty(); // returns false

See also size().

new bool QtCore.QByteArray.IsNull ( )

Returns true if this byte array is null; otherwise returns false.

Example:

QByteArray().isNull(); // returns true

QByteArray("").isNull(); // returns false

QByteArray("abc").isNull(); // returns false

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().

See also isEmpty().

new bool QtCore.QByteArray.IsSharedWith ( QByteArray  other)
new int QtCore.QByteArray.LastIndexOf ( QByteArray  a,
int  from = -1 
)

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:

QByteArray x("crazy azimuths");

QByteArray y("az");

x.lastIndexOf(y); // returns 6

x.lastIndexOf(y, 6); // returns 6

x.lastIndexOf(y, 5); // returns 2

x.lastIndexOf(y, 1); // returns -1

See also indexOf(), contains(), and count().

new int QtCore.QByteArray.LastIndexOf ( sbyte  c,
int  from = -1 
)

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:

QByteArray x("crazy azimuths");

QByteArray y("az");

x.lastIndexOf(y); // returns 6

x.lastIndexOf(y, 6); // returns 6

x.lastIndexOf(y, 5); // returns 2

x.lastIndexOf(y, 1); // returns -1

See also indexOf(), contains(), and count().

new int QtCore.QByteArray.LastIndexOf ( string  c,
int  from = -1 
)

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:

QByteArray x("crazy azimuths");

QByteArray y("az");

x.lastIndexOf(y); // returns 6

x.lastIndexOf(y, 6); // returns 6

x.lastIndexOf(y, 5); // returns 2

x.lastIndexOf(y, 1); // returns -1

See also indexOf(), contains(), and count().

new QByteArray QtCore.QByteArray.Left ( int  len)

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:

QByteArray x("Pineapple");

QByteArray y = x.left(4);

// y == "Pine"

See also right(), mid(), startsWith(), and truncate().

new QByteArray QtCore.QByteArray.LeftJustified ( int  width)

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:

QByteArray x("apple");

QByteArray y = x.leftJustified(8, '.'); // y == "apple..."

See also rightJustified().

new QByteArray QtCore.QByteArray.LeftJustified ( int  width,
sbyte  fill,
bool  truncate = false 
)

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:

QByteArray x("apple");

QByteArray y = x.leftJustified(8, '.'); // y == "apple..."

See also rightJustified().

new int QtCore.QByteArray.Length ( )

Same as size().

new QByteArray QtCore.QByteArray.Mid ( int  index,
int  len = -1 
)

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:

QByteArray x("Five pineapples");

QByteArray y = x.mid(5, 4); // y == "pine"

QByteArray z = x.mid(5); // z == "pineapples"

See also left() and right().

static QByteArray QtCore.QByteArray.Number ( double  arg1)
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:

int n = 63;

QByteArray::number(n); // returns "63"

QByteArray::number(n, 16); // returns "3f"

QByteArray::number(n, 16).toUpper(); // returns "3F"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also setNum() and toInt().

static QByteArray QtCore.QByteArray.Number ( int  arg1,
int @  base = 10 
)
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:

int n = 63;

QByteArray::number(n); // returns "63"

QByteArray::number(n, 16); // returns "3f"

QByteArray::number(n, 16).toUpper(); // returns "3F"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also setNum() and toInt().

static QByteArray QtCore.QByteArray.Number ( uint  arg1,
int @  base = 10 
)
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:

int n = 63;

QByteArray::number(n); // returns "63"

QByteArray::number(n, 16); // returns "3f"

QByteArray::number(n, 16).toUpper(); // returns "3F"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also setNum() and toInt().

static QByteArray QtCore.QByteArray.Number ( long  arg1,
int @  base = 10 
)
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:

int n = 63;

QByteArray::number(n); // returns "63"

QByteArray::number(n, 16); // returns "3f"

QByteArray::number(n, 16).toUpper(); // returns "3F"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also setNum() and toInt().

static QByteArray QtCore.QByteArray.Number ( ulong  arg1,
int @  base = 10 
)
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:

int n = 63;

QByteArray::number(n); // returns "63"

QByteArray::number(n, 16); // returns "3f"

QByteArray::number(n, 16).toUpper(); // returns "3F"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also setNum() and toInt().

static QByteArray QtCore.QByteArray.Number ( double  arg1,
sbyte  f,
int  prec = 6 
)
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:

int n = 63;

QByteArray::number(n); // returns "63"

QByteArray::number(n, 16); // returns "3f"

QByteArray::number(n, 16).toUpper(); // returns "3F"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also setNum() and toInt().

static QtCore.QByteArray.operator System.String ( QByteArray  arg1)
explicitstatic
static bool QtCore.QByteArray.operator!= ( QByteArray  arg1,
QByteArray  arg2 
)
static

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.

static bool QtCore.QByteArray.operator!= ( QByteArray  arg1,
string  arg2 
)
static

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.

static QByteArray QtCore.QByteArray.operator+ ( QByteArray  arg1,
QByteArray  arg2 
)
static

Returns a byte array that is the result of concatenating byte array a1 and byte array a2.

See also QByteArray::operator+=().

static QByteArray QtCore.QByteArray.operator+ ( QByteArray  arg1,
string  arg2 
)
static

This is an overloaded function.

Returns a byte array that is the result of concatenating byte array a1 and string a2.

static QByteArray QtCore.QByteArray.operator+ ( QByteArray  arg1,
sbyte  arg2 
)
static

This is an overloaded function.

Returns a byte array that is the result of concatenating byte array a1 and character a2.

static bool QtCore.QByteArray.operator< ( QByteArray  arg1,
QByteArray  arg2 
)
static

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.

static bool QtCore.QByteArray.operator< ( QByteArray  arg1,
string  arg2 
)
static

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.

static bool QtCore.QByteArray.operator<= ( QByteArray  arg1,
QByteArray  arg2 
)
static

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.

static bool QtCore.QByteArray.operator<= ( QByteArray  arg1,
string  arg2 
)
static

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.

static bool QtCore.QByteArray.operator== ( QByteArray  arg1,
QByteArray  arg2 
)
static

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.

static bool QtCore.QByteArray.operator== ( QByteArray  arg1,
string  arg2 
)
static

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.

static bool QtCore.QByteArray.operator> ( QByteArray  arg1,
QByteArray  arg2 
)
static

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.

static bool QtCore.QByteArray.operator> ( QByteArray  arg1,
string  arg2 
)
static

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.

static bool QtCore.QByteArray.operator>= ( QByteArray  arg1,
QByteArray  arg2 
)
static

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.

static bool QtCore.QByteArray.operator>= ( QByteArray  arg1,
string  arg2 
)
static

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.

new QByteArray QtCore.QByteArray.Prepend ( QByteArray  a)

Prepends the byte array ba to this byte array and returns a reference to this byte array.

Example:

QByteArray x("ship");

QByteArray y("air");

x.prepend(y);

// x == "airship"

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.

See also append() and insert().

new QByteArray QtCore.QByteArray.Prepend ( sbyte  c)

This is an overloaded function.

Prepends the character ch to this byte array.

new QByteArray QtCore.QByteArray.Prepend ( string  s)

This is an overloaded function.

Prepends the string str to this byte array.

new QByteArray QtCore.QByteArray.Prepend ( string  s,
int  len 
)

This is an overloaded function.

Prepends len bytes of the string str to this byte array.

This function was introduced in Qt 4.6.

new void QtCore.QByteArray.Push_back ( QByteArray  a)

This function is provided for STL compatibility. It is equivalent to append(other).

new void QtCore.QByteArray.Push_back ( sbyte  c)

This is an overloaded function.

Same as append(ch).

new void QtCore.QByteArray.Push_back ( string  c)

This is an overloaded function.

Same as append(str).

new void QtCore.QByteArray.Push_front ( QByteArray  a)

This function is provided for STL compatibility. It is equivalent to prepend(other).

new void QtCore.QByteArray.Push_front ( sbyte  c)

This is an overloaded function.

Same as prepend(ch).

new void QtCore.QByteArray.Push_front ( string  c)

This is an overloaded function.

Same as prepend(str).

new QByteArray QtCore.QByteArray.Remove ( int  index,
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:

QByteArray ba("Montreal");

ba.remove(1, 4);

// ba == "Meal"

See also insert() and replace().

new QByteArray QtCore.QByteArray.Repeated ( int  times)

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:

QByteArray ba("ab");

ba.repeated(4); // returns "abababab"

This function was introduced in Qt 4.5.

new QByteArray QtCore.QByteArray.Replace ( QByteArray  before,
QByteArray  after 
)

This is an overloaded function.

Replaces every occurrence of the byte array before with the byte array after.

Example:

QByteArray ba("colour behaviour flavour neighbour");

ba.replace(QByteArray("ou"), QByteArray("o"));

// ba == "color behavior flavor neighbor"

new QByteArray QtCore.QByteArray.Replace ( QByteArray  before,
string  after 
)

This is an overloaded function.

Replaces every occurrence of the byte array before with the string after.

new QByteArray QtCore.QByteArray.Replace ( sbyte  before,
QByteArray  after 
)

This is an overloaded function.

Replaces every occurrence of the character before with the byte array after.

new QByteArray QtCore.QByteArray.Replace ( string  before,
QByteArray  after 
)

This is an overloaded function.

Replaces every occurrence of the string before with the byte array after.

new QByteArray QtCore.QByteArray.Replace ( sbyte  before,
string  after 
)

This is an overloaded function.

Replaces every occurrence of the character before with the string after.

new QByteArray QtCore.QByteArray.Replace ( string  before,
string  after 
)

This is an overloaded function.

Replaces every occurrence of the string before with the string after.

new QByteArray QtCore.QByteArray.Replace ( sbyte  before,
sbyte  after 
)

This is an overloaded function.

Replaces every occurrence of the character before with the character after.

new QByteArray QtCore.QByteArray.Replace ( int  index,
int  len,
QByteArray  s 
)

Replaces len bytes from index position pos with the byte array after, and returns a reference to this byte array.

Example:

QByteArray x("Say yes!");

QByteArray y("no");

x.replace(4, 3, y);

// x == "Say no!"

See also insert() and remove().

new QByteArray QtCore.QByteArray.Replace ( int  index,
int  len,
string  s 
)

This is an overloaded function.

Replaces len bytes from index position pos with the zero terminated string after.

Notice: this can change the length of the byte array.

new QByteArray QtCore.QByteArray.Replace ( int  index,
int  len,
string  s,
int  alen 
)

This is an overloaded function.

Replaces len bytes from index position pos with alen bytes from the string after. after is allowed to have '\0' characters.

This function was introduced in Qt 4.7.

new QByteArray QtCore.QByteArray.Replace ( string  before,
int  bsize,
string  after,
int  asize 
)

This is an overloaded function.

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.

new void QtCore.QByteArray.Reserve ( int  size)

Attempts to allocate memory for at least size bytes. If you know in advance how large the byte array will be, you can call this function, and if you call resize() often you are likely to get better performance. If 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().

See also squeeze() and capacity().

new void QtCore.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.

See also size() and truncate().

new QByteArray QtCore.QByteArray.Right ( int  len)

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:

QByteArray x("Pineapple");

QByteArray y = x.right(5);

// y == "apple"

See also endsWith(), left(), and mid().

new QByteArray QtCore.QByteArray.RightJustified ( int  width)

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:

QByteArray x("apple");

QByteArray y = x.rightJustified(8, '.'); // y == "...apple"

See also leftJustified().

new QByteArray QtCore.QByteArray.RightJustified ( int  width,
sbyte  fill,
bool  truncate = false 
)

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:

QByteArray x("apple");

QByteArray y = x.rightJustified(8, '.'); // y == "...apple"

See also leftJustified().

new QByteArray QtCore.QByteArray.SetNum ( float  arg1)

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:

QByteArray ba;

int n = 63;

ba.setNum(n); // ba == "63"

ba.setNum(n, 16); // ba == "3f"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also number() and toInt().

new QByteArray QtCore.QByteArray.SetNum ( double  arg1)

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:

QByteArray ba;

int n = 63;

ba.setNum(n); // ba == "63"

ba.setNum(n, 16); // ba == "3f"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also number() and toInt().

new QByteArray QtCore.QByteArray.SetNum ( short  arg1,
int @  base = 10 
)

This is an overloaded function.

See also toShort().

new QByteArray QtCore.QByteArray.SetNum ( ushort  arg1,
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. The base can be any value between 2 and 36.

Example:

QByteArray ba;

int n = 63;

ba.setNum(n); // ba == "63"

ba.setNum(n, 16); // ba == "3f"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also number() and toInt().

new QByteArray QtCore.QByteArray.SetNum ( int  arg1,
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. The base can be any value between 2 and 36.

Example:

QByteArray ba;

int n = 63;

ba.setNum(n); // ba == "63"

ba.setNum(n, 16); // ba == "3f"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also number() and toInt().

new QByteArray QtCore.QByteArray.SetNum ( uint  arg1,
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. The base can be any value between 2 and 36.

Example:

QByteArray ba;

int n = 63;

ba.setNum(n); // ba == "63"

ba.setNum(n, 16); // ba == "3f"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also number() and toInt().

new QByteArray QtCore.QByteArray.SetNum ( long  arg1,
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. The base can be any value between 2 and 36.

Example:

QByteArray ba;

int n = 63;

ba.setNum(n); // ba == "63"

ba.setNum(n, 16); // ba == "3f"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also number() and toInt().

new QByteArray QtCore.QByteArray.SetNum ( ulong  arg1,
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. The base can be any value between 2 and 36.

Example:

QByteArray ba;

int n = 63;

ba.setNum(n); // ba == "63"

ba.setNum(n, 16); // ba == "3f"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also number() and toInt().

new QByteArray QtCore.QByteArray.SetNum ( float  arg1,
sbyte  f,
int  prec = 6 
)

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:

QByteArray ba;

int n = 63;

ba.setNum(n); // ba == "63"

ba.setNum(n, 16); // ba == "3f"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also number() and toInt().

new QByteArray QtCore.QByteArray.SetNum ( double  arg1,
sbyte  f,
int  prec = 6 
)

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:

QByteArray ba;

int n = 63;

ba.setNum(n); // ba == "63"

ba.setNum(n, 16); // ba == "3f"

Note: The format of the number is not localized; the default C locale is used irrespective of the user's locale.

See also number() and toInt().

new QByteArray QtCore.QByteArray.SetRawData ( string  a,
uint  n 
)

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.

This function was introduced in Qt 4.7.

See also fromRawData(), data(), and constData().

new QByteArray QtCore.QByteArray.Simplified ( )

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:

QByteArray ba(" lots\t of\nwhitespace\r\n ");

ba = ba.simplified();

// ba == "lots of whitespace";

See also trimmed().

new int QtCore.QByteArray.Size ( )

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:

QByteArray ba("Hello");

int n = ba.size(); // n == 5

ba.data()[0]; // returns 'H'

ba.data()[4]; // returns 'o'

ba.data()[5]; // returns '\0'

See also isEmpty() and resize().

new System.Collections.Generic.List<QByteArray> QtCore.QByteArray.Split ( sbyte  sep)

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.

new void QtCore.QByteArray.Squeeze ( )

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.

See also reserve() and capacity().

new bool QtCore.QByteArray.StartsWith ( QByteArray  a)

Returns true if this byte array starts with byte array ba; otherwise returns false.

Example:

QByteArray url("ftp://ftp.qt.nokia.com/&quot;);

if (url.startsWith("ftp:&quot;))

...

See also endsWith() and left().

new bool QtCore.QByteArray.StartsWith ( sbyte  c)

This is an overloaded function.

Returns true if this byte array starts with character ch; otherwise returns false.

new bool QtCore.QByteArray.StartsWith ( string  c)

This is an overloaded function.

Returns true if this byte array starts with string str; otherwise returns false.

new void QtCore.QByteArray.Swap ( QByteArray  other)

Swaps byte array other with this byte array. This operation is very fast and never fails.

This function was introduced in Qt 4.8.

new QByteArray QtCore.QByteArray.ToBase64 ( )

Returns a copy of the byte array, encoded as Base64.

QByteArray text("Qt is great!");

text.toBase64(); // returns "UXQgaXMgZ3JlYXQh"

The algorithm used to encode Base64-encoded data is defined in RFC 2045.

See also fromBase64().

new double QtCore.QByteArray.ToDouble ( )

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.

QByteArray string("1234.56");

double a = string.toDouble(); // a == 1234.56

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new double QtCore.QByteArray.ToDouble ( ref bool  ok)

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.

QByteArray string("1234.56");

double a = string.toDouble(); // a == 1234.56

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new float QtCore.QByteArray.ToFloat ( )

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new float QtCore.QByteArray.ToFloat ( ref bool  ok)

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new QByteArray QtCore.QByteArray.ToHex ( )

Returns a hex encoded copy of the byte array. The hex encoding uses the numbers 0-9 and the letters a-f.

See also fromHex().

new int QtCore.QByteArray.ToInt ( )

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.

QByteArray str("FF");

bool ok;

int hex = str.toInt(&ok, 16); // hex == 255, ok == true

int dec = str.toInt(&ok, 10); // dec == 0, ok == false

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new int QtCore.QByteArray.ToInt ( ref bool  ok,
int @  base = 10 
)

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.

QByteArray str("FF");

bool ok;

int hex = str.toInt(&ok, 16); // hex == 255, ok == true

int dec = str.toInt(&ok, 10); // dec == 0, ok == false

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new NativeLong QtCore.QByteArray.ToLong ( )

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.

QByteArray str("FF");

bool ok;

long hex = str.toLong(&ok, 16); // hex == 255, ok == true

long dec = str.toLong(&ok, 10); // dec == 0, ok == false

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

This function was introduced in Qt 4.1.

See also number().

new NativeLong QtCore.QByteArray.ToLong ( ref bool  ok,
int @  base = 10 
)

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.

QByteArray str("FF");

bool ok;

long hex = str.toLong(&ok, 16); // hex == 255, ok == true

long dec = str.toLong(&ok, 10); // dec == 0, ok == false

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

This function was introduced in Qt 4.1.

See also number().

new long QtCore.QByteArray.ToLongLong ( )

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new long QtCore.QByteArray.ToLongLong ( ref bool  ok,
int @  base = 10 
)

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new QByteArray QtCore.QByteArray.ToLower ( )

Returns a lowercase copy of the byte array. The bytearray is interpreted as a Latin-1 encoded string.

Example:

QByteArray x("Qt by NOKIA");

QByteArray y = x.toLower();

// y == "qt by nokia"

See also toUpper() and 8-bit Character Comparisons.

new QByteArray QtCore.QByteArray.ToPercentEncoding ( )

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:

QByteArray text = "{a fishy string?}";

QByteArray ba = text.toPercentEncoding("{}", "s");

qDebug(ba.constData());

// prints "{a fi%73hy %73tring%3F}"

The hex encoding uses the numbers 0-9 and the uppercase letters A-F.

This function was introduced in Qt 4.4.

See also fromPercentEncoding() and QUrl::toPercentEncoding().

new QByteArray QtCore.QByteArray.ToPercentEncoding ( QByteArray  exclude)

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:

QByteArray text = "{a fishy string?}";

QByteArray ba = text.toPercentEncoding("{}", "s");

qDebug(ba.constData());

// prints "{a fi%73hy %73tring%3F}"

The hex encoding uses the numbers 0-9 and the uppercase letters A-F.

This function was introduced in Qt 4.4.

See also fromPercentEncoding() and QUrl::toPercentEncoding().

new QByteArray QtCore.QByteArray.ToPercentEncoding ( QByteArray  exclude,
QByteArray  include 
)

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:

QByteArray text = "{a fishy string?}";

QByteArray ba = text.toPercentEncoding("{}", "s");

qDebug(ba.constData());

// prints "{a fi%73hy %73tring%3F}"

The hex encoding uses the numbers 0-9 and the uppercase letters A-F.

This function was introduced in Qt 4.4.

See also fromPercentEncoding() and QUrl::toPercentEncoding().

new QByteArray QtCore.QByteArray.ToPercentEncoding ( QByteArray  exclude,
QByteArray  include,
sbyte  percent 
)

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:

QByteArray text = "{a fishy string?}";

QByteArray ba = text.toPercentEncoding("{}", "s");

qDebug(ba.constData());

// prints "{a fi%73hy %73tring%3F}"

The hex encoding uses the numbers 0-9 and the uppercase letters A-F.

This function was introduced in Qt 4.4.

See also fromPercentEncoding() and QUrl::toPercentEncoding().

new short QtCore.QByteArray.ToShort ( )

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new short QtCore.QByteArray.ToShort ( ref bool  ok,
int @  base = 10 
)

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new uint QtCore.QByteArray.ToUInt ( )

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new uint QtCore.QByteArray.ToUInt ( ref bool  ok,
int @  base = 10 
)

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new NativeULong QtCore.QByteArray.ToULong ( )

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

This function was introduced in Qt 4.1.

See also number().

new NativeULong QtCore.QByteArray.ToULong ( ref bool  ok,
int @  base = 10 
)

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

This function was introduced in Qt 4.1.

See also number().

new ulong QtCore.QByteArray.ToULongLong ( )

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new ulong QtCore.QByteArray.ToULongLong ( ref bool  ok,
int @  base = 10 
)

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new QByteArray QtCore.QByteArray.ToUpper ( )

Returns an uppercase copy of the byte array. The bytearray is interpreted as a Latin-1 encoded string.

Example:

QByteArray x("Qt by NOKIA");

QByteArray y = x.toUpper();

// y == "QT BY NOKIA"

See also toLower() and 8-bit Character Comparisons.

new ushort QtCore.QByteArray.ToUShort ( )

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new ushort QtCore.QByteArray.ToUShort ( ref bool  ok,
int @  base = 10 
)

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.

Note: The conversion of the number is performed in the default C locale, irrespective of the user's locale.

See also number().

new QByteArray QtCore.QByteArray.Trimmed ( )

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:

QByteArray ba(" lots\t of\nwhitespace\r\n ");

ba = ba.trimmed();

// ba == "lots\t of\nwhitespace";

Unlike simplified(), trimmed() leaves internal whitespace alone.

See also simplified().

new void QtCore.QByteArray.Truncate ( int  pos)

Truncates the byte array at index position pos.

If pos is beyond the end of the array, nothing happens.

Example:

QByteArray ba("Stockholm");

ba.truncate(5); // ba == "Stock"

See also chop(), resize(), and left().

Member Data Documentation

SmokeInvocation QtCore.QByteArray.interceptor
protected

Property Documentation

virtual System.IntPtr QtCore.QByteArray.SmokeObject
getset