xml.h
changeset 172 fc1e478697d3
parent 127 656ac25e009b
child 174 95872af46fc4
equal deleted inserted replaced
5:d2a95fad6b23 6:61605df89885
    18 #include <string>
    18 #include <string>
    19 #include <vector>
    19 #include <vector>
    20 #include <list>
    20 #include <list>
    21 #include <map>
    21 #include <map>
    22 #include <lemon/error.h>
    22 #include <lemon/error.h>
    23 #include <lemon/xy.h>
    23 #include <lemon/dim2.h>
    24 
    24 
    25 namespace lemon {
    25 namespace lemon {
    26 
    26 
    27   class XmlIo 
    27   class XmlIo 
    28   {
    28   {
   407   ///\e
   407   ///\e
   408   
   408   
   409   ///\relates XmlIo
   409   ///\relates XmlIo
   410   ///
   410   ///
   411   template<class T>
   411   template<class T>
   412   void xml(XmlIo &x,lemon::xy<T> &v)
   412   void xml(XmlIo &x,lemon::dim2::Point<T> &v)
   413   {
   413   {
   414     { XmlIo::LineTag t(x,"x"); x(v.x); }
   414     { XmlIo::LineTag t(x,"x"); x(v.x); }
   415     { XmlIo::ContTag t(x,"y"); x(v.y); }
   415     { XmlIo::ContTag t(x,"y"); x(v.y); }
   416   }
   416   }
   417 
   417 
   418   ///\e
   418   ///\e
   419   
   419   
   420   ///\relates XmlIo
   420   ///\relates XmlIo
   421   ///
   421   ///
   422   template<class T>
   422   template<class T>
   423   void xml(XmlIo &x,lemon::BoundingBox<T> &v)
   423   void xml(XmlIo &x,lemon::dim2::BoundingBox<T> &v)
   424   {
   424   {
   425     if(x.write()) {
   425     if(x.write()) {
   426       if(!v.empty()) {
   426       if(!v.empty()) {
   427 	x("point",v.bottomLeft());
   427 	x("point",v.bottomLeft());
   428 	if(v.bottomLeft()!=v.topRight()) x("point",v.topRight());
   428 	if(v.bottomLeft()!=v.topRight()) x("point",v.topRight());
   429       }
   429       }
   430     }
   430     }
   431     else {
   431     else {
   432       v.clear();
   432       v.clear();
   433       while(x.nextTag()=="point") {
   433       while(x.nextTag()=="point") {
   434 	lemon::xy<T> co;
   434 	lemon::dim2::Point<T> co;
   435 	x("point",co);
   435 	x("point",co);
   436 	v.add(co);
   436 	v.add(co);
   437       }
   437       }
   438     }
   438     }
   439   }
   439   }