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


C++ TiXmlPrinter::Str方法代码示例

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


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

示例1: AppData

wxFBDataObject::wxFBDataObject( PObjectBase obj )
:
wxDataObject()
{
	if ( obj )
	{
		// create xml representation of ObjectBase
		ticpp::Element element;
		obj->SerializeObject( &element );

		// add version info to xml data, just in case it is pasted into a different version of wxFB
		element.SetAttribute( "fbp_version_major", AppData()->m_fbpVerMajor );
		element.SetAttribute( "fbp_version_minor", AppData()->m_fbpVerMinor );

		ticpp::Document doc;
		doc.LinkEndChild( &element );
		TiXmlPrinter printer;
        printer.SetIndent( "\t" );

        #if defined( __WXMSW__ )
            printer.SetLineBreak( "\r\n" );
        #else
            printer.SetLineBreak( "\n" );
        #endif

        doc.Accept( &printer );
		m_data = printer.Str();
	}
}
开发者ID:heyuqi,项目名称:wxFormBuilder,代码行数:29,代码来源:dataobject.cpp

示例2: save

void xml_write_archive::save(const variant& what)
  {
	  TiXmlPrinter printer;
	  printer.SetIndent( "\t" );

	  base_write_archive::save( what ); 
	  
	  doc_.Accept( &printer );
	  result_ = printer.Str();
  }
开发者ID:gcubar,项目名称:XKP,代码行数:10,代码来源:xml_archive.cpp

示例3: tiXmlToStr

		std::string tiXmlToStr(TiXmlNode* xmlNode)
		{
				//print
			TiXmlPrinter printer;
			printer.SetIndent( "\t" );

			xmlNode->Accept( &printer );
			const std::string& result = printer.Str();

			return result;
		}
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:11,代码来源:convertFunction.cpp

示例4: getDeviceDescription

string GarminFilebasedDevice::getDeviceDescription() const
{
    if (this->deviceDescription == NULL) { return ""; }

    TiXmlPrinter printer;
	printer.SetIndent( "\t" );
	this->deviceDescription->Accept( &printer );
    string str = printer.Str();

    if (Log::enabledDbg()) Log::dbg("GarminFilebasedDevice::getDeviceDescription() Done: "+this->displayName );
    return str;
}
开发者ID:ianmartin,项目名称:GarminPlugin,代码行数:12,代码来源:garminFilebasedDevice.cpp

示例5: readFitnessDataFromGarmin

string Edge305Device::readGpxData() {
    if (this->fitnessData == NULL) {
        this->fitnessData = readFitnessDataFromGarmin();
    }

    if (this->fitnessData != NULL) {
        transferSuccessful = true;
        TiXmlDocument * output = this->fitnessData->getGpxDocument();
        TiXmlPrinter printer;
        printer.SetIndent( "  " );
        output->Accept( &printer );
        string fitnessXml = printer.Str();
        delete(output);
        return fitnessXml;
    } else {
        transferSuccessful = false;
        return "";
    }
}
开发者ID:codingtony,项目名称:GarminPlugin,代码行数:19,代码来源:edge305Device.cpp

示例6: buildXML

/**
 * Builds the XML response for the HTTP server, providing download statistics.
 */
std::string DownloadManager::buildXML() {
	updateDownloadStatistics();
	
	doc = new ticpp::Document("doc");
	
	ticpp::Declaration dec( "1.0", "", "");
	doc->LinkEndChild(&dec);
	
	ticpp::Element downloads_tag("DOWNLOADS");
	
	doc->LinkEndChild(&downloads_tag);
	
	for(int i = 0; i < getDownloads().size(); i++) {
		
		ticpp::Element download_tag("DOWNLOAD");
		downloads_tag.LinkEndChild(&download_tag);
		
		buildSizeTag(i, &download_tag);
		buildCompletedTag(i, &download_tag);
		buildStatusTag(i, &download_tag);
		buildNameTag(i, &download_tag);
		buildDSpeedTag(i, &download_tag);
		buildUSpeedTag(i, &download_tag);
		buildProgressTag(i, &download_tag);
		buildRatioTag(&download_tag);
		buildUploadAmountTag(&download_tag);
		buildDownloadAmountTag(&download_tag);
		buildSeedersTag(i, &download_tag);
		buildPeersTag(i, &download_tag);
		buildHashTag(i, &download_tag);
		buildTimeTag(i, &download_tag);
	}
	
	TiXmlPrinter printer;
	doc->Accept(&printer);
	std::string xml_stats = printer.Str();
	
	return xml_stats;
}
开发者ID:ebcayabyab-personal,项目名称:swiftarm,代码行数:42,代码来源:DownloadManager.cpp

示例7: main

int main()
{

	//
	// We start with the 'demoStart' todo list. Process it. And
	// should hopefully end up with the todo list as illustrated.
	//
	const char* demoStart =
		"<?xml version=\"1.0\"  standalone='no' >\n"
		"<!-- Our to do list data -->"
		"<ToDo>\n"
		"<!-- Do I need a secure PDA? -->\n"
		"<Item priority=\"1\" distance='close'> Go to the <bold>Toy store!</bold></Item>"
		"<Item priority=\"2\" distance='none'> Do bills   </Item>"
		"<Item priority=\"2\" distance='far &amp; back'> Look for Evil Dinosaurs! </Item>"
		"</ToDo>";
		
	{

	#ifdef TIXML_USE_STL
		//	What the todo list should look like after processing.
		// In stream (no formatting) representation.
		const char* demoEnd =
			"<?xml version=\"1.0\" standalone=\"no\" ?>"
			"<!-- Our to do list data -->"
			"<ToDo>"
			"<!-- Do I need a secure PDA? -->"
			"<Item priority=\"2\" distance=\"close\">Go to the"
			"<bold>Toy store!"
			"</bold>"
			"</Item>"
			"<Item priority=\"1\" distance=\"far\">Talk to:"
			"<Meeting where=\"School\">"
			"<Attendee name=\"Marple\" position=\"teacher\" />"
			"<Attendee name=\"Voel\" position=\"counselor\" />"
			"</Meeting>"
			"<Meeting where=\"Lunch\" />"
			"</Item>"
			"<Item priority=\"2\" distance=\"here\">Do bills"
			"</Item>"
			"</ToDo>";
	#endif

		// The example parses from the character string (above):
		#if defined( WIN32 ) && defined( TUNE )
		_CrtMemCheckpoint( &startMemState );
		#endif	

		{
			// Write to a file and read it back, to check file I/O.

			TiXmlDocument doc( "demotest.xml" );
			doc.Parse( demoStart );

			if ( doc.Error() )
			{
				printf( "Error in %s: %s\n", doc.Value(), doc.ErrorDesc() );
				exit( 1 );
			}
			doc.SaveFile();
		}

		TiXmlDocument doc( "demotest.xml" );
		bool loadOkay = doc.LoadFile();

		if ( !loadOkay )
		{
			printf( "Could not load test file 'demotest.xml'. Error='%s'. Exiting.\n", doc.ErrorDesc() );
			exit( 1 );
		}

		printf( "** Demo doc read from disk: ** \n\n" );
		printf( "** Printing via doc.Print **\n" );
		doc.Print( stdout );

		{
			printf( "** Printing via TiXmlPrinter **\n" );
			TiXmlPrinter printer;
			doc.Accept( &printer );
			fprintf( stdout, "%s", printer.CStr() );
		}
		#ifdef TIXML_USE_STL	
		{
			printf( "** Printing via operator<< **\n" );
			std::cout << doc;
		}
		#endif
		TiXmlNode* node = 0;
		TiXmlElement* todoElement = 0;
		TiXmlElement* itemElement = 0;


		// --------------------------------------------------------
		// An example of changing existing attributes, and removing
		// an element from the document.
		// --------------------------------------------------------

		// Get the "ToDo" element.
		// It is a child of the document, and can be selected by name.
		node = doc.FirstChild( "ToDo" );
//.........这里部分代码省略.........
开发者ID:huntriver,项目名称:TankVSBugs-CSE380-,代码行数:101,代码来源:xmltest.cpp

示例8: Write


//.........这里部分代码省略.........
    {
      nrrdImageIo->SetDimensions(i, dimensions[i]);
      nrrdImageIo->SetSpacing(i, spacing4D[i]);
      nrrdImageIo->SetOrigin(i, origin4D[i]);

      mitk::Vector3D mitkDirection;
      mitkDirection.SetVnlVector(geometry->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix().get_column(i));
      itk::Vector<double, 4u> direction4D;
      direction4D[0] = mitkDirection[0];
      direction4D[1] = mitkDirection[1];
      direction4D[2] = mitkDirection[2];

      // MITK only supports a 3x3 direction matrix. Due to templating in itk, however, we must
      // save a 4x4 matrix for 4D images. in this case, add an homogneous component to the matrix.
      if (i == 3)
      {
        direction4D[3] = 1; // homogenous component
      }
      else
      {
        direction4D[3] = 0;
      }
      vnl_vector<double> axisDirection(dimension);
      for (unsigned int j = 0; j < dimension; j++)
      {
        axisDirection[j] = direction4D[j] / spacing4D[i];
      }
      nrrdImageIo->SetDirection(i, axisDirection);

      ioRegion.SetSize(i, inputVector->GetLargestPossibleRegion().GetSize(i));
      ioRegion.SetIndex(i, inputVector->GetLargestPossibleRegion().GetIndex(i));
    }

    //use compression if available
    nrrdImageIo->UseCompressionOn();

    nrrdImageIo->SetIORegion(ioRegion);
    nrrdImageIo->SetFileName(path);

    // label set specific meta data
    char keybuffer[512];
    char valbuffer[512];

    sprintf(keybuffer, "modality");
    sprintf(valbuffer, "org.mitk.image.multilabel");
    itk::EncapsulateMetaData<std::string>(nrrdImageIo->GetMetaDataDictionary(), std::string(keybuffer), std::string(valbuffer));

    sprintf(keybuffer, "layers");
    sprintf(valbuffer, "%1d", input->GetNumberOfLayers());
    itk::EncapsulateMetaData<std::string>(nrrdImageIo->GetMetaDataDictionary(), std::string(keybuffer), std::string(valbuffer));

    for (unsigned int layerIdx = 0; layerIdx<input->GetNumberOfLayers(); layerIdx++)
    {
      sprintf(keybuffer, "layer_%03d", layerIdx); // layer idx
      sprintf(valbuffer, "%1d", input->GetNumberOfLabels(layerIdx)); // number of labels for the layer
      itk::EncapsulateMetaData<std::string>(nrrdImageIo->GetMetaDataDictionary(), std::string(keybuffer), std::string(valbuffer));

      mitk::LabelSet::LabelContainerConstIteratorType iter = input->GetLabelSet(layerIdx)->IteratorConstBegin();
      unsigned int count(0);
      while (iter != input->GetLabelSet(layerIdx)->IteratorConstEnd())
      {
        std::auto_ptr<TiXmlDocument> document;
        document.reset(new TiXmlDocument());

        TiXmlDeclaration* decl = new TiXmlDeclaration("1.0", "", ""); // TODO what to write here? encoding? etc....
        document->LinkEndChild(decl);
        TiXmlElement * labelElem = GetLabelAsTiXmlElement(iter->second);
        document->LinkEndChild(labelElem);
        TiXmlPrinter printer;
        printer.SetIndent("");
        printer.SetLineBreak("");

        document->Accept(&printer);

        sprintf(keybuffer, "org.mitk.label_%03u_%05u", layerIdx, count);
        itk::EncapsulateMetaData<std::string>(nrrdImageIo->GetMetaDataDictionary(), std::string(keybuffer), printer.Str());
        ++iter;
        ++count;
      }
    }
    // end label set specific meta data

    ImageReadAccessor imageAccess(inputVector);
    nrrdImageIo->Write(imageAccess.GetData());
  }
  catch (const std::exception& e)
  {
    mitkThrow() << e.what();
  }
  // end image write

  try
  {
    setlocale(LC_ALL, currLocale.c_str());
  }
  catch(...)
  {
    mitkThrow() << "Could not reset locale " << currLocale;
  }
}
开发者ID:dkuegler,项目名称:MITK,代码行数:101,代码来源:mitkLabelSetImageIO.cpp

示例9: TiXmlDeclaration


//.........这里部分代码省略.........
          <Documentation>http://www.topografix.com/GPX/1/1/gpx.xsd</Documentation>
        </Specification>
        <Location>
          <FileExtension>GPX</FileExtension>
        </Location>
        <TransferDirection>InputOutput</TransferDirection>
      </File>
    </DataType>
*/

    TiXmlElement * dataTypes = new TiXmlElement( "DataType" );
    massStorage->LinkEndChild(dataTypes);
    TiXmlElement * name = new TiXmlElement( "Name" );
   	name->LinkEndChild(new TiXmlText("GPSData"));
    dataTypes->LinkEndChild(name);

    TiXmlElement * file = new TiXmlElement( "File" );
    dataTypes->LinkEndChild(file);
    TiXmlElement * spec = new TiXmlElement( "Specification" );
    file->LinkEndChild(spec);

    TiXmlElement * identifier = new TiXmlElement( "Identifier" );
    identifier->LinkEndChild(new TiXmlText("http://www.topografix.com/GPX/1/1"));
    spec->LinkEndChild(identifier);

    TiXmlElement * docu = new TiXmlElement( "Documentation" );
   	docu->LinkEndChild(new TiXmlText("http://www.topografix.com/GPX/1/1/gpx.xsd"));
    spec->LinkEndChild(docu);

    TiXmlElement * loc = new TiXmlElement( "Location" );
    file->LinkEndChild(loc);

    TiXmlElement * fileEx = new TiXmlElement( "FileExtension" );
   	fileEx->LinkEndChild(new TiXmlText("GPX"));
    loc->LinkEndChild(fileEx);

    TiXmlElement * transferDir = new TiXmlElement( "TransferDirection" );
    transferDir->LinkEndChild(new TiXmlText("InputOutput"));
    file->LinkEndChild(transferDir);


    /*
    <DataType>
      <Name>FitnessHistory</Name>
      <File>
        <Specification>
          <Identifier>http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2</Identifier>
          <Documentation>http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd</Documentation>
        </Specification>
        <Location>
          <FileExtension>TCX</FileExtension>
        </Location>
        <TransferDirection>OutputFromUnit</TransferDirection>
      </File>
    </DataType>
    */
    dataTypes = new TiXmlElement( "DataType" );
    massStorage->LinkEndChild(dataTypes);
    name = new TiXmlElement( "Name" );
   	name->LinkEndChild(new TiXmlText("FitnessHistory"));
    dataTypes->LinkEndChild(name);

    file = new TiXmlElement( "File" );
    dataTypes->LinkEndChild(file);

    spec = new TiXmlElement( "Specification" );
    file->LinkEndChild(spec);

    identifier = new TiXmlElement( "Identifier" );
    identifier->LinkEndChild(new TiXmlText("http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2"));
    spec->LinkEndChild(identifier);

    docu = new TiXmlElement( "Documentation" );
   	docu->LinkEndChild(new TiXmlText("http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd"));
    spec->LinkEndChild(docu);

    loc = new TiXmlElement( "Location" );
    file->LinkEndChild(loc);

    fileEx = new TiXmlElement( "FileExtension" );
   	fileEx->LinkEndChild(new TiXmlText("TCX"));
    loc->LinkEndChild(fileEx);

    transferDir = new TiXmlElement( "TransferDirection" );
    transferDir->LinkEndChild(new TiXmlText("InputOutput"));
    file->LinkEndChild(transferDir);




    TiXmlPrinter printer;
	printer.SetIndent( "\t" );
	doc.Accept( &printer );
    string str = printer.Str();

    if (Log::enabledDbg()) Log::dbg("GpsDevice::getDeviceDescription() Done: "+this->displayName );
    return str;


}
开发者ID:codingtony,项目名称:GarminPlugin,代码行数:101,代码来源:edge305Device.cpp

示例10: returnValue

Atlas::Message::MapType EntityRecipe::createEntity(Eris::TypeService& typeService)
{
	S_LOG_VERBOSE("Creating entity.");

	ScriptingService& scriptingService = EmberServices::getSingleton().getScriptingService();
	// Loading script code
	scriptingService.executeCode(mScript, "LuaScriptingProvider");

	// Walking through adapter bindings
	for (BindingsStore::iterator I = mBindings.begin(); I != mBindings.end(); ++I) {
		const std::string& func = I->second->getFunc();

		S_LOG_VERBOSE(" binding: " << I->first << " to func " << func);

		if (func.empty()) {
			std::vector<std::string>& adapters = I->second->getAdapters();

			if (adapters.size() == 1) {
				std::string adapterName = adapters[0];
				Atlas::Message::Element val = mGUIAdapters[adapterName]->getValue();
				I->second->setValue(val);
			} else {
				S_LOG_WARNING("Should be only one adapter without calling function.");
			}
		} else {
			Lua::LuaScriptingCallContext callContext;

			lua_State* L = static_cast<Lua::LuaScriptingProvider*> (scriptingService.getProviderFor("LuaScriptingProvider"))->getLuaState();

			// Pushing function params
			std::vector<std::string>& adapters = I->second->getAdapters();
			for (std::vector<std::string>::iterator J = adapters.begin(); J != adapters.end(); J++) {
				std::string adapterName = *J;
				Atlas::Message::Element* val = new Atlas::Message::Element(mGUIAdapters[adapterName]->getValue());
				tolua_pushusertype_and_takeownership(L, val, "Atlas::Message::Element");
			}

			// Calling test function
			scriptingService.callFunction(func, adapters.size(), "LuaScriptingProvider", &callContext);

			LuaRef returnValue(callContext.getReturnValue());

			Atlas::Message::Element returnObj;
			returnObj = returnValue.asObject<Atlas::Message::Element> ("Atlas::Message::Element");
			I->second->setValue(returnObj);
		}
	}
	//Inject all default attributes that aren't yet added.
	// 	TiXmlElement *elem = mEntitySpec->FirstChildElement("atlas");
	// 	if (elem)
	// 	{
	// 		Eris::TypeInfo* erisType = mConn->getTypeService()->getTypeByName(getEntityType());
	// 		if (erisType) {
	// 			const Atlas::Message::MapType& defaultAttributes = erisType->getAttributes();
	// 			for (Atlas::Message::MapType::const_iterator I = defaultAttributes.begin(); I != defaultAttributes.end(); ++I) {
	// 				bool hasAttribute = false;
	// 				TiXmlNode* child(0);
	// 				while(child = elem->IterateChildren(child)) {
	// 					if (child->ToElement()) {
	// 						if (std::string(child->ToElement()->Attribute("name")) == I->first) {
	// 							hasAttribute = true;
	// 							break;
	// 						}
	// 					}
	// 				}
	//
	// 				if (!hasAttribute) {
	// 					//The attribute isn't present, we'll inject it
	// 					//This a bit contrived, since we'll now first convert the atlas into xml and inject it into the TiXmlElement (which will convert the xml strings into TiXml structures). And then later on we'll parse the xml again and create the final atlas data from it. However, the main reason for doing it this way is that in the future we would want to have nested child elements, which could be repeated. And in those cases we'll want to work directly with xml.
	// 				}
	// 			}
	// 		}
	// 	}
	/*
	 std::stringstream str;

	 Atlas::Message::Element element(message);

	 Atlas::Message::QueuedDecoder decoder;

	 Atlas::Codecs::XML codec(str, decoder);
	 Atlas::Formatter formatter(str, codec);
	 Atlas::Message::Encoder encoder(formatter);
	 formatter.streamBegin();
	 encoder.streamMessageElement(message);
	 formatter.streamEnd();
	 */
	if (mEntitySpec) {
		// Print entity into string
		TiXmlPrinter printer;
		printer.SetStreamPrinting();
		mEntitySpec->Accept(&printer);

		S_LOG_VERBOSE("Composed entity: " << printer.Str());

		std::stringstream strStream(printer.CStr(), std::ios::in);

		// Create objects
		Atlas::Message::QueuedDecoder decoder;
		Atlas::Codecs::XML codec(strStream, decoder);
//.........这里部分代码省略.........
开发者ID:angkorcn,项目名称:ember,代码行数:101,代码来源:EntityRecipe.cpp

示例11: getXml

string MessageBox::getXml() {
/*
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<MessageBox xmlns="http://www.garmin.com/xmlschemas/PluginAPI/v1" DefaultButtonValue="2">
  <Icon>Question</Icon>
  <Text>The file F:/Garmin/gpx/GC22K31.gpx already exists on your GPS Device. OK to overwrite the file?</Text>
  <Button Caption="OK" Value="1"/>
  <Button Caption="Cancel" Value="2"/>
</MessageBox>
*/

    TiXmlDocument doc;
    TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", "no" );
    doc.LinkEndChild( decl );

	TiXmlElement * msgBox = new TiXmlElement( "MessageBox" );
    msgBox->SetAttribute("xmlns", "http://www.garmin.com/xmlschemas/PluginAPI/v1");
    msgBox->SetAttribute("DefaultButtonValue", this->defaultButton);
    doc.LinkEndChild( msgBox );

	TiXmlElement * icon = new TiXmlElement( "Icon" );
	if (this->type == Question) {
        icon->LinkEndChild(new TiXmlText("Question"));
	} else {
	    Log::err("MessageBox::getXml Message type not yet implemented!");
        icon->LinkEndChild(new TiXmlText("Unknown"));
	}
    msgBox->LinkEndChild( icon );

	TiXmlElement * textelem = new TiXmlElement( "Text" );
    textelem->LinkEndChild(new TiXmlText(this->text));
    msgBox->LinkEndChild( textelem );

    if ((this->buttons & BUTTON_OK) > 0) {
        TiXmlElement * btn = new TiXmlElement( "Button" );
        btn->SetAttribute("Caption", "OK");
        btn->SetAttribute("Value", BUTTON_OK);
        msgBox->LinkEndChild( btn );
    }

    if ((this->buttons & BUTTON_CANCEL) > 0) {
        TiXmlElement * btn = new TiXmlElement( "Button" );
        btn->SetAttribute("Caption", "Cancel");
        btn->SetAttribute("Value", BUTTON_CANCEL);
        msgBox->LinkEndChild( btn );
    }

    if ((this->buttons & BUTTON_YES) > 0) {
        TiXmlElement * btn = new TiXmlElement( "Button" );
        btn->SetAttribute("Caption", "Yes");
        btn->SetAttribute("Value", BUTTON_YES);
        msgBox->LinkEndChild( btn );
    }

    if ((this->buttons & BUTTON_NO) > 0) {
        TiXmlElement * btn = new TiXmlElement( "Button" );
        btn->SetAttribute("Caption", "No");
        btn->SetAttribute("Value", BUTTON_NO);
        msgBox->LinkEndChild( btn );
    }

    TiXmlPrinter printer;
	//printer.SetIndent( "\t" );
	doc.Accept( &printer );
    string str = printer.Str();

    return str;
}
开发者ID:DanielArndt,项目名称:GarminPlugin,代码行数:68,代码来源:messageBox.cpp

示例12: GenerateCode

bool XrcCodeGenerator::GenerateCode( PObjectBase project )
{
    m_cw->Clear();
    m_contextMenus.clear();

    ticpp::Document doc;
    ticpp::Declaration decl( "1.0", "UTF-8", "yes" );
    doc.LinkEndChild( &decl );

    ticpp::Element element( "resource" );
    element.SetAttribute( "xmlns", "http://www.wxwindows.org/wxxrc" );
    element.SetAttribute( "version", "2.3.0.1" );

    // If project is not actually a "Project", generate it
    if ( project->GetClassName() == wxT("Project") )
    {
        for( unsigned int i = 0; i < project->GetChildCount(); i++ )
        {
            ticpp::Element* child = GetElement( project->GetChild( i ) );
            if ( child )
            {
                element.LinkEndChild( child );
                delete child;
            }
        }
    }
    else
    {
        ticpp::Element* child = GetElement( project );
        if ( child )
        {
            element.LinkEndChild( child );
            delete child;
        }
    }

    // generate context menus as top-level menus
    for( std::vector<ticpp::Element*>::iterator it = m_contextMenus.begin(); it != m_contextMenus.end(); ++it )
    {
        element.LinkEndChild( *it );
        delete *it;
    }

    doc.LinkEndChild( &element );

    TiXmlPrinter printer;
    printer.SetIndent( "\t" );

#if defined( __WXMSW__ )
    printer.SetLineBreak( "\r\n" );
#elif defined( __WXMAC__ )
    printer.SetLineBreak( "\r" );
#else
    printer.SetLineBreak( "\n" );
#endif

    doc.Accept( &printer );
    const std::string& xrcFile = printer.Str();

    m_cw->Write( _WXSTR( xrcFile ) );

    return true;

}
开发者ID:noriter,项目名称:wxfb,代码行数:64,代码来源:xrccg.cpp


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