⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmpi_error.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 2 页
字号:
            return NULL;        }        CMPIBoolean notNull;        String pgOtherErrorSourceFormat;        try        {            notNull = cer->getOtherErrorSourceFormat(pgOtherErrorSourceFormat);            if (!notNull)            {                if (rc) CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);                return NULL;            }        }        catch (...)        {            if (rc) CMSetStatus(rc, CMPI_RC_ERR_FAILED);            return NULL;        }        if (rc) CMSetStatus(rc,CMPI_RC_OK);        return string2CMPIString(pgOtherErrorSourceFormat);    }    static CMPIrc errGetCIMStatusCode(const CMPIError* eErr, CMPIStatus* rc)    {        CIMError* cer=(CIMError*)eErr->hdl;        if (!cer)        {            if (rc) CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);            return CMPI_RC_ERR_INVALID_PARAMETER;        }        CMPIBoolean notNull;        CIMError::CIMStatusCodeEnum pgCIMStatusCode;        try        {            notNull = cer->getCIMStatusCode(pgCIMStatusCode);            if (!notNull)            {                if (rc) CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);                return CMPI_RC_ERR_INVALID_PARAMETER;            }        }        catch (...)        {            if (rc) CMSetStatus(rc, CMPI_RC_ERR_FAILED);            return CMPI_RC_ERR_FAILED;        }        if (rc) CMSetStatus(rc,CMPI_RC_OK);        return (CMPIrc)pgCIMStatusCode;    }    static CMPIString* errGetCIMStatusCodeDescription(        const CMPIError* eErr, CMPIStatus* rc)    {        CIMError* cer=(CIMError*)eErr->hdl;        if (!cer)        {            if (rc) CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);            return NULL;        }        CMPIBoolean notNull;        String pgCIMStatusCodeDescription;        try        {            notNull = cer->getCIMStatusCodeDescription(                pgCIMStatusCodeDescription);            if (!notNull)            {                if (rc) CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);                return NULL;            }        }        catch (...)        {            if (rc) CMSetStatus(rc, CMPI_RC_ERR_FAILED);            return NULL;        }        if (rc) CMSetStatus(rc,CMPI_RC_OK);        return string2CMPIString(pgCIMStatusCodeDescription);    }    static CMPIArray* errGetMessageArguments(        const CMPIError* eErr, CMPIStatus* rc)    {        CIMError* cer=(CIMError*)eErr->hdl;        if (!cer)        {            if (rc) CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);            return NULL;        }        CMPIBoolean notNull;        Array<String> pgMessageArguments;        try        {            notNull = cer->getMessageArguments(pgMessageArguments);            if (!notNull)            {                if (rc) CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);                return NULL;            }        }        catch (...)        {            if (rc) CMSetStatus(rc, CMPI_RC_ERR_FAILED);            return NULL;        }        CMPIUint32 arrSize = pgMessageArguments.size();        CMPIData *dta=new CMPIData[arrSize+1];        // first element reserved for type and size        dta->type=CMPI_string;        dta->value.uint32=arrSize;        for (unsigned int i=1; i<=arrSize; i++) {           dta[i].type=CMPI_string;           dta[i].state=CMPI_goodValue;           String s = pgMessageArguments[i-1];           dta[i].value.string=string2CMPIString(s);        }        if (rc) CMSetStatus(rc,CMPI_RC_OK);        return reinterpret_cast<CMPIArray*>(new CMPI_Object(dta));    }    static CMPIStatus errSetErrorType(        CMPIError* eErr, const CMPIErrorType errorType)    {        CIMError* cer=(CIMError*)eErr->hdl;        if (!cer)        {            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);        }        CIMError::ErrorTypeEnum pgErrorType;        pgErrorType = (CIMError::ErrorTypeEnum)errorType;        try        {            cer->setErrorType(pgErrorType);        }        catch (...)        {            CMReturn(CMPI_RC_ERR_FAILED);        }        CMReturn(CMPI_RC_OK);    }    static CMPIStatus errSetOtherErrorType(        CMPIError* eErr, const char* otherErrorType)    {        CIMError* cer=(CIMError*)eErr->hdl;        if (!cer)        {            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);        }        String pgOtherErrorType(otherErrorType);        try        {            cer->setOtherErrorType(pgOtherErrorType);        }        catch (...)        {            CMReturn(CMPI_RC_ERR_FAILED);        }        CMReturn(CMPI_RC_OK);    }    static CMPIStatus errSetProbableCauseDescription(        CMPIError* eErr, const char* probableCauseDescription)    {        CIMError* cer=(CIMError*)eErr->hdl;        if (!cer)        {            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);        }        String pgProbableCauseDescription(probableCauseDescription);        try        {            cer->setProbableCauseDescription(pgProbableCauseDescription);        }        catch (...)        {            CMReturn(CMPI_RC_ERR_FAILED);        }        CMReturn(CMPI_RC_OK);    }    static CMPIStatus errSetRecommendedActions(        CMPIError* eErr, const CMPIArray* recommendedActions)    {        CIMError* cer=(CIMError*)eErr->hdl;        if (!cer)        {            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);        }        Array<String> pgRecommendedActions;        CMPIData* dta=(CMPIData*)recommendedActions->hdl;        if (!dta)         {            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);        }        try        {            for (unsigned int i=0; i<dta->value.uint32; i++)             {                CMPIData arrEl;                const char * arrElStr;                CMPIStatus rc = {CMPI_RC_OK,NULL};                if (dta[i].type!=CMPI_string)                {                    CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);                }                arrEl = CMGetArrayElementAt(recommendedActions, i, &rc);                if (rc.rc != CMPI_RC_OK)                {                    return rc;                }                arrElStr = CMGetCharsPtr(arrEl.value.string, &rc);                if (rc.rc != CMPI_RC_OK)                {                    return rc;                }                pgRecommendedActions.append(String(arrElStr));                if (rc.rc != CMPI_RC_OK)                {                    return rc;                }            }            cer->setRecommendedActions(pgRecommendedActions);        }        catch (...)        {            CMReturn(CMPI_RC_ERR_FAILED);        }        CMReturn(CMPI_RC_OK);    }    static CMPIStatus errSetErrorSource(        CMPIError* eErr, const char* errorSource)    {        CIMError* cer=(CIMError*)eErr->hdl;        if (!cer)        {            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);        }        String pgErrorSource(errorSource);        try        {            cer->setErrorSource(pgErrorSource);        }        catch (...)        {            CMReturn(CMPI_RC_ERR_FAILED);        }        CMReturn(CMPI_RC_OK);    }    static CMPIStatus errSetErrorSourceFormat(        CMPIError* eErr, const CMPIErrorSrcFormat errorSrcFormat)    {        CIMError* cer=(CIMError*)eErr->hdl;        if (!cer)        {            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);        }        CIMError::ErrorSourceFormatEnum pgErrorSourceFormat;        pgErrorSourceFormat = (CIMError::ErrorSourceFormatEnum)errorSrcFormat;        try        {            cer->setErrorSourceFormat(pgErrorSourceFormat);        }        catch (...)        {            CMReturn(CMPI_RC_ERR_FAILED);        }        CMReturn(CMPI_RC_OK);    }    static CMPIStatus errSetOtherErrorSourceFormat(        CMPIError* eErr, const char* otherErrorSourceFormat)    {        CIMError* cer=(CIMError*)eErr->hdl;        if (!cer)        {            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);        }        String pgOtherErrorSourceFormat(otherErrorSourceFormat);        try        {            cer->setOtherErrorSourceFormat(pgOtherErrorSourceFormat);        }        catch (...)        {            CMReturn(CMPI_RC_ERR_FAILED);        }        CMReturn(CMPI_RC_OK);    }    static CMPIStatus errSetCIMStatusCodeDescription(        CMPIError* eErr, const char* cimStatusCodeDescription)    {        CIMError* cer=(CIMError*)eErr->hdl;        if (!cer)        {            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);        }        String pgCIMStatusCodeDescription(cimStatusCodeDescription);        try        {            cer->setCIMStatusCodeDescription(pgCIMStatusCodeDescription);        }        catch (...)        {            CMReturn(CMPI_RC_ERR_FAILED);        }        CMReturn(CMPI_RC_OK);    }    static CMPIStatus errSetMessageArguments(        CMPIError* eErr, CMPIArray* messageArguments)    {        CIMError* cer=(CIMError*)eErr->hdl;        if (!cer)        {            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);        }        Array<String> pgMessageArguments;        CMPIData* dta=(CMPIData*)messageArguments->hdl;        if (!dta)         {            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);        }        try        {            for (unsigned int i=0; i<dta->value.uint32; i++)             {                CMPIData arrEl;                const char * arrElStr;                CMPIStatus rc = {CMPI_RC_OK,NULL};                if (dta[i].type!=CMPI_string)                {                    CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);                }                arrEl = CMGetArrayElementAt(messageArguments, i, &rc);                if (rc.rc != CMPI_RC_OK)                {                    return rc;                }                arrElStr = CMGetCharsPtr(arrEl.value.string, &rc);                if (rc.rc != CMPI_RC_OK)                {                    return rc;                }                pgMessageArguments.append(String(arrElStr));                if (rc.rc != CMPI_RC_OK)                {                    return rc;                }            }            cer->setMessageArguments(pgMessageArguments);        }        catch (...)        {            CMReturn(CMPI_RC_ERR_FAILED);        }        CMReturn(CMPI_RC_OK);    }}static CMPIErrorFT error_FT={    CMPICurrentVersion,    errRelease,    errClone,    errGetErrorType,    errGetOtherErrorType,    errGetOwningEntity,    errGetMessageID,    errGetMessage,    errGetPerceivedSeverity,    errGetProbableCause,    errGetProbableCauseDescription,    errGetRecommendedActions,    errGetErrorSource,    errGetErrorSourceFormat,    errGetOtherErrorSourceFormat,    errGetCIMStatusCode,    errGetCIMStatusCodeDescription,    errGetMessageArguments,    errSetErrorType,    errSetOtherErrorType,    errSetProbableCauseDescription,    errSetRecommendedActions,    errSetErrorSource,    errSetErrorSourceFormat,    errSetOtherErrorSourceFormat,    errSetCIMStatusCodeDescription,    errSetMessageArguments,};CMPIErrorFT *CMPI_Error_Ftab=&error_FT;PEGASUS_NAMESPACE_END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -