本文整理汇总了C++中MethodInfo::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ MethodInfo::getName方法的具体用法?C++ MethodInfo::getName怎么用?C++ MethodInfo::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MethodInfo
的用法示例。
在下文中一共展示了MethodInfo::getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool DataBus::GetClientMethodInfoResponsePacket::create(const quint8 source,
const quint8 destination,
const quint8 packetId,
const MethodInfo &methodInfo,
Packet *packet)
{
// Check parameters
if ((source == 0) ||
(methodInfo.isValid() == false) ||
(packet == 0))
{
// Error, invalid parameters
return false;
}
// Create Header
packet->setSource(source);
packet->setDestination(destination);
packet->setPacketType(PacketType_GetClientMethodInfoResponse);
packet->setPacketId(packetId);
// Create Payload
QByteArray data;
data.append(static_cast<char>(methodInfo.getId()));
data.append(methodInfo.getName());
data.append(static_cast<char>(methodInfo.getNoOfParameters()));
data.append(static_cast<char>(methodInfo.getNoOfReturnValues()));
packet->setData(data);
// Success
return true;
}
示例2:
MethodInfo *Assembly::getStaticMethodInfo(const char *name)
{
utArray<Type *> types;
for (UTsize i = 0; i < modules.size(); i++)
{
modules.at(i)->getTypes(types);
for (UTsize j = 0; j < types.size(); j++)
{
Type *type = types.at(j);
MemberTypes types;
types.method = true;
utArray<MemberInfo *> members;
type->findMembers(types, members);
for (UTsize k = 0; k < members.size(); k++)
{
//TODO: this get's the first static main method, at compiler time
// we need to verify only one entry per assembly
MethodInfo *methodInfo = (MethodInfo *)members.at(k);
if (methodInfo->isStatic() && !strcmp(methodInfo->getName(), name))
{
return methodInfo;
}
}
}
types.clear();
}
return NULL;
}
示例3: print_method
void print_method(const MethodInfo &mi)
{
std::cout << "\t ";
// display if the method is virtual
if (mi.isVirtual())
std::cout << "virtual ";
// display the method's return type if defined
if (mi.getReturnType().isDefined())
std::cout << mi.getReturnType().getQualifiedName() << " ";
else
std::cout << "[UNDEFINED TYPE] ";
// display the method's name
std::cout << mi.getName() << "(";
// display method's parameters
const ParameterInfoList ¶ms = mi.getParameters();
for (ParameterInfoList::const_iterator k=params.begin(); k!=params.end(); ++k)
{
// get the ParameterInfo object that describes the
// current parameter
const ParameterInfo &pi = **k;
// display the parameter's modifier
if (pi.isIn())
std::cout << "IN";
if (pi.isOut())
std::cout << "OUT";
if (pi.isIn() || pi.isOut())
std::cout << " ";
// display the parameter's type name
if (pi.getParameterType().isDefined())
std::cout << pi.getParameterType().getQualifiedName();
// display the parameter's name if defined
if (!pi.getName().empty())
std::cout << " " << pi.getName();
if ((k+1)!=params.end())
std::cout << ", ";
}
std::cout << ")";
if (mi.isConst())
std::cout << " const";
if (mi.isPureVirtual())
std::cout << " = 0";
std::cout << "\n";
}
示例4: if
// TODO: Unify this with the JIT bc generator binary expressions
// https://theengineco.atlassian.net/browse/LOOM-640
// https://theengineco.atlassian.net/browse/LOOM-641
Expression *TypeCompiler::visit(BinaryOperatorExpression *expression)
{
Tokens *tok = Tokens::getSingletonPtr();
Expression *eleft = expression->leftExpression;
Expression *eright = expression->rightExpression;
// operator overloads
lmAssert(eleft->type && eright->type, "Untyped binary expression");
const char *opmethod = tok->getOperatorMethodName(expression->op);
if (opmethod)
{
MemberInfo *mi = eleft->type->findMember(opmethod);
if (mi)
{
lmAssert(mi->isMethod(), "Non-method operator");
MethodInfo *method = (MethodInfo *)mi;
lmAssert(method->isOperator(), "Non-operator method");
utArray<Expression *> args;
args.push_back(eleft);
args.push_back(eright);
ExpDesc opcall;
ExpDesc emethod;
BC::singleVar(cs, &opcall, eleft->type->getName());
BC::expString(cs, &emethod, method->getName());
BC::expToNextReg(cs->fs, &opcall);
BC::expToNextReg(cs->fs, &emethod);
BC::expToVal(cs->fs, &emethod);
BC::indexed(cs->fs, &opcall, &emethod);
generateCall(&opcall, &args, method);
expression->e = opcall;
return expression;
}
}
// dynamic cast
if ((expression->op == &tok->KEYWORD_IS) ||
(expression->op == &tok->KEYWORD_INSTANCEOF) ||
(expression->op == &tok->KEYWORD_AS))
{
lmAssert(eleft->type && eright->type, "Untype expression");
FuncState *fs = cs->fs;
ExpDesc object;
BC::singleVar(cs, &object, "Object");
ExpDesc method;
if (expression->op == &tok->KEYWORD_IS)
{
BC::expString(cs, &method, "_is");
}
else if (expression->op == &tok->KEYWORD_AS)
{
BC::expString(cs, &method, "_as");
}
else
{
BC::expString(cs, &method, "_instanceof");
}
BC::expToNextReg(fs, &object);
BC::expToNextReg(fs, &method);
BC::expToVal(fs, &method);
BC::indexed(fs, &object, &method);
utArray<Expression *> args;
args.push_back(eleft);
args.push_back(new StringLiteral(eright->type->getAssembly()->getName().c_str()));
args.push_back(new NumberLiteral(eright->type->getTypeID()));
generateCall(&object, &args);
expression->e = object;
return expression;
}
BinOpr op = getbinopr(expression->op);
if (op == OPR_LOOM_ADD)
{
lmAssert(eleft->type && eright->type, "Untyped add operaton %i",
lineNumber);
int ncheck = 0;
if (eleft->type->isEnum() || (eleft->type->getFullName() == "system.Number"))
{
ncheck++;
//.........这里部分代码省略.........