]> git.tdb.fi Git - libs/gl.git/blobdiff - source/primitivetype.cpp
Make Animation::Iterator assignable
[libs/gl.git] / source / primitivetype.cpp
index 0872f7760ae549b4ea7bdcc11779d7f27595e48b..c9a827926a108805ef9c7e1b6aba8fc7c02f4699 100644 (file)
@@ -1,44 +1,37 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
+#include <msp/strings/format.h>
 #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