当前位置: 首页>>代码示例>>C++>>正文


C++ ENUM_TO_STRING函数代码示例

本文整理汇总了C++中ENUM_TO_STRING函数的典型用法代码示例。如果您正苦于以下问题:C++ ENUM_TO_STRING函数的具体用法?C++ ENUM_TO_STRING怎么用?C++ ENUM_TO_STRING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ENUM_TO_STRING函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: JSONEncoder_CharPtr_ToString

JSON_ENCODER_TOSTRING_RESULT JSONEncoder_CharPtr_ToString(STRING_HANDLE destination, const void* value)
{
    JSON_ENCODER_TOSTRING_RESULT result;

    /*Coes_SRS_JSON_ENCODER_99_047:[ JSONEncoder_CharPtr_ToString shall return JSON_ENCODER_TOSTRING_INVALID_ARG if destination or value parameters passed to it are NULL.]*/
    if ((destination == NULL) ||
        (value == NULL))
    {
        result = JSON_ENCODER_TOSTRING_INVALID_ARG;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_TOSTRING_RESULT, result));
    }
    /*Codes_SRS_JSON_ENCODER_99_048:[ JSONEncoder_CharPtr_ToString shall use strcpy_s to copy from value to destination.]*/
    else if (STRING_concat(destination, (const char*)value) != 0)
    {
        /*Codes_SRS_JSON_ENCODER_99_049:[ If strcpy_s fails then JSONEncoder_CharPtr_ToString shall return JSON_ENCODER_TOSTRING_ERROR.]*/
        result = JSON_ENCODER_TOSTRING_ERROR;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_TOSTRING_RESULT, result));
    }
    else
    {
        /*Codes_SRS_JSON_ENCODER_99_050:[ If strcpy_s doesn't fail, then JSONEncoder_CharPtr_ToString shall return JSON_ENCODER_TOSTRING_OK]*/
        result = JSON_ENCODER_TOSTRING_OK;
    }

    return result;
}
开发者ID:Ahmed-Salama,项目名称:Project_JAR,代码行数:26,代码来源:jsonencoder.c

示例2: MultiTree_GetValue

MULTITREE_RESULT MultiTree_GetValue(MULTITREE_HANDLE treeHandle, const void** destination)
{
    MULTITREE_RESULT result;
    /*Codes_SRS_MULTITREE_99_042:[If treeHandle is NULL, the function shall return MULTITREE_INVALID_ARG.]*/
    if (treeHandle == NULL)
    {
        result = MULTITREE_INVALID_ARG;
        LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
    }
    /*Codes_SRS_MULTITREE_99_043:[ If destination is NULL, the function shall return MULTITREE_INVALID_ARG.]*/
    else if (destination == NULL)
    {
        result = MULTITREE_INVALID_ARG;
        LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
    }
    else
    {
        MULTITREE_HANDLE_DATA * node = (MULTITREE_HANDLE_DATA*)treeHandle;
        /*Codes_SRS_MULTITREE_99_044:[ If there is no value in the node then MULTITREE_EMPTY_VALUE shall be returned.]*/
        if (node->value == NULL)
        {
            result = MULTITREE_EMPTY_VALUE;
            LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
        }
        else
        {
            /*Codes_SRS_MULTITREE_99_041:[This function updates the *destination parameter to the internally stored value.]*/
            *destination = node->value;
            result = MULTITREE_OK;
        }
    }
    return result;
}
开发者ID:mohesk,项目名称:azure-iot-sdks,代码行数:33,代码来源:multitree.c

示例3: Lock

LOCK_RESULT Lock(LOCK_HANDLE handle)
{
    LOCK_RESULT result;
    if (handle == NULL)
    {
        /*SRS_LOCK_99_007:[ This API on NULL handle passed returns LOCK_ERROR]*/
        result = LOCK_ERROR;
        LogError("(result = %s)", ENUM_TO_STRING(LOCK_RESULT, result));
    }
    else
    {
        if (mtx_lock((mtx_t*)handle) == thrd_success)
        {
            /*SRS_LOCK_99_005:[ This API on success should return LOCK_OK]*/
            result = LOCK_OK;
        }
        else
        {
            /*SRS_LOCK_99_006:[ This API on error should return LOCK_ERROR]*/
            result = LOCK_ERROR;
            LogError("(result = %s)", ENUM_TO_STRING(LOCK_RESULT, result));
        }
    }
    return result;
}
开发者ID:aog2000a,项目名称:azure-c-shared-utility,代码行数:25,代码来源:lock_c11.c

示例4: ThreadAPI_Join

THREADAPI_RESULT ThreadAPI_Join(THREAD_HANDLE threadHandle, int* res)
{
    THREADAPI_RESULT result;

    THREAD_INSTANCE* threadInstance = (THREAD_INSTANCE*)threadHandle;
    if (threadInstance == NULL)
    {
        result = THREADAPI_INVALID_ARG;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
    }
    else
    {
        void* threadResult;
        if (pthread_join(threadInstance->Pthread_handle, &threadResult) != 0)
        {
            result = THREADAPI_ERROR;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
        }
        else
        {
            if (res != NULL)
            {
                *res = (int)(intptr_t)threadResult;
            }

            result = THREADAPI_OK;
        }

        free(threadInstance);
    }

    return result;
}
开发者ID:JohnCashmore,项目名称:azure-iot-sdks,代码行数:33,代码来源:threadapi_pthreads.c

示例5: ThreadAPI_Create

THREADAPI_RESULT ThreadAPI_Create(THREAD_HANDLE* threadHandle, THREAD_START_FUNC func, void* arg)
{
    THREADAPI_RESULT result;
    if ((threadHandle == NULL) ||
        (func == NULL))
    {
        result = THREADAPI_INVALID_ARG;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
    }
    else
    {
        *threadHandle = CreateThread(NULL, 0, func, arg, 0, NULL);
        if(threadHandle == NULL)
        {
            result = THREADAPI_ERROR;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
        }
        else
        {
            result = THREADAPI_OK;
        }
    }

    return result;
}
开发者ID:ashokkhurana,项目名称:azure-c-shared-utility,代码行数:25,代码来源:threadapi_win32.c

示例6: DataPublisher_StartTransaction

TRANSACTION_HANDLE DataPublisher_StartTransaction(DATA_PUBLISHER_HANDLE dataPublisherHandle)
{
    TRANSACTION* transaction;

    /* Codes_SRS_DATA_PUBLISHER_99_038:[ If DataPublisher_StartTransaction is called with a NULL argument it shall return NULL.] */
    if (dataPublisherHandle == NULL)
    {
        transaction = NULL;
        LogError("(Error code: %s)\r\n", ENUM_TO_STRING(DATA_PUBLISHER_RESULT, DATA_PUBLISHER_INVALID_ARG));
    }
    else
    {
        /* Codes_SRS_DATA_PUBLISHER_99_007:[ A call to DataPublisher_StartTransaction shall start a new transaction.] */
        transaction = (TRANSACTION*)malloc(sizeof(TRANSACTION));
        if (transaction == NULL)
        {
            LogError("Allocating transaction failed (Error code: %s)\r\n", ENUM_TO_STRING(DATA_PUBLISHER_RESULT, DATA_PUBLISHER_ERROR));
        }
        else
        {
            transaction->ValueCount = 0;
            transaction->Values = NULL;
            transaction->DataPublisherInstance = (DATA_PUBLISHER_INSTANCE*)dataPublisherHandle;
        }
    }

    /* Codes_SRS_DATA_PUBLISHER_99_008:[ DataPublisher_StartTransaction shall return a non-NULL handle upon success.] */
    /* Codes_SRS_DATA_PUBLISHER_99_009:[ DataPublisher_StartTransaction shall return NULL upon failure.] */
    return transaction;
}
开发者ID:Ahmed-Salama,项目名称:Project_JAR,代码行数:30,代码来源:datapublisher.c

示例7: serializer_init

SERIALIZER_RESULT serializer_init(const char* overrideSchemaNamespace)
{
    SERIALIZER_RESULT result;

    /* Codes_SRS_SCHEMALIB_99_074:[serializer_init when already initialized shall return SERIALIZER_ALREADY_INIT.] */
    if (g_AgentState != AGENT_NOT_INITIALIZED)
    {
        result = SERIALIZER_ALREADY_INIT;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(SERIALIZER_RESULT, result));
    }
    else
    {
        /* Codes_SRS_SCHEMALIB_99_006:[ Initialize CodeFirst by a call to CodeFirst_Init.] */
        /* Codes_SRS_SCHEMALIB_99_076:[serializer_init shall pass the value of overrideSchemaNamespace argument to CodeFirst_Init.] */
        if (CodeFirst_Init(overrideSchemaNamespace) != CODEFIRST_OK)
        {
            /* Codes_SRS_SCHEMALIB_99_007:[ On error SERIALIZER_CODEFIRST_INIT_FAILED shall be returned.] */
            result = SERIALIZER_CODEFIRST_INIT_FAILED;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(SERIALIZER_RESULT, result));
        }
        else
        {
            /* Codes_SRS_SCHEMALIB_99_075:[When an serializer_init call fails for any reason the previous initialization state shall be preserved. The initialized state shall only be changed on a succesfull Init.] */
            g_AgentState = AGENT_INITIALIZED;

            /* Codes_SRS_SCHEMALIB_99_073:[On success serializer_init shall return SERIALIZER_OK.] */
            result = SERIALIZER_OK;
        }
    }

    return result;
}
开发者ID:MaxKhlupnov,项目名称:azure-iot-sdks,代码行数:32,代码来源:schemalib.c

示例8: HTTPHeaders_GetHeader

/*produces a string in *destination that is equal to name: value*/
HTTP_HEADERS_RESULT HTTPHeaders_GetHeader(HTTP_HEADERS_HANDLE handle, size_t index, char** destination)
{
    HTTP_HEADERS_RESULT result = HTTP_HEADERS_OK;

    /*Codes_SRS_HTTP_HEADERS_99_028:[ The function shall return NULL if the handle is invalid.]*/
    /*Codes_SRS_HTTP_HEADERS_99_032:[ The function shall return HTTP_HEADERS_INVALID_ARG if the destination  is NULL]*/
    if (
        (handle == NULL) ||
        (destination == NULL)
        )
    {
        result = HTTP_HEADERS_INVALID_ARG;
        LogError("invalid arg (NULL), result= %s", ENUM_TO_STRING(HTTP_HEADERS_RESULT, result));
    }
    /*Codes_SRS_HTTP_HEADERS_99_029:[ The function shall return HTTP_HEADERS_INVALID_ARG if index is not valid (for example, out of range) for the currently stored headers.]*/
    else
    {
        HTTP_HEADERS_HANDLE_DATA* handleData = (HTTP_HEADERS_HANDLE_DATA*)handle;
        const char*const* keys;
        const char*const* values;
        size_t headerCount;
        if (Map_GetInternals(handleData->headers, &keys, &values, &headerCount) != MAP_OK)
        {
            /*Codes_SRS_HTTP_HEADERS_99_034:[ The function shall return HTTP_HEADERS_ERROR when an internal error occurs]*/
            result = HTTP_HEADERS_ERROR;
            LogError("Map_GetInternals failed, result= %s", ENUM_TO_STRING(HTTP_HEADERS_RESULT, result));
        }
        else
        {
            /*Codes_SRS_HTTP_HEADERS_99_029:[ The function shall return HTTP_HEADERS_INVALID_ARG if index is not valid (for example, out of range) for the currently stored headers.]*/
            if (index >= headerCount)
            {
                result = HTTP_HEADERS_INVALID_ARG;
                LogError("index out of bounds, result= %s", ENUM_TO_STRING(HTTP_HEADERS_RESULT, result));
            }
            else
            {
                *destination = (char*)malloc(strlen(keys[index]) + COLON_AND_SPACE_LENGTH + strlen(values[index]) + 1);
                if (*destination == NULL)
                {
                    /*Codes_SRS_HTTP_HEADERS_99_034:[ The function shall return HTTP_HEADERS_ERROR when an internal error occurs]*/
                    result = HTTP_HEADERS_ERROR;
                    LogError("unable to malloc, result= %s", ENUM_TO_STRING(HTTP_HEADERS_RESULT, result));
                }
                else
                {
                    /*Codes_SRS_HTTP_HEADERS_99_016:[ The function shall store the name:value pair in such a way that when later retrieved by a call to GetHeader it will return a string that shall strcmp equal to the name+": "+value.]*/
                    /*Codes_SRS_HTTP_HEADERS_99_027:[ Calling this API shall produce the string value+": "+pair) for the index header in the *destination parameter.]*/
                    strcpy(*destination, keys[index]);
                    strcat(*destination, COLON_AND_SPACE);
                    strcat(*destination, values[index]);
                    /*Codes_SRS_HTTP_HEADERS_99_035:[ The function shall return HTTP_HEADERS_OK when the function executed without error.]*/
                    result = HTTP_HEADERS_OK;
                }
            }
        }
    }

    return result;
}
开发者ID:aog2000a,项目名称:azure-c-shared-utility,代码行数:61,代码来源:httpheaders.c

示例9: Unlock

LOCK_RESULT Unlock(LOCK_HANDLE handle)
{
	LOCK_RESULT result;
	if (handle == NULL)
	{
		/*SRS_LOCK_99_011:[ This API on NULL handle passed returns LOCK_ERROR]*/
		result = LOCK_ERROR;
		LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
	}
	else
	{
		if (pthread_mutex_unlock((pthread_mutex_t*)handle) == 0)
		{
			/*SRS_LOCK_99_009:[ This API on success should return LOCK_OK]*/
			result = LOCK_OK;
		}
		else
		{
			/*SRS_LOCK_99_010:[ This API on error should return LOCK_ERROR]*/
			result = LOCK_ERROR;
			LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
		}
	}
	return result;
}
开发者ID:rabbitom,项目名称:azure-c-shared-utility,代码行数:25,代码来源:lock_pthreads.c

示例10: HTTPHeaders_GetHeaderCount

HTTP_HEADERS_RESULT HTTPHeaders_GetHeaderCount(HTTP_HEADERS_HANDLE handle, size_t* headerCount)
{
    HTTP_HEADERS_RESULT result;
    /*Codes_SRS_HTTP_HEADERS_99_024:[ The function shall return HTTP_HEADERS_INVALID_ARG when an invalid handle is passed.]*/
    /*Codes_SRS_HTTP_HEADERS_99_025:[ The function shall return HTTP_HEADERS_INVALID_ARG when headersCount is NULL.]*/
    if ((handle == NULL) ||
        (headerCount == NULL))
    {
        result = HTTP_HEADERS_INVALID_ARG;
        LogError("(result = %s)", ENUM_TO_STRING(HTTP_HEADERS_RESULT, result));
    }
    else
    {
        HTTP_HEADERS_HANDLE_DATA *handleData = (HTTP_HEADERS_HANDLE_DATA *)handle;
        const char*const* keys;
        const char*const* values;
        /*Codes_SRS_HTTP_HEADERS_99_023:[ Calling this API shall provide the number of stored headers.]*/
        if (Map_GetInternals(handleData->headers, &keys, &values, headerCount) != MAP_OK)
        {
            /*Codes_SRS_HTTP_HEADERS_99_037:[ The function shall return HTTP_HEADERS_ERROR when an internal error occurs.]*/
            result = HTTP_HEADERS_ERROR;
            LogError("Map_GetInternals failed, result= %s", ENUM_TO_STRING(HTTP_HEADERS_RESULT, result));
        }
        else
        {
            /*Codes_SRS_HTTP_HEADERS_99_026:[ The function shall write in *headersCount the number of currently stored headers and shall return HTTP_HEADERS_OK]*/
            result = HTTP_HEADERS_OK;
        }
    }

    return result;
}
开发者ID:aog2000a,项目名称:azure-c-shared-utility,代码行数:32,代码来源:httpheaders.c

示例11: ThreadAPI_Join

THREADAPI_RESULT ThreadAPI_Join(THREAD_HANDLE threadHandle, int *res)
{
    THREADAPI_RESULT result;
    thrd_t* thrd_t_ptr = (thrd_t*)threadHandle;

    if (threadHandle == NULL)
    {
        result = THREADAPI_INVALID_ARG;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
    }
    else
    {
        switch (thrd_join(*thrd_t_ptr, res))
        {
        default:
        case thrd_error:
            result = THREADAPI_ERROR;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
            break;

        case thrd_success:
            result = THREADAPI_OK;
            break;

        case thrd_nomem:
            result = THREADAPI_NO_MEMORY;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
            break;
        }

        free(thrd_t_ptr);
    }

    return result;
}
开发者ID:Deadolus,项目名称:azure-c-shared-utility,代码行数:35,代码来源:threadapi_c11.c

示例12: Lock_Deinit

LOCK_RESULT Lock_Deinit(LOCK_HANDLE handle)
{
	LOCK_RESULT result=LOCK_OK ;
	if (NULL == handle)
	{
		/*SRS_LOCK_99_013:[ This API on NULL handle passed returns LOCK_ERROR]*/
		result = LOCK_ERROR;
		LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
	}
	else
	{
		/*SRS_LOCK_99_012:[ This API frees the memory pointed by handle]*/
		if(pthread_mutex_destroy((pthread_mutex_t*)handle)==0)
		{
			free(handle);
			handle = NULL;
		}
		else
		{
			result = LOCK_ERROR;
			LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
		}
	}
	
	return result;
}
开发者ID:rabbitom,项目名称:azure-c-shared-utility,代码行数:26,代码来源:lock_pthreads.c

示例13: DataMarshaller_Create

DATA_MARSHALLER_HANDLE DataMarshaller_Create(SCHEMA_MODEL_TYPE_HANDLE modelHandle, bool includePropertyPath)
{
    DATA_MARSHALLER_HANDLE result;
    DATA_MARSHALLER_INSTANCE* dataMarshallerInstance;

    /*Codes_SRS_DATA_MARSHALLER_99_019:[ DataMarshaller_Create shall return NULL if any argument is NULL.]*/
    if (
        (modelHandle == NULL) 
        )
    {
        result = NULL;
        LogError("(result = %s)", ENUM_TO_STRING(DATA_MARSHALLER_RESULT, DATA_MARSHALLER_INVALID_ARG));
    }
    else if ((dataMarshallerInstance = (DATA_MARSHALLER_INSTANCE*)malloc(sizeof(DATA_MARSHALLER_INSTANCE))) == NULL)
    {
        /* Codes_SRS_DATA_MARSHALLER_99_048:[On any other errors not explicitly specified, DataMarshaller_Create shall return NULL.] */
        result = NULL;
        LogError("(result = %s)", ENUM_TO_STRING(DATA_MARSHALLER_RESULT, DATA_MARSHALLER_ERROR));
    }
    else
    {
        /*everything ok*/
        dataMarshallerInstance->ModelHandle = modelHandle;
        dataMarshallerInstance->IncludePropertyPath = includePropertyPath;

        /*Codes_SRS_DATA_MARSHALLER_99_018:[ DataMarshaller_Create shall create a new DataMarshaller instance and on success it shall return a non NULL handle.]*/
        result = dataMarshallerInstance;
    }
    return result;
}
开发者ID:BeatriceOltean,项目名称:azure-iot-sdks,代码行数:30,代码来源:datamarshaller.c

示例14: MultiTree_GetChild

MULTITREE_RESULT MultiTree_GetChild(MULTITREE_HANDLE treeHandle, size_t index, MULTITREE_HANDLE *childHandle)
{
    MULTITREE_RESULT result;
    /*Codes_SRS_MULTITREE_99_031:[ If parameter treeHandle is NULL, the function returns MULTITREE_INVALID_ARG.]*/
    if (treeHandle == NULL)
    {
        result = MULTITREE_INVALID_ARG;
        LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
    }
    /*Codes_SRS_MULTITREE_99_033:[ If parameter childHandle is NULL, the function shall return MULTITREE_INVALID_ARG.]*/
    else if (childHandle == NULL)
    {
        result = MULTITREE_INVALID_ARG;
        LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
    }
    else 
    {
        MULTITREE_HANDLE_DATA * node = (MULTITREE_HANDLE_DATA *)treeHandle;
        /*Codes_SRS_MULTITREE_99_032:[If parameter index is out of range, the function shall return MULTITREE_OUT_OF_RANGE_INDEX]*/
        if (node->nChildren <= index)
        {
            result = MULTITREE_INVALID_ARG;
            LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
        }
        else
        {
            /*Codes_SRS_MULTITREE_99_030:[ This function writes in *childHandle parameter the "index"th child of the node pointed to by parameter treeHandle]*/
            /*Codes_SRS_MULTITREE_99_035:[ The function returns MULTITREE_OK when *childHandle contains a handle to the "index"th child of the tree designated by parameter treeHandle.]*/
            *childHandle = node->children[index];
            result = MULTITREE_OK;
        }
    }
    return result;
}
开发者ID:mohesk,项目名称:azure-iot-sdks,代码行数:34,代码来源:multitree.c

示例15: ENUM_TO_STRING

boost::python::dict controller::getILockStatesDefinition()
{
    std::map< VELA_ENUM::ILOCK_STATE,  std::string  > m;
    m[ VELA_ENUM::ILOCK_STATE::ILOCK_BAD   ] = ENUM_TO_STRING( VELA_ENUM::ILOCK_STATE::ILOCK_BAD   );
    m[ VELA_ENUM::ILOCK_STATE::ILOCK_GOOD  ] = ENUM_TO_STRING( VELA_ENUM::ILOCK_STATE::ILOCK_GOOD  );
    m[ VELA_ENUM::ILOCK_STATE::ILOCK_ERROR ] = ENUM_TO_STRING( VELA_ENUM::ILOCK_STATE::ILOCK_ERROR );
    return enumStringMapToPythonDict( m );
}
开发者ID:adb-xkc85723,项目名称:VELA-CLARA-Controllers,代码行数:8,代码来源:controller.cpp


注:本文中的ENUM_TO_STRING函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。