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 #define kType_IVTableT(kType_type, T) \
401 kCast(T##VTable*, xkType_IVTableT(kType_type, kTypeOf(T)))
414 return obj->staticData;
431 return obj->staticInitialized;
448 return obj->cMethodCount;
463 kAssert(index < obj->cMethodCount);
465 return &obj->cMethodInfo[index];
490 return obj->vMethodCount;
505 kAssert(index < obj->vMethodCount);
507 return &obj->vMethodInfo[index];
521 xkInterfaceInfo* info = xkType_InterfaceInfo(obj, interfaceType);
523 return kIsNull(info) ? 0 : info->iMethodCount;
538 xkInterfaceInfo* info = xkType_InterfaceInfo(obj, interfaceType);
540 kAssert(index < info->iMethodCount);
542 return kIsNull(info) ?
kNULL : &info->iMethodInfo[index];
558 return obj->fieldCount;
573 kAssert(index < obj->fieldCount);
575 return &obj->fieldInfo[index];
591 return obj->enumeratorCount;
606 kAssert(index < obj->enumeratorCount);
608 return &obj->enumeratorInfo[index];
669 return obj->versionCount;
684 kAssert(index < obj->versionCount);
686 return &obj->versionInfo[index];
699 return kCast(kTypeVersionInfo*, version)->guid;
712 return kCast(kTypeVersionInfo*, version)->serialize;
725 return kCast(kTypeVersionInfo*, version)->deserialize;
738 return kCast(kTypeVersionInfo*, version)->format;
751 return kCast(kTypeVersionInfo*, version)->formatVersion;
kFunction kType_VersionDeserializeFx(kType type, kTypeVersion version)
Gets the deserialization method for the specified type version.
Definition: kType.h:723
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:736
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:697
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:1992
void * kType_Static(kType type)
Gets a pointer to the type's static data structure.
Definition: kType.h:410
const kFieldInfo * kType_FieldInfoAt(kType type, kSize index)
Gets metadata for the field at the specified index.
Definition: kType.h:569
Represents an unsigned integer that can store a pointer address.
#define kTYPE_FLAGS_ABSTRACT
Type is an abstract class.
Definition: kApiDef.h:1996
kVersion kType_VersionFormatVersion(kType type, kTypeVersion version)
Gets the serialization format version associated with the type version.
Definition: kType.h:749
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:602
kSize kType_EnumeratorCount(kType type)
Reports count of registered enumerators for the given enumeration type.
Definition: kType.h:587
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:427
Represents type field information.
Definition: kApiDef.h:2026
kSize kType_MethodCount(kType type)
Reports count of non-virtual methods.
Definition: kType.h:444
#define kTYPE_FLAGS_ENUM
Type is an enumeration.
Definition: kApiDef.h:1995
#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:486
Represents enumerator information.
Definition: kApiDef.h:2039
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:1994
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:2014
kSize kType_FieldCount(kType type)
Reports count of registered fields for the given type.
Definition: kType.h:554
kFunction kType_VersionSerializeFx(kType type, kTypeVersion version)
Gets the serialization method for the specified type version.
Definition: kType.h:710
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:2933
kSize kType_VersionCount(kType type)
Reports count of registered type versions.
Definition: kType.h:665
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:518
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:459
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:535
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:1997
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:1993
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:1998
#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:680
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:1828
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:501