1 #include <msp/strings/format.h>
9 GLenum get_gl_predicate(Predicate pred)
13 case NEVER: return GL_NEVER;
14 case ALWAYS: return GL_ALWAYS;
15 case LESS: return GL_LESS;
16 case LEQUAL: return GL_LEQUAL;
17 case EQUAL: return GL_EQUAL;
18 case GREATER: return GL_GREATER;
19 case GEQUAL: return GL_GEQUAL;
20 case NOTEQUAL: return GL_NOTEQUAL;
21 default: throw invalid_argument("get_gl_predicate");
25 void operator>>(const LexicalConverter &conv, Predicate &pred)
27 const string &str = conv.get();
30 else if(str=="ALWAYS")
34 else if(str=="LEQUAL")
38 else if(str=="GREATER")
40 else if(str=="GEQUAL")
42 else if(str=="NOTEQUAL")
45 throw lexical_error(format("conversion of '%s' to Predicate", str));
48 void operator<<(LexicalConverter &conv, Predicate pred)
52 case NEVER: conv.result("NEVER"); break;
53 case ALWAYS: conv.result("ALWAYS"); break;
54 case LESS: conv.result("LESS"); break;
55 case LEQUAL: conv.result("LEQUAL"); break;
56 case EQUAL: conv.result("EQUAL"); break;
57 case GREATER: conv.result("GREATER"); break;
58 case GEQUAL: conv.result("GEQUAL"); break;
59 case NOTEQUAL: conv.result("NOTEQUAL"); break;
60 default: conv.result(format("Predicate(%#x)", static_cast<int>(pred))); break;