APINavigator_​GetNavigatorVPRootGroupsID

Gets the list of Navigator viewpoint roots.

    GSErrCode ACAPI_Navigator (
        APINavigator_GetNavigatorVPRootGroupsID,
        GS::Array<API_Guid>*     rootGuids
    );

 

Parameters

rootGuids
[out] The GUIDs of the current AddOn’s Navigator viewpoint roots.

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
rootGuids was nullptr.

For other common API errors see the API Errors document.

 

Example

This example prints all Navigator viewpoint roots, groups and leaf nodes to the debug output.


enum NextEnumAction {
    ProcessSubtree,
    SkipSubtree,
    BreakEnumeration
};


// breadth-first enumeration
static void     EnumerateAllNavigatorAddOnViewPoints (const std::function<NextEnumAction (const API_NavigatorAddOnViewPointData& vp)>& processor)
{
    GS::Array<API_Guid> rootGuids;
    DBVERIFY (ACAPI_Navigator (APINavigator_GetNavigatorVPRootGroupsID, &rootGuids) == NoError);

    GS::Queue<API_Guid> q;

    for (const API_Guid& guid : rootGuids)
        q.Push (guid);

    while (!q.IsEmpty ()) {
        API_NavigatorAddOnViewPointData viewPointData;
        viewPointData.guid = q.Pop ();
        DBVERIFY (ACAPI_Navigator (APINavigator_GetNavigatorVPItemID, &viewPointData) == NoError);

        switch (processor (viewPointData)) {
            case ProcessSubtree:
                if (viewPointData.itemType == API_NavigatorAddOnViewPointRootID || viewPointData.itemType == API_NavigatorAddOnViewPointGroupID) {
                    GS::Array<API_Guid> childGuids;
                    DBVERIFY (ACAPI_Navigator (APINavigator_GetNavigatorVPItemChildrenID, &viewPointData.guid, &childGuids) == NoError);
                    for (const API_Guid& guid : childGuids)
                        q.Push (guid);
                }
                break;

            case SkipSubtree:
                // do not process children
                break;

            case BreakEnumeration:
                return;

            default:
                DBBREAK ();
                return;
        }
    }
}


static void    PrintAllNavigatorAddOnViewPoints (void)
{
    EnumerateAllNavigatorAddOnViewPoints ([] (const API_NavigatorAddOnViewPointData& vp) -> NextEnumAction {
        DBPrintf (GS::UniString (vp.displayId + " " + vp.displayName + "\n").ToCStr ());
        return ProcessSubtree;
    });
}

 

Requirements

Version: API 22 or later
Header: APIdefs_Navigator.h

 

See Also

APINavigator_GetNavigatorVPItemChildrenID,
APINavigator_GetNavigatorVPItemID,
ACAPI_Navigator,
API Functions