Zen API

- Home
- Topics
- Types
- Files

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;
67 kType type;
68 kSize offset;
69 kSize count;
70 } kFieldInfo;
71
77 typedef struct kEnumeratorInfo
78 {
79 k32s value;
80 kTypeName name;
81 kTypeName displayName;
82 } kEnumeratorInfo;
83
89 typedef struct kTypeVersionInfo
90 {
91 kText16 format;
92 kVersion formatVersion;
93 kText64 guid;
94 kFunction serialize;
95 kFunction deserialize;
96 } kTypeVersionInfo;
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
351 kFx(kBool) kType_StaticInitialized(kType type);
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
456 kFx(kSize) kType_EnumeratorCount(kType type);
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
kText64
Represents a 64-unit, null-terminated, kChar sequence.
kType::kType_IsValue
kBool kType_IsValue(kType type)
Determines whether a type represents a value (primitive, struct, enum).
kType::kType_Extends
kBool kType_Extends(kType type, kType baseType)
Determines whether a type extends another type.
kType::kType_Implements
kBool kType_Implements(kType type, kType interfaceType)
Determines whether a type implements a specific interface.
kTypeVersionInfo::serialize
kFunction serialize
Serialization method.
Definition: kType.h:94
kMethodInfo::methodName
kTypeName methodName
Method name (e.g. "Clone").
Definition: kType.h:54
kType::kType_FindEnumeratorInfo
kStatus kType_FindEnumeratorInfo(kType type, k32s value, const kEnumeratorInfo **info)
Finds enumerator metadata for the enumerator with the specified value.
kEnumeratorInfo::name
kTypeName name
Enumerator name (e.g. "kPIXEL_FORMAT_8BPP_GREYSCALE").
Definition: kType.h:80
kType::kType_IsClass
kBool kType_IsClass(kType type)
Determines whether a type represents a class.
kType::kType_IsArrayValue
kBool kType_IsArrayValue(kType type)
Reports whether the type is an 'array-value' type (e.g., kText32)
kAssembly
Represents a library of types.
kType::kType_Static
void * kType_Static(kType type)
Gets a pointer to the type's static data structure.
kType::kType_FieldInfoAt
const kFieldInfo * kType_FieldInfoAt(kType type, kSize index)
Gets metadata for the field at the specified index.
kSize
Represents an unsigned integer that can store a pointer address.
kType::kType_VersionInfoAt
const kTypeVersionInfo * kType_VersionInfoAt(kType type, kSize index)
Gets metadata for the serialization version at the specified index.
kType::kType_IsInterface
kBool kType_IsInterface(kType type)
Determines whether a type represents an interface.
kType::kType_EnumeratorInfoAt
const kEnumeratorInfo * kType_EnumeratorInfoAt(kType type, kSize index)
Gets metadata for the enumerator at the specified index.
kType::kType_EnumeratorCount
kSize kType_EnumeratorCount(kType type)
Reports count of registered enumerators for the given enumeration type.
kEnumeratorInfo::displayName
kTypeName displayName
Formatted display name (e.g. "8bpp Greyscale");.
Definition: kType.h:81
kType::kType_StaticInitialized
kBool kType_StaticInitialized(kType type)
Reports whether the type's static data structure has been successfully initialized.
kFieldInfo
Represents type field information.
Definition: kType.h:64
kType::kType_MethodCount
kSize kType_MethodCount(kType type)
Reports count of non-virtual methods.
kType::kType_InterfaceAt
kType kType_InterfaceAt(kType type, kSize index)
Gets the implemented interface at the specified index.
kType::kType_VMethodCount
kSize kType_VMethodCount(kType type)
Reports count of virtual methods.
kEnumeratorInfo
Represents enumerator information.
Definition: kType.h:77
kChar
Represents a single unit (byte) in a UTF-8 character.
kType::kType_FormatEnumerator
kStatus kType_FormatEnumerator(kType type, k32s value, kChar *displayName, kSize capacity)
Formats an enumerator value to a text buffer using the enumerator display name.
kType::kType_VTable
kFunction * kType_VTable(kType type)
Gets a pointer to the type's primary virtual method table.
kType::kType_Base
kType kType_Base(kType type)
Gets the base of a class or interface.
kType::kType_Name
const kChar * kType_Name(kType type)
Gets the name of the type.
kType::kType_FindMethodInfo
kStatus kType_FindMethodInfo(kType type, const kChar *name, const kMethodInfo **info)
Finds metadata for the non-virtual method with the specified name.
kTypeVersionInfo::formatVersion
kVersion formatVersion
Serialization format version (e.g. "6.0.0.0").
Definition: kType.h:92
kTypeVersionInfo::guid
kText64 guid
Unique id (e.g. "kArrayList-0").
Definition: kType.h:93
kMethodInfo
Represents type method information.
Definition: kType.h:52
kFieldInfo::name
kTypeName name
Field name.
Definition: kType.h:66
kType::kType_FieldCount
kSize kType_FieldCount(kType type)
Reports count of registered fields for the given type.
kType::kType_VersionCount
kSize kType_VersionCount(kType type)
Reports count of registered serialization versions.
kApiDef.h
Core Zen type declarations.
kType::kType_IsReference
kBool kType_IsReference(kType type)
Determines whether a type represents a class or interface.
k32s
Represents a 32-bit signed integer.
kType::kType_Size
kSize kType_Size(kType type)
Gets the external size of a type.
kType::kType_IMethodCount
kSize kType_IMethodCount(kType type, kType interfaceType)
Reports count of interface methods for the given interface.
kFunction
void(kCall * kFunction)()
Generic pointer to function.
Definition: kApiDef.h:28
kType::kType_InterfaceCount
kSize kType_InterfaceCount(kType type)
Reports count of implemented interfaces.
kType::kType_IsEnum
kBool kType_IsEnum(kType type)
Reports whether the type is an enumeration.
kFieldInfo::type
kType type
Field type.
Definition: kType.h:67
kType::kType_IsAbstract
kBool kType_IsAbstract(kType type)
Determines whether a type represents an abstract class.
kType::kType_MethodInfoAt
const kMethodInfo * kType_MethodInfoAt(kType type, kSize index)
Gets metadata for the non-virtual method at the specified index.
kText16
Represents a 16-unit, null-terminated, kChar sequence.
kType::kType_Assembly
kAssembly kType_Assembly(kType type)
Gets the assembly to which the type belongs.
kType::kType_IMethodInfoAt
const kMethodInfo * kType_IMethodInfoAt(kType type, kType interfaceType, kSize index)
Gets metadata for the interface method at the specified index.
kType
Represents metadata about a type (class, interface, or value).
kType::kType_ParseEnumerator
kStatus kType_ParseEnumerator(kType type, k32s *value, const kChar *displayName)
Parses an enumerator value from a text buffer using the enumerator display name.
kEnumeratorInfo::value
k32s value
Enumerator numeric value.
Definition: kType.h:79
kMethodInfo::functionName
kTypeName functionName
Full function name (e.g. "kObject_Clone").
Definition: kType.h:55
kType::kType_InnerSize
kSize kType_InnerSize(kType type)
Gets the internal size of a type.
kVersion
Represents a version number.
kStatus
Represents an error code.
kFieldInfo::offset
kSize offset
Offset of field within structure (bytes).
Definition: kType.h:68
kTypeVersionInfo
Represents serialization version information.
Definition: kType.h:89
kType::kType_Is
kBool kType_Is(kType type, kType other)
Determines whether a type is equivalent to another type.
kType::kType_StaticSize
kSize kType_StaticSize(kType type)
Gets the size of a type's static data.
kBool
Represents a boolean value.
kFieldInfo::count
kSize count
Count of values in this field (typically 1; can be higher for "array value" fields, e.g. kText32).
Definition: kType.h:69
kType::kType_IVTable
kFunction * kType_IVTable(kType type, kType interfaceType)
Gets a pointer to the type's virtual method table corresponding to the specified interface type...
kType::kType_IsBitEnum
kBool kType_IsBitEnum(kType type)
Reports whether the type is an enumeration bitset.
kTypeVersionInfo::deserialize
kFunction deserialize
Deserialization method.
Definition: kType.h:95
kTypeVersionInfo::format
kText16 format
Serialization format name (e.g. "kdat6").
Definition: kType.h:91
kType::kType_VMethodInfoAt
const kMethodInfo * kType_VMethodInfoAt(kType type, kSize index)
Gets metadata for the virtual method at the specified index.