Zen API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kType.h
Go to the documentation of this file.
1 
10 #include <kApi/kApiDef.h> //--inclusion order controlled by kApiDef
11 
12 #ifndef K_API_TYPE_H
13 #define K_API_TYPE_H
14 
15 kBeginHeader()
16 
17 
18 #define kTypeName kText64
19 
27 typedef k32u kTypeFlags;
28 
30 #define kTYPE_FLAGS_CLASS (0x01)
31 #define kTYPE_FLAGS_INTERFACE (0x02)
32 #define kTYPE_FLAGS_VALUE (0x04)
33 #define kTYPE_FLAGS_ENUM (0x08)
34 #define kTYPE_FLAGS_BIT_ENUM (0x10)
35 #define kTYPE_FLAGS_ABSTRACT (0x20)
36 #define kTYPE_FLAGS_ARRAY_VALUE (0x40)
37 #define kTYPE_FLAGS_PRIMITIVE (0x80)
38 
46 typedef kPointer kTypeVersion;
47 
53 typedef struct kMethodInfo
54 {
55  kTypeName methodName;
56  kTypeName functionName;
57  kFunction function;
58 } kMethodInfo;
59 
65 typedef struct kFieldInfo
66 {
67  kTypeName name;
71 } kFieldInfo;
72 
78 typedef struct kEnumeratorInfo
79 {
81  kTypeName name;
82  kTypeName displayName;
84 
90 typedef struct kTypeVersionInfo
91 {
98 
132 //typedef kObject kType; --forward-declared in kApiDef.x.h
133 
141 kFx(kAssembly) kType_Assembly(kType type);
142 
150 kFx(const kChar*) kType_Name(kType type);
151 
162 kFx(kBool) kType_Is(kType type, kType other);
163 
171 kFx(kBool) kType_IsValue(kType type);
172 
180 kFx(kBool) kType_IsClass(kType type);
181 
189 kFx(kBool) kType_IsInterface(kType type);
190 
198 kFx(kBool) kType_IsReference(kType type);
199 
207 kFx(kBool) kType_IsAbstract(kType type);
208 
215 kFx(kBool) kType_IsEnum(kType type);
216 
223 kFx(kBool) kType_IsBitEnum(kType type);
224 
231 kFx(kBool) kType_IsArrayValue(kType type);
232 
239 kFx(kBool) kType_IsPrimitive(kType type);
240 
247 kFx(kBool) kType_IsPacked(kType type);
248 
257 kFx(kBool) kType_Implements(kType type, kType interfaceType);
258 
267 kFx(kBool) kType_Extends(kType type, kType baseType);
268 
276 kFx(kType) kType_Base(kType type);
277 
285 kFx(kSize) kType_InterfaceCount(kType type);
286 
295 kFx(kType) kType_InterfaceAt(kType type, kSize index);
296 
307 kFx(kSize) kType_Size(kType type);
308 
319 kFx(kSize) kType_InnerSize(kType type);
320 
328 kFx(kSize) kType_StaticSize(kType type);
329 
337 kFx(kFunction*) kType_VTable(kType type);
338 
347 kFx(kFunction*) kType_IVTable(kType type, kType interfaceType);
348 
356 kFx(void*) kType_Static(kType type);
357 
369 
380 kFx(kSize) kType_MethodCount(kType type);
381 
390 kFx(const kMethodInfo*) kType_MethodInfoAt(kType type, kSize index);
391 
401 kFx(kStatus) kType_FindMethodInfo(kType type, const kChar* name, const kMethodInfo** info);
402 
410 kFx(kSize) kType_VMethodCount(kType type);
411 
420 kFx(const kMethodInfo*) kType_VMethodInfoAt(kType type, kSize index);
421 
430 kFx(kSize) kType_IMethodCount(kType type, kType interfaceType);
431 
441 kFx(const kMethodInfo*) kType_IMethodInfoAt(kType type, kType interfaceType, kSize index);
442 
452 kFx(kSize) kType_FieldCount(kType type);
453 
462 kFx(const kFieldInfo*) kType_FieldInfoAt(kType type, kSize index);
463 
474 
483 kFx(const kEnumeratorInfo*) kType_EnumeratorInfoAt(kType type, kSize index);
484 
494 kFx(kStatus) kType_FindEnumeratorInfo(kType type, k32s value, const kEnumeratorInfo** info);
495 
513 kFx(kStatus) kType_FormatEnumerator(kType type, k32s value, kChar* displayName, kSize capacity);
514 
527 kFx(kStatus) kType_ParseEnumerator(kType type, k32s* value, const kChar* displayName);
528 
538 kFx(kSize) kType_VersionCount(kType type);
539 
548 kFx(const kTypeVersionInfo*) kType_VersionInfoAt(kType type, kSize index);
549 
551 #define kType_Assembly_(TYPE) kxType_Assembly_(TYPE)
552 #define kType_Is_(TYPE, OTHER) kxType_Is_(TYPE, OTHER)
553 #define kType_IsValue_(TYPE) kxType_IsValue_(TYPE)
554 #define kType_IsClass_(TYPE) kxType_IsClass_(TYPE)
555 #define kType_IsInterface_(TYPE) kxType_IsInterface_(TYPE)
556 #define kType_IsAbstract_(TYPE) kxType_IsAbstract_(TYPE)
557 #define kType_IsReference_(TYPE) kxType_IsReference_(TYPE)
558 #define kType_IsEnum_(TYPE) kxType_IsEnum_(TYPE)
559 #define kType_IsBitEnum_(TYPE) kxType_IsBitEnum_(TYPE)
560 #define kType_IsArrayValue_(TYPE) kxType_IsArrayValue_(TYPE)
561 #define kType_IsPrimitive_(TYPE) kxType_IsPrimitive_(TYPE)
562 #define kType_IsPacked_(TYPE) kxType_IsPacked_(TYPE)
563 #define kType_Implements_(TYPE, IFACE) kxType_Implements_(TYPE, IFACE)
564 #define kType_Extends_(TYPE, BASE) kxType_Extends_(TYPE, BASE)
565 #define kType_Base_(TYPE) kxType_Base_(TYPE)
566 #define kType_Size_(TYPE) kxType_Size_(TYPE)
567 #define kType_InnerSize_(TYPE) kxType_InnerSize_(TYPE)
568 #define kType_VTable_(TYPE) kxType_VTable_(TYPE)
569 #define kType_Static_(TYPE) kxType_Static_(TYPE)
570 
572 kEndHeader()
573 
574 #include <kApi/kType.x.h>
575 
576 #endif
Represents a 64-unit, null-terminated, kChar sequence.
kBool kType_IsValue(kType type)
Determines whether a type represents a value (primitive, struct, enum).
kBool kType_Extends(kType type, kType baseType)
Determines whether a type extends another type.
kBool kType_Implements(kType type, kType interfaceType)
Determines whether a type implements a specific interface.
kFunction serialize
Serialization method.
Definition: kType.h:95
kTypeName methodName
Method name (e.g. "Clone").
Definition: kType.h:55
kStatus kType_FindEnumeratorInfo(kType type, k32s value, const kEnumeratorInfo **info)
Finds enumerator metadata for the enumerator with the specified value.
kTypeName name
Enumerator name (e.g. "kPIXEL_FORMAT_8BPP_GREYSCALE").
Definition: kType.h:81
kBool kType_IsClass(kType type)
Determines whether a type represents a class.
kBool kType_IsArrayValue(kType type)
Reports whether the type is an 'array-value' type (e.g., kText32)
Represents a library of types.
void * kType_Static(kType type)
Gets a pointer to the type's static data structure.
const kFieldInfo * kType_FieldInfoAt(kType type, kSize index)
Gets metadata for the field at the specified index.
Represents an unsigned integer that can store a pointer address.
const kTypeVersionInfo * kType_VersionInfoAt(kType type, kSize index)
Gets metadata for the serialization version at the specified index.
kBool kType_IsInterface(kType type)
Determines whether a type represents an interface.
const kEnumeratorInfo * kType_EnumeratorInfoAt(kType type, kSize index)
Gets metadata for the enumerator at the specified index.
kSize kType_EnumeratorCount(kType type)
Reports count of registered enumerators for the given enumeration type.
kBool kType_IsPacked(kType type)
Reports whether the fields of a value type are tightly packed (free from structure padding)...
kTypeName displayName
Formatted display name (e.g. "8bpp Greyscale");.
Definition: kType.h:82
kBool kType_StaticInitialized(kType type)
Reports whether the type's static data structure has been successfully initialized.
Represents type field information.
Definition: kType.h:65
kSize kType_MethodCount(kType type)
Reports count of non-virtual methods.
kType kType_InterfaceAt(kType type, kSize index)
Gets the implemented interface at the specified index.
kSize kType_VMethodCount(kType type)
Reports count of virtual methods.
Represents enumerator information.
Definition: kType.h:78
Represents a single unit (byte) in a UTF-8 character.
kStatus kType_FormatEnumerator(kType type, k32s value, kChar *displayName, kSize capacity)
Formats an enumerator value to a text buffer using the enumerator display name.
kFunction * kType_VTable(kType type)
Gets a pointer to the type's primary virtual method table.
kType kType_Base(kType type)
Gets the base of a class or interface.
const kChar * kType_Name(kType type)
Gets the name of the type.
kStatus kType_FindMethodInfo(kType type, const kChar *name, const kMethodInfo **info)
Finds metadata for the non-virtual method with the specified name.
kVersion formatVersion
Serialization format version (e.g. "6.0.0.0").
Definition: kType.h:93
kBool kType_IsPrimitive(kType type)
Reports whether the type is a primitive value (single-valued; lacks fields).
kText64 guid
Unique id (e.g. "kArrayList-0").
Definition: kType.h:94
Represents type method information.
Definition: kType.h:53
kTypeName name
Field name.
Definition: kType.h:67
kSize kType_FieldCount(kType type)
Reports count of registered fields for the given type.
kSize kType_VersionCount(kType type)
Reports count of registered serialization versions.
Core Zen type declarations.
kBool kType_IsReference(kType type)
Determines whether a type represents a class or interface.
Represents a 32-bit signed integer.
kSize kType_Size(kType type)
Gets the external size of a type.
kSize kType_IMethodCount(kType type, kType interfaceType)
Reports count of interface methods for the given interface.
void(kCall * kFunction)()
Generic pointer to function.
Definition: kApiDef.h:28
kSize kType_InterfaceCount(kType type)
Reports count of implemented interfaces.
kBool kType_IsEnum(kType type)
Reports whether the type is an enumeration.
kType type
Field type.
Definition: kType.h:68
kBool kType_IsAbstract(kType type)
Determines whether a type represents an abstract class.
const kMethodInfo * kType_MethodInfoAt(kType type, kSize index)
Gets metadata for the non-virtual method at the specified index.
Represents a 16-unit, null-terminated, kChar sequence.
kAssembly kType_Assembly(kType type)
Gets the assembly to which the type belongs.
const kMethodInfo * kType_IMethodInfoAt(kType type, kType interfaceType, kSize index)
Gets metadata for the interface method at the specified index.
Represents metadata about a type (class, interface, or value).
kStatus kType_ParseEnumerator(kType type, k32s *value, const kChar *displayName)
Parses an enumerator value from a text buffer using the enumerator display name.
k32s value
Enumerator numeric value.
Definition: kType.h:80
kTypeName functionName
Full function name (e.g. "kObject_Clone").
Definition: kType.h:56
kSize kType_InnerSize(kType type)
Gets the internal size of a type.
Represents a version number.
Represents an error code.
kSize offset
Offset of field within structure (bytes).
Definition: kType.h:69
Represents serialization version information.
Definition: kType.h:90
kBool kType_Is(kType type, kType other)
Determines whether a type is equivalent to another type.
kSize kType_StaticSize(kType type)
Gets the size of a type's static data.
Represents a boolean value.
kSize count
Count of values in this field (typically 1; can be higher for "array value" fields, e.g. kText32).
Definition: kType.h:70
kFunction * kType_IVTable(kType type, kType interfaceType)
Gets a pointer to the type's virtual method table corresponding to the specified interface type...
kBool kType_IsBitEnum(kType type)
Reports whether the type is an enumeration bitset.
kFunction deserialize
Deserialization method.
Definition: kType.h:96
kText16 format
Serialization format name (e.g. "kdat6").
Definition: kType.h:92
const kMethodInfo * kType_VMethodInfoAt(kType type, kSize index)
Gets metadata for the virtual method at the specified index.