qtvariantwriter module

Module qtvariantwriter provides the class QtVariantWriter which allows the serialization of a QVariant object.

class pysbs.qtclasses.qtvariantwriter.QtVariantWriter

Bases: object

Class QtVariantWriter allows to write (serialize) a QtVariant object into a Byte Array or a base64 encoded string.

static boolToBytes(aBool)

Convert the given boolean into in bytes

Parameters:

aBool (bool) – The boolean to convert into bytes

Returns:

the result of the conversion as a string

static charToBytes(aChar)

Convert the given character in bytes

Parameters:

aChar (char) – The character to convert into bytes

Returns:

the result of the conversion as a string

static doubleToBytes(aDouble)

Convert the given double into in bytes

Parameters:

aDouble (double) – The double to convert into bytes

Returns:

the result of the conversion as a string

static int16ToBytes(aInt)

Convert the given integer into in bytes

Parameters:

aInt (integer) – The integer to convert into bytes

Returns:

the result of the conversion as a string

static int32ToBytes(aInt)

Convert the given integer into in bytes

Parameters:

aInt (integer) – The integer to convert into bytes

Returns:

the result of the conversion as a string

static int8ToBytes(aInt)

Convert the given integer into in bytes

Parameters:

aInt (integer) – The integer to convert into bytes

Returns:

the result of the conversion as a string

toBase64String(aQtVariant)

Write the given QtVariant object into a base64 encoded string.

Parameters:

aQtVariant (QtVariant) – The QtVariant object to write in a base64 string

Returns:

The base64 encoded string

toByteArrayString(aVariant)

Write the given QtVariant object into a byte array.

Parameters:

aQtVariant (QtVariant) – The QtVariant object to write in a ByteArray string

Returns:

The bytearray string

writeBool(aBool)

Write the given Boolean into 1 byte

Parameters:

aBool (bool) – The boolean to write

writeByteArray(aByteArray)

Write the given ByteArray with its size

Parameters:

aByteArray (ByteArray) – The ByteArray to write

writeChar(aChar)

Write the given char into 1 byte

Parameters:

aChar (char) – The character to write

writeDouble(aDouble)

Write the given double into 8 bytes

Parameters:

aDouble (double) – The double to write

writeInt(aInt)

Write the given integer into 4 bytes

Parameters:

aInt (integer) – The integer to write

writeInt16(aInt)

Write the given integer into 2 bytes

Parameters:

aInt (integer) – The integer to write

writeInt8(aInt)

Write the given integer into 1 byte

Parameters:

aInt (integer) – The integer to write

writeQtVariant(aQtVariant)

Write the given variant item (=type + value)

Parameters:

aQtVariant (QtVariant) – The variant object to write

writeQtVariantList(aList)

Write the given variant list

Parameters:

aList (list of QtVariant) – The variant list to write

writeQtVariantMap(aMap)

Write the given variant map

Parameters:

aMap (QtVariantMap) – The variant map to write

writeQtVariantString(aStr)

Write the given string with its size

Parameters:

aStr (str) – The string to write

writeQtVariantValue(aQtVariant)

Write the given variant item value, according to the given type

Parameters:

aQtVariant (QtVariant) – The object to write

writeSize(aSize)

Write the given size

Parameters:

aSize (tuple of two int) – The size to write

writeString(aStr)

Write the given string into 2*len(aStr) bytes

Parameters:

aStr (string) – The string to write

writeStringList(aStringList)

Write the given string list

Parameters:

aStringList (list of string) – The list of strings to write

writeURL(aURL)

Write the given URL with its size

Parameters:

aURL (str) – The url to write