diff -r 3a44a2bb6da8 -r f227a74db59d xml.h --- a/xml.h Wed Aug 13 17:24:25 2008 +0100 +++ b/xml.h Fri Oct 10 13:36:20 2008 +0100 @@ -25,6 +25,7 @@ #include #include #include +#include #include namespace lemon { @@ -74,7 +75,7 @@ if(write()) if(level>=0) indent(level); else level=0; - else throw LogicError(); + else LEMON_ASSERT(true, "Invalid indentation."); } ///Read/write a tag @@ -159,7 +160,7 @@ void skipWhiteSpaces() { - if(write()) throw LogicError(); + if(write()) LEMON_ASSERT(true, "Can't skip whitespaces in write mode."); { char c; while (is.get(c) && std::isspace(c,is.getloc())) @@ -180,7 +181,7 @@ /// void useTag(const std::string &_tag) { if(nextTag()==_tag) useTag(); - else throw DataFormatError("",line_number,"Unexpected token name"); + else throw FormatError("Unexpected token name","",line_number); } public: ///Return the next tag (if a tag follows on the stream). @@ -189,16 +190,16 @@ /// const std::string &nextTag() { - if(write()) throw LogicError(); + if(write()) LEMON_ASSERT(true,"Don't use nextTag() in write mode"); else if(next_tag.empty()) { char c; skipWhiteSpaces(); if(!is.get(c) || c!='<') - throw DataFormatError("",line_number,"Bad format"); + throw FormatError("Bad format","",line_number); next_tag.clear(); while (is.get(c) && c!='>') next_tag.push_back(c); if(c!='>') - throw DataFormatError("",line_number,"Bad format"); + throw FormatError("Bad format","",line_number); } return next_tag; } @@ -229,7 +230,7 @@ else { skipWhiteSpaces(); if(!(is >> const_cast(v))) - throw DataFormatError("",line_number,"Not an 'int'"); + throw FormatError("Not an 'int'","",line_number); } return *this; } @@ -239,7 +240,7 @@ else { skipWhiteSpaces(); if(!(is >> const_cast(v))) - throw DataFormatError("",line_number,"Not an 'double'"); + throw FormatError("Not an 'double'","",line_number); } return *this; } @@ -271,7 +272,7 @@ while (is.get(c) && c!='<') if(c=='\\') if(!is.get(c)) - throw DataFormatError("",line_number,"Bad string"); + throw FormatError("Bad string","",line_number); else switch(c) { case 'n': w.push_back('\n'); @@ -285,7 +286,7 @@ w.push_back(c); } if(c!='<') - throw DataFormatError("",line_number,"Unexpected eof"); + throw FormatError("Unexpected eof","",line_number); is.unget(); } return *this; @@ -425,7 +426,7 @@ ///\relates XmlIo /// template - void xml(XmlIo &x,lemon::dim2::BoundingBox &v) + void xml(XmlIo &x,lemon::dim2::Box &v) { if(x.write()) { if(!v.empty()) {