src/lemon/graph_writer.h
changeset 1396 56f9a4ba9149
parent 1394 f0c48d7fa73d
child 1402 655d8e78454d
     1.1 --- a/src/lemon/graph_writer.h	Wed Apr 27 16:49:04 2005 +0000
     1.2 +++ b/src/lemon/graph_writer.h	Thu Apr 28 09:54:38 2005 +0000
     1.3 @@ -156,6 +156,11 @@
     1.4      bool escaped;
     1.5    };
     1.6  
     1.7 +  class GUIWriter {
     1.8 +  public:
     1.9 +    virtual void write(std::ostream& os) = 0;
    1.10 +  };
    1.11 +
    1.12    
    1.13    /// \brief The graph writer class.
    1.14    ///
    1.15 @@ -238,7 +243,7 @@
    1.16      /// it constructs the given map and it use the given writer as the
    1.17      /// default skipper.
    1.18      GraphWriter(std::ostream& _os, const Graph& _graph) 
    1.19 -      : os(_os), graph(_graph) {}
    1.20 +      : gui_writer(0), os(_os), graph(_graph){}
    1.21  
    1.22  
    1.23      /// \brief Destruct the graph writer.
    1.24 @@ -318,6 +323,10 @@
    1.25        return *this;
    1.26      }
    1.27  
    1.28 +    GraphWriter& writeGUI(const GUIWriter& writer) {
    1.29 +      gui_writer = &writer;
    1.30 +    }
    1.31 +
    1.32      /// \brief Executes the writer commands.
    1.33      ///
    1.34      /// Executes the writer commands.
    1.35 @@ -328,6 +337,7 @@
    1.36        writeEdgeSet(nodeWriter, edgeWriter);
    1.37        writeNodes(nodeWriter);
    1.38        writeEdges(edgeWriter);
    1.39 +      writeGUI();
    1.40        os << "@end" << std::endl;
    1.41      }
    1.42  
    1.43 @@ -433,6 +443,12 @@
    1.44        } 
    1.45      }
    1.46      
    1.47 +    void writeGUI() {      
    1.48 +      if (gui_writer) {
    1.49 +	os << "@gui" << std::endl;
    1.50 +	gui_writer->write(os);
    1.51 +      }
    1.52 +    }
    1.53  
    1.54  
    1.55  
    1.56 @@ -450,6 +466,8 @@
    1.57      typedef std::vector<std::pair<std::string, Edge> > EdgeWriters;
    1.58      EdgeWriters edge_writers;
    1.59  
    1.60 +    GUIWriter* gui_writer;
    1.61 +
    1.62      std::ostream& os;
    1.63      const Graph& graph;
    1.64