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


C++ IObject::GetClassID方法代码示例

本文整理汇总了C++中IObject::GetClassID方法的典型用法代码示例。如果您正苦于以下问题:C++ IObject::GetClassID方法的具体用法?C++ IObject::GetClassID怎么用?C++ IObject::GetClassID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IObject的用法示例。


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

示例1: _CObject_ReflectInterfaceInfo

ELAPI _CObject_ReflectInterfaceInfo(
    /* [in] */ PInterface object,
    /* [out] */ IInterfaceInfo** interfaceInfo)
{
    if (!object || !interfaceInfo) {
        return E_INVALID_ARGUMENT;
    }

    EIID iid;
    ECode ec = object->GetInterfaceID(object, &iid);
    if (FAILED(ec)) return E_INVALID_ARGUMENT;

    IObject* iObject = (IObject*)object->Probe(EIID_IObject);
    if (iObject == NULL) return E_NO_INTERFACE;

    ClassID clsid;
    ec = iObject->GetClassID(&clsid);
    if (FAILED(ec)) return E_INVALID_ARGUMENT;

    AutoPtr<IModuleInfo> obj;
    ec = _CReflector_AcquireModuleInfo(String(clsid.mUunm), (IModuleInfo**)&obj);
    if (FAILED(ec)) {
        return ec;
    }
    CModuleInfo* moduleInfo = (CModuleInfo*)obj.Get();

    ClassDirEntry* classDir = NULL;
    ClassDescriptor* clsDesc = NULL;
    ClassInterface* cifDir = NULL;
    InterfaceDirEntry* ifDir = NULL;
    InterfaceDescriptor* ifDesc = NULL;
    UInt16 index = 0;
    Int32 base = moduleInfo->mClsModule->mBase;

    *interfaceInfo = NULL;
    for (Int32 i = 0; i < moduleInfo->mClsMod->mClassCount; i++) {
        classDir = getClassDirAddr(base, moduleInfo->mClsMod->mClassDirs, i);
        clsDesc = adjustClassDescAddr(base, classDir->mDesc);
        //find the class
        if (clsDesc->mClsid == clsid.mClsid) {
            for (Int32 j = 0; j < clsDesc->mInterfaceCount; j++) {
                cifDir = getCIFAddr(base, clsDesc->mInterfaces, j);
                index = cifDir->mIndex;
                ifDir = getInterfaceDirAddr(base,
                        moduleInfo->mClsMod->mInterfaceDirs, index);
                ifDesc = adjustInterfaceDescAddr(base, ifDir->mDesc);
                //find the interface
                if (ifDesc->mIID == iid) {
                    ec = g_objInfoList.AcquireInterfaceInfo(
                            moduleInfo->mClsModule, index, (IInterface **)interfaceInfo);
                    return ec;
                }
            }
        }
    }

    return E_DOES_NOT_EXIST;
}
开发者ID:maerson,项目名称:CPP_Framework_Elastos5,代码行数:58,代码来源:reflection.cpp

示例2: _Impl_CheckClsId

ELAPI _Impl_CheckClsId(
    /* [in] */ PInterface serverObj,
    /* [in] */ const ClassID* classiD,
    /* [out] */ PInterface* outServerObj)
{
    IObject* object;
    char str[80];
    ClassID clsid;
    clsid.mUunm = str;

    object = (IObject*)serverObj->Probe(EIID_IObject);
    if (NULL == object) return E_INVALID_ARGUMENT;

    object->GetClassID(&clsid);
    while (*(EMuid *)&clsid != *(EMuid *)classiD) {
        object = (IObject*)object->Probe(EIID_SUPER_OBJECT);
        if (NULL == object) return E_INVALID_ARGUMENT;

        object->GetClassID(&clsid);
    }
    *outServerObj = object;  // don't AddRef, Caller don't Release either.
    return NOERROR;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:23,代码来源:cbapi.cpp

示例3: _CObject_ReflectModuleInfo

ELAPI _CObject_ReflectModuleInfo(
    /* [in] */ PInterface object,
    /* [out] */ IModuleInfo** moduleInfo)
{
    if (!object || !moduleInfo) {
        return E_INVALID_ARGUMENT;
    }

    IObject* iObject = (IObject*)object->Probe(EIID_IObject);
    if (iObject == NULL) return E_NO_INTERFACE;

    ClassID clsid;
    ECode ec = iObject->GetClassID(&clsid);
    if (FAILED(ec)) {
        return E_NO_INTERFACE;
    }

    return _CReflector_AcquireModuleInfo(String(clsid.mUunm), moduleInfo);
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:19,代码来源:reflection.cpp

示例4: _CObject_ReflectClassInfo

ELAPI _CObject_ReflectClassInfo(
    /* [in] */ PInterface object,
    /* [out] */ IClassInfo** classInfo)
{
    if (!object || !classInfo) {
        return E_INVALID_ARGUMENT;
    }

    IObject* iObject = (IObject*)object->Probe(EIID_IObject);
    if (iObject == NULL) return E_NO_INTERFACE;

    ClassID clsid;
    ECode ec = iObject->GetClassID(&clsid);
    if (FAILED(ec)) {
        return E_NO_INTERFACE;
    }

    AutoPtr<IModuleInfo> iModuleInfo;
    ec = g_objInfoList.AcquireModuleInfo(String(clsid.mUunm),
            (IModuleInfo**)&iModuleInfo);
    if (FAILED(ec)) {
        return ec;
    }

    CModuleInfo* moduleInfo = (CModuleInfo*)iModuleInfo.Get();

    ClassDirEntry* classDir = NULL;
    ClassDescriptor* clsDesc = NULL;
    Int32 base = moduleInfo->mClsModule->mBase;

    *classInfo = NULL;
    for (Int32 i = 0; i < moduleInfo->mClsMod->mClassCount; i++) {
        classDir = getClassDirAddr(base, moduleInfo->mClsMod->mClassDirs, i);
        clsDesc = adjustClassDescAddr(base, classDir->mDesc);
        if (clsDesc->mClsid == clsid.mClsid) {
            ec = g_objInfoList.AcquireClassInfo(moduleInfo->mClsModule,
                    classDir, (IInterface **)classInfo);
            return ec;
        }
    }

    return E_DOES_NOT_EXIST;
}
开发者ID:maerson,项目名称:CPP_Framework_Elastos5,代码行数:43,代码来源:reflection.cpp


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