15 #include <kApi/kType.x.h>
91 return (type == other) ||
215 return (obj->flags & xkTYPE_FLAGS_PACKED) != 0;
243 return obj->bases[0] == baseType ||
244 obj->bases[1] == baseType ||
245 obj->bases[2] == baseType ||
246 obj->bases[3] == baseType;
260 return obj->bases[0];
274 return obj->interfaceCount;
289 kAssert(index < obj->interfaceCount);
291 return obj->interfaces[index].type;
325 return obj->innerSize;
339 return obj->staticSize;
367 #define kType_VTableT(kType_type, T) \
368 kCast(T##VTable*, xkType_VTableT(kType_type, kTypeOf(T)))
382 if (obj->interfaces[0].type == interfaceType)
return obj->interfaces[0].iTable;
383 else if (obj->interfaces[1].type == interfaceType)
return obj->interfaces[1].iTable;
384 else if (obj->interfaces[2].type == interfaceType)
return obj->interfaces[2].iTable;
385 else if (obj->interfaces[3].type == interfaceType)
return obj->interfaces[3].iTable;
400 return obj->staticData;
417 return !
kIsNull(obj->staticInitialized) && *obj->staticInitialized;
434 return obj->cMethodCount;
449 kAssert(index < obj->cMethodCount);
451 return &obj->cMethodInfo[index];
476 return obj->vMethodCount;
491 kAssert(index < obj->vMethodCount);
493 return &obj->vMethodInfo[index];
507 xkInterfaceInfo* info = xkType_InterfaceInfo(obj, interfaceType);
509 return kIsNull(info) ? 0 : info->iMethodCount;
524 xkInterfaceInfo* info = xkType_InterfaceInfo(obj, interfaceType);
526 kAssert(index < info->iMethodCount);
528 return kIsNull(info) ?
kNULL : &info->iMethodInfo[index];
544 return obj->fieldCount;
559 kAssert(index < obj->fieldCount);
561 return &obj->fieldInfo[index];
577 return obj->enumeratorCount;
592 kAssert(index < obj->enumeratorCount);
594 return &obj->enumeratorInfo[index];
655 return obj->versionCount;
670 kAssert(index < obj->versionCount);
672 return &obj->versionInfo[index];
685 return kCast(kTypeVersionInfo*, version)->guid;
698 return kCast(kTypeVersionInfo*, version)->serialize;
711 return kCast(kTypeVersionInfo*, version)->deserialize;
724 return kCast(kTypeVersionInfo*, version)->format;
737 return kCast(kTypeVersionInfo*, version)->formatVersion;
kFunction kType_VersionDeserializeFx(kType type, kTypeVersion version)
Gets the deserialization method for the specified type version.
Definition: kType.h:709
kBool kType_IsValue(kType type)
Determines whether a type represents a value (primitive, struct, enum).
Definition: kType.h:103
kBool kType_Extends(kType type, kType baseType)
Determines whether a type extends another type.
Definition: kType.h:239
kBool kType_Implements(kType type, kType interfaceType)
Determines whether a type implements a specific interface.
Definition: kType.h:226
const kChar * kType_VersionFormat(kType type, kTypeVersion version)
Gets the serialization format name associated with the type version.
Definition: kType.h:722
kStatus kType_FindEnumeratorInfo(kType type, k32s value, const kEnumeratorInfo **info)
Finds enumerator metadata for the enumerator with the specified value.
const kChar * kType_VersionGuid(kType type, kPointer version)
Gets the GUID associated with the specified type version.
Definition: kType.h:683
kBool kType_IsClass(kType type)
Determines whether a type represents a class.
Definition: kType.h:117
kBool kType_IsArrayValue(kType type)
Reports whether the type is an 'array-value' type (e.g., kText32)
Definition: kType.h:185
Represents a library of types.
Represents a void pointer.
#define kIsNull(POINTER)
Tests for equality with null pointer.
Definition: kApiDef.h:339
#define kTYPE_FLAGS_CLASS
Type is a class.
Definition: kApiDef.h:1931
void * kType_Static(kType type)
Gets a pointer to the type's static data structure.
Definition: kType.h:396
const kFieldInfo * kType_FieldInfoAt(kType type, kSize index)
Gets metadata for the field at the specified index.
Definition: kType.h:555
Represents an unsigned integer that can store a pointer address.
#define kTYPE_FLAGS_ABSTRACT
Type is an abstract class.
Definition: kApiDef.h:1935
kVersion kType_VersionFormatVersion(kType type, kTypeVersion version)
Gets the serialization format version associated with the type version.
Definition: kType.h:735
kBool kType_IsInterface(kType type)
Determines whether a type represents an interface.
Definition: kType.h:131
const kEnumeratorInfo * kType_EnumeratorInfoAt(kType type, kSize index)
Gets metadata for the enumerator at the specified index.
Definition: kType.h:588
kSize kType_EnumeratorCount(kType type)
Reports count of registered enumerators for the given enumeration type.
Definition: kType.h:573
kBool kType_IsPacked(kType type)
Reports whether the fields of a value type are tightly packed (free from structure padding)...
Definition: kType.h:211
kBool kType_StaticInitialized(kType type)
Reports whether the type's static data structure has been successfully initialized.
Definition: kType.h:413
Represents type field information.
Definition: kApiDef.h:1965
kSize kType_MethodCount(kType type)
Reports count of non-virtual methods.
Definition: kType.h:430
#define kTYPE_FLAGS_ENUM
Type is an enumeration.
Definition: kApiDef.h:1934
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:26
kType kType_InterfaceAt(kType type, kSize index)
Gets the implemented interface at the specified index.
Definition: kType.h:285
kSize kType_VMethodCount(kType type)
Reports count of virtual methods.
Definition: kType.h:472
Represents enumerator information.
Definition: kApiDef.h:1978
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.
Definition: kType.h:349
kType kType_Base(kType type)
Gets the base of a class or interface.
Definition: kType.h:256
#define kTYPE_FLAGS_VALUE
Type is a value.
Definition: kApiDef.h:1933
const kChar * kType_Name(kType type)
Gets the name of the type.
Definition: kType.h:72
kStatus kType_FindMethodInfo(kType type, const kChar *name, const kMethodInfo **info)
Finds metadata for the non-virtual method with the specified name.
kBool kType_IsPrimitive(kType type)
Reports whether the type is a primitive value (single-valued; lacks fields).
Definition: kType.h:198
Represents type method information.
Definition: kApiDef.h:1953
kSize kType_FieldCount(kType type)
Reports count of registered fields for the given type.
Definition: kType.h:540
kFunction kType_VersionSerializeFx(kType type, kTypeVersion version)
Gets the serialization method for the specified type version.
Definition: kType.h:696
kPointer kTypeVersion
Represents an opaque reference to type version information (used in object serialization).
#define kObjR(TypeName_T, T_object)
Declares a local "obj" (this-pointer) variable and initializes it from an object handle, without type-checking.
Definition: kApiDef.h:2870
kSize kType_VersionCount(kType type)
Reports count of registered type versions.
Definition: kType.h:651
Core Zen type declarations.
kBool kType_IsReference(kType type)
Determines whether a type represents a class or interface.
Definition: kType.h:145
Represents a 32-bit signed integer.
kSize kType_Size(kType type)
Gets the external size of a type.
Definition: kType.h:304
kSize kType_IMethodCount(kType type, kType interfaceType)
Reports count of interface methods for the given interface.
Definition: kType.h:504
void(kCall * kFunction)()
Generic pointer to function.
Definition: kApiDef.h:28
kSize kType_InterfaceCount(kType type)
Reports count of implemented interfaces.
Definition: kType.h:270
kBool kType_IsEnum(kType type)
Reports whether the type is an enumeration.
Definition: kType.h:172
kBool kType_IsAbstract(kType type)
Determines whether a type represents an abstract class.
Definition: kType.h:159
const kMethodInfo * kType_MethodInfoAt(kType type, kSize index)
Gets metadata for the non-virtual method at the specified index.
Definition: kType.h:445
kAssembly kType_Assembly(kType type)
Gets the assembly to which the type belongs.
Definition: kType.h:59
const kMethodInfo * kType_IMethodInfoAt(kType type, kType interfaceType, kSize index)
Gets metadata for the interface method at the specified index.
Definition: kType.h:521
Represents metadata about a type (class, interface, or value).
#define kTYPE_FLAGS_ARRAY_VALUE
Type is an array-based value (e.g. kText32).
Definition: kApiDef.h:1936
kStatus kType_ParseEnumerator(kType type, k32s *value, const kChar *displayName)
Parses an enumerator value from a text buffer using the enumerator display name.
kSize kType_InnerSize(kType type)
Gets the internal size of a type.
Definition: kType.h:321
#define kAssert(EXPRESSION)
Aborts execution if EXPRESSION is kFALSE.
Definition: kApiDef.h:749
#define kTYPE_FLAGS_INTERFACE
Type is an interface.
Definition: kApiDef.h:1932
Represents a version number.
Represents an error code.
#define kTYPE_FLAGS_PRIMITIVE
Type is a primitive value (i.e., has no fields).
Definition: kApiDef.h:1937
#define kNULL
Null pointer.
Definition: kApiDef.h:267
kTypeVersion kType_VersionAt(kType type, kSize index)
Gets the type version handle at the specified index.
Definition: kType.h:666
kBool kType_Is(kType type, kType other)
Determines whether a type is equivalent to another type.
Definition: kType.h:89
kSize kType_StaticSize(kType type)
Gets the size of a type's static data.
Definition: kType.h:335
Represents a boolean value.
#define kCast(TYPE, ITEM)
Casts the ITEM argument to the specified TYPE.
Definition: kApiDef.h:1767
kFunction * kType_IVTable(kType type, kType interfaceType)
Gets a pointer to the type's virtual method table corresponding to the specified interface type...
Definition: kType.h:378
const kMethodInfo * kType_VMethodInfoAt(kType type, kSize index)
Gets metadata for the virtual method at the specified index.
Definition: kType.h:487