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


C++ TiXmlDocument::InsertEndChild方法代码示例

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


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

示例1: SaveXml

bool cSubMenu::SaveXml(char *fname )
{

    if (_fname)
    {
        TiXmlDocument xml = TiXmlDocument(fname );
        TiXmlComment  comment;
        comment.SetValue(
            " Mini-VDR cSetupConfiguration File\n"
            " (c) Ralf Dotzert\n"
            "\n\n"
            " for Example see vdr-menu.xml.example\n\n"
        );

        TiXmlElement root("menus");
        root.SetAttribute("suffix",   _menuSuffix);
        for (cSubMenuNode *node = _menuTree.First(); node; node = _menuTree.Next(node))
            node->SaveXml(&root);

        if (xml.InsertEndChild(comment) != NULL &&
                xml.InsertEndChild(root) != NULL)
        {
            return xml.SaveFile(fname);
        }
    }
    else
    {
        return false;
    }

    return true;
}
开发者ID:signal2noise,项目名称:vdr-mirror,代码行数:32,代码来源:submenu.c

示例2: CreateExample

bool Wiinnertag::CreateExample(const string &filepath)
{
	if(filepath.size() == 0)
		return false;

	CreateSubfolder(filepath.c_str());

	string fullpath = filepath;
	if(fullpath[fullpath.size()-1] != '/')
		fullpath += '/';
	fullpath += "Wiinnertag.xml";

	TiXmlDocument xmlDoc;

	TiXmlDeclaration declaration("1.0", "UTF-8", "");
	xmlDoc.InsertEndChild(declaration);

	TiXmlElement Tag("Tag");
	Tag.SetAttribute("URL", "http://www.wiinnertag.com/wiinnertag_scripts/update_sign.php?key={KEY}&game_id={ID6}");
	Tag.SetAttribute("Key", "1234567890");
	xmlDoc.InsertEndChild(Tag);

	xmlDoc.SaveFile(fullpath);

	return true;
}
开发者ID:Jeremy-D-Miller,项目名称:usbloader-gui,代码行数:26,代码来源:Wiinnertag.cpp

示例3: OnEditCopy

void CUIDesignerView::OnEditCopy()
{
	ASSERT(m_cfUI != NULL);

	TiXmlDocument xmlDoc;
	TiXmlDeclaration Declaration("1.0","utf-8","yes");
	xmlDoc.InsertEndChild(Declaration);
	TiXmlElement* pCopyElm = new TiXmlElement("UICopy");
	CopyUI(pCopyElm);
	xmlDoc.InsertEndChild(*pCopyElm);
	TiXmlPrinter printer;
	xmlDoc.Accept(&printer);
	delete pCopyElm;
	CSharedFile file(GMEM_MOVEABLE, printer.Size() + 1);
	file.Write(printer.CStr(), printer.Size());
	file.Write("\0", 1);
	COleDataSource* pDataSource = NULL;
	TRY
	{
		pDataSource = new COleDataSource;
		pDataSource->CacheGlobalData(m_cfUI, file.Detach());
		pDataSource->SetClipboard();
	}
	CATCH_ALL(e)
	{
		delete pDataSource;
		THROW_LAST();
	}
	END_CATCH_ALL
}
开发者ID:pyq881120,项目名称:urltraveler,代码行数:30,代码来源:UIDesignerView.cpp

示例4: SaveInMixedMode

bool wxsItemResData::SaveInMixedMode()
{
    // Should be currently up to date, but just for sure udpating it once again
    if ( !RebuildXrcFile() ) return false;

    // Storing extra data into Wxs file

    TiXmlDocument Doc;

    Doc.InsertEndChild(TiXmlDeclaration("1.0","utf-8",""));
    TiXmlElement* wxSmithNode = Doc.InsertEndChild(TiXmlElement("wxsmith"))->ToElement();

    // Now storing all extra data
    TiXmlElement* Extra = wxSmithNode->InsertEndChild(TiXmlElement("resource_extra"))->ToElement();
    SaveExtraDataReq(m_RootItem,Extra);
    for ( int i=0; i<GetToolsCount(); i++ )
    {
        SaveExtraDataReq(m_Tools[i],Extra);
    }

    if ( TinyXML::SaveDocument(m_WxsFileName,&Doc) )
    {
        m_Undo.Saved();
        return true;
    }
    return false;
}
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:27,代码来源:wxsitemresdata.cpp

示例5: UIAdd

void CALLBACK CUICommandHistory::UIAdd(TiXmlNode* pNode)
{
	TiXmlElement* pElement = pNode->ToElement();
	CStringA strParentName = pElement->Attribute("parentname");
	pElement->RemoveAttribute("parentname");
	if(strParentName.IsEmpty())
		return;

	CUIDesignerView* pUIView = g_pMainFrame->GetActiveUIView();
	CPaintManagerUI* pManager = pUIView->GetPaintManager();
	CControlUI* pParentControl = pManager->FindControl(StringConvertor::Utf8ToWide(strParentName));
	if(pParentControl == NULL)
		return;

	TiXmlDocument xmlDoc;
	TiXmlDeclaration Declaration("1.0","utf-8","yes");
	xmlDoc.InsertEndChild(Declaration);
	TiXmlElement* pRootElem = new TiXmlElement("UIAdd");
	pRootElem->InsertEndChild(*pElement);
	xmlDoc.InsertEndChild(*pRootElem);
	TiXmlPrinter printer;
	xmlDoc.Accept(&printer);
	delete pRootElem;

	CDialogBuilder builder;
	CControlUI* pRoot=builder.Create(StringConvertor::Utf8ToWide(printer.CStr()), (UINT)0, NULL, pManager);
 	if(pRoot)
		pUIView->RedoUI(pRoot, pParentControl);
}
开发者ID:DayDayUpCQ,项目名称:misc,代码行数:29,代码来源:UICommandHistory.cpp

示例6: Load

bool CPluginSettings::Load(const CURL& url)
{
  m_url = url;  

  // create the users filepath
  m_userFileName.Format("P:\\plugin_data\\%s\\%s", url.GetHostName().c_str(), url.GetFileName().c_str());
  CUtil::RemoveSlashAtEnd(m_userFileName);
  CUtil::AddFileToFolder(m_userFileName, "settings.xml", m_userFileName);
  
  // Create our final path
  CStdString pluginFileName = "Q:\\plugins\\";

  CUtil::AddFileToFolder(pluginFileName, url.GetHostName(), pluginFileName);
  CUtil::AddFileToFolder(pluginFileName, url.GetFileName(), pluginFileName);

  // Replace the / at end, GetFileName() leaves a / at the end
  pluginFileName.Replace("/", "\\");

  CUtil::AddFileToFolder(pluginFileName, "resources", pluginFileName);
  CUtil::AddFileToFolder(pluginFileName, "settings.xml", pluginFileName);

  pluginFileName = _P(pluginFileName);
  m_userFileName = _P(m_userFileName);

  if (!m_pluginXmlDoc.LoadFile(pluginFileName.c_str()))
  {
    CLog::Log(LOGERROR, "Unable to load: %s, Line %d\n%s", pluginFileName.c_str(), m_pluginXmlDoc.ErrorRow(), m_pluginXmlDoc.ErrorDesc());
    return false;
  }
  
  // Make sure that the plugin XML has the settings element
  TiXmlElement *setting = m_pluginXmlDoc.RootElement();
  if (!setting || strcmpi(setting->Value(), "settings") != 0)
  {
    CLog::Log(LOGERROR, "Error loading Settings %s: cannot find root element 'settings'", pluginFileName.c_str());
    return false;
  }  
  
  // Load the user saved settings. If it does not exist, create it
  if (!m_userXmlDoc.LoadFile(m_userFileName.c_str()))
  {
    TiXmlDocument doc;
    TiXmlDeclaration decl("1.0", "UTF-8", "yes");
    doc.InsertEndChild(decl);
    
    TiXmlElement xmlRootElement("settings");
    doc.InsertEndChild(xmlRootElement);
    
    m_userXmlDoc = doc;
    
    // Don't worry about the actual settings, they will be set when the user clicks "Ok"
    // in the settings dialog
  }

  return true;
}
开发者ID:aaronjb,项目名称:plex,代码行数:56,代码来源:PluginSettings.cpp

示例7: RebuildXrcFile

bool wxsItemResData::RebuildXrcFile()
{
    // First - opening file
    TiXmlDocument Doc;
    TiXmlElement* Resources = nullptr;
    TiXmlElement* Object = nullptr;

    if ( TinyXML::LoadDocument(m_XrcFileName,&Doc) )
    {
        Resources = Doc.FirstChildElement("resource");
    }

    if ( !Resources )
    {
        Doc.Clear();
        Doc.InsertEndChild(TiXmlDeclaration("1.0","utf-8",""));
        Resources = Doc.InsertEndChild(TiXmlElement("resource"))->ToElement();
        Resources->SetAttribute("xmlns","http://www.wxwidgets.org/wxxrc");
    }

    // Searching for object representing this resource
    for ( Object = Resources->FirstChildElement("object"); Object; Object = Object->NextSiblingElement("object") )
    {
        if ( cbC2U(Object->Attribute("name")) == m_ClassName )
        {
            Object->Clear();
            while ( Object->FirstAttribute() )
            {
                Object->RemoveAttribute(Object->FirstAttribute()->Name());
            }
            break;
        }
    }

    if ( !Object )
    {
        Object = Resources->InsertEndChild(TiXmlElement("object"))->ToElement();
    }

    // The only things left are: to dump item into object ...
    m_RootItem->XmlWrite(Object,true,false);
    Object->SetAttribute("name",cbU2C(m_ClassName));
    for ( int i=0; i<GetToolsCount(); i++ )
    {
        TiXmlElement* ToolElement = Object->InsertEndChild(TiXmlElement("object"))->ToElement();
        m_Tools[i]->XmlWrite(ToolElement,true,false);
    }

    // ... and save back the file
    return TinyXML::SaveDocument(m_XrcFileName,&Doc);
}
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:51,代码来源:wxsitemresdata.cpp

示例8: SaveXml

bool TracksXml::SaveXml(Ogre::String file)
{
	TiXmlDocument xml;	TiXmlElement root("tracks");

	for (int i=0; i < trks.size(); ++i)
	{
		const TrackInfo& t = trks[i];
		TiXmlElement trk("track");

		trk.SetAttribute("n",			toStrC( t.n ));
		trk.SetAttribute("name",		t.name.c_str());
		trk.SetAttribute("created",		dt2s(t.created).c_str());
		trk.SetAttribute("crtver",		toStrC( t.crtver ));
		trk.SetAttribute("modified",	dt2s(t.modified).c_str());
		trk.SetAttribute("scenery",		t.scenery.c_str());
		trk.SetAttribute("author",		t.author.c_str());
		
		trk.SetAttribute("fluids",		toStrC( t.fluids ));
		trk.SetAttribute("bumps",		toStrC( t.bumps ));		trk.SetAttribute("jumps",		toStrC( t.jumps ));
		trk.SetAttribute("loops",		toStrC( t.loops ));		trk.SetAttribute("pipes",		toStrC( t.pipes ));
		trk.SetAttribute("banked",		toStrC( t.banked ));	trk.SetAttribute("frenzy",		toStrC( t.frenzy ));
		trk.SetAttribute("long",		toStrC( t.longn ));

		trk.SetAttribute("diff",		toStrC( t.diff ));
		trk.SetAttribute("rating",		toStrC( t.rating ));
		trk.SetAttribute("rateuser",	toStrC( t.rateuser ));
		trk.SetAttribute("drivenlaps",	toStrC( t.drivenlaps ));
		root.InsertEndChild(trk);
	}

	xml.InsertEndChild(root);
	return xml.SaveFile(file.c_str());
}
开发者ID:jsj2008,项目名称:stuntrally,代码行数:33,代码来源:TracksXml.cpp

示例9: WriteToXml

void WriteToXml(string& strXml, vector<bool>& vecType,string& FileName)
{
	COriFileOperate oriFile(FileName);
	size_t nVecSize = vecType.size();
	if (strXml.find("chinese_simple") != -1)
	{
		for (size_t i=1;i<nVecSize;++i)
		{
			vecType[i] = false;
		}
	}
	char* szNumOrStrInfo = new char[nVecSize+1];
	for (size_t i = 0; i < nVecSize; i++)
	{
		if (vecType[i])
		{
			szNumOrStrInfo[i] = 'n';
		}
		else
		{
			szNumOrStrInfo[i] = 's';
		}
	}
	szNumOrStrInfo[nVecSize] = '\0';
	TiXmlDocument* pXmlDoc = new TiXmlDocument;
	pXmlDoc->InsertEndChild(TiXmlElement("config"));
	TiXmlNode* pXmlNode = pXmlDoc->FirstChild("config");
	pXmlNode->InsertEndChild(TiXmlElement("TableType"));
	TiXmlElement* pXmlElem = pXmlNode->FirstChildElement("TableType");
	pXmlElem->InsertEndChild(TiXmlText("S"));
	string str = szNumOrStrInfo;
	string str1 = oriFile.GetDataByRowCol(0,0);
	transform(str1.begin(),str1.end(),str1.begin(),toupper);
	for(uint32 i=1;i<=str.size();i++)
	{
		TiXmlElement* cxn = new TiXmlElement("Col");
		pXmlNode->LinkEndChild(cxn);
	//	cxn->SetAttribute("ColNum",i);
		if(str1!="NOTE:")
		{
			cxn->SetAttribute("Name",oriFile.GetDataByRowCol(0,i-1).c_str());
		}
		else
		{
			cxn->SetAttribute("Name",oriFile.GetDataByRowCol(1,i-1).c_str());
		}
		string ss;
		stringstream temp;
		temp<<szNumOrStrInfo[i-1];
		temp>>ss;
		cxn->SetAttribute("Type",ss);
	}

	pXmlDoc->SaveFile(strXml);

	delete pXmlDoc;
	pXmlDoc = NULL;
	delete[] szNumOrStrInfo;
	szNumOrStrInfo = NULL;
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:60,代码来源:MakeTxtXmlAuto.cpp

示例10: SaveDownloadHistory

bool CWebBrowserDownloadHandler::SaveDownloadHistory()
{
  TiXmlDocument xmlDoc;
  TiXmlElement xmlRootElement("downloadhistory");
  TiXmlNode *pRoot = xmlDoc.InsertEndChild(xmlRootElement);
  if (pRoot == nullptr)
    return false;

  TiXmlElement xmlDownloadHistory("histories");
  TiXmlNode* pHistoriesNode = pRoot->InsertEndChild(xmlDownloadHistory);
  if (pHistoriesNode)
  {
    for (const auto& entry : m_finishedDownloads)
    {
      TiXmlElement xmlSetting("history");
      TiXmlNode* pHistoryNode = pHistoriesNode->InsertEndChild(xmlSetting);
      if (pHistoryNode)
      {
        XMLUtils::SetString(pHistoryNode, "name", entry.second->GetName().c_str());
        XMLUtils::SetString(pHistoryNode, "path", entry.second->GetPath().c_str());
        XMLUtils::SetString(pHistoryNode, "url", entry.second->GetURL().c_str());
        XMLUtils::SetLong(pHistoryNode, "time", static_cast<long>(entry.second->GetDownloadTime()));
      }
    }
  }

  std::string strSettingsFile = kodi::GetBaseUserPath("download_history.xml");
  if (!xmlDoc.SaveFile(strSettingsFile))
  {
    kodi::Log(ADDON_LOG_ERROR, "failed to write download history data");
    return false;
  }

  return true;
}
开发者ID:AlwinEsch,项目名称:web.browser.chromium,代码行数:35,代码来源:DialogDownload.cpp

示例11: write

// ----------------------------------------------------------------------------
//
void TrackInfoCacheFile::write( AudioTrackInfoCache& cache )
{
    TiXmlDocument doc;

    TiXmlElement root( "audio_track_info" );

    for (  AudioTrackInfoCache::value_type pair : cache ) {
        TiXmlElement entry( "entry" );
        add_text_element( entry, "link", pair.first );
        add_text_element( entry, "id", pair.second.id );
        add_text_element( entry, "song_type", pair.second.song_type );

        TiXmlElement attributes( "attrs" );
        add_attribute( attributes, "key", pair.second.key );
        add_attribute( attributes, "mode", pair.second.mode );
        add_attribute( attributes, "time_signature", pair.second.time_signature );
        add_attribute( attributes, "energy", pair.second.energy );
        add_attribute( attributes, "liveness", pair.second.liveness );
        add_attribute( attributes, "tempo", pair.second.tempo );
        add_attribute( attributes, "speechiness", pair.second.speechiness );
        add_attribute( attributes, "acousticness", pair.second.acousticness );
        add_attribute( attributes, "instrumentalness", pair.second.instrumentalness );
        add_attribute( attributes, "duration", pair.second.duration );
        add_attribute( attributes, "loudness", pair.second.loudness );
        add_attribute( attributes, "valence", pair.second.valence );
        add_attribute( attributes, "danceability", pair.second.danceability );

        entry.InsertEndChild( attributes );
        root.InsertEndChild( entry );
    }

    doc.InsertEndChild( root ); 
    doc.SaveFile( m_filename );
}
开发者ID:glocklueng,项目名称:DMXStudio,代码行数:36,代码来源:TrackInfoCacheFile.cpp

示例12: SaveFile

//------------------------------------------------------------------------------
void CToolsHistory::SaveFile(  )
{
	TiXmlDocument aDoc;
	TiXmlNode* pRootNode = aDoc.InsertEndChild( TiXmlElement( "cache" ));

	TiXmlNode* pSceneNode = pRootNode->InsertEndChild( TiXmlElement("Scenes"));
	TiXmlNode* pPathsNode = pRootNode->InsertEndChild( TiXmlElement("paths"));

	//Scene
	for( unsigned i=0; i<m_sceneHistory.size(); ++i )
	{
		TiXmlElement aHistoryNode("history");
		aHistoryNode.SetAttribute("Scene", m_sceneHistory[i].first.c_str());
		aHistoryNode.SetAttribute("path", m_sceneHistory[i].second.c_str());
		pSceneNode->InsertEndChild(aHistoryNode);
	}

	//path
	for( unsigned i=0; i<m_pathHistory.size(); ++i )
	{
		TiXmlElement aHistoryNode("history");
		aHistoryNode.SetAttribute("path", m_pathHistory[i].c_str());
		pPathsNode->InsertEndChild(aHistoryNode);
	}

	//default editor
	TiXmlElement aEditorNode("default_editor");
	aEditorNode.SetAttribute("path", m_strDefaultEditor.c_str());
	pRootNode->InsertEndChild(aEditorNode);

	aDoc.SaveFile(m_strCacheFile.c_str());
}
开发者ID:Abyss116,项目名称:libguiex,代码行数:33,代码来源:toolshistory.cpp

示例13: Save

bool CButtonMapXml::Save(void) const
{
  TiXmlDocument xmlFile;

  TiXmlDeclaration* decl = new TiXmlDeclaration("1.0", "", "");
  xmlFile.LinkEndChild(decl);

  TiXmlElement rootElement(BUTTONMAP_XML_ROOT);
  TiXmlNode* root = xmlFile.InsertEndChild(rootElement);
  if (root == NULL)
    return false;

  TiXmlElement* pElem = root->ToElement();
  if (!pElem)
    return false;

  TiXmlElement deviceElement(DEVICES_XML_ELEM_DEVICE);
  TiXmlNode* deviceNode = pElem->InsertEndChild(deviceElement);
  if (deviceNode == NULL)
    return false;

  TiXmlElement* deviceElem = deviceNode->ToElement();
  if (deviceElem == NULL)
    return false;

  CDeviceXml::Serialize(m_device, deviceElem);

  if (!SerializeButtonMaps(deviceElem))
    return false;

  return xmlFile.SaveFile(m_strResourcePath);
}
开发者ID:Montellese,项目名称:peripheral.joystick,代码行数:32,代码来源:ButtonMapXml.cpp

示例14: SaveXml

//  Save progress
bool ProgressXml::SaveXml(std::string file)
{
	TiXmlDocument xml;	TiXmlElement root("progress");

	for (int i=0; i < chs.size(); ++i)
	{
		const ProgressChamp& pc = chs[i];
		TiXmlElement eCh("champ");
			eCh.SetAttribute("name",	pc.name.c_str() );
			eCh.SetAttribute("ver",		toStrC( pc.ver ));
			eCh.SetAttribute("cur",	toStrC( pc.curTrack ));
			eCh.SetAttribute("p",	toStrC( pc.points ));

			for (int i=0; i < pc.trks.size(); ++i)
			{
				const ProgressTrack& pt = pc.trks[i];
				TiXmlElement eTr("t");
				eTr.SetAttribute("p",	fToStr( pt.points, 1).c_str());
				eCh.InsertEndChild(eTr);
			}
		root.InsertEndChild(eCh);
	}
	xml.InsertEndChild(root);
	return xml.SaveFile(file.c_str());
}
开发者ID:HaohaoLau,项目名称:stuntrally,代码行数:26,代码来源:ChampsXml.cpp

示例15: writeFixtureDefinition

// ----------------------------------------------------------------------------
//
void DefinitionWriter::writeFixtureDefinition( 
            LPCSTR file_name, 
            LPCSTR author, 
            LPCSTR version, 
            FixtureDefinitionPtrArray& definitions )
{
    TiXmlElement fixtures( "fixture_definitions" );
    add_text_element( fixtures, "author", author );
    add_text_element( fixtures, "version", version );

    visit_ptr_array<FixtureDefinitionPtrArray>( fixtures, definitions );

    TiXmlDocument doc;
    TiXmlDeclaration xml_decl( "1.0", "", "" );

    doc.InsertEndChild( xml_decl );
    doc.InsertEndChild( fixtures );
    //doc.Print();

    CString output_file = file_name;

    if ( doc.SaveFile( output_file ) )
        studio.log_status( "Wrote fixture definitions to '%s'\n", output_file );
    else
        studio.log_status( "Error writing to '%s'\n", output_file );
}
开发者ID:desantir,项目名称:DMXStudio,代码行数:28,代码来源:DefinitionWriter.cpp


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