本文整理汇总了C++中TClass::GetListOfAllPublicMethods方法的典型用法代码示例。如果您正苦于以下问题:C++ TClass::GetListOfAllPublicMethods方法的具体用法?C++ TClass::GetListOfAllPublicMethods怎么用?C++ TClass::GetListOfAllPublicMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TClass
的用法示例。
在下文中一共展示了TClass::GetListOfAllPublicMethods方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execSharedPtr
int execSharedPtr()
{
#if __cplusplus >= 201103L
string output;
gInterpreter->GetInterpreterTypeName("std::__shared_ptr<int>",output,kTRUE);
if ( output.length() && output != "__shared_ptr<int>" ) {
Error("GetInterpreterTypeName","Instead of __shared_ptr<int>, we got %s.",output.c_str());
//return 1;
}
TClass *c = TClass::GetClass("std::shared_ptr<int>");
if (!c) {
Error("GetClass","Did not find the TClass for std::shared_ptr<int>.");
return 2;
}
TObject *m = c->GetListOfAllPublicMethods()->FindObject("get");
if (!m) {
Error("GetListOfAllPublicMethods","Did not find the get method");
return 3;
}
if (0 != strcmp("get",m->GetName())) {
Error("TMethod","Instead of get the name of the method is %s",m->GetName());
return 4;
}
std::shared_ptr<int> ptr;
TMethodCall call((TFunction*)m);
call.Execute();
c = TClass::GetClass("__shared_ptr<int>");
if (!c) c = TClass::GetClass("std::shared_ptr<int>");
if (c) {
m = c->GetListOfAllPublicMethods()->FindObject("operator=");
if (!m) {
Error("GetListOfAllPublicMethods","Did not find the operator= method");
return 3;
}
if (0 != strcmp("operator=",m->GetName())) {
Error("TMethod","Instead of operator= the name of the method is %s",m->GetName());
return 4;
}
TMethodCall callop((TFunction*)m);
callop.Execute(&ptr);
m = c->GetListOfAllPublicMethods()->FindObject("swap");
if (!m) {
Error("GetListOfAllPublicMethods","Did not find the swap method");
return 3;
}
if (0 != strcmp("swap",m->GetName())) {
Error("TMethod","Instead of swap the name of the method is %s",m->GetName());
return 4;
}
TMethodCall callswap((TFunction*)m);
callswap.Execute(&ptr);
}
#else
// Emulated expected errors
Error("TClingCallFunc::exec","The method get is called without an object.");
Error("TClingCallFunc::exec","Not enough arguments provided for operator= (0 instead of the minimum 1)");
Error("TClingCallFunc::exec","Not enough arguments provided for swap (0 instead of the minimum 1)");
#endif
return 0;
}