当前位置: 首页>>代码示例>>C++>>正文


C++ Token::LookupAttr方法代码示例

本文整理汇总了C++中Token::LookupAttr方法的典型用法代码示例。如果您正苦于以下问题:C++ Token::LookupAttr方法的具体用法?C++ Token::LookupAttr怎么用?C++ Token::LookupAttr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Token的用法示例。


在下文中一共展示了Token::LookupAttr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

static void
autonumber(FlexBuffer *buffer, const Token& t)
{
  const AttributeRec *id = t.LookupAttr(SGMLName::intern("ID", 1));
  const AttributeRec *type = t.LookupAttr(SGMLName::intern("Type", 1));
  const AttributeRec *initial = t.LookupAttr(SGMLName::intern("Initial", 1));
  const AttributeRec *delta = t.LookupAttr(SGMLName::intern("Delta", 1));
  const AttributeRec *reset = t.LookupAttr(SGMLName::intern("Reset", 1));
  const AttributeRec *counter = t.LookupAttr(SGMLName::intern("Counter", 1));

  if(!id) throw(Unexpected("Autonumber: missing ID attribute"));
  if(!type) throw(Unexpected("Autonumber: missing Type attribute"));
  if(!initial) throw(Unexpected("Autonumber: missing Initial attribute"));
  if(!delta) throw(Unexpected("Autonumber: missing Delta attribute"));
  if(!reset) throw(Unexpected("Autonumber: missing Reset attribute"));
  if(!counter) throw(Unexpected("Autonumber: missing Counter attribute"));

  
  buffer->writeStr(id->getAttrValueString());
  buffer->writeStr(" = autonumber[\"");
  buffer->writeStr(type->getAttrValueString());
  buffer->writeStr("\", \"");
  buffer->writeStr(initial->getAttrValueString());
  buffer->writeStr("\", \"");
  buffer->writeStr(delta->getAttrValueString());
  buffer->writeStr("\", ");

  write_array(buffer,  counter->getAttrValueString(), 1);

  buffer->writeStr(", ");

  write_array(buffer, reset->getAttrValueString(), 1);

  buffer->writeStr("]\n\n");
}
开发者ID:juddy,项目名称:edcde,代码行数:35,代码来源:StyleTask.C

示例2: switch

void TestTask2::markup(const Token &t)
{

  ComplexTask::markup( t );
  
  switch(t.type()){
  case START:

    /*
     * See if any OLIAS Architecture Form exists
     */

    if ( t.AttributeMatch( OLAF::OLIAS, OLAF::Graphic ) ) {
      f_base = t.level();

      if ( t.LookupAttr( OLAF::OL_data ) ) 
	ComplexTask::addSubTask( new OL_Data ( t, OLAF::OL_data ) );
    }
    break;

  case END:
    if ( f_base == t.level() ) {
      for ( int i=0; i < ComplexTask::used; i++ ) {
	OL_Data *t = ( OL_Data *) subtask(i);
	cout << "OL_Data found = " << t->content() << endl;
      }
    }
    break;

  default :
    break;

  }
}
开发者ID:juddy,项目名称:edcde,代码行数:34,代码来源:Task.C

示例3: if


//.........这里部分代码省略.........
	 report_position(f_buffer, t.file(), t.line());
	 f_buffer->writeStr( f_pathbuf->GetBuffer() );
	 f_buffer->writeStr( "\n" );
	 write_tabs( f_buffer, feature_depth, '\t');
	 f_buffer->writeStr( "{\n" );
	 feature_depth->push( t.level() );

	 break;

       case OLAF::AutoNumber:

	 report_position(onlineSS, t.file(), t.line());
	 autonumber(onlineSS, t);

	 report_position(printSS, t.file(), t.line());
	 autonumber(printSS, t);
	 break;
	
       case OLAF::FeatureText:

	 report_position(f_buffer, t.file(), t.line());
	 write_tabs( f_buffer, feature_depth, '\t');
	 
	 f_buffer->writeStr( t.giName() );
	 f_buffer->writeStr( ": " );
	 f_dataMode = startContent;
	 break;


      case OLAF::AutoRef:
	 {
	   const AttributeRec *arec;
	   int id = SGMLName::intern("ID");
	   if((arec = t.LookupAttr(id))){

	     if(f_dataMode == inContent){
	       f_buffer->writeStr(" + ");
	     }
	     
	     f_buffer->writeStr(arec->getAttrValueString());
	     f_dataMode = inContent;
	   } /* else document is not conforming... sgmls will report error */
	 }
	 break;
			       
       case OLAF::Feature:

	 report_position(f_buffer, t.file(), t.line());
	 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();
开发者ID:juddy,项目名称:edcde,代码行数:67,代码来源:StyleTask.C


注:本文中的Token::LookupAttr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。