Example #1
0
void XNode::Clear()
{
	FOREACH_Child( this, p )
		SAFE_DELETE( p );
	m_childs.clear();
	
	FOREACH_Attr( this, p2 )
		SAFE_DELETE( p2 );
	m_attrs.clear();
}
Example #2
0
void XmlFileUtil::CompileXNodeTree( XNode *pNode, const RString &sFile )
{
	vector<XNode *> aToCompile;
	aToCompile.push_back( pNode );

	Lua *L = LUA->Get();
	while( aToCompile.size() )
	{
		pNode = aToCompile.back();
		aToCompile.pop_back();
		FOREACH_Child( pNode, pChild )
			aToCompile.push_back( pChild );

		FOREACH_Attr( pNode, pAttr )
		{
			XNodeValue *pValue = CompileXMLNodeValue( L, pAttr->first, pAttr->second, sFile );
			delete pAttr->second;
			pAttr->second = pValue;
		}
	}
Example #3
0
void XmlFileUtil::AnnotateXNodeTree( XNode *pNode, const RString &sFile )
{
	RString sDir = Dirname( sFile );

	vector<XNode *> queue;
	queue.push_back( pNode );
	while( !queue.empty() )
	{
		pNode = queue.back();
		queue.pop_back();
		FOREACH_Child( pNode, pChild )
			queue.push_back( pChild );

		/* Source file, for error messages: */
		pNode->AppendAttr( "_Source", sFile );

		/* Directory of caller, for relative paths: */
		pNode->AppendAttr( "_Dir", sDir );

		/* Note that this node came from a legacy XML file */
		pNode->AppendAttr( "_LegacyXml", true );
	}
}