本文整理汇总了C++中Obj::Class方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj::Class方法的具体用法?C++ Obj::Class怎么用?C++ Obj::Class使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj
的用法示例。
在下文中一共展示了Obj::Class方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showObjss
void showObjss(stringstream& ss,Obj o){
bool f=o.isToken();Word wc=WordBits/4,wa=sizeof(addrT)*2+2;
obj C=o.Class();
ss<<hex<<setw(wc)<<o.w<<"|";
String v=dict.nameOf(C);
if(v!=classNotFound){
ss<<setw(20)<<v<<" ";
ss<<setw(4)<<hex<<uWord(t2i(C));
}else
ss<<setw(20)<<hex<<C.w<<" ";
ss<<" |";
if(o.isToken()){
vect& v=o.V();
ss<<(v.readOnly ? " X |" : " |");
ss<<(v.reference ? " X |" : " |");
ss<<(o.hasBody() ? " X |" : " |");
// ss<<(v.excludeFirst ? " X |" : " |");
ss<<(v.fields ? " X |" : " |");
ss<< setw(7)<<v.executionLevel<<"|";
ss<< setw(wa)<<v.addr0<<" |";
}else{
int w=3+4+8+3+wa+2;char s[w+1];memset(s,'-',w);s[w]=0;s[0]=' ';s[w-1]=' ';
ss<<" | | | | |";
ss<<setw(wa+2)<<"|";
}
ss<<" "<<toString(o);
ss<<endl;
}
示例2: match
AggregateOrdered match(const Aggregate s,AggregateOrdered positions, Obj pat,AggregateOrdered r=0,Word pn=1){
// p holds the positions array that may have 1 or 2 columns per raw
#define loop(aa,step) for(Word i=0,i1=aa.elements(),p;i<i1 && (p=aa[i],true);i+=step)
switch(pat.Class().w){
case _classInt:{
if(!r)
r=AggregateOrdered();
uWord sn=s.elements();
loop(positions,pn){
if(0<=p && p+1<=sn && s[p]==pat.w) r.keyExists((Obj)(p+1));
}
};
break;
case _classAggregate:
stack.push(positions);
execute(pat,true);
r=stack.pop();
break;
case _classString:
case _classPatternAll:{
AggregateOrdered r1=positions;
for(auto pat1:(Aggregate)pat)
r1=match(s,r1,pat1);
if(!r) r=r1;else r+=r1;
break;
}
case _classPatternAny:
if(!r)
r=AggregateOrdered();
for(auto pat1:(Aggregate)pat)
match(s,positions,pat1,r);
break;
default:
assert0(false,"unexpected in matchAll");
break;
}
return r;
}