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 
45 typedef kPointer kTypeVersion;
46 
52 typedef struct kMethodInfo
53 {
54  kTypeName methodName;
55  kTypeName functionName;
56  kFunction function;
57 } kMethodInfo;
58 
64 typedef struct kFieldInfo
65 {
66  kTypeName name;
70 } kFieldInfo;
71 
77 typedef struct kEnumeratorInfo
78 {
80  kTypeName name;
81  kTypeName displayName;
83 
89 typedef struct kTypeVersionInfo
90 {
97 
131 //typedef kObject kType; --forward-declared in kApiDef.x.h
132 
140 kFx(kAssembly) kType_Assembly(kType type);
141 
149 kFx(const kChar*) kType_Name(kType type);
150 
161 kFx(kBool) kType_Is(kType type, kType other);
162 
170 kFx(kBool) kType_IsValue(kType type);
171 
179 kFx(kBool) kType_IsClass(kType type);
180 
188 kFx(kBool) kType_IsInterface(kType type);
189 
197 kFx(kBool) kType_IsReference(kType type);
198 
206 kFx(kBool) kType_IsAbstract(kType type);
207 
214 kFx(kBool) kType_IsEnum(kType type);
215 
222 kFx(kBool) kType_IsBitEnum(kType type);
223 
230 kFx(kBool) kType_IsArrayValue(kType type);
231 
240 kFx(kBool) kType_Implements(kType type, kType interfaceType);
241 
250 kFx(kBool) kType_Extends(kType type, kType baseType);
251 
259 kFx(kType) kType_Base(kType type);
260 
268 kFx(kSize) kType_InterfaceCount(kType type);
269 
278 kFx(kType) kType_InterfaceAt(kType type, kSize index);
279 
290 kFx(kSize) kType_Size(kType type);
291 
302 kFx(kSize) kType_InnerSize(kType type);
303 
311 kFx(kSize) kType_StaticSize(kType type);
312 
320 kFx(kFunction*) kType_VTable(kType type);
321 
330 kFx(kFunction*) kType_IVTable(kType type, kType interfaceType);
331 
339 kFx(void*) kType_Static(kType type);
340 
352 
363 kFx(kSize) kType_MethodCount(kType type);
364 
373 kFx(const kMethodInfo*) kType_MethodInfoAt(kType type, kSize index);
374 
384 kFx(kStatus) kType_FindMethodInfo(kType type, const kChar* name, const kMethodInfo** info);
385 
393 kFx(kSize) kType_VMethodCount(kType type);
394 
403 kFx(const kMethodInfo*) kType_VMethodInfoAt(kType type, kSize index);
404 
413 kFx(kSize) kType_IMethodCount(kType type, kType interfaceType);
414 
424 kFx(const kMethodInfo*) kType_IMethodInfoAt(kType type, kType interfaceType, kSize index);
425 
435 kFx(kSize) kType_FieldCount(kType type);
436 
445 kFx(const kFieldInfo*) kType_FieldInfoAt(kType type, kSize index);
446 
457 
466 kFx(const kEnumeratorInfo*) kType_EnumeratorInfoAt(kType type, kSize index);
467 
477 kFx(kStatus) kType_FindEnumeratorInfo(kType type, k32s value, const kEnumeratorInfo** info);
478 
496 kFx(kStatus) kType_FormatEnumerator(kType type, k32s value, kChar* displayName, kSize capacity);
497 
510 kFx(kStatus) kType_ParseEnumerator(kType type, k32s* value, const kChar* displayName);
511 
521 kFx(kSize) kType_VersionCount(kType type);
522 
531 kFx(const kTypeVersionInfo*) kType_VersionInfoAt(kType type, kSize index);
532 
534 #define kType_Assembly_(TYPE) kxType_Assembly_(TYPE)
535 #define kType_Is_(TYPE, OTHER) kxType_Is_(TYPE, OTHER)
536 #define kType_IsValue_(TYPE) kxType_IsValue_(TYPE)
537 #define kType_IsClass_(TYPE) kxType_IsClass_(TYPE)
538 #define kType_IsInterface_(TYPE) kxType_IsInterface_(TYPE)
539 #define kType_IsAbstract_(TYPE) kxType_IsAbstract_(TYPE)
540 #define kType_IsReference_(TYPE) kxType_IsReference_(TYPE)
541 #define kType_IsEnum_(TYPE) kxType_IsEnum_(TYPE)
542 #define kType_IsBitEnum_(TYPE) kxType_IsBitEnum_(TYPE)
543 #define kType_IsArrayValue_(TYPE) kxType_IsArrayValue_(TYPE)
544 #define kType_Implements_(TYPE, IFACE) kxType_Implements_(TYPE, IFACE)
545 #define kType_Extends_(TYPE, BASE) kxType_Extends_(TYPE, BASE)
546 #define kType_Base_(TYPE) kxType_Base_(TYPE)
547 #define kType_Size_(TYPE) kxType_Size_(TYPE)
548 #define kType_InnerSize_(TYPE) kxType_InnerSize_(TYPE)
549 #define kType_VTable_(TYPE) kxType_VTable_(TYPE)
550 #define kType_Static_(TYPE) kxType_Static_(TYPE)
551 
553 kEndHeader()
554 
555 #include <kApi/kType.x.h>
556 
557 #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:94
kTypeName methodName
Method name (e.g. "Clone").
Definition: kType.h:54
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:80
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.
kTypeName displayName
Formatted display name (e.g. "8bpp Greyscale");.
Definition: kType.h:81
kBool kType_StaticInitialized(kType type)
Reports whether the type's static data structure has been successfully initialized.
Represents type field information.
Definition: kType.h:64
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:77
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:92
kText64 guid
Unique id (e.g. "kArrayList-0").
Definition: kType.h:93
Represents type method information.
Definition: kType.h:52
kTypeName name
Field name.
Definition: kType.h:66
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:67
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:79
kTypeName functionName
Full function name (e.g. "kObject_Clone").
Definition: kType.h:55
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:68
Represents serialization version information.
Definition: kType.h:89
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:69
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:95
kText16 format
Serialization format name (e.g. "kdat6").
Definition: kType.h:91
const kMethodInfo * kType_VMethodInfoAt(kType type, kSize index)
Gets metadata for the virtual method at the specified index.