本文整理汇总了C++中PClass::name方法的典型用法代码示例。如果您正苦于以下问题:C++ PClass::name方法的具体用法?C++ PClass::name怎么用?C++ PClass::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PClass
的用法示例。
在下文中一共展示了PClass::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// miscelaneous output routines
ostream& operator << (ostream& os, Signature& sig)
{
Signature::iterator si;
StringList::iterator sli;
StringList *args = sig.get_arg_names();
if (args && args->size()==0) args = NULL;
if (!s_ctor && !s_dtor) // *fix 1.1.2 these don't have return types!
os << sig.return_type() << ' ';
string na = s_fun_name;
char first = na[0];
// *fix 1.2.7 wasn't outputing 'operator' in front of '()'
if (!isalpha(first) && first != '_' /*&& first != '('*/) na = "operator" + na;
PClass pc = sig.class_ptr();
if (pc != NULL) {
string classn = pc->name();
if (! s_full_names && pc->is_template()) classn = pc->get_template()->name();
if (s_ctor) na = classn; else
if (s_dtor) na = "~" + classn;
if (s_full_names) na = classn + "::" + na;
}
os << na << '(';
if (args != NULL) sli = args->begin();
for(si = sig.begin(); si != sig.end(); ) {
os << *si++;
if (args != NULL) os << ' ' << *sli++;
if (si != sig.end()) os << ',';
}
os << ')';
if (sig.is_const()) os << " const";
return os;
}
示例2: dissemble
void dissemble(PFBlock fb)
{
Opcodes opcode;
int rmode,rdata, k = 0;
string name;
Instruction *pi = fb->pstart;
while (pi != end_of_code) {
opcode = (Opcodes)pi->opcode;
// *add 1.2.4 HALT+data is not always a breakpoint!
// (it is used as a NOP + <any useful tag data>)
if (opcode == HALT) {
if (pi->data < MAX_BREAKPOINTS) {
Breakpoint *pb = Breakpoint::from_id(pi->data);
Instruction ai = pb->saved_instruction();
std::cout << "*";
opcode = (Opcodes)ai.opcode;
rmode = ai.rmode; rdata = ai.data;
} else { opcode = NOP; rdata = pi->data; }
} else {
rmode = pi->rmode; rdata = pi->data;
}
name = get_opcode_name(opcode);
std::cout << k++ << ' ' << name << '\t';
if (opcode == CCALL || opcode == CALL || opcode == CALLD || opcode == CALLN) {
FBlock* pfb;
void *data = data_ptr(rdata);
if (opcode == CALLN)
pfb = Builtin::imported_fblock_from_function((void*)((NFBlock *)data)->pfn);
else pfb = PFBlock(data_ptr(rdata));
if (pfb) Function::from_fun_block(pfb)->dump(std::cout);
} else
if (opcode == JSWITCH) {
int *swb = (int *)data_ptr(rdata);
int sz = *swb++;
int def = *swb++;
std::cout << '(' << sz << ',' << def << ") ";
for (int i = 0; i < sz; i++) std::cout << *swb++ << ' ' << *swb++ << ' ';
}
else
if (opcode == TOSD || opcode == TPODS) {
PClass pc = *(PClass *)data_ptr(rdata);
std::cout << pc->name();
}
else {
if (rmode)
switch(rmode) {
case DIRECT: std::cout << "D "; break;
case SREL: std::cout << "R "; break;
case OREL: std::cout << "S "; break;
}
if (rdata != 0) std::cout << rdata;
}
std::cout << std::endl;
if (opcode == RET || opcode == RETI || opcode == RETD) break;
pi++;
}
}