Zen API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kType Class Reference

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:
Inheritance graph

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 kEnumeratorInfokType_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 kFieldInfokType_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 kMethodInfokType_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_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...
 
kFunctionkType_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 kMethodInfokType_MethodInfoAt (kType type, kSize index)
 Gets metadata for the non-virtual method at the specified index. More...
 
const kCharkType_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...
 
kTypeVersion kType_VersionAt (kType type, kSize index)
 Gets the type version handle at the specified index. More...
 
kSize kType_VersionCount (kType type)
 Reports count of registered type versions. More...
 
kFunction kType_VersionDeserializeFx (kType type, kTypeVersion version)
 Gets the deserialization method for the specified type version. More...
 
const kCharkType_VersionFormat (kType type, kTypeVersion version)
 Gets the serialization format name associated with the type version. More...
 
kVersion kType_VersionFormatVersion (kType type, kTypeVersion version)
 Gets the serialization format version associated with the type version. More...
 
const kCharkType_VersionGuid (kType type, kPointer version)
 Gets the GUID associated with the specified type version. More...
 
kFunction kType_VersionSerializeFx (kType type, kTypeVersion version)
 Gets the serialization method for the specified type version. More...
 
kSize kType_VMethodCount (kType type)
 Reports count of virtual methods. More...
 
const kMethodInfokType_VMethodInfoAt (kType type, kSize index)
 Gets metadata for the virtual method at the specified index. More...
 
kFunctionkType_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...
 
kBool kObject_HasForeignData (kObject object)
 Reports whether the object, including aggregated child elements, contains any foreign memory references. 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

#define kType_IVTableT(kType_type, T)
 Gets a strongly-typed pointer to the type's virtual method table corresponding to the specified interface type. More...
 
#define kType_VTableT(kType_type, T)
 Gets a strongly-typed pointer to the type's primary virtual method table. More...
 
kPointer kTypeVersion
 Represents an opaque reference to type version information (used in object serialization).
 
#define kTypeName
 Alias for type used to store a kType text name.
 

Additional Inherited Members

- Protected Member Functions inherited from kObject
kStatus kObject_FreeMem (kObject object, void *mem)
 Protected method called by derived classes to free memory using the object's allocator. More...
 
kStatus kObject_FreeMemRef (kObject object, void *mem)
 Protected method called by derived classes to free memory (and reset the provided memory pointer to kNULL) using the object's allocator. More...
 
kStatus kObject_GetMem (kObject object, kSize size, void *mem)
 Protected method called by derived classes to allocate memory using the object's allocator. More...
 
kStatus kObject_GetMemZero (kObject object, kSize size, void *mem)
 Protected method called by derived classes to allocate and zero memory using the object's allocator. More...
 
kStatus kObject_Init (kObject object, kType type, kAlloc alloc)
 Protected method called by derived classes to initialize the kObject base class. More...
 
kStatus kObject_VDisposeItems (kObject object)
 Protected virtual method that destroys any aggregated child objects associated with a collection. More...
 
kBool kObject_VEquals (kObject object, kObject other)
 Protected virtual method that compares two objects for equality. More...
 
kBool kObject_VHasForeignData (kObject object)
 Protected virtual method that reports whether the object, including aggregated child elements, contains any foreign memory references. More...
 
kSize kObject_VHashCode (kObject object)
 Protected virtual method that calculates a hash code representing the object instance. More...
 
kStatus kObject_VInitClone (kObject object, kObject source, kAlloc allocator)
 Protected virtual method that clones (makes a deep copy of) the specified source object. More...
 
kStatus kObject_VRelease (kObject object)
 Protected virtual method that deallocates any resources owned by the object. More...
 
kSize kObject_VSize (kObject object)
 Protected virtual method that calculates the total size (in bytes) of the object instance. More...
 

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