X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=plugins%2Fmapxml%2Fxmlwrite.cpp;fp=plugins%2Fmapxml%2Fxmlwrite.cpp;h=590e64310680662c07d8176a2b31e32938d01842;hp=6e24f7cf8297492c0f6bf747e2588af44ddd8f7f;hb=9557abbf571aaf6bd9180e05baa209f25ebade3a;hpb=0b86577ab8b9bcd3403b77eafc33c2048b147d35 diff --git a/plugins/mapxml/xmlwrite.cpp b/plugins/mapxml/xmlwrite.cpp index 6e24f7cf..590e6431 100644 --- a/plugins/mapxml/xmlwrite.cpp +++ b/plugins/mapxml/xmlwrite.cpp @@ -1,23 +1,23 @@ /* -Copyright (C) 2001-2006, William Joseph. -All Rights Reserved. + Copyright (C) 2001-2006, William Joseph. + All Rights Reserved. -This file is part of GtkRadiant. + This file is part of GtkRadiant. -GtkRadiant is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + GtkRadiant is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -GtkRadiant is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + GtkRadiant is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with GtkRadiant; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + You should have received a copy of the GNU General Public License + along with GtkRadiant; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ // // writes xml tree format from internal objects @@ -29,63 +29,55 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "scenelib.h" #include "entityxml.h" -inline XMLExporter* Node_getXMLExporter(scene::Node& node) -{ - return NodeTypeCast::cast(node); +inline XMLExporter* Node_getXMLExporter( scene::Node& node ){ + return NodeTypeCast::cast( node ); } class write_all : public scene::Traversable::Walker { - XMLImporter& m_importer; +XMLImporter& m_importer; public: - write_all(XMLImporter& importer) : m_importer(importer) - { - } - bool pre(scene::Node& node) const - { - Entity* entity = Node_getEntity(node); - if(entity != 0) - { - m_importer.write("\n", 1); - StaticElement element("entity"); - m_importer.pushElement(element); - entity_export exporter(*entity); - exporter.exportXML(m_importer); - } - else - { - XMLExporter* exporter = Node_getXMLExporter(node); - if(exporter != 0) - { - m_importer.write("\n", 1); - exporter->exportXML(m_importer); - m_importer.write("\n", 1); - } - } - return true; - } - void post(scene::Node& node) const - { - if(Node_getEntity(node) != 0) - { - m_importer.write("\n", 1); - m_importer.popElement("entity"); - } - } +write_all( XMLImporter& importer ) : m_importer( importer ){ +} +bool pre( scene::Node& node ) const { + Entity* entity = Node_getEntity( node ); + if ( entity != 0 ) { + m_importer.write( "\n", 1 ); + StaticElement element( "entity" ); + m_importer.pushElement( element ); + entity_export exporter( *entity ); + exporter.exportXML( m_importer ); + } + else + { + XMLExporter* exporter = Node_getXMLExporter( node ); + if ( exporter != 0 ) { + m_importer.write( "\n", 1 ); + exporter->exportXML( m_importer ); + m_importer.write( "\n", 1 ); + } + } + return true; +} +void post( scene::Node& node ) const { + if ( Node_getEntity( node ) != 0 ) { + m_importer.write( "\n", 1 ); + m_importer.popElement( "entity" ); + } +} }; -void Map_Write(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& out) -{ - XMLStreamWriter writer(out); - writer.write("\n", 1); - { - StaticElement element("mapdoom3"); - writer.pushElement(element); +void Map_Write( scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& out ){ + XMLStreamWriter writer( out ); + writer.write( "\n", 1 ); + { + StaticElement element( "mapdoom3" ); + writer.pushElement( element ); - traverse(root, write_all(writer)); + traverse( root, write_all( writer ) ); - writer.write("\n", 1); - writer.popElement(element.name()); - } + writer.write( "\n", 1 ); + writer.popElement( element.name() ); + } }