X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprimitivetype.cpp;h=7b47dfd852b927db1285bdb37fa27513c39682e0;hp=717d98358e993a356bffe1a7cdccdc409f3db829;hb=3d6188a7f48566398e7ad7548dbd47a68bc73bdc;hpb=0fc02952ed449ff85f5f9e96ea2fc724c8456891 diff --git a/source/primitivetype.cpp b/source/primitivetype.cpp index 717d9835..7b47dfd8 100644 --- a/source/primitivetype.cpp +++ b/source/primitivetype.cpp @@ -1,37 +1,33 @@ +#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") + else if(conv.get()=="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