kanzi::KzbMemoryParser Class Reference

Parser of the kzb file structure. More...

#include <kanzi/core.ui/kzb/kzb_memory_parser.hpp>

Public Types

typedef pair< AbstractPropertyType, VariantPropertyPair
 
typedef vector< PropertyPairPropertyContainer
 
typedef vector< BindingSharedPtrBindingContainer
 

Public Member Functions

 KzbMemoryParser (KzbFile *kzbFile, const byte *data, uint64_t dataSize)
 Constructor. More...
 
uint32_t parseUint32 ()
 Parse value from current position in the file. More...
 
uint64_t parseUint64 ()
 Parse value from current position in the file. More...
 
int32_t parseInt32 ()
 Parse value from current position in the file. More...
 
uint16_t parseUint16 ()
 Parse value from current position in the file. More...
 
uint8_t parseUint8 ()
 Parse value from current position in the file. More...
 
float parseFloat ()
 Parse value from current position in the file. More...
 
bool parseBool ()
 Parse value from current position in the file. More...
 
ColorRGBA parseColorRGBA ()
 Parse value from current position in the file. More...
 
Vector2 parseVector2 ()
 Parse value from current position in the file. More...
 
Vector3 parseVector3 ()
 Parse value from current position in the file. More...
 
Vector4 parseVector4 ()
 Parse value from current position in the file. More...
 
Matrix3x3 parseMatrix3x3 ()
 Parse value from current position in the file. More...
 
Matrix4x4 parseMatrix4x4 ()
 Parse value from current position in the file. More...
 
string_view parseNullTerminatedString ()
 Parse value from current position in the file. More...
 
string_view parseSizedString ()
 Parse value from current position in the file. More...
 
ConstByteSpan parseData (size_t size)
 Parse value from current position in the file. More...
 
ConstByteSpan parseSizedData ()
 Parse value from current position in the file. More...
 
SRTValue2D parseSRT2D ()
 Parse value from current position in the file. More...
 
kanzi::SRTValue3D parseSRT3D ()
 Parse value from current position in the file. More...
 
KzbMemoryParser parseSlice ()
 Parse a slice from current position in the file. More...
 
void loadPropertyValue (Object &object)
 Load single property value from current location in the file and store it in an object. More...
 
void loadProperties (Object &object)
 Load properties from current location in the file and store them in an object. More...
 
void loadProperties (PropertyContainer &properties, bool resolveResources)
 Load properties from current location in the file and store them in a property container. More...
 
void loadProperties (PropertyContainer &properties, BindingContainer &referenceBindings, bool resolveResources)
 Load properties from current location in the file and store them in a property container. More...
 
Variant loadVariantValue (PropertyDataType dataType, bool resolveResources)
 Load variant value from current location in the file. More...
 
Variant loadVariant (bool resolveResources)
 Load variant from current location in the file. More...
 
const MetaclassloadMetaclass ()
 Load metaclass from current location in the file. More...
 
AbstractPropertyType loadPropertyType ()
 Load property type from current location in the file. More...
 
string_view loadString ()
 Load string from current location in the file. More...
 
ObjectSharedPtr loadObject ()
 Load object from current location in the file. More...
 
void skip (size_t sizeBytes)
 Skip bytes from current location in the file. More...
 
void alignToOffset (ptrdiff_t alignBytes)
 Skip to next alignment of given bytes, relative to the beginning of the parsed data. More...
 
const bytegetData () const
 Returns memory data. More...
 
const bytegetCurrentData () const
 Returns memory data. More...
 
uint64_t getSize () const
 Returns size of the file. More...
 

Detailed Description

Parser of the kzb file structure.

Used to parse binary data from file into raw values and engine constructs. As opposed to #KzbFile, KzbMemoryParser reads and parses values.

Member Typedef Documentation

Constructor & Destructor Documentation

kanzi::KzbMemoryParser::KzbMemoryParser ( KzbFile kzbFile,
const byte data,
uint64_t  dataSize 
)
inlineexplicit

Constructor.

Parameters
kzbFilekzb file construct that holds the file information.
dataData block.
dataSizeData size.

Member Function Documentation

uint32_t kanzi::KzbMemoryParser::parseUint32 ( )
inline

Parse value from current position in the file.

Returns
32-bit unsigned integer value.
uint64_t kanzi::KzbMemoryParser::parseUint64 ( )
inline

Parse value from current position in the file.

Returns
64-bit unsigned integer value.
int32_t kanzi::KzbMemoryParser::parseInt32 ( )
inline

Parse value from current position in the file.

Returns
32-bit signed integer value.
uint16_t kanzi::KzbMemoryParser::parseUint16 ( )
inline

Parse value from current position in the file.

Returns
16-bit unsigned integer value.
uint8_t kanzi::KzbMemoryParser::parseUint8 ( )
inline

Parse value from current position in the file.

Returns
8-bit unsigned integer value.
float kanzi::KzbMemoryParser::parseFloat ( )
inline

Parse value from current position in the file.

Returns
32-bit floating point value.
bool kanzi::KzbMemoryParser::parseBool ( )
inline

Parse value from current position in the file.

Returns
Boolean value.
ColorRGBA kanzi::KzbMemoryParser::parseColorRGBA ( )
inline

Parse value from current position in the file.

Returns
Boolean value.
Vector2 kanzi::KzbMemoryParser::parseVector2 ( )
inline

Parse value from current position in the file.

Returns
2-component floating point vector value.
Vector3 kanzi::KzbMemoryParser::parseVector3 ( )
inline

Parse value from current position in the file.

Returns
3-component floating point vector value.
Vector4 kanzi::KzbMemoryParser::parseVector4 ( )
inline

Parse value from current position in the file.

Returns
4-component floating point vector value.
Matrix3x3 kanzi::KzbMemoryParser::parseMatrix3x3 ( )
inline

Parse value from current position in the file.

Returns
3x3 floating point matrix value.
Matrix4x4 kanzi::KzbMemoryParser::parseMatrix4x4 ( )
inline

Parse value from current position in the file.

Returns
4x4 floating point matrix value.
string_view kanzi::KzbMemoryParser::parseNullTerminatedString ( )
inline

Parse value from current position in the file.

Returns
View into string value.
string_view kanzi::KzbMemoryParser::parseSizedString ( )
inline

Parse value from current position in the file.

Returns
View into string value.
ConstByteSpan kanzi::KzbMemoryParser::parseData ( size_t  size)
inline

Parse value from current position in the file.

Returns
Byte span.
ConstByteSpan kanzi::KzbMemoryParser::parseSizedData ( )
inline

Parse value from current position in the file.

Returns
Byte span.
SRTValue2D kanzi::KzbMemoryParser::parseSRT2D ( )
inline

Parse value from current position in the file.

Returns
2D SRT value.
kanzi::SRTValue3D kanzi::KzbMemoryParser::parseSRT3D ( )
inline

Parse value from current position in the file.

Returns
3D SRT value.
KzbMemoryParser kanzi::KzbMemoryParser::parseSlice ( )
inline

Parse a slice from current position in the file.

Returns
KzbMemoryParser mapped to the slice.
void kanzi::KzbMemoryParser::loadPropertyValue ( Object object)

Load single property value from current location in the file and store it in an object.

Parameters
objectObject to store the property value to.
void kanzi::KzbMemoryParser::loadProperties ( Object object)

Load properties from current location in the file and store them in an object.

Parameters
objectObject to store property collection to.
void kanzi::KzbMemoryParser::loadProperties ( PropertyContainer properties,
bool  resolveResources 
)

Load properties from current location in the file and store them in a property container.

Parameters
propertiesProperty container to store properties to.
resolveResourcesTrue to resolve resource immediately.
void kanzi::KzbMemoryParser::loadProperties ( PropertyContainer properties,
BindingContainer referenceBindings,
bool  resolveResources 
)

Load properties from current location in the file and store them in a property container.

Parameters
propertiesProperty container to store properties to.
referenceBindingsBinding container to store reference bindings in.
resolveResourcesTrue to resolve resource immediately.
Variant kanzi::KzbMemoryParser::loadVariantValue ( PropertyDataType  dataType,
bool  resolveResources 
)

Load variant value from current location in the file.

Parameters
dataTypeData type of the variant.
resolveResourcesTrue to resolve resource immediately.
Returns
Variant read.
Variant kanzi::KzbMemoryParser::loadVariant ( bool  resolveResources)

Load variant from current location in the file.

Parameters
resolveResourcesTrue to resolve resource immediately.
Returns
Variant read.
const Metaclass* kanzi::KzbMemoryParser::loadMetaclass ( )

Load metaclass from current location in the file.

Returns
Metaclass read.
AbstractPropertyType kanzi::KzbMemoryParser::loadPropertyType ( )

Load property type from current location in the file.

Returns
Property type read.
string_view kanzi::KzbMemoryParser::loadString ( )

Load string from current location in the file.

Returns
View into string.
ObjectSharedPtr kanzi::KzbMemoryParser::loadObject ( )

Load object from current location in the file.

Returns
Object loaded.
void kanzi::KzbMemoryParser::skip ( size_t  sizeBytes)
inline

Skip bytes from current location in the file.

Parameters
sizeBytesBytes to skip.
void kanzi::KzbMemoryParser::alignToOffset ( ptrdiff_t  alignBytes)
inline

Skip to next alignment of given bytes, relative to the beginning of the parsed data.

If alignment is already correct, the position is not moved.

Parameters
alignBytesAlignment to skip to.
const byte* kanzi::KzbMemoryParser::getData ( ) const
inline

Returns memory data.

Returns
Point to beginning of file data.
const byte* kanzi::KzbMemoryParser::getCurrentData ( ) const
inline

Returns memory data.

Returns
Point to current location in file.
uint64_t kanzi::KzbMemoryParser::getSize ( ) const
inline

Returns size of the file.


The documentation for this class was generated from the following file: