Example #1
0
void Bank::getXml( ModuleData* data, ostringstream& result )
{
    Document doc;
    Element* element = writeModule( data );
    doc.LinkEndChild( element );

    result << doc;
}
Example #2
0
void Bank::getXml( Program* program, ostringstream& result )
{
    if( program )
    {
        Document doc;
        Element* element = writeProgram( program );
        doc.LinkEndChild( element );

        result << doc;
    }
}
Example #3
0
void Bank::save( const string& p, bool saveCurrent, bool backup )
{
    string path = p.empty() ? path_ : p;
    if( path.empty() ) 
        return;

    if( saveCurrent ) 
        saveCurrentProgram();

    if( backup )
        makeBackup();

    Document doc;
	Declaration* declaration = new Declaration(  "1.0", "", "no" );
	doc.LinkEndChild( declaration );

	Element* bankElement = new Element( "Bank" );
    bankElement->SetAttribute( "name", name_ );
    bankElement->SetAttribute( "program", programNum_ );
    	
	for( UINT32 i=0; i<size(); i++ )
	{
		Program* program = at( i );
        if( program->empty() == false )
        {
		    Element* programElement = writeProgram( program );
		    bankElement->LinkEndChild( programElement );
        }
	}
	doc.LinkEndChild( bankElement );

    try {
	    doc.SaveFile( path );
        path_ = path;
    }
    catch( const exception& e ) {
        TRACE( e.what() );
    }
	doc.Clear();
}