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


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

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


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

示例1: GetChild

XAttr *XNode::GetChildAttr( const char* name, const char* attrname )
{
	XNode *node = GetChild(name);
	return node ? node->GetAttr(attrname) : NULL;
}
开发者ID:Braunson,项目名称:openitg,代码行数:5,代码来源:XmlFile.cpp

示例2: GetLegacyActorClass

Actor *ActorUtil::LoadFromNode( const XNode* _pNode, Actor *pParentActor )
{
	ASSERT( _pNode != NULL );

	XNode node = *_pNode;

	// Remove this in favor of using conditionals in Lua. -Chris
	// There are a number of themes out there that depend on this (including
	// sm-ssc default). Probably for the best to leave this in. -aj
	{
		bool bCond;
		if( node.GetAttrValue("Condition", bCond) && !bCond )
			return NULL;
	}

	RString sClass;
	bool bHasClass = node.GetAttrValue( "Class", sClass );
	if( !bHasClass )
		bHasClass = node.GetAttrValue( "Type", sClass );

	bool bLegacy = (node.GetAttr( "_LegacyXml" ) != NULL);
	if( !bHasClass && bLegacy )
		sClass = GetLegacyActorClass( &node );

	map<RString,CreateActorFn>::iterator iter = g_pmapRegistrees->find( sClass );
	if( iter == g_pmapRegistrees->end() )
	{
		RString sFile;
		if (bLegacy && node.GetAttrValue("File", sFile) && sFile != "")
		{
			RString sPath;
			// Handle absolute paths correctly
			if (sFile.Left(1) == "/")
				sPath = sFile;
			else
				sPath = Dirname(GetSourcePath(&node)) + sFile;
			if (ResolvePath(sPath, GetWhere(&node)))
			{
				Actor *pNewActor = MakeActor(sPath, pParentActor);
				if (pNewActor == NULL)
					return NULL;
				if (pParentActor)
					pNewActor->SetParent(pParentActor);
				pNewActor->LoadFromNode(&node);
				return pNewActor;
			}
		}

		// sClass is invalid
		RString sError = ssprintf( "%s: invalid Class \"%s\"",
			ActorUtil::GetWhere(&node).c_str(), sClass.c_str() );
		LuaHelpers::ReportScriptError(sError);
		return new Actor;	// Return a dummy object so that we don't crash in AutoActor later.
	}

	const CreateActorFn &pfn = iter->second;
	Actor *pRet = pfn();

	if( pParentActor )
		pRet->SetParent( pParentActor );

	pRet->LoadFromNode( &node );
	return pRet;
}
开发者ID:AratnitY,项目名称:stepmania,代码行数:64,代码来源:ActorUtil.cpp


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