-
Notifications
You must be signed in to change notification settings - Fork 0
API: Definitions, Sources and Factories
Craig Minihan edited this page Nov 2, 2016
·
28 revisions
##Object Definitions
In order to create scriptable objects they must have a source which may be created statically or at runtime. ScriptObjectDefinition exposes methods to determine the number of fields, their names and their types in the source object.
In addition the class can calculate a hash based on the field names and types which can be used by libscriptobject to lookup metadata associated with the object (e.g. common keys).
The class is defined as follows:
class ScriptObjectDefinition {
public:
virtual unsigned count() const = 0;
virtual ScriptObjectType type(int index) const = 0;
virtual const char* name(int index) const = 0;
virtual unsigned length(int index) const = 0;
void CalculateHash(ScriptObjectHash digest) const;
};The count method returns the number of fields in the object. The type method the type of the field at the supplied index. The name method returns the null terminated name of the field and length the number of characters occupied by the name.