]> git.tdb.fi Git - libs/gl.git/blob - source/core/predicate.cpp
Remove support for array size specialization from the engine as well
[libs/gl.git] / source / core / predicate.cpp
1 #include <msp/strings/format.h>
2 #include "gl.h"
3 #include "predicate.h"
4
5 using namespace std;
6
7 namespace Msp {
8 namespace GL {
9
10 void operator>>(const LexicalConverter &conv, Predicate &pred)
11 {
12         const string &str = conv.get();
13         if(str=="NEVER")
14                 pred = NEVER;
15         else if(str=="ALWAYS")
16                 pred = ALWAYS;
17         else if(str=="LESS")
18                 pred = LESS;
19         else if(str=="LEQUAL")
20                 pred = LEQUAL;
21         else if(str=="EQUAL")
22                 pred = EQUAL;
23         else if(str=="GREATER")
24                 pred = GREATER;
25         else if(str=="GEQUAL")
26                 pred = GEQUAL;
27         else if(str=="NOTEQUAL")
28                 pred = NOTEQUAL;
29         else
30                 throw lexical_error(format("conversion of '%s' to Predicate", str));
31 }
32
33 void operator<<(LexicalConverter &conv, Predicate pred)
34 {
35         switch(pred)
36         {
37         case NEVER: conv.result("NEVER"); break;
38         case ALWAYS: conv.result("ALWAYS"); break;
39         case LESS: conv.result("LESS"); break;
40         case LEQUAL: conv.result("LEQUAL"); break;
41         case EQUAL: conv.result("EQUAL"); break;
42         case GREATER: conv.result("GREATER"); break;
43         case GEQUAL: conv.result("GEQUAL"); break;
44         case NOTEQUAL: conv.result("NOTEQUAL"); break;
45         default: conv.result(format("Predicate(%#x)", static_cast<int>(pred))); break;
46         }
47 }
48
49 } // namespace GL
50 } // namespace Msp