本文整理汇总了C++中Token::GetNextAttr方法的典型用法代码示例。如果您正苦于以下问题:C++ Token::GetNextAttr方法的具体用法?C++ Token::GetNextAttr怎么用?C++ Token::GetNextAttr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::GetNextAttr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: markup
void TestTask::markup(const Token &t)
{
switch(t.type()){
case START:
printf("\nStart Element: %s\n", t.giName());
const AttributeRec *a;
for(a = t.GetFirstAttr(); a ; a = t.GetNextAttr(a)){
const char *ty = SGMLName::lookup(a->getAttrType());
printf("Attribute: %s = [%s]`%s'\n",
SGMLName::lookup(a->getAttrName()), ty, a->getAttrValueString());
}
break;
case END:
printf("End Element: %s\n", t.giName());
break;
default:
printf("Unknown Token Type: %d\n", t.type());
abort();
break;
}
}
示例2: if
//.........这里部分代码省略.........
write_tabs( f_buffer, feature_depth, '\t');
f_buffer->writeStr( t.giName() );
f_buffer->writeStr( ": " );
const AttributeRec *arec;
/*
* Is it an enumeration feature?
*/
if((arec = t.LookupAttr(OLAF::OL_Choice))){
/* OL_Choice can only be applied to NAME attributes, hence
we don't neet to worryabout "'s in the attribute value.
*/
/* except TRUE and FALSE....*/
const char *val = arec->getAttrValueString();
int quotes = !isdigit(val[0])
&& strcmp(val, "TRUE") != 0
&& strcmp(val, "FALSE") != 0
&& val[0] != '@';
if (quotes) f_buffer->writeStr("\"");
f_buffer->writeStr(val);
if (quotes) f_buffer->writeStr("\" ");
}else{
f_buffer->writeStr( " {\n" );
for (arec = t.GetFirstAttr();
arec != NULL;
arec = t.GetNextAttr( arec )) {
if (( arec->getAttrValueString() != NULL ) &&
( arec->getAttrName() != OLAF::OLIAS )) {
write_tabs( f_buffer, feature_depth, '\t');
f_buffer->put('\t');
write_attr(f_buffer, arec);
f_buffer->writeStr( ",\n" );
}
}
feature_depth->push(t.level());
}
break;
}
/*
* first time we see OL-ID="...", spawn an OL_Data to collect the id
*/
if ((f_base >= 0) && (f_locator == NULL) &&
(t.LookupAttr(OLAF::OL_id))) {
#ifdef FISH_DEBUG
DBUG_PRINT("Style", ("spawning locator collection subtask\n"));
#endif
f_locator = new OL_Data(t, OLAF::OL_id, REMOVE_SPACES);
addSubTask( f_locator );
}
}