ACAPI_​Element_​GetComponents

Returns the components of the element.

    GSErrCode  ACAPI_Element_GetComponents (
        const API_Elem_Head*        elemHead,
        API_ComponentRefType***     compRefs,
        Int32*                      nComp
    );

 

Parameters

elemHead
[in] The element whose components you want to obtain.
compRefs
[out] List of the components.
nComp
[out] Number of the components.

 

Return Values

APIERR_BADPARS
compRefs is nullptr or nComp is nullptr.
APIERR_BADID
Incorrect elemHead was specified.
APIERR_MEMFULL
Not enough memory to get the components.

For other common API errors see the API Errors document.

 

Remarks

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

 

Example


void GetComponents (const API_Guid& guid)
{
    API_Elem_Head         elemHead;
    API_ComponentRefType  **compRefs;
    API_ListData          listdata;
    Int32                 nComp, i;
    char                  s[256];
    GSErrCode             err;

    BNZeroMemory (&elemHead, sizeof (API_Elem_Head));
    elemHead.guid = guid;

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

 

Requirements

Version: API 2.1 or later
Header: ACAPinc.h

See Also

API_ElemTypeID, API_ComponentRefType,
Element Manager, Listing Manager, API Functions