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


C++ CXmlNode::SelectNodes方法代码示例

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


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

示例1: Load

void GConfig::Load(const tstring& sFile)
{
	CXmlNode root;
	root.Load(sFile);

	m_nWidth = root.GetAttr(_T("width"), CXmlNode::IntType());
	if (m_nWidth <= 0) m_nWidth = 720;
	if (m_nHeight <= 0) m_nHeight = 540;
	m_nHeight = root.GetAttr(_T("height"), CXmlNode::IntType());
	m_nPlayers = root.GetAttr(_T("players"), CXmlNode::IntType());
	m_pos_HandCard.resize(m_nPlayers);
	m_pos_PlayingCard.resize(m_nPlayers);
	m_pos_OutCard.resize(m_nPlayers);
	m_pos_Head.resize(m_nPlayers);
	m_nCardsSet = root.GetAttr(_T("cardsset"), CXmlNode::IntType());
	m_nBottomCards = root.GetAttr(_T("bottomcards"), CXmlNode::IntType());

	CXmlNodes nds;
	root.SelectNodes(nds, "property");

	for(int i=0; i<nds.GetSize(); ++i)
	{
		if (_T("movecardframes") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType())) 
			m_nMoveCardFrames = nds[i]->GetAttr(_T("value"), CXmlNode::IntType());

		else if (_T("pos_head") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType()))
		{
			CXmlNodes nds2;
			nds[i]->SelectNodes(nds2, _T("player"));
			for(int j=0; j<nds2.GetSize(); j++)
			{
				m_pos_Head[j] = nds2[j]->GetAttr(_T("value"), CXmlNode::PointType());
			}
		}
	
		else if (_T("pos_handcard") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType()))
		{
			CXmlNodes nds2;
			nds[i]->SelectNodes(nds2, _T("player"));
			for(int j=0; j<nds2.GetSize(); j++)
			{
				m_pos_HandCard[j].m_pos = nds2[j]->GetAttr(_T("value"), CXmlNode::PointType());
				m_pos_HandCard[j].m_offset = nds2[j]->GetAttr(_T("offset"), CXmlNode::PointType());
			}
		}

		else if (_T("pos_outcard") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType()))
		{
			CXmlNodes nds2;
			nds[i]->SelectNodes(nds2, _T("player"));
			for(int j=0; j<nds2.GetSize(); j++)
			{
				m_pos_OutCard[j].m_pos = nds2[j]->GetAttr(_T("value"), CXmlNode::PointType());
				m_pos_OutCard[j].m_offset = nds2[j]->GetAttr(_T("offset"), CXmlNode::PointType());
			}
		}

		else if (_T("pos_playingcard") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType()))
		{
			CXmlNodes nds2;
			nds[i]->SelectNodes(nds2, _T("player"));
			for(int j=0; j<nds2.GetSize(); j++)
			{
				m_pos_PlayingCard[j].m_pos = nds2[j]->GetAttr(_T("value"), CXmlNode::PointType());
				m_pos_PlayingCard[j].m_offset = nds2[j]->GetAttr(_T("offset"), CXmlNode::PointType());
			}
		}

		else if (_T("pos_button_quit") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType())) 
			m_pos_Button_Quit = nds[i]->GetAttr(_T("value"), CXmlNode::PointType());

		else if (_T("pos_button_play") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType())) 
			m_pos_Button_Play = nds[i]->GetAttr(_T("value"), CXmlNode::PointType());

		else if (_T("pos_button_playcard") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType())) 
			m_pos_Button_PlayCard = nds[i]->GetAttr(_T("value"), CXmlNode::PointType());

		else if (_T("pos_button_skipcard") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType())) 
			m_pos_Button_SkipCard = nds[i]->GetAttr(_T("value"), CXmlNode::PointType());

		else if (_T("pos_sendcard") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType())) 
			m_pos_SendCard = nds[i]->GetAttr(_T("value"), CXmlNode::PointType());

		else if (_T("pos_bottomcard") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType())) 
			m_pos_BottomCard = nds[i]->GetAttr(_T("value"), CXmlNode::PointType());

		else if (_T("information") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType())) 
		{
			m_nInfoFontSize = nds[i]->GetAttr(_T("fontsize"), CXmlNode::IntType());
			m_clrInfo = nds[i]->GetAttr(_T("color"), CXmlNode::ColorType());
			m_pos_Info = nds[i]->GetAttr(_T("pos"), CXmlNode::PointType());
		}
			
		else if (_T("playername") == nds[i]->GetAttr(_T("name"), CXmlNode::StringType())) 
		{
			m_clrName = nds[i]->GetAttr(_T("color"), CXmlNode::ColorType());
			m_nNameFontSize = nds[i]->GetAttr(_T("fontsize"), CXmlNode::IntType());
		}
	}

//.........这里部分代码省略.........
开发者ID:wyrover,项目名称:lord-card,代码行数:101,代码来源:Config.cpp


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