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


C++ ITypeInfo类代码示例

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


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

示例1: getConcatResultType

ITypeInfo * getConcatResultType(IHqlExpression * expr)
{
    assertex(!"not sure if this is unicode safe, but appears not to be used");
    //first work out the maximum size of the target
    unsigned max = expr->numChildren();
    unsigned idx;
    unsigned totalSize = 0;
    bool unknown = false;
    type_t resultType = type_string;

    for (idx = 0; idx < max; idx++)
    {
        ITypeInfo * type = expr->queryChild(idx)->queryType();
        unsigned size = type->getStringLen();
        if (size == UNKNOWN_LENGTH)
            unknown = true;
        else
            totalSize += size;
        if (type->getTypeCode() == type_varstring)
            resultType = type_varstring;
    }

    if (unknown)
        totalSize = 1023;
    if (resultType == type_string)
        return makeStringType(totalSize, NULL, NULL);
    return makeVarStringType(totalSize);
}
开发者ID:jamienoss,项目名称:HPCC-Platform,代码行数:28,代码来源:hqlcpputil.cpp

示例2: InitTypeLibGUID

/* Extract GUID with name nameGUID and assign it to guid */
static void
InitTypeLibGUID(
    ITypeLib* const pTypeLib, ITypeInfo** const typeInfoPtrArray,
    MEMBERID* const memberIdArray, const nsAString& nameGUID,
    const TYPEKIND typeKindGUID, GUID& guid) {
    
    // Copy nameGUID as FindName requires a non const string
    nsString copyNameGUID(nameGUID);
    PRInt32 hashValue = 0;
    PRUint16 countFound = 1;
    HRESULT result = pTypeLib->FindName(
        copyNameGUID.BeginWriting(), hashValue, typeInfoPtrArray, 
        memberIdArray, &countFound
    );
    
    if (result == S_OK) {
        for (PRUint16 i = 0; i < countFound; ++i) {
            ITypeInfo* pTypeInfo = typeInfoPtrArray[i];
            typeInfoPtrArray[i] = 0;
            TYPEATTR* pTypeAttribute = 0;
            
            result = pTypeInfo->GetTypeAttr(&pTypeAttribute);
            if (result == S_OK) {
                if (pTypeAttribute->typekind == typeKindGUID) {
                    guid = pTypeAttribute->guid;
                }
                pTypeInfo->ReleaseTypeAttr(pTypeAttribute);
            }
        
            SAFE_RELEASE(pTypeInfo);
        }
    }
}
开发者ID:darobin,项目名称:rainbow,代码行数:34,代码来源:VideoSourceWin.cpp

示例3:

static PyObject *PyRecord_reduce(PyObject *self, PyObject *args)
{
	PyObject *ret = NULL;
	PyRecord *pyrec = (PyRecord *)self;
	PyObject *obModule = NULL, *obModDict = NULL, *obFunc = NULL;
	ITypeInfo *pti = NULL;
	TYPEATTR *pta = NULL;
	ULONG cb;
	HRESULT hr;
	GUID structguid;
	if (!PyArg_ParseTuple(args, ":reduce"))
		return NULL;
	hr = pyrec->pri->GetTypeInfo(&pti);
	if (FAILED(hr)||pti==NULL) {
		PyCom_BuildPyException(hr);
		goto done;
	}
	hr = pti->GetTypeAttr(&pta);
	if (FAILED(hr)||pta==NULL) {
		PyCom_BuildPyException(hr);
		goto done;
	}
	hr = pyrec->pri->GetGuid(&structguid);
	if (FAILED(hr)) {
		PyCom_BuildPyException(hr);
		goto done;
	}
	hr = pyrec->pri->GetSize(&cb);
	if (FAILED(hr)) {
		PyCom_BuildPyException(hr);
		goto done;
	}
	obModule = PyImport_ImportModule("pythoncom");
	if (obModule)
		obModDict = PyModule_GetDict(obModule); // no ref added!
	if (obModDict)
		obFunc = PyDict_GetItemString(obModDict, "GetRecordFromGuids"); // no ref added!
	if (!obFunc) {
		PyErr_Clear();
		PyErr_SetString(PyExc_RuntimeError, "pythoncom.GetRecordFromGuids() can't be located!");
		goto done;
	}
	ret = Py_BuildValue("O(NHHiNN)",
						obFunc,
						PyWinObject_FromIID(pta->guid),
						pta->wMajorVerNum,
						pta->wMinorVerNum,
						pta->lcid,
						PyWinObject_FromIID(structguid),
						PyString_FromStringAndSize((char *)pyrec->pdata, cb));

done:
	if (pta&& pti)
		pti->ReleaseTypeAttr(pta);
	if (pti) pti->Release();
	Py_XDECREF(obModule);
	// obModDict and obFunc have no new reference.
	return ret;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:59,代码来源:PyRecord.cpp

示例4: GetIDsOfNames

HRESULT CComTypeInfoHolder::GetIDsOfNames(REFIID /*riid*/, LPOLESTR* rgszNames,
	UINT cNames, LCID lcid, DISPID* rgdispid)
{
	ITypeInfo* pInfo;;
	HRESULT hRes = GetTI(lcid, &pInfo);
	return (pInfo != NULL) ?
		pInfo->GetIDsOfNames(rgszNames, cNames, rgdispid) : hRes;
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:8,代码来源:atlimpl.cpp

示例5: GetI

PyObject *PyITypeInfo::GetTypeAttr()
{
	TYPEATTR *attr;
	ITypeInfo *pMyTypeInfo = GetI(this);
	if (pMyTypeInfo==NULL) return NULL;
	PY_INTERFACE_PRECALL;
	SCODE sc = pMyTypeInfo->GetTypeAttr(&attr);
	PY_INTERFACE_POSTCALL;
	if (FAILED(sc))
		return PyCom_BuildPyException(sc, pMyTypeInfo, IID_ITypeInfo);

/*	
	PyObject *obIID = PyWinObject_FromIID(attr->guid);
	PyObject *obDescAlias;
	// Some (only a few 16 bit MSOffice only one so far, and even then only occasionally!)
	// servers seem to send invalid tdescAlias when its not actually an alias.
	if (attr->typekind == TKIND_ALIAS)
		obDescAlias = MakeTypeDesc(&attr->tdescAlias);
	else {
		Py_INCREF(Py_None);
		obDescAlias=Py_None;
	}

	PyObject *obIDLDesc = MakeIDLDesc(&attr->idldescType);
	PyObject *ret = Py_BuildValue("(OiiiiiiiiiiiiiOO)",
		obIID,                   // @tupleitem 0|<o PyIID>|IID|The IID
		attr->lcid,				 // @tupleitem 1|int|lcid|The lcid
		attr->memidConstructor,	 // @tupleitem 2|int|memidConstructor|ID of constructor
		attr->memidDestructor,	 // @tupleitem 3|int|memidDestructor|ID of destructor,
		attr->cbSizeInstance,	 // @tupleitem 4|int|cbSizeInstance|The size of an instance of this type
		attr->typekind,			 // @tupleitem 5|int|typekind|The kind of type this information describes.  One of the win32con.TKIND_* constants.
		attr->cFuncs,			 // @tupleitem 6|int|cFuncs|Number of functions.
		attr->cVars,			 // @tupleitem 7|int|cVars|Number of variables/data members.
		attr->cImplTypes,		 // @tupleitem 8|int|cImplTypes|Number of implemented interfaces.
		attr->cbSizeVft,		 // @tupleitem 9|int|cbSizeVft|The size of this type's VTBL
		attr->cbAlignment,		 // @tupleitem 10|int|cbAlignment|Byte alignment for an instance of this type.
		attr->wTypeFlags,		 // @tupleitem 11|int|wTypeFlags|One of the pythoncom TYPEFLAG_
		attr->wMajorVerNum,		 // @tupleitem 12|int|wMajorVerNum|Major version number.
		attr->wMinorVerNum,		 // @tupleitem 13|int|wMinorVerNum|Minor version number.
		obDescAlias,			 // @tupleitem 14|<o TYPEDESC>|obDescAlias|If TypeKind == pythoncom.TKIND_ALIAS, specifies the type for which this type is an alias.
		obIDLDesc				 // @tupleitem 15|<o IDLDESC>|obIDLDesc|IDL attributes of the described type.
	);
	Py_XDECREF(obDescAlias);
	Py_XDECREF(obIDLDesc);
	Py_XDECREF(obIID);
***/
	PyObject *ret = PyObject_FromTYPEATTR(attr);

	{
	PY_INTERFACE_PRECALL;
	pMyTypeInfo->ReleaseTypeAttr(attr);
	PY_INTERFACE_POSTCALL;
	}

	return ret;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:56,代码来源:PyIType.cpp

示例6: PrintTInfo

HRESULT PrintTInfo(ITypeInfo* pTinfo, int indentation){
	TYPEATTR* pTypeAttr;
	HRESULT hr = pTinfo->GetTypeAttr(&pTypeAttr); COMRet(hr);
	for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT("    "); 
	LPOLESTR guid_str;
	hr = StringFromCLSID(pTypeAttr->guid, &guid_str);
	std::wcout<<guid_str<<std::endl;

	// Inherited Interfaces, therefore we recursively call PrintInfo
	for(int i = 0; i != pTypeAttr->cImplTypes; ++i){
		HREFTYPE RefType;
		hr = pTinfo->GetRefTypeOfImplType(i, &RefType); COMRet(hr);
		ITypeInfo* pImplTinfo;
		hr = pTinfo->GetRefTypeInfo(RefType, &pImplTinfo); COMRet(hr);
		hr = PrintTInfo(pImplTinfo, indentation + 1); if(hr != S_OK && hr != TYPE_E_BADMODULEKIND) return hr; // Because this ITypeInfo is retrieved
		pImplTinfo->Release();                                                                                // directly from a .tlb file instead
		                                                                                                      // of a .dll, AddressofMember fails
	}

	//member functions
	for(int i = 0; i != pTypeAttr->cFuncs; ++i){
		FUNCDESC* pFuncDesc;
		hr = pTinfo->GetFuncDesc(i, &pFuncDesc); COMRet(hr);
		const UINT cMaxNames = 10; UINT cNames;
		BSTR rgBstrNames[cMaxNames];
		hr = pTinfo->GetNames(pFuncDesc->memid, rgBstrNames, cMaxNames, &cNames); COMRet(hr);
		void* pv;
		hr = pTinfo->AddressOfMember(pFuncDesc->memid, pFuncDesc->invkind, &pv); if(hr != S_OK && hr != TYPE_E_BADMODULEKIND) return hr;
		for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT("    ");
		std::wcout<<TEXT("Func memid = ")<<pFuncDesc->memid<<TEXT(" Name = ")<<*rgBstrNames<<TEXT(" DllAddress = ")<<pv<<std::endl;
		for(int j = 0; j != pFuncDesc->cParams; ++j){
			TCHAR szBuffer[30];
			wParamFlagsTranslate(pFuncDesc->lprgelemdescParam->paramdesc.wParamFlags, szBuffer, 30);
			for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT("    ");
			std::wcout<<TEXT(" ")<<szBuffer<<TEXT(" ")<<*(rgBstrNames+j+1)<<TEXT(": ")<<std::endl;
			TExpandPointer(pFuncDesc->lprgelemdescParam->tdesc, 2);
		}
		pTinfo->ReleaseFuncDesc(pFuncDesc);
	}

	//member variables
	for(int i = 0; i != pTypeAttr->cVars; ++i){
		VARDESC* pVarDesc;
		hr = pTinfo->GetVarDesc(i, &pVarDesc); COMRet(hr);
		for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT("    ");
		std::wcout<<TEXT("Var memid = ")<<pVarDesc->memid<<TEXT("Varkind = ")<<pVarDesc->varkind<<std::endl;
		TCHAR szBuffer[30];
		wParamFlagsTranslate(pVarDesc->elemdescVar.paramdesc.wParamFlags, szBuffer, 30);
		for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT("    ");
		std::wcout<<"  Variable wParamFlags: "<<szBuffer<<std::endl;
		TExpandPointer(pVarDesc->elemdescVar.tdesc, 1);
		pTinfo->ReleaseVarDesc(pVarDesc);
	}
	pTinfo->ReleaseTypeAttr(pTypeAttr);
	return hr;
}
开发者ID:fumin,项目名称:NtuWebmailIEPlugin,代码行数:56,代码来源:top.cpp

示例7: SetErrorInfo

HRESULT CComTypeInfoHolder::Invoke(IDispatch* p, DISPID dispidMember, REFIID /*riid*/,
	LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult,
	EXCEPINFO* pexcepinfo, UINT* puArgErr)
{
	SetErrorInfo(0, NULL);
	ITypeInfo* pInfo;;
	HRESULT hRes = GetTI(lcid, &pInfo);
	return (pInfo != NULL) ?
		pInfo->Invoke(p, dispidMember, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr) :
		hRes;
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:11,代码来源:atlimpl.cpp

示例8:

STDMETHODIMP
InterfaceAdapter::GetIDsOfNames (
    InterfaceAdapter *pThis,
    REFIID,
    OLECHAR **rgszNames,
    UINT cNames,
    LCID,
    DISPID *rgDispId)
{
    ITypeInfo *pTypeInfo = pThis->m_dispatchImpl.typeInfo();
    return pTypeInfo->GetIDsOfNames(rgszNames, cNames, rgDispId);
}
开发者ID:jbroll,项目名称:tcom,代码行数:12,代码来源:InterfaceAdapter.cpp

示例9: makeTypeInfo

JNIEXPORT jobject JNICALL Java_org_racob_com_TypeInfo_getRefTypeInfo
  (JNIEnv *env, jobject obj, jint pointer, jint reftype) {
   ITypeInfo *typeInfo = (ITypeInfo *) pointer;
   ITypeInfo *newTypeInfo = NULL;
   HRESULT hr = typeInfo->GetRefTypeInfo(reftype, &newTypeInfo);
   if (!SUCCEEDED(hr)) {
      ThrowComFail(env, "getRefTypeInfo failed", hr);
      return NULL;
   }

   return makeTypeInfo(env, newTypeInfo);
}
开发者ID:enebo,项目名称:racob,代码行数:12,代码来源:TypeInfo.cpp

示例10: ThrowComFail

JNIEXPORT jint JNICALL Java_org_racob_com_TypeInfo_getRefTypeOfImplType
  (JNIEnv *env, jobject obj, jint pointer, jint index) {
  ITypeInfo *typeInfo = (ITypeInfo *) pointer;
  HREFTYPE href;
  HRESULT hr = typeInfo->GetRefTypeOfImplType(index, &href);
  if (!SUCCEEDED(hr)) {
     ThrowComFail(env, "getRefTypeOfImplType failed", hr);
     return NULL;
  }

  return (jint) href;
}
开发者ID:enebo,项目名称:racob,代码行数:12,代码来源:TypeInfo.cpp

示例11: _tmain

int _tmain(int argc, _TCHAR* argv[]){
	const OLECHAR szFile[] = TEXT("testmidl.tlb");//TEXT("D:\\Desktop\\COM_Type_Library_Viewer\\COM_Type_Library_Viewer\\testmidl.tlb");
	ITypeLib* p_tlib;  
	ITypeInfo* pTinfo;
	HRESULT hr = LoadTypeLib(szFile, &p_tlib); 
	//hr = p_tlib->GetTypeInfoOfGuid(IID_ISum, &pTinfo);//Succeeded
	//hr = p_tlib->GetTypeInfoOfGuid(LIBID_Component, &pTinfo);
	hr = p_tlib->GetTypeInfoOfGuid(CLSID_InsideCOM, &pTinfo);//Succeeded!!
	hr = PrintTInfo(pTinfo, 0);
	pTinfo->Release();
	p_tlib->Release();
	std::getchar();
	return 1;
}
开发者ID:fumin,项目名称:NtuWebmailIEPlugin,代码行数:14,代码来源:top.cpp

示例12: addSimpleField

void DataSourceMetaData::addSimpleField(const char * name, const char * xpath, ITypeInfo * type, unsigned flag)
{
    ITypeInfo * promoted = type->queryPromotedType();
    unsigned size = promoted->getSize();
    unsigned thisBits = 0;
    if (size == UNKNOWN_LENGTH)
    {
        isStoredFixedWidth = false;
        switch (type->getTypeCode())
        {
        case type_set:
            minRecordSize += sizeof(bool) + sizeof(size32_t);
            break;
        case type_varstring:
            minRecordSize += 1;
            break;
        case type_packedint:
            minRecordSize += 1;
            break;
        case type_varunicode:
            minRecordSize += sizeof(UChar);
            break;
        default:
            minRecordSize += sizeof(size32_t);
            break;
        }
    }
    else if (type->getTypeCode() == type_bitfield)
    {
        thisBits = type->getBitSize();
        if (thisBits > bitsRemaining)
        {
            size = type->queryChildType()->getSize();
            minRecordSize += size;
            bitsRemaining = size * 8;
        }
        bitsRemaining -= thisBits;
    }
    else
        minRecordSize += size;
    if (thisBits == 0)
        bitsRemaining = 0;
    fields.append(*new DataSourceMetaItem(flag, name, xpath, type));
}
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:44,代码来源:fvsource.cpp

示例13: queryActiveTableSelector

IHqlExpression * HqlCppCaseInfo::buildIndexedMap(BuildCtx & ctx, IHqlExpression * test, unsigned lower, unsigned upper)
{
    ITypeInfo * compareType = test->queryType()->queryPromotedType();
    type_t compareTypeCode = compareType->getTypeCode();

    HqlExprArray values;
    IHqlExpression * dft = queryActiveTableSelector();  // value doesn't matter as long as it will not occur
    unsigned num = (upper-lower+1);
    values.ensure(num);
    unsigned idx;
    for (idx = 0; idx < num; idx++)
        values.append(*LINK(dft));

    ForEachItemIn(idx2, pairs)
    {
        IHqlExpression & cur = pairs.item(idx2);
        IValue * value = cur.queryChild(0)->queryValue();
        unsigned replaceIndex;
        switch (compareTypeCode)
        {
        case type_int:
            replaceIndex = (int)value->getIntValue()-lower;
            break;
        case type_string:
            {
                StringBuffer temp;
                value->getStringValue(temp);
                replaceIndex = (int)(unsigned char)temp.charAt(0)-lower;
                break;
            }
        default:
            throwUnexpectedType(compareType);
        }

        IHqlExpression * mapTo = cur.queryChild(1);
        if (mapTo->getOperator() != no_constant)
            throwUnexpected();
        if (replaceIndex >= num)
            translator.reportWarning(CategoryIgnored, HQLWRN_CaseCanNeverMatch, "CASE entry %d can never match the test condition", replaceIndex);
        else
            values.replace(*LINK(mapTo),replaceIndex);
    }
开发者ID:RogerDev,项目名称:HPCC-Platform,代码行数:42,代码来源:hqlcppcase.cpp

示例14: Invoke

STDMETHODIMP CJServer::Invoke(DISPID dispID, REFIID riid
    , LCID lcid, unsigned short wFlags, DISPPARAMS *pDispParams
    , VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
    HRESULT     hr;
    ITypeInfo  *pTI;
    LANGID      langID=PRIMARYLANGID(lcid);

    if (IID_NULL!=riid) return DISP_E_UNKNOWNINTERFACE;
    hr=GetTypeInfo(0, lcid, &pTI);
    if (FAILED(hr)) return hr;

    //This is exactly what DispInvoke does--so skip the overhead.
    hr=pTI->Invoke((SERVERCLASS *)this, dispID, wFlags
        , pDispParams, pVarResult, pExcepInfo, puArgErr);

    //Exception handling is done within ITypeInfo::Invoke
    pTI->Release();
    return hr;
}
开发者ID:EdKeith,项目名称:core,代码行数:20,代码来源:jdllcomx.cpp

示例15: get_interfacename

static void get_interfacename( IUnknown *punk, VARIANT *vres )
{
	HRESULT hr;
	IDispatch *pDisp;
	ITypeInfo *pTI;
	BSTR bstr = NULL;
	hr = punk->QueryInterface( IID_IDispatch, (void **)&pDisp );
	if ( SUCCEEDED(hr) && pDisp != NULL ) {
		hr = pDisp->GetTypeInfo( 0, LOCALE_USER_DEFAULT, &pTI );
		if ( SUCCEEDED(hr) && pTI != NULL ) {
			hr = pTI->GetDocumentation( MEMBERID_NIL, &bstr, NULL, NULL, NULL );
			pTI->Release();
		}
		pDisp->Release();
	}
	if ( bstr == NULL ) {
		bstr = SysAllocString( L"" );
	}
	vres->bstrVal = bstr;
	vres->vt = VT_BSTR;
}
开发者ID:zakki,项目名称:openhsp,代码行数:21,代码来源:hspvar_comobj.cpp


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