Type Descriptions
The information associated with an object described by ITypeInfo can include a set of functions, a set of data members, and various type attributes. It is essentially the same as the information described by a C++ class declaration, which can be used to define both interfaces and structures, as well as any combination of functions and data members. In addition to interfaces and structure definitions, the ITypeInfo interface is used to describe other types, including enumerations and aliases. Because the interface to a C file or library is simply a set of functions and variable declarations, ITypeInfo can also be used to describe them.
Type information comprises individual type descriptions. Each type description must have one of the following forms.
Category | ODL keyword | Description |
---|---|---|
alias | typedef | An alias for another type. |
enumeration | enum | An enumeration. |
structure | struct | A structure. |
union | union | A single data item that can have one of a specified group of types. |
module | module | Data and functions not accessed through virtual function table (VTBL) entries. |
IDispatch | dispinterface | IDispatch properties and methods accessed through IDispatch::Invoke. |
OLE interface | interface | OLE member functions accessed through VTBL entries. |
dual interface | dual | Supports either VTBL or IDispatch. |
component object class | coclass | A component object class. Specifies an implementation of one or more OLE interfaces and one or more IDispatch interfaces. |
Note
All bit flags that are not used specifically should be set to zero for future compatibility.
Alias
An alias has TypeKind = TKIND_ALIAS. An alias is an empty set of functions, an empty set of data members, and a type description (located in the TYPEATTR), which gives the actual type definition (typedef) of the alias.
Enumeration (Statement)
An enumeration (enum) has TypeKind = TKIND_ENUM. An enumeration is an empty set of functions and a set of constant data members.
Structure (Statement)
A structure (struct) description has TypeKind = TKIND_RECORD. A structure is an empty set of functions and a set of per-instance data members.
Union (Statement)
A union description has TypeKind = TKIND_UNION. A union is an empty set of functions and a set of per-instance data members, each of which has an instance offset of zero.
Module (Statement)
A module has TypeKind = TKIND_MODULE. A module is a set of static functions and a set of static data members.
OLE-Compatible Interface
An interface definition has TypeKind = TKIND_INTERFACE. An interface is a set of pure virtual functions and an empty set of data members. If a type description contains any virtual functions, then the pointer to the VTBL is the first 4 bytes of the instance.
The type information fully describes the member functions in the VTBL, including parameter names and types and function return types. It may inherit from no more than one other interface.
With interfaces and dispinterfaces, all members should have different names, except the accessor functions of properties. For property functions having the same name, the documentation string and Help context should be set for only one of the functions (because they define the same property conceptually).
IDispatch Interface
These include objects (TypeKind = TKIND_DISPATCH) that support the IDispatch interface with a specification of the dispatch data members (such as properties) and methods supported through the object's Invoke implementation. All members of the dispinterface should have different IDs, except for the accessor functions of properties.
Dual Interface
Dual interfaces (dual) have two different type descriptions for the same interface. The TKIND_INTERFACE type description describes the interface as a standard OLE Component Object Model (COM) interface. The TKIND_DISPATCH type description describes the interface as a standard dispatch interface. The lcid and retval parameters, and the HRESULT return types are removed, and the return type of the member is specified to be the same type as the retval parameter.
By default, the TYPEKIND enumeration for a dual interface is TKIND_INTERFACE. Tools that bind to interfaces should check the type flags for TYPEFLAG_FDUAL. If this flag is set, the TKIND_DISPATCH type description is available through a call to ITypeInfo::GetRefTypeOfImplType with an index of –1, followed by a call to ITypeInfo::GetRefTypeInfo.
Component Object Classes
These coclass objects (TypeKind = TKIND_COCLASS) support a set of implemented interfaces, which can be of either TKIND_INTERFACE or TKIND_DISPATCH.
Related topics