MAP_RESULT Map_GetInternals()

in src/map.c [576:602]


MAP_RESULT Map_GetInternals(MAP_HANDLE handle, const char*const** keys, const char*const** values, size_t* count)
{
    MAP_RESULT result;
    /*Codes_SRS_MAP_02_046: [If parameter handle, keys, values or count is NULL then Map_GetInternals shall return MAP_INVALIDARG.] */
    if (
        (handle == NULL) ||
        (keys == NULL) ||
        (values == NULL) ||
        (count == NULL)
        )
    {
        result = MAP_INVALIDARG;
        LOG_MAP_ERROR;
    }
    else
    {
        /*Codes_SRS_MAP_02_043: [Map_GetInternals shall produce in *keys an pointer to an array of const char* having all the keys stored so far by the map.]*/
        /*Codes_SRS_MAP_02_044: [Map_GetInternals shall produce in *values a pointer to an array of const char* having all the values stored so far by the map.]*/
        /*Codes_SRS_MAP_02_045: [  Map_GetInternals shall produce in *count the number of stored keys and values.]*/
        MAP_HANDLE_DATA* handleData = handle;
        *keys =(const char* const*)(handleData->keys);
        *values = (const char* const*)(handleData->values);
        *count = handleData->count;
        result = MAP_OK;
    }
    return result;
}