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 #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;
68 kType type;
69 kSize offset;
70 kSize count;
71 } kFieldInfo;
72
78 typedef struct kEnumeratorInfo
79 {
80 k32s value;
81 kTypeName name;
82 kTypeName displayName;
83 } kEnumeratorInfo;
84
90 typedef struct kTypeVersionInfo
91 {
92 kText16 format;
93 kVersion formatVersion;
94 kText64 guid;
95 kFunction serialize;
96 kFunction deserialize;
97 } kTypeVersionInfo;
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
368 kFx(kBool) kType_StaticInitialized(kType type);
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
473 kFx(kSize) kType_EnumeratorCount(kType type);
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
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:95
kMethodInfo::methodName
kTypeName methodName
Method name (e.g. "Clone").
Definition: kType.h:55
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:81
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.
kType::kType_IsPacked
kBool kType_IsPacked(kType type)
Reports whether the fields of a value type are tightly packed (free from structure padding)...
kEnumeratorInfo::displayName
kTypeName displayName
Formatted display name (e.g. "8bpp Greyscale");.
Definition: kType.h:82
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:65
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:78
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:93
kType::kType_IsPrimitive
kBool kType_IsPrimitive(kType type)
Reports whether the type is a primitive value (single-valued; lacks fields).
kTypeVersionInfo::guid
kText64 guid
Unique id (e.g. "kArrayList-0").
Definition: kType.h:94
kMethodInfo
Represents type method information.
Definition: kType.h:53
kFieldInfo::name
kTypeName name
Field name.
Definition: kType.h:67
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:68
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:80
kMethodInfo::functionName
kTypeName functionName
Full function name (e.g. "kObject_Clone").
Definition: kType.h:56
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:69
kTypeVersionInfo
Represents serialization version information.
Definition: kType.h:90
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:70
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:96
kTypeVersionInfo::format
kText16 format
Serialization format name (e.g. "kdat6").
Definition: kType.h:92
kType::kType_VMethodInfoAt
const kMethodInfo * kType_VMethodInfoAt(kType type, kSize index)
Gets metadata for the virtual method at the specified index.