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


C++ TiXmlHandle::Text方法代码示例

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


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

示例1: readTag

//---------------------------------------------------------
bool ofXMLSettings::readTag(string  tag, char * valueString, int which){

	vector<string> tokens = tokenize(tag,":");
		
	TiXmlHandle tagHandle = *storedHandle;
	for(int x=0;x<tokens.size();x++){
		if(x == 0)tagHandle = tagHandle.ChildElement(tokens.at(x), which);
		else tagHandle = tagHandle.FirstChildElement( tokens.at(x) );
	}

	// once we've walked, let's get that value...
	TiXmlHandle valHandle = tagHandle.Child( 0 );
    
    //now, clear that vector! 
	tokens.clear();		
	
    // if that value is really text, let's get the value out of it ! 
    if (valHandle.Text()){
    	int maxLen = MIN(MAX_TAG_VALUE_LENGTH_IN_CHARS, strlen(valHandle.Text()->Value()));
    	memcpy(valueString, valHandle.Text()->Value(), maxLen);
    	return true;	
    }  else {
		return false;
	}
}
开发者ID:LeonFedotov,项目名称:L.A.S.E.R.-TAG-GRL,代码行数:26,代码来源:ofXMLSettings.cpp

示例2: main


//.........这里部分代码省略.........

		// Going to the toy store is now our second priority...
		// So set the "priority" attribute of the first item in the list.
		node = todoElement->FirstChildElement();	// This skips the "PDA" comment.
		assert( node );
		itemElement = node->ToElement();
		assert( itemElement  );
		itemElement->SetAttribute( "priority", 2 );

		// Change the distance to "doing bills" from
		// "none" to "here". It's the next sibling element.
		itemElement = itemElement->NextSiblingElement();
		assert( itemElement );
		itemElement->SetAttribute( "distance", "here" );

		// Remove the "Look for Evil Dinosaurs!" item.
		// It is 1 more sibling away. We ask the parent to remove
		// a particular child.
		itemElement = itemElement->NextSiblingElement();
		todoElement->RemoveChild( itemElement );

		itemElement = 0;

		// --------------------------------------------------------
		// What follows is an example of created elements and text
		// nodes and adding them to the document.
		// --------------------------------------------------------

		// Add some meetings.
		TiXmlElement item( "Item" );
		item.SetAttribute( "priority", "1" );
		item.SetAttribute( "distance", "far" );

		TiXmlText text( "Talk to:" );

		TiXmlElement meeting1( "Meeting" );
		meeting1.SetAttribute( "where", "School" );

		TiXmlElement meeting2( "Meeting" );
		meeting2.SetAttribute( "where", "Lunch" );

		TiXmlElement attendee1( "Attendee" );
		attendee1.SetAttribute( "name", "Marple" );
		attendee1.SetAttribute( "position", "teacher" );

		TiXmlElement attendee2( "Attendee" );
		attendee2.SetAttribute( "name", "Voel" );
		attendee2.SetAttribute( "position", "counselor" );

		// Assemble the nodes we've created:
		meeting1.InsertEndChild( attendee1 );
		meeting1.InsertEndChild( attendee2 );

		item.InsertEndChild( text );
		item.InsertEndChild( meeting1 );
		item.InsertEndChild( meeting2 );

		// And add the node to the existing list after the first child.
		node = todoElement->FirstChild( "Item" );
		assert( node );
		itemElement = node->ToElement();
		assert( itemElement );

		todoElement->InsertAfterChild( itemElement, item );

		printf( "\n** Demo doc processed: ** \n\n" );
开发者ID:huntriver,项目名称:TankVSBugs-CSE380-,代码行数:67,代码来源:xmltest.cpp

示例3: main


//.........这里部分代码省略.........

	// Going to the toy store is now our second priority...
	// So set the "priority" attribute of the first item in the list.
	node = todoElement->FirstChildElement();	// This skips the "PDA" comment.
	assert( node );
	itemElement = node->ToElement();
	assert( itemElement  );
	itemElement->SetAttribute( "priority", 2 );

	// Change the distance to "doing bills" from
	// "none" to "here". It's the next sibling element.
	itemElement = itemElement->NextSiblingElement();
	assert( itemElement );
	itemElement->SetAttribute( "distance", "here" );

	// Remove the "Look for Evil Dinosours!" item.
	// It is 1 more sibling away. We ask the parent to remove
	// a particular child.
	itemElement = itemElement->NextSiblingElement();
	todoElement->RemoveChild( itemElement );

	itemElement = 0;

	// --------------------------------------------------------
	// What follows is an example of created elements and text
	// nodes and adding them to the document.
	// --------------------------------------------------------

	// Add some meetings.
	TiXmlElement item( "Item" );
	item.SetAttribute( "priority", "1" );
	item.SetAttribute( "distance", "far" );

	TiXmlText text( "Talk to:" );

	TiXmlElement meeting1( "Meeting" );
	meeting1.SetAttribute( "where", "School" );

	TiXmlElement meeting2( "Meeting" );
	meeting2.SetAttribute( "where", "Lunch" );

	TiXmlElement attendee1( "Attendee" );
	attendee1.SetAttribute( "name", "Marple" );
	attendee1.SetAttribute( "position", "teacher" );

	TiXmlElement attendee2( "Attendee" );
	attendee2.SetAttribute( "name", "Voel" );
	attendee2.SetAttribute( "position", "counselor" );

	// Assemble the nodes we've created:
	meeting1.InsertEndChild( attendee1 );
	meeting1.InsertEndChild( attendee2 );

	item.InsertEndChild( text );
	item.InsertEndChild( meeting1 );
	item.InsertEndChild( meeting2 );

	// And add the node to the existing list after the first child.
	node = todoElement->FirstChild( "Item" );
	assert( node );
	itemElement = node->ToElement();
	assert( itemElement );

	todoElement->InsertAfterChild( itemElement, item );

	printf( "\n** Demo doc processed: ** \n\n" );
开发者ID:bsmr-worldforge,项目名称:libwfut,代码行数:67,代码来源:xmltest.cpp

示例4: main


//.........这里部分代码省略.........
          
          // Going to the toy store is now our second priority...
          // So set the "priority" attribute of the first item in the list.
          node = todoElement->FirstChildElement();	// This skips the "PDA" comment.
          assert( node );
          itemElement = node->ToElement();
          assert( itemElement  );
          itemElement->SetAttribute( "priority", 2 );
          
          // Change the distance to "doing bills" from
          // "none" to "here". It's the next sibling element.
          itemElement = itemElement->NextSiblingElement();
          assert( itemElement );
          itemElement->SetAttribute( "distance", "here" );
          
          // Remove the "Look for Evil Dinosours!" item.
          // It is 1 more sibling away. We ask the parent to remove
          // a particular child.
          itemElement = itemElement->NextSiblingElement();
          todoElement->RemoveChild( itemElement );
          
          itemElement = 0;
          
          // --------------------------------------------------------
          // What follows is an example of created elements and text
          // nodes and adding them to the document.
          // --------------------------------------------------------
          
          // Add some meetings.
          TiXmlElement item( "Item" );
          item.SetAttribute( "priority", "1" );
          item.SetAttribute( "distance", "far" );
          
          TiXmlText text( "Talk to:" );
          
          TiXmlElement meeting1( "Meeting" );
          meeting1.SetAttribute( "where", "School" );
          
          TiXmlElement meeting2( "Meeting" );
          meeting2.SetAttribute( "where", "Lunch" );
          
          TiXmlElement attendee1( "Attendee" );
          attendee1.SetAttribute( "name", "Marple" );
          attendee1.SetAttribute( "position", "teacher" );
          
          TiXmlElement attendee2( "Attendee" );
          attendee2.SetAttribute( "name", "Vo&#x82;" );
          attendee2.SetAttribute( "position", "counselor" );
          
          // Assemble the nodes we've created:
          meeting1.InsertEndChild( attendee1 );
          meeting1.InsertEndChild( attendee2 );
          
          item.InsertEndChild( text );
          item.InsertEndChild( meeting1 );
          item.InsertEndChild( meeting2 );
          
          // And add the node to the existing list after the first child.
          node = todoElement->FirstChild( "Item" );
          assert( node );
          itemElement = node->ToElement();
          assert( itemElement );
          
          todoElement->InsertAfterChild( itemElement, item );
          
          printf( "\n** Demo doc processed: ** \n\n" );
开发者ID:E-LLP,项目名称:europa,代码行数:67,代码来源:xmltest.cpp


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