X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprimitivetype.cpp;h=c9a827926a108805ef9c7e1b6aba8fc7c02f4699;hp=0872f7760ae549b4ea7bdcc11779d7f27595e48b;hb=4b4d2a48048268d2ad48bafbce8647af8088573f;hpb=b617c5d7b5283ad260a77f01e42e6170cabbc03d diff --git a/source/primitivetype.cpp b/source/primitivetype.cpp index 0872f776..c9a82792 100644 --- a/source/primitivetype.cpp +++ b/source/primitivetype.cpp @@ -1,44 +1,37 @@ -/* $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); + throw lexical_error(format("conversion of '%s' to PrimitiveType", conv.get())); +} - return in; +void require_primitive_type(PrimitiveType type) +{ + if(type==QUADS || type==QUAD_STRIP) + static Require _req(MSP_legacy_features); } } // namespace GL