get_data
Description:
Returns a pointer to the serialized form of a Variant instance.
The returned data may not be in fully-normalised form if read from an untrusted source. The returned data must not be freed; it remains valid for as long as this exists.
If this is a fixed-sized value that was deserialized from a corrupted serialized container then null may be returned. In this case, the proper thing to do is typically to use the appropriate number of nul bytes in place of this. If this is not fixed-sized then null is never returned.
In the case that this is already in serialized form, this function is O(1). If the value is not already in serialized form, serialization occurs implicitly and is approximately O(n) in the size of the result.
To deserialize the data returned by this function, in addition to the serialized data, you must know the type of the Variant, and (if the machine might be different) the endianness of the machine that stored it. As a result, file formats or network messages that incorporate serialized Variant s must include this information either implicitly (for instance "the file always contains a g_variant_type_variant and it is always in little-endian order") or explicitly (by storing the type and/or endianness in addition to the serialized data).
Parameters:
this |
a Variant instance |
Returns:
the serialized form of this, or null |