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


C++ XNode::GetChild方法代码示例

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


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

示例1: GetXMLData

bool ScreenArcadePatch::GetXMLData( RageFileDriverZip *fZip, CString &sGame, CString &sMessage, int &iRevision )
{
	int iError;
	RageFileBasic *fXML = fZip->Open( "patch.xml", RageFile::READ, iError );

	if( fXML == NULL )
	{
		STATE_TEXT( "Patch information check failed: could not open patch.xml." );
		return false;
	}

	/* check the actual XML data now */
	XNode *pNode = new XNode;
	pNode->m_sName = "Patch";
	pNode->LoadFromFile( *fXML );

	if( !pNode->GetChild("Game") || !pNode->GetChild("Revision") || !pNode->GetChild("Message") )
	{
		STATE_TEXT( "Patch information check failed: patch.xml is corrupt." );
		SAFE_DELETE( pNode );
		SAFE_DELETE( fXML );
		return false;
	}

	/* save the patch data */
	pNode->GetChild("Revision")->GetValue(iRevision);
	sGame = pNode->GetChildValue("Game");
	sMessage = pNode->GetChildValue("Message");

	SAFE_DELETE( pNode );
	SAFE_DELETE( fXML );

	return true;
}
开发者ID:Braunson,项目名称:openitg,代码行数:34,代码来源:ScreenArcadePatch.cpp

示例2: Load

void TitleSubst::Load(const std::string &filename, const std::string &section)
{
	XNode xml;
	if( !XmlFileUtil::LoadFromFileShowErrors(xml,filename) )
	{
		// LoadFromFile will show its own error
		//LOG->Trace("Error opening %s: %s", filename.c_str(), f.GetError().c_str() );
		return;
	}

	XNode *pGroup = xml.GetChild( section );
	if( pGroup == nullptr )
	{
		return;
	}
	for (auto const *child: *pGroup)
	{
		if( child == nullptr || child->GetName() != "Translation" )
		{
			continue;
		}
		TitleTrans tr;
		tr.LoadFromNode( child );
		AddTrans(tr);
	}
}
开发者ID:dguzek,项目名称:stepmania,代码行数:26,代码来源:TitleSubstitution.cpp

示例3: GetRevision

int DiagnosticsUtil::GetRevision()
{
	// default value if a patch value can't be found/loaded
	int iRevision = 1;

	// Create the XML Handler, and clear it, for practice.
	XNode *xml = new XNode;
	xml->Clear();
	xml->m_sName = "patch";

	// if the file is readable and has the proper node, save its value
	if( !IsAFile(PATCH_XML_PATH) )
		LOG->Warn( "GetRevision(): There is no patch file (patch.xml)" );
	else if( !xml->LoadFromFile(PATCH_XML_PATH) )
		LOG->Warn( "GetRevision(): Could not load from patch.xml" );
	else if( !xml->GetChild("Revision") )
		LOG->Warn( "GetRevision(): Revision node missing! (patch.xml)" );
	else
		iRevision = atoi( xml->GetChild("Revision")->m_sValue );

	SAFE_DELETE( xml );

	return iRevision;
}
开发者ID:TaroNuke,项目名称:openitg,代码行数:24,代码来源:DiagnosticsUtil.cpp

示例4: GetNumMachineScores

int DiagnosticsUtil::GetNumMachineScores()
{
	// Create the XML Handler and clear it, for practice
	XNode *xml = new XNode;
	xml->Clear();
	
	// Check for the file existing
	if( !IsAFile(STATS_XML_PATH) )
	{
		LOG->Warn( "There is no Stats.xml file!" );
		SAFE_DELETE( xml ); 
		return 0;
	}
	
	// Make sure you can read it
	if( !xml->LoadFromFile(STATS_XML_PATH) )
	{
		LOG->Trace( "Stats.xml unloadable!" );
		SAFE_DELETE( xml ); 
		return 0;
	}
	
	const XNode *pData = xml->GetChild( "SongScores" );
	
	if( pData == NULL )
	{
		LOG->Warn( "Error loading scores: <SongScores> node missing" );
		SAFE_DELETE( xml ); 
		return 0;
	}
	
	unsigned int iScoreCount = 0;
	
	// Named here, for LoadFromFile() renames it to "Stats"
	xml->m_sName = "SongScores";
	
	// For each pData Child, or the Child in SongScores...
	FOREACH_CONST_Child( pData , p )
		iScoreCount++;

	SAFE_DELETE( xml ); 

	return iScoreCount;
}
开发者ID:TaroNuke,项目名称:openitg,代码行数:44,代码来源:DiagnosticsUtil.cpp

示例5:

   bool
   PropertySet::XMLLoad(XNode *pBackupNode)
   {
      XNode *pPropertiesNode = pBackupNode->GetChild(_T("Properties"));
      if (!pPropertiesNode)
         return true;

      for (int i = 0; i < pPropertiesNode->GetChildCount(); i++)
      {
         XNode *pPropertyNode = pPropertiesNode->GetChild(i);
         String sName = pPropertyNode->name;
         String sStringValue = pPropertyNode->GetAttrValue(_T("StringValue"));
         int iLongValue = _ttoi(pPropertyNode->GetAttrValue(_T("LongValue")));

         std::shared_ptr<Property> pProperty = GetProperty_(sName);
         if (pProperty)
         {
            pProperty->SetStringValue(sStringValue);
            pProperty->SetLongValue(iLongValue);
         }
      }

      return true;
   }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:24,代码来源:PropertySet.cpp


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