X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprimitivetype.cpp;h=98053660e595cb4189e6b15fe016e6f31cbfd425;hb=f1b12c992db974c679d85ae6ec22cd318199d0d5;hp=0872f7760ae549b4ea7bdcc11779d7f27595e48b;hpb=b617c5d7b5283ad260a77f01e42e6170cabbc03d;p=libs%2Fgl.git diff --git a/source/primitivetype.cpp b/source/primitivetype.cpp index 0872f776..98053660 100644 --- a/source/primitivetype.cpp +++ b/source/primitivetype.cpp @@ -1,44 +1,31 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - +#include #include "primitivetype.h" namespace Msp { namespace GL { -std::istream &operator>>(std::istream &in, PrimitiveType &pt) +void operator>>(const LexicalConverter &conv, PrimitiveType &pt) { - std::string str; - in>>str; - - if(str=="POINTS") + if(conv.get()=="POINTS") pt = POINTS; - else if(str=="LINES") + else if(conv.get()=="LINES") pt = LINES; - else if(str=="LINE_LOOP") + else if(conv.get()=="LINE_LOOP") pt = LINE_LOOP; - else if(str=="LINE_STRIP") + else if(conv.get()=="LINE_STRIP") pt = LINE_STRIP; - else if(str=="TRIANGLES") + else if(conv.get()=="TRIANGLES") pt = TRIANGLES; - else if(str=="TRIANGLE_STRIP") + else if(conv.get()=="TRIANGLE_STRIP") pt = TRIANGLE_STRIP; - else if(str=="TRIANGLE_FAN") + else if(conv.get()=="TRIANGLE_FAN") pt = TRIANGLE_FAN; - else if(str=="QUADS") + else if(conv.get()=="QUADS") pt = QUADS; - else if(str=="QUAD_STRIP") + else if(conv.get()=="QUAD_STRIP") pt = QUAD_STRIP; - else if(str=="POLYGON") - pt = POLYGON; else - in.setstate(std::ios_base::failbit); - - return in; + throw lexical_error(format("conversion of '%s' to PrimitiveType", conv.get())); } } // namespace GL