Tombstone Engine

Facebook Twitter YouTube IndieDB

Structure::ValidateProperty

Defined in:  TSOpenDDL.h
Determines the validity of a property and returns its type and location.
Prototype

virtual bool ValidateProperty(const DataDescription *dataDescription, const String<>& identifier, DataType *type, void **value);

Parameters
dataDescription The data description object to which the structure belongs.
identifier The property identifier, as read from an OpenDDL file.
type A pointer to the location that receives the data type for the property.
value A pointer to the location that receives a pointer to the property's value.
Description
The ValidateProperty function is called for each property specified in an OpenDDL file for a particular data structure to determine whether the property is valid, and if so, what type it expects and where to store its value. This function should be overridden by any subclass of the Structure class that defines properties, and it should return true when the identifier parameter identifies one of the supported properties. If the string specified by the identifier parameter is not recognized, then the function should return false. The default implementation of the ValidateProperty function always returns false.

When the property identifier is valid, an implementation of the ValidateProperty function must write the type of data expected by the property to the location specified by the type parameter, and it must write a pointer to the location holding the property value to the location specified by the value parameter. The data type must be one of the following values.
kDataBool Boolean.
kDataInt8 8-bit signed integer.
kDataInt16 16-bit signed integer.
kDataInt32 32-bit signed integer.
kDataInt64 64-bit signed integer.
kDataUnsignedInt8 8-bit unsigned integer.
kDataUnsignedInt16 16-bit unsigned integer.
kDataUnsignedInt32 32-bit unsigned integer.
kDataUnsignedInt64 64-bit unsigned integer.
kDataHalf 16-bit floating-point.
kDataFloat 32-bit floating-point.
kDataDouble 64-bit floating-point.
kDataString String.
kDataRef Reference.
kDataType Type.
For the string and reference data types, the property value must be represented by a String object with the default template parameter of 0.

An implementation of the ValidateProperty function must always return the same results for any given property identifier. If the same property appears multiple times in the property list for a structure, then values appearing later must overwrite earlier values, and the earlier values must be ignored.
See Also

Structure::ValidateSubstructure

DataDescription