]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture.cpp
Use the lexical_cast framework instead of istreams
[libs/gl.git] / source / texture.cpp
index d22f189bdcad4cc0a3c0e2f7edb0d55f30c5adaf..7ae1a2c2c5bda0e171e6f2ad171646afac48eab5 100644 (file)
@@ -8,27 +8,22 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-istream &operator>>(istream &in, TextureFilter &tf)
+void operator>>(const LexicalConverter &c, TextureFilter &tf)
 {
-       string str;
-       in>>str;
-
-       if(str=="NEAREST")
+       if(c.get()=="NEAREST")
                tf = NEAREST;
-       else if(str=="LINEAR")
+       else if(c.get()=="LINEAR")
                tf = LINEAR;
-       else if(str=="NEAREST_MIPMAP_NEAREST")
+       else if(c.get()=="NEAREST_MIPMAP_NEAREST")
                tf = NEAREST_MIPMAP_NEAREST;
-       else if(str=="NEAREST_MIPMAP_LINEAR")
+       else if(c.get()=="NEAREST_MIPMAP_LINEAR")
                tf = NEAREST_MIPMAP_LINEAR;
-       else if(str=="LINEAR_MIPMAP_NEAREST")
+       else if(c.get()=="LINEAR_MIPMAP_NEAREST")
                tf = LINEAR_MIPMAP_NEAREST;
-       else if(str=="LINEAR_MIPMAP_LINEAR")
+       else if(c.get()=="LINEAR_MIPMAP_LINEAR")
                tf = LINEAR_MIPMAP_LINEAR;
        else
-               in.setstate(ios_base::failbit);
-
-       return in;
+               throw lexical_error(format("conversion of '%s' to TextureFilter", c.get()));
 }