XML.hxx

Go to the documentation of this file.
00001 // XML.hxx: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2005, 2006 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00016 //
00017 #ifndef VCSN_XML_XML_HXX
00018 # define VCSN_XML_XML_HXX
00019 
00030 # include <vaucanson/misc/usual_macros.hh>
00031 # include <vaucanson/xml/xml_converter.hh>
00032 
00033 namespace vcsn
00034 {
00035   namespace xml
00036   {
00037 
00038     XML::XML(const std::string& name, bool use_label_node)
00039       : name_(name), use_label_node_(use_label_node)
00040     {}
00041 
00042     template<typename Saver, typename Conv>
00043     void XML::operator()(std::ostream& out, const Saver& s,
00044                          const Conv&) const
00045     {
00046       xercesc::XMLPlatformUtils::Initialize();
00047 
00048       typedef typename Saver::automaton_t automaton_t;
00049 
00050       xml_converter<automaton_t> xc(use_label_node_);
00051       xc.save(s.automaton(), out, name_);
00052 
00053       xercesc::XMLPlatformUtils::Terminate();
00054     }
00055 
00056 
00057     template <typename Loader>
00058     void
00059     XML::operator()(std::istream& in, Loader& l)
00060     {
00061       xercesc::XMLPlatformUtils::Initialize();
00062 
00063       typedef typename Loader::automaton_t automaton_t;
00064 
00065       xml_converter<automaton_t> xc(use_label_node_);
00066       xc.load(l.automaton(), in);
00067 
00068       xercesc::XMLPlatformUtils::Terminate();
00069     }
00070 
00071 
00072   } // !xml
00073 
00074 } // !vcsn
00075 
00076 
00077 #endif // ! VCSN_XML_XML_HXX

Generated on Wed Jun 13 17:00:30 2007 for Vaucanson by  doxygen 1.5.1