本文整理汇总了C++中Type::GetMethod方法的典型用法代码示例。如果您正苦于以下问题:C++ Type::GetMethod方法的具体用法?C++ Type::GetMethod怎么用?C++ Type::GetMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type::GetMethod方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InterceptedFunction
//*************************************************************************
// Method: getManagedDefinition
// Description: Uses reflection to get information about a managed method
//
// Parameters:
// fInfo - structure which contains query data
//
// Return Value: (InterceptedFunction) the function definition
//*************************************************************************
InterceptedFunction * AddCustIntWizPg2::getManagedDefinition (functionInformation * fInfo)
{
InterceptedFunction * iFunc = new InterceptedFunction();
//Set the function name
iFunc->Name = fInfo->functionName;
//Set the library location name
iFunc->OriginalDll = Path::GetFileName(fInfo->libraryName);
//LOAD THE ASSEMBLY TO GET MORE INFORMATION
Assembly * asmLibrary = Assembly::LoadFrom (fInfo->libraryName);
//Get the module
Module * asmModule = asmLibrary->GetModule (fInfo->moduleName);
//Get the type
Type * moduleType = asmModule->GetType (fInfo->typeName);
//Get the method
if (!fInfo->isConstructor)
{
MethodInfo * mi = NULL;
try
{
mi = moduleType->GetMethod (getBaseName(fInfo->functionName), fInfo->bindingFlags, NULL, fInfo->paramTypeArray, NULL);
}
catch(...)
{
// in case of an exception, just return NULL
return NULL;
}
if (!mi)
return NULL;
//Get Parameter Info
ParameterInfo * paramInfo[] = mi->GetParameters();
//Set the modifiers
if (mi->IsPrivate) iFunc->AddTypeModifier ("private");
if (mi->IsPublic) iFunc->AddTypeModifier ("public");
if (mi->IsVirtual) iFunc->AddTypeModifier ("virtual");
if (mi->IsAbstract) iFunc->AddTypeModifier ("abstract");
if (mi->IsStatic) iFunc->AddTypeModifier ("static");
//Set return type
iFunc->ReturnType = mi->ReturnType->ToString();
//Set Parameter Info
for (int parCount = 0; parCount < paramInfo->Count; parCount++)
{
ParameterInfo * pInfo = paramInfo[parCount];
InterceptedFunctionParameter * ifParam = new InterceptedFunctionParameter ();
ifParam->ID = pInfo->Position;
ifParam->Name = pInfo->Name;
ifParam->Type = pInfo->ParameterType->FullName;
ifParam->Access = "";
if (pInfo->IsIn)
ifParam->Access = "IN ";
if (pInfo->IsOut)
ifParam->Access = String::Concat(ifParam->Access, "OUT");
if (ifParam->Access->Length == 0)
ifParam->Access = "NONE";
iFunc->AddParameter (ifParam);
}
}
else
{
ConstructorInfo * ci = moduleType->GetConstructor (fInfo->bindingFlags, NULL, fInfo->paramTypeArray, NULL);
if (!ci)
return NULL;
//Get Parameter Info
ParameterInfo * paramInfo[] = ci->GetParameters();
//Set the modifiers
if (ci->IsPrivate) iFunc->AddTypeModifier ("private");
if (ci->IsPublic) iFunc->AddTypeModifier ("public");
if (ci->IsVirtual) iFunc->AddTypeModifier ("virtual");
if (ci->IsAbstract) iFunc->AddTypeModifier ("abstract");
if (ci->IsStatic) iFunc->AddTypeModifier ("static");
//Set return type
iFunc->ReturnType = S"System.Void";
//.........这里部分代码省略.........