ACAPI_​Element_​GetDescriptors

Returns the descriptors of an element.

    GSErrCode  ACAPI_Element_GetDescriptors (
        const API_Elem_Head*         elemHead,
        API_DescriptorRefType***     descRef,
        Int32*                       nDesc
    );

 

Parameters

elemHead
[in] The element you want to get the descriptors for.
descRef
[out] List of the descriptors.
nDesc
[out] Number of the descriptors in the list.

Return Values

APIERR_BADPARS
descRef is nullptr or nDesc is nullptr.
APIERR_BADID
Incorrect elemHead was specified.
APIERR_MEMFULL
Not enough memory to get the descriptors.

For other common API errors see the API Errors document.

 

Remarks

This function is used to get information for every descriptor of an element. These descriptors are in the property objects of the element. This applies to all the construction elements.

 

Example


void GetDiscriptors (const API_Guid& guid)
{
    API_Elem_Head          elemHead;
    API_DescriptorRefType  **descRefs;
    API_ListData           listdata;
    Int32                  nDesc, i;
    char                   s[256];
    GSErrCode              err;

    BNClear (elemHead);
    elemHead.guid = guid;

    err = ACAPI_Element_GetDescriptors (&elemHead, &descRefs, &nDesc);
    if (err == NoError) {
        for (i = 0; i < nDesc; i++) {
            listdata.header.typeID   = API_ComponentID;
            listdata.header.index    = (*descRefs)[i].index;
            listdata.header.setIndex = (*descRefs)[i].setIndex;
            if ((*descRefs)[i].status != APIDBRef_Deleted) {
                BNZeroMemory (&listdata, sizeof (API_ListData));
                listdata.header.typeID   = API_DescriptorID;
                listdata.header.setIndex = (*descRefs)[i].setIndex;
                listdata.header.index    = (*descRefs)[i].index;
                switch ((*descRefs)[i].status) {
                    case APIDBRef_Normal:
                        err = ACAPI_ListData_Get (&listdata);
                        break;
                    case APIDBRef_Local:
                        err = ACAPI_ListData_GetLocal ((*descRefs)[i].libIndex, &listdata);
                        break;
                }
            }
            if (err == NoError) {
                sprintf (s, "Keycode/code: \"%s\"/\"%s\"", listdata.descriptor.keycode, listdata.descriptor.code);
                ACAPI_WriteReport (s, false);
                ACAPI_WriteReport (*(listdata.descriptor.name), false);
            }
            BMKillHandle (&listdata.descriptor.name);
        }
        BMKillHandle ((GSHandle *) &descRefs);
    }
}

 

Requirements

Version: API 2.1 or later
Header: ACAPinc.h

 

See Also

API_ElemTypeID, API_DescriptorRefType,
Element Manager, Listing Manager, API Functions