Kanzi Graphics Engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
kzu_variant.h File Reference

Value variant. More...

Functions

kzsError kzuVariantCreate (const struct KzcMemoryManager *memoryManager, struct KzuVariant **out_variant)
 Creates an empty variant object. More...
 
kzsError kzuVariantDelete (struct KzuVariant *variant)
 Deletes a variant object. More...
 
kzsError kzuVariantSetEmpty (struct KzuVariant *variant)
 Set a variant to be empty. More...
 
kzBool kzuVariantIsEmpty (const struct KzuVariant *variant)
 Checks if a variant is empty. More...
 
enum KzuPropertyDataType kzuVariantGetType (const struct KzuVariant *variant)
 Get the type of the value stored in a variant. More...
 
kzsError kzuVariantSetFloat (struct KzuVariant *variant, kzFloat value)
 Initialize a variant with a kzFloat value. More...
 
kzsError kzuVariantSetFloatWithField (struct KzuVariant *variant, enum KzuPropertyField field, kzFloat value)
 Set a float field of a variant. More...
 
kzFloat kzuVariantGetFloat (const struct KzuVariant *variant)
 Get the kzFloat value stored in a variant. More...
 
kzFloat kzuVariantGetFloatWithField (const struct KzuVariant *variant, enum KzuPropertyField field)
 Get the kzFloat value stored in a variant, also use field. More...
 
kzsError kzuVariantSetInt (struct KzuVariant *variant, kzInt value)
 Initialize a variant with a kzInt value. More...
 
kzInt kzuVariantGetInt (const struct KzuVariant *variant)
 Get the kzInt value stored in a variant. More...
 
kzsError kzuVariantSetBool (struct KzuVariant *variant, kzBool value)
 Initialize a variant with a kzBool value. More...
 
kzBool kzuVariantGetBool (const struct KzuVariant *variant)
 Get the kzBool value stored in a variant. More...
 
kzsError kzuVariantSetColor (struct KzuVariant *variant, struct KzcColorRGBA value)
 Initialize a variant with a KzcColorRGBA value. More...
 
struct KzcColorRGBA kzuVariantGetColor (const struct KzuVariant *variant)
 Get the KzcColorRGBA value stored in a variant. More...
 
kzsError kzuVariantSetVector2 (struct KzuVariant *variant, struct KzcVector2 value)
 Initialize a variant with a KzcVector2 value. More...
 
struct KzcVector2 kzuVariantGetVector2 (const struct KzuVariant *variant)
 Get the KzcVector2 value stored in a variant. More...
 
kzsError kzuVariantSetVector3 (struct KzuVariant *variant, struct KzcVector3 value)
 Initialize a variant with a KzcVector3 value. More...
 
struct KzcVector3 kzuVariantGetVector3 (const struct KzuVariant *variant)
 Get the KzcVector3 value stored in a variant. More...
 
kzsError kzuVariantSetVector4 (struct KzuVariant *variant, struct KzcVector4 value)
 Initialize a variant with a KzcVector4 value. More...
 
struct KzcVector4 kzuVariantGetVector4 (const struct KzuVariant *variant)
 Get the KzcVector4 value stored in a variant. More...
 
kzsError kzuVariantSetMatrix2x2 (struct KzuVariant *variant, struct KzcMatrix2x2 value)
 Initialize a variant with a KzcMatrix2x2 value. More...
 
struct KzcMatrix2x2 kzuVariantGetMatrix2x2 (const struct KzuVariant *variant)
 Get the KzcMatrix2x2 value stored in a variant. More...
 
kzsError kzuVariantSetMatrix3x3 (struct KzuVariant *variant, struct KzcMatrix3x3 value)
 Initialize a variant with a KzcMatrix3x3 value. More...
 
kzsError kzuVariantSetMatrix3x3SRT (struct KzuVariant *variant, const struct KzcVector2 *scale, kzFloat rotation, const struct KzcVector2 *translation)
 Initialize a variant with KzcMatrix3x3 SRT values. More...
 
struct KzcMatrix3x3 kzuVariantGetMatrix3x3 (const struct KzuVariant *variant)
 Get the KzcMatrix3x3 value stored in a variant. More...
 
void kzuVariantGetMatrix3x3SRT (const struct KzuVariant *variant, struct KzcVector2 *out_scale, kzFloat *out_rotation, struct KzcVector2 *out_translation)
 Get the KzcMatrix3x3 SRT values stored in a variant. More...
 
kzsError kzuVariantSetMatrix4x4 (struct KzuVariant *variant, struct KzcMatrix4x4 value)
 Initialize a variant with a KzcMatrix4x4 value. More...
 
kzsError kzuVariantSetMatrix4x4SRT (struct KzuVariant *variant, const struct KzcVector3 *scale, const struct KzcVector3 *rotation, const struct KzcVector3 *translation)
 Initialize a variant with KzcMatrix4x4 SRT values. More...
 
struct KzcMatrix4x4 kzuVariantGetMatrix4x4 (const struct KzuVariant *variant)
 Get the KzcMatrix4x4 value stored in a variant. More...
 
void kzuVariantGetMatrix4x4SRT (const struct KzuVariant *variant, struct KzcVector3 *out_scale, struct KzcVector3 *out_rotation, struct KzcVector3 *out_translation)
 Get the KzcMatrix4x4 SRT values stored in a variant. More...
 
kzsError kzuVariantSetString (struct KzuVariant *variant, kzString value)
 Initialize a variant with a kzString value. More...
 
kzsError kzuVariantSetStringWithoutCopy (struct KzuVariant *variant, kzMutableString value)
 Initialize a variant with a kzString value without copying the value. More...
 
kzString kzuVariantGetString (const struct KzuVariant *variant)
 Get the kzString value stored in a variant. More...
 
kzsError kzuVariantSetPointer (struct KzuVariant *variant, void *value)
 Initialize a variant with a pointer value. More...
 
kzsError kzuVariantSetPointerResource (struct KzuVariant *variant, struct KzuResource *resource)
 Initialize a variant with a resource value. More...
 
kzsError kzuVariantSetPointerRelativePath (struct KzuVariant *variant, kzString path)
 Initialize a variant with a relative path. More...
 
voidkzuVariantGetPointer (const struct KzuVariant *variant)
 Get the pointer value stored in a variant. More...
 
kzsError kzuVariantSetResourceID (struct KzuVariant *variant, kzString value)
 Initialize a variant with a resourceID value. More...
 
kzString kzuVariantGetResourceID (const struct KzuVariant *variant)
 Get the pointer value stored in a variant. More...
 
kzBool kzuVariantIsEqual (const struct KzuVariant *variantA, const struct KzuVariant *variantB)
 Check if variants are equal. More...
 
kzsError kzuVariantCopy (struct KzuVariant *targetVariant, const struct KzuVariant *sourceVariant)
 Copy a variant. More...
 
enum KzuPropertyDataType kzuVariantResolveType (const struct KzuVariant *variant, enum KzuPropertyField field)
 Resolve the actual data type of a variant, including the field. More...
 
kzsError kzuVariantCast (struct KzuVariant *targetVariant, enum KzuPropertyDataType targetDataType, const struct KzuVariant *sourceVariant, kzBool *out_cast)
 Cast a variant into the target variant. More...
 
kzsError kzuVariantInitializeFromProperty (const struct KzuPropertyManager *propertyManager, const void *object, const struct KzuPropertyType *propertyType, enum KzuPropertyField field, struct KzuVariant *variant, kzBool *out_found)
 Gets an object's property from a property manager and sets the property value to the given variant. More...
 
kzsError kzuVariantSetToProperty (const struct KzuVariant *variant, const struct KzuPropertyManager *propertyManager, const void *object, const struct KzuPropertyType *propertyType, enum KzuPropertyField field, kzBool *out_written)
 Sets an object's property from a variant. More...
 
kzsError kzuVariantFilterWithField (struct KzuVariant *variant, enum KzuPropertyField field)
 Changes the value and the type of the variant to a sub-value and a sub-type of the variant. More...
 

Detailed Description

Value variant.

Copyright 2008-2019 by Rightware. All rights reserved.

Function Documentation

kzsError kzuVariantCreate ( const struct KzcMemoryManager memoryManager,
struct KzuVariant **  out_variant 
)

Creates an empty variant object.

kzsError kzuVariantDelete ( struct KzuVariant variant)

Deletes a variant object.

kzsError kzuVariantSetEmpty ( struct KzuVariant variant)

Set a variant to be empty.

Empty variants are considered invalid.

kzBool kzuVariantIsEmpty ( const struct KzuVariant variant)

Checks if a variant is empty.

Empty variants are considered invalid.

enum KzuPropertyDataType kzuVariantGetType ( const struct KzuVariant variant)

Get the type of the value stored in a variant.

kzsError kzuVariantSetFloat ( struct KzuVariant variant,
kzFloat  value 
)

Initialize a variant with a kzFloat value.

kzsError kzuVariantSetFloatWithField ( struct KzuVariant variant,
enum KzuPropertyField  field,
kzFloat  value 
)

Set a float field of a variant.

kzFloat kzuVariantGetFloat ( const struct KzuVariant variant)

Get the kzFloat value stored in a variant.

kzFloat kzuVariantGetFloatWithField ( const struct KzuVariant variant,
enum KzuPropertyField  field 
)

Get the kzFloat value stored in a variant, also use field.

kzsError kzuVariantSetInt ( struct KzuVariant variant,
kzInt  value 
)

Initialize a variant with a kzInt value.

kzInt kzuVariantGetInt ( const struct KzuVariant variant)

Get the kzInt value stored in a variant.

kzsError kzuVariantSetBool ( struct KzuVariant variant,
kzBool  value 
)

Initialize a variant with a kzBool value.

kzBool kzuVariantGetBool ( const struct KzuVariant variant)

Get the kzBool value stored in a variant.

kzsError kzuVariantSetColor ( struct KzuVariant variant,
struct KzcColorRGBA  value 
)

Initialize a variant with a KzcColorRGBA value.

struct KzcColorRGBA kzuVariantGetColor ( const struct KzuVariant variant)

Get the KzcColorRGBA value stored in a variant.

kzsError kzuVariantSetVector2 ( struct KzuVariant variant,
struct KzcVector2  value 
)

Initialize a variant with a KzcVector2 value.

struct KzcVector2 kzuVariantGetVector2 ( const struct KzuVariant variant)

Get the KzcVector2 value stored in a variant.

kzsError kzuVariantSetVector3 ( struct KzuVariant variant,
struct KzcVector3  value 
)

Initialize a variant with a KzcVector3 value.

struct KzcVector3 kzuVariantGetVector3 ( const struct KzuVariant variant)

Get the KzcVector3 value stored in a variant.

kzsError kzuVariantSetVector4 ( struct KzuVariant variant,
struct KzcVector4  value 
)

Initialize a variant with a KzcVector4 value.

struct KzcVector4 kzuVariantGetVector4 ( const struct KzuVariant variant)

Get the KzcVector4 value stored in a variant.

kzsError kzuVariantSetMatrix2x2 ( struct KzuVariant variant,
struct KzcMatrix2x2  value 
)

Initialize a variant with a KzcMatrix2x2 value.

struct KzcMatrix2x2 kzuVariantGetMatrix2x2 ( const struct KzuVariant variant)

Get the KzcMatrix2x2 value stored in a variant.

kzsError kzuVariantSetMatrix3x3 ( struct KzuVariant variant,
struct KzcMatrix3x3  value 
)

Initialize a variant with a KzcMatrix3x3 value.

kzsError kzuVariantSetMatrix3x3SRT ( struct KzuVariant variant,
const struct KzcVector2 scale,
kzFloat  rotation,
const struct KzcVector2 translation 
)

Initialize a variant with KzcMatrix3x3 SRT values.

struct KzcMatrix3x3 kzuVariantGetMatrix3x3 ( const struct KzuVariant variant)

Get the KzcMatrix3x3 value stored in a variant.

void kzuVariantGetMatrix3x3SRT ( const struct KzuVariant variant,
struct KzcVector2 out_scale,
kzFloat out_rotation,
struct KzcVector2 out_translation 
)

Get the KzcMatrix3x3 SRT values stored in a variant.

kzsError kzuVariantSetMatrix4x4 ( struct KzuVariant variant,
struct KzcMatrix4x4  value 
)

Initialize a variant with a KzcMatrix4x4 value.

kzsError kzuVariantSetMatrix4x4SRT ( struct KzuVariant variant,
const struct KzcVector3 scale,
const struct KzcVector3 rotation,
const struct KzcVector3 translation 
)

Initialize a variant with KzcMatrix4x4 SRT values.

struct KzcMatrix4x4 kzuVariantGetMatrix4x4 ( const struct KzuVariant variant)

Get the KzcMatrix4x4 value stored in a variant.

void kzuVariantGetMatrix4x4SRT ( const struct KzuVariant variant,
struct KzcVector3 out_scale,
struct KzcVector3 out_rotation,
struct KzcVector3 out_translation 
)

Get the KzcMatrix4x4 SRT values stored in a variant.

kzsError kzuVariantSetString ( struct KzuVariant variant,
kzString  value 
)

Initialize a variant with a kzString value.

kzsError kzuVariantSetStringWithoutCopy ( struct KzuVariant variant,
kzMutableString  value 
)

Initialize a variant with a kzString value without copying the value.

The variant will take possession of the string. Only use this if ready to relinquish the ownership.

kzString kzuVariantGetString ( const struct KzuVariant variant)

Get the kzString value stored in a variant.

kzsError kzuVariantSetPointer ( struct KzuVariant variant,
void value 
)

Initialize a variant with a pointer value.

kzsError kzuVariantSetPointerResource ( struct KzuVariant variant,
struct KzuResource resource 
)

Initialize a variant with a resource value.

kzsError kzuVariantSetPointerRelativePath ( struct KzuVariant variant,
kzString  path 
)

Initialize a variant with a relative path.

void* kzuVariantGetPointer ( const struct KzuVariant variant)

Get the pointer value stored in a variant.

kzsError kzuVariantSetResourceID ( struct KzuVariant variant,
kzString  value 
)

Initialize a variant with a resourceID value.

kzString kzuVariantGetResourceID ( const struct KzuVariant variant)

Get the pointer value stored in a variant.

kzBool kzuVariantIsEqual ( const struct KzuVariant variantA,
const struct KzuVariant variantB 
)

Check if variants are equal.

Empty variants are not equal to each other. KZU_PROPERTY_DATA_TYPE_STRUCT and KZU_PROPERTY_DATA_TYPE_ARRAY data types are not supported.

Returns
KZ_TRUE if the variants are equal, KZ_FALSE otherwise.
kzsError kzuVariantCopy ( struct KzuVariant targetVariant,
const struct KzuVariant sourceVariant 
)

Copy a variant.

enum KzuPropertyDataType kzuVariantResolveType ( const struct KzuVariant variant,
enum KzuPropertyField  field 
)

Resolve the actual data type of a variant, including the field.

Parameters
variantVariant to examine.
fieldField.
Returns
Data type.
kzsError kzuVariantCast ( struct KzuVariant targetVariant,
enum KzuPropertyDataType  targetDataType,
const struct KzuVariant sourceVariant,
kzBool out_cast 
)

Cast a variant into the target variant.

Parameters
targetVariantThe variant which value is written.
targetDataTypeKzuPropertyDataType to use as the target variant's data type.
sourceVariantThe variant which value is read.
out_castSet on success. The value is KZ_TRUE if the cast succeeded, otherwise KZ_FALSE.
Returns
KZS_SUCCESS on success.
kzsError kzuVariantInitializeFromProperty ( const struct KzuPropertyManager *  propertyManager,
const void object,
const struct KzuPropertyType propertyType,
enum KzuPropertyField  field,
struct KzuVariant variant,
kzBool out_found 
)

Gets an object's property from a property manager and sets the property value to the given variant.

Parameters
propertyManagerThe property manager to use.
objectObject owning the property to read.
propertyTypeKzuPropertyType of the property to read.
fieldThe field to read from the property.
variantPreviously created variant which value is set.
out_foundSet on success. The value is KZ_TRUE if the property was found, otherwise KZ_FALSE.
Returns
KZS_SUCCESS on success, KZS_ERROR_ENUM_OUT_OF_RANGE in case of unsuitable data type or field.
kzsError kzuVariantSetToProperty ( const struct KzuVariant variant,
const struct KzuPropertyManager *  propertyManager,
const void object,
const struct KzuPropertyType propertyType,
enum KzuPropertyField  field,
kzBool out_written 
)

Sets an object's property from a variant.

Parameters
variantVariant which value is read.
propertyManagerThe property manager to use.
objectObject owning the property to set.
propertyTypeKzuPropertyType of the property to set.
fieldKzuPropertyField of the property to set.
out_foundSet on success. The value is KZ_TRUE if the property was written, otherwise KZ_FALSE.
Returns
KZS_SUCCESS on success, KZU_ERROR_WRONG_PROPERTY_DATA_TYPE if the field is not suitable, KZS_ERROR_ENUM_OUT_OF_RANGE if the variant data type is invalid.
kzsError kzuVariantFilterWithField ( struct KzuVariant variant,
enum KzuPropertyField  field 
)

Changes the value and the type of the variant to a sub-value and a sub-type of the variant.

Parameters
variantVariant which value is filtered.
fieldThe field to filter by.
Returns
KZS_SUCCESS on success, KZU_ERROR_WRONG_PROPERTY_DATA_TYPE if the field is not suitable for filtering, KZS_ERROR_ENUM_OUT_OF_RANGE if the variant data type is invalid.