1 #include <msp/strings/format.h>
10 unsigned get_gl_predicate(Predicate pred)
14 case NEVER: return GL_NEVER;
15 case ALWAYS: return GL_ALWAYS;
16 case LESS: return GL_LESS;
17 case LEQUAL: return GL_LEQUAL;
18 case EQUAL: return GL_EQUAL;
19 case GREATER: return GL_GREATER;
20 case GEQUAL: return GL_GEQUAL;
21 case NOTEQUAL: return GL_NOTEQUAL;
22 default: throw invalid_argument("get_gl_predicate");
26 void operator>>(const LexicalConverter &conv, Predicate &pred)
28 const string &str = conv.get();
31 else if(str=="ALWAYS")
35 else if(str=="LEQUAL")
39 else if(str=="GREATER")
41 else if(str=="GEQUAL")
43 else if(str=="NOTEQUAL")
46 throw lexical_error(format("conversion of '%s' to Predicate", str));
49 void operator<<(LexicalConverter &conv, Predicate pred)
53 case NEVER: conv.result("NEVER"); break;
54 case ALWAYS: conv.result("ALWAYS"); break;
55 case LESS: conv.result("LESS"); break;
56 case LEQUAL: conv.result("LEQUAL"); break;
57 case EQUAL: conv.result("EQUAL"); break;
58 case GREATER: conv.result("GREATER"); break;
59 case GEQUAL: conv.result("GEQUAL"); break;
60 case NOTEQUAL: conv.result("NOTEQUAL"); break;
61 default: conv.result(format("Predicate(%#x)", static_cast<int>(pred))); break;