#pragma once #include #include #include #include #include #include "../../datatype.h" class Instance; typedef Instance(*InstanceConstructor)(); const uint INST_NOT_CREATABLE = 1; // const uint INST_SINGLETON = 2; typedef uint InstanceClassFlags; struct InstanceClassDescriptor { std::string className; InstanceConstructor constructor; InstanceClassFlags flags; }; // const uint PROP_READONLY = 1; const uint PROP_NOSCRIPT = 2; // Cannot be read or written to by unpriveleged scripts const uint PROP_NOSAVE = 4; // Property should not be serialized by the engine const uint PROP_CLIENTONLY = 8; // Only accessible by the client typedef uint PropertyFlags; typedef DataValue(*InstancePropertyGetter)(); typedef void(*InstancePropertySetter)(DataValue); // Properties may either have a backing field directly accessed by Instance, // or, for more granular control may define a getter (and setter if writable). struct MemberPropertyDescriptor { DataType dataType; PropertyFlags flags; std::optional backingField; std::optional getter; std::optional setter; }; // typedef DataValue(*InstanceMethodHandler)(std::vector); struct MemberMethodDescriptor { DataType returnType; // This may need to be converted into a vector in the future for overloaded methods std::vector parameters; InstanceMethodHandler handler; }; // TODO: Add MemberCallbackDescriptor typedef std::map> InstanceMemberTable;