Typedef, Enum, Union, and Struct Attributes
The latest version of this topic can be found at Typedef, Enum, Union, and Struct Attributes.
The following attributes apply to the typedef, struct, and enum C++ keywords.
typedef
Attribute | Description |
---|---|
case | Used with the switch_type attribute in a union. |
custom | Lets you define your own attribute. |
export | Causes a data structure to be placed in the .idl file. |
first_is | Specifies the index of the first array element to be transmitted. |
helpcontext | Specifies a context ID that lets the user view information about this element in the Help file. |
helpfile | Sets the name of the Help file for a type library. |
helpstring | Specifies a character string that is used to describe the element to which it applies. |
library_block | Places a construct inside the .idl file's library block. |
ptr | Designates a pointer as a full pointer. |
public | Ensures that a typedef will go into the type library even if it is not referenced from within the .idl file. |
ref | Identifies a reference pointer. |
switch_is | Specifies the expression or identifier acting as the union discriminant that selects the union member. |
switch_type | Identifies the type of the variable used as the union discriminant. |
unique | Specifies a unique pointer. |
wire_marshal | Specifies a data type that will be used for transmission instead of an application-specific data type. |
enum
Attribute | Description |
---|---|
custom | Lets you define your own attribute. |
export | Causes a data structure to be placed in the .idl file. |
uuid | Specifies the unique ID for a class or interface. |
v1_enum | Directs that the specified enumerated type be transmitted as a 32-bit entity, rather than the 16-bit default. |
union
Attribute | Description |
---|---|
custom | Lets you define your own attribute. |
export | Causes a data structure to be placed in the .idl file. |
first_is | Specifies the index of the first array element to be transmitted. |
last_is | Specifies the index of the last array element to be transmitted. |
length_is | Specifies the number of array elements to be transmitted. |
max_is | Designates the maximum value for a valid array index. |
size_is | Specifies the size of memory allocated for sized pointers, sized pointers to sized pointers, and single- or multidimensional arrays. |
unique | Specifies a unique pointer. |
uuid | Specifies the unique ID for a class or interface. |
Nonencapsulated union
Attribute | Description |
---|---|
ms_union | Controls the network data representation alignment of nonencapsulated unions. |
no_injected_text | Prevents the compiler from injecting code as a result of attribute use. |
struct
Attribute | Description |
---|---|
aggregatable | Indicates that the class supports aggregation. |
aggregates | Indicates that a control aggregates the target class. |
appobject | Identifies the coclass as an application object, which is associated with a full .exe application, and indicates that the functions and properties of the coclass are globally available in this type library. |
coclass | Creates an ActiveX control. |
com_interface_entry | Adds an interface entry to a COM map. |
control | Specifies that the user-defined type is a control. |
custom | Lets you define your own attribute. |
db_column | Binds a specified column to the rowset. |
db_command | Creates an OLE DB command. |
db_param | Associates the specified member variable with an input or output parameter and delimits the variable. |
db_source | Creates a connection to a data source. |
db_table | Opens an OLE DB table. |
default | Indicates that the custom or dispinterface defined within a coclass represents the default programmability interface. |
defaultvtable | Defines an interface as the default vtable interface for a control. |
event_receiver | Creates an event receiver. |
event_source | Creates an event source. |
export | Causes a data structure to be placed in the .idl file. |
first_is | Specifies the index of the first array element to be transmitted. |
hidden | Indicates that the item exists but should not be displayed in a user-oriented browser. |
implements_category | Specifies implemented component categories for the class. |
last_is | Specifies the index of the last array element to be transmitted. |
length_is | Specifies the number of array elements to be transmitted. |
max_is | Designates the maximum value for a valid array index. |
requires_category | Specifies the required component categories of the target class. |
size_is | Specifies the size of memory allocated for sized pointers, sized pointers to sized pointers, and single- or multidimensional arrays. |
source | On a class, specifies the COM object's source interfaces for connection points. On a property or method, indicates that the member returns an object or VARIANT that is a source of events. |
threading | Specifies the threading model for a COM object. |
unique | Specifies a unique pointer. |
uuid | Specifies the unique ID for a class or interface. |
version | Identifies a particular version among multiple versions of a class. |
vi_progid | Specifies a version-independent form of the ProgID. |