CHANGED: #1471 Links are now serialized.

This commit is contained in:
dfighter1985 2012-08-17 20:36:35 +02:00
parent ef43b498bc
commit 8402f2657f
2 changed files with 49 additions and 0 deletions

View file

@ -49,6 +49,7 @@ namespace NLGUI
xmlNodePtr serializeControls( xmlNodePtr parentNode ) const; xmlNodePtr serializeControls( xmlNodePtr parentNode ) const;
xmlNodePtr serializeViews( xmlNodePtr parentNode ) const; xmlNodePtr serializeViews( xmlNodePtr parentNode ) const;
virtual xmlNodePtr serializeTreeData( xmlNodePtr parentNode ) const; virtual xmlNodePtr serializeTreeData( xmlNodePtr parentNode ) const;
bool serializeLinks( xmlNodePtr parentNode ) const;
virtual uint32 getMemory (); virtual uint32 getMemory ();

View file

@ -674,6 +674,7 @@ namespace NLGUI
serializeSubGroups( node ); serializeSubGroups( node );
serializeControls( node ); serializeControls( node );
serializeViews( node ); serializeViews( node );
serializeLinks( node );
return node; return node;
} }
@ -774,6 +775,53 @@ namespace NLGUI
return node; return node;
} }
bool CInterfaceGroup::serializeLinks( xmlNodePtr parentNode ) const
{
if( parentNode == NULL )
return false;
const std::map< uint32, SLinkData > &linkMap =
CWidgetManager::getInstance()->getParser()->getLinkMap();
xmlNodePtr node = NULL;
std::map< uint32, SLinkData >::const_iterator itr;
for( itr = linkMap.begin(); itr != linkMap.end(); ++itr )
{
if( itr->second.parent != getId() )
continue;
const SLinkData &data = itr->second;
node = xmlNewNode( NULL, BAD_CAST "link" );
if( node == NULL )
return false;
xmlAddChild( parentNode, node );
xmlSetProp( node, BAD_CAST "expr", BAD_CAST data.expr.c_str() );
if( !data.target.empty() )
xmlSetProp( node, BAD_CAST "target", BAD_CAST data.target.c_str() );
if( !data.action.empty() )
{
xmlSetProp( node, BAD_CAST "action", BAD_CAST data.action.c_str() );
if( !data.params.empty() )
xmlSetProp( node, BAD_CAST "params", BAD_CAST data.params.c_str() );
if( !data.cond.empty() )
xmlSetProp( node, BAD_CAST "cond", BAD_CAST data.cond.c_str() );
}
}
return true;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceGroup::parseMaxSizeRef(const char *ptr) void CInterfaceGroup::parseMaxSizeRef(const char *ptr)
{ {