qtvariantreader module
Module qtvariantreader provides the class QtVariantReader which allows the deserialization of a QVariant object.
- class pysbs.qtclasses.qtvariantreader.QtVariantReader
Bases:
objectClass QtVariantReader allows to read (deserialize) a
QtVariantobject from a Byte Array or a base64 encoded string.- static bytesToBool(aStr)
Convert the given string in hexadecimal into a bool
- Parameters:
aStr (bytes) – The string to convert
- Returns:
The result of the conversion as a bool
- static bytesToChar(aStr)
Convert the given string in hexadecimal into a char
- Parameters:
aStr (bytes) – The string to convert
- Returns:
The result of the conversion as a char
- static bytesToInt(aStr)
Convert the given string in hexadecimal into an integer
- Parameters:
aStr (bytes) – The string to convert
- Returns:
The result of the conversion as an integer
- static bytesToInt16(aStr)
Convert the given string in hexadecimal into an integer
- Parameters:
aStr (bytes) – The string to convert
- Returns:
The result of the conversion as an integer
- static bytesToInt8(aStr)
Convert the given string in hexadecimal into an integer
- Parameters:
aStr (bytes) – The string to convert
- Returns:
The result of the conversion as an integer
- getFromBase64String(aEncodedString, aType)
Read the given base64 encoded string and return the included QtVariant which must be of the given type
- Parameters:
aEncodedString (str) – The string to read
aType (
QtVariantTypeEnum) – Type of the QtVariant included in the byte array
- Returns:
The
QtVariantobject
- getFromByteArray(aByteArray, aType)
Read the given byte array and return the included QtVariant which must be of the given type
- Parameters:
aByteArray (bytearray or str) – The byte array to read
aType (
QtVariantTypeEnum) – Type of the QtVariant included in the byte array
- Returns:
The
QtVariantobject
- readBool()
Read 1 bytes as a Boolean
- Returns:
The next boolean as a Boolean
- readByteArray()
Read the next ByteArray
- Returns:
The ByteArray as a String
- readChar()
Read 1 bytes as a char
- Returns:
The next character as a string
- readDouble()
Read 8 bytes as a double
- Returns:
The next double as an Double
- readInt()
Read 4 bytes as an integer
- Returns:
The next integer as an Integer
- readInt16()
Read 2 bytes as an integer
- Returns:
The next integer as an Integer
- readInt8()
Read 1 byte as an integer
- Returns:
The next integer as an Integer
- readKey()
Read the next key (=size of the key + string)
- Returns:
The key as a String
- readQtVariant()
Read the next variant item (=type + value)
- Returns:
The variant item as a QtVariant
- readQtVariantList()
Read the next variant list
- Returns:
The variant map as a list of QtVariant
- readQtVariantMap()
Read the next variant map
- Returns:
The variant map as a dictionary of QtVariant
- readQtVariantString()
Read the next string
- Returns:
The bytes as a String
- readQtVariantValue()
Read the next variant item value, according to the given type
- Returns:
The variant item as a QtVariant
- readSize()
Read the next size object
- Returns:
The size as a tuple(int width,int height)
- readString()
Read aSize bytes as a string
- Returns:
The bytes as a String
- readStringList()
Read the next string list
- Returns:
The string map as a list of string
- readURL()
Read the next URL
- Returns:
The url as a string