Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
Public Member Functions | Related
kType Class Reference
kApi

## Description

Represents metadata about a type (class, interface, or value).

When an assembly is constructed, one kType instance is created for every type defined in the assembly. kAssembly methods can be used to discover the types in the assembly, and kType methods can be used to learn about individual types (e.g., type name, base class).

The kObject_Type method can be used to obtain type information for any object derived from kObject. The kTypeOf macro can be used to obtain type information for any class, interface, or value by compile-time type symbol.

void DescribeObjectType(kObject object)
{
kType type = kObject_Type(object);
kType base = kType_Base(type);
printf("Type name: %s\n", kType_Name(type));
printf("Base type: %s\n", (base == 0) ? "(None)" : kType_Name(base));
printf("Type assembly: %s\n", kAssembly_Name(kType_Assembly(type)));
printf("Virtual method count: %u\n", (k32u) kType_VMethodCount(type));
printf("Extends kStream?: %s\n", kType_Extends(type, kTypeOf(kStream)) ? "Yes" : "No");
printf("Implements kCollection?: %s\n", kType_Implements(type, kTypeOf(kCollection)) ? "Yes" : "No");
}
Inheritance diagram for kType:

## Public Member Functions
kAssembly | kType_Assembly (kType type)
| Gets the assembly to which the type belongs. More...
kType | kType_Base (kType type)
| Gets the base of a class or interface. More...
kSize | kType_EnumeratorCount (kType type)
| Reports count of registered enumerators for the given enumeration type. More...
const kEnumeratorInfo * | kType_EnumeratorInfoAt (kType type, kSize index)
| Gets metadata for the enumerator at the specified index. More...
kBool | kType_Extends (kType type, kType baseType)
| Determines whether a type extends another type. More...
kSize | kType_FieldCount (kType type)
| Reports count of registered fields for the given type. More...
const kFieldInfo * | kType_FieldInfoAt (kType type, kSize index)
| Gets metadata for the field at the specified index. More...
kStatus | kType_FindEnumeratorInfo (kType type, k32s value, const kEnumeratorInfo **info)
| Finds enumerator metadata for the enumerator with the specified value. More...
kStatus | kType_FindMethodInfo (kType type, const kChar *name, const kMethodInfo **info)
| Finds metadata for the non-virtual method with the specified name. More...
kStatus | kType_FormatEnumerator (kType type, k32s value, kChar *displayName, kSize capacity)
| Formats an enumerator value to a text buffer using the enumerator display name. More...
kSize | kType_IMethodCount (kType type, kType interfaceType)
| Reports count of interface methods for the given interface. More...
const kMethodInfo * | kType_IMethodInfoAt (kType type, kType interfaceType, kSize index)
| Gets metadata for the interface method at the specified index. More...
kBool | kType_Implements (kType type, kType interfaceType)
| Determines whether a type implements a specific interface. More...
kSize | kType_InnerSize (kType type)
| Gets the internal size of a type. More...
kType | kType_InterfaceAt (kType type, kSize index)
| Gets the implemented interface at the specified index. More...
kSize | kType_InterfaceCount (kType type)
| Reports count of implemented interfaces. More...
kBool | kType_Is (kType type, kType other)
| Determines whether a type is equivalent to another type. More...
kBool | kType_IsAbstract (kType type)
| Determines whether a type represents an abstract class. More...
kBool | kType_IsArrayValue (kType type)
| Reports whether the type is an 'array-value' type (e.g., kText32) More...
kBool | kType_IsBitEnum (kType type)
| Reports whether the type is an enumeration bitset. More...
kBool | kType_IsClass (kType type)
| Determines whether a type represents a class. More...
kBool | kType_IsEnum (kType type)
| Reports whether the type is an enumeration. More...
kBool | kType_IsInterface (kType type)
| Determines whether a type represents an interface. More...
kBool | kType_IsPacked (kType type)
| Reports whether the fields of a value type are tightly packed (free from structure padding). More...
kBool | kType_IsPrimitive (kType type)
| Reports whether the type is a primitive value (single-valued; lacks fields). More...
kBool | kType_IsReference (kType type)
| Determines whether a type represents a class or interface. More...
kBool | kType_IsValue (kType type)
| Determines whether a type represents a value (primitive, struct, enum). More...
kFunction * | kType_IVTable (kType type, kType interfaceType)
| Gets a pointer to the type's virtual method table corresponding to the specified interface type. More...
kSize | kType_MethodCount (kType type)
| Reports count of non-virtual methods. More...
const kMethodInfo * | kType_MethodInfoAt (kType type, kSize index)
| Gets metadata for the non-virtual method at the specified index. More...
const kChar * | kType_Name (kType type)
| Gets the name of the type. More...
kStatus | kType_ParseEnumerator (kType type, k32s *value, const kChar *displayName)
| Parses an enumerator value from a text buffer using the enumerator display name. More...
kSize | kType_Size (kType type)
| Gets the external size of a type. More...
void * | kType_Static (kType type)
| Gets a pointer to the type's static data structure. More...
kBool | kType_StaticInitialized (kType type)
| Reports whether the type's static data structure has been successfully initialized. More...
kSize | kType_StaticSize (kType type)
| Gets the size of a type's static data. More...
kSize | kType_VersionCount (kType type)
| Reports count of registered serialization versions. More...
const kTypeVersionInfo * | kType_VersionInfoAt (kType type, kSize index)
| Gets metadata for the serialization version at the specified index. More...
kSize | kType_VMethodCount (kType type)
| Reports count of virtual methods. More...
const kMethodInfo * | kType_VMethodInfoAt (kType type, kSize index)
| Gets metadata for the virtual method at the specified index. More...
kFunction * | kType_VTable (kType type)
| Gets a pointer to the type's primary virtual method table. More...
Public Member Functions inherited from kObject
kAlloc | kObject_Alloc (kObject object)
| Gets the memory allocator associated with this object. More...
kStatus | kObject_Clone (kObject *object, kObject source, kAlloc allocator)
| Constructs a new object by copying an existing object, including any aggregated child elements. More...
kStatus | kObject_Destroy (kObject object)
| Destroys the object. More...
kStatus | kObject_Dispose (kObject object)
| Destroys the object and any aggregated child elements. More...
kBool | kObject_Equals (kObject object, kObject other)
| Determines whether the object is equal to another object. More...
kSize | kObject_HashCode (kObject object)
| Gets a hash code representing the state of this object. More...
kBool | kObject_Is (kObject object, kType type)
| Determines whether this object is an instance of the specified type. More...
kBool | kObject_IsShared (kObject object)
| Reports whether the object is currently shared (reference count greater than one). More...
kStatus | kObject_SetPool (kObject object, kObjectPool pool)
| Sets the object pool associated with this object. More...
kStatus | kObject_Share (kObject object)
| Increments the reference count associated with this object. More...
kSize | kObject_Size (kObject object)
| Estimates the memory consumed by this object, including any aggregated child elements. More...
kType | kObject_Type (kObject object)
| Returns the type of the object. More...

## Related
kPointer | kTypeVersion
| Represents an opaque reference to type version information (used in object serialization).
#define | kTypeName kText64
| Alias for type used to store a kType text name.
#define | kType_Assembly_(TYPE) kxType_Assembly_(TYPE)
| Macro version of kType_Assembly.
#define | kType_Is_(TYPE, OTHER) kxType_Is_(TYPE, OTHER)
| Macro version of kType_Is.
#define | kType_IsValue_(TYPE) kxType_IsValue_(TYPE)
| Macro version of kType_IsValue.
#define | kType_IsClass_(TYPE) kxType_IsClass_(TYPE)
| Macro version of kType_IsClass.
#define | kType_IsInterface_(TYPE) kxType_IsInterface_(TYPE)
| Macro version of kType_IsInterface.
#define | kType_IsAbstract_(TYPE) kxType_IsAbstract_(TYPE)
| Macro version of kType_IsAbstract.
#define | kType_IsReference_(TYPE) kxType_IsReference_(TYPE)
| Macro version of kType_IsReference.
#define | kType_IsEnum_(TYPE) kxType_IsEnum_(TYPE)
| Macro version of kType_IsEnum.
#define | kType_IsBitEnum_(TYPE) kxType_IsBitEnum_(TYPE)
| Macro version of kType_IsBitEnum.
#define | kType_IsArrayValue_(TYPE) kxType_IsArrayValue_(TYPE)
| Macro version of kType_IsArrayValue.
#define | kType_IsPrimitive_(TYPE) kxType_IsPrimitive_(TYPE)
| Macro version of kType_IsPrimitive.
#define | kType_IsPacked_(TYPE) kxType_IsPacked_(TYPE)
| Macro version of kType_IsPacked.
#define | kType_Implements_(TYPE, IFACE) kxType_Implements_(TYPE, IFACE)
| Macro version of kType_Implements.
#define | kType_Extends_(TYPE, BASE) kxType_Extends_(TYPE, BASE)
| Macro version of kType_Extends.
#define | kType_Base_(TYPE) kxType_Base_(TYPE)
| Macro version of kType_Base.
#define | kType_Size_(TYPE) kxType_Size_(TYPE)
| Macro version of kType_Size.
#define | kType_InnerSize_(TYPE) kxType_InnerSize_(TYPE)
| Macro version of kType_InnerSize.
#define | kType_VTable_(TYPE) kxType_VTable_(TYPE)
| Macro version of kType_VTable.
#define | kType_Static_(TYPE) kxType_Static_(TYPE)
| Macro version of kType_Static.
Related inherited from kObject
#define | kObject_Type_(OBJ) kxObject_Type_(OBJ)
| Macro version of kObject_Type.
#define | kObject_Is_(OBJ, TYPE) kxObject_Is_(OBJ, TYPE)
| Macro version of kObject_Is.
#define | kObject_Alloc_(OBJ) kxObject_Allocator_(OBJ)
| Macro version of kObject_Alloc.

The documentation for this class was generated from the following file:

- kType.h