X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fpixelformat.cpp;h=60fdc111e427c5e6ba563bfe0b849b1f4976537f;hp=8f742d83c38fcd012e0a46068eb96a0a350820aa;hb=3d6188a7f48566398e7ad7548dbd47a68bc73bdc;hpb=0fc02952ed449ff85f5f9e96ea2fc724c8456891 diff --git a/source/pixelformat.cpp b/source/pixelformat.cpp index 8f742d83..60fdc111 100644 --- a/source/pixelformat.cpp +++ b/source/pixelformat.cpp @@ -6,41 +6,36 @@ using namespace std; namespace Msp { namespace GL { -istream &operator>>(istream &in, PixelFormat &fmt) +void operator>>(const LexicalConverter &conv, PixelFormat &fmt) { - string word; - - in>>word; - if(word=="COLOR_INDEX") + if(conv.get()=="COLOR_INDEX") fmt = COLOR_INDEX; - else if(word=="STENCIL_INDEX") + else if(conv.get()=="STENCIL_INDEX") fmt = STENCIL_INDEX; - else if(word=="DEPTH_COMPONENT") + else if(conv.get()=="DEPTH_COMPONENT") fmt = DEPTH_COMPONENT; - else if(word=="RED") + else if(conv.get()=="RED") fmt = RED; - else if(word=="GREEN") + else if(conv.get()=="GREEN") fmt = GREEN; - else if(word=="BLUE") + else if(conv.get()=="BLUE") fmt = BLUE; - else if(word=="ALPHA") + else if(conv.get()=="ALPHA") fmt = ALPHA; - else if(word=="RGB") + else if(conv.get()=="RGB") fmt = RGB; - else if(word=="RGBA") + else if(conv.get()=="RGBA") fmt = RGBA; - else if(word=="BGR") + else if(conv.get()=="BGR") fmt = BGR; - else if(word=="BGRA") + else if(conv.get()=="BGRA") fmt = BGRA; - else if(word=="LUMINANCE") + else if(conv.get()=="LUMINANCE") fmt = LUMINANCE; - else if(word=="LUMINANCE_ALPHA") + else if(conv.get()=="LUMINANCE_ALPHA") fmt = LUMINANCE_ALPHA; else - in.setstate(ios_base::failbit); - - return in; + throw lexical_error(format("conversion of '%s' to PixelFormat", conv.get())); } PixelFormat pixelformat_from_graphics(Graphics::PixelFormat pf)