-
Notifications
You must be signed in to change notification settings - Fork 0
/
FunctionControlMask.java
63 lines (55 loc) · 1.84 KB
/
FunctionControlMask.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.destranix.glslang;
import java.util.EnumSet;
public enum FunctionControlMask {
FunctionControlMaskNone(Main.FUNCTION_CONTROL_MASK_NONE),
FunctionControlInlineMask(Main.FUNCTION_CONTROL_INLINE_MASK),
FunctionControlDontInlineMask(Main.FUNCTION_CONTROL_DONT_INLINE_MASK),
FunctionControlPureMask(Main.FUNCTION_CONTROL_PURE_MASK),
FunctionControlConstMask(Main.FUNCTION_CONTROL_CONST_MASK);
private final int value;
private FunctionControlMask(int value) {
this.value = value;
}
public int getConstant() {
return this.value;
}
public static int setToInt(EnumSet<FunctionControlMask> set) {
int ret = 0;
for (FunctionControlMask val : set) {
ret |= val.getConstant();
}
return ret;
}
public static FunctionControlMask valueByStr(String str) {
switch (str) {
case "FunctionControlMaskNone":
return FunctionControlMaskNone;
case "FunctionControlInlineMask":
return FunctionControlInlineMask;
case "FunctionControlDontInlineMask":
return FunctionControlDontInlineMask;
case "FunctionControlPureMask":
return FunctionControlPureMask;
case "FunctionControlConstMask":
return FunctionControlConstMask;
default:
throw new IllegalArgumentException("Cannot translate string into enum value!");
}
}
public static FunctionControlMask valueByConstant(int constant) {
switch (constant) {
case Main.FUNCTION_CONTROL_MASK_NONE:
return FunctionControlMaskNone;
case Main.FUNCTION_CONTROL_INLINE_MASK:
return FunctionControlInlineMask;
case Main.FUNCTION_CONTROL_DONT_INLINE_MASK:
return FunctionControlDontInlineMask;
case Main.FUNCTION_CONTROL_PURE_MASK:
return FunctionControlPureMask;
case Main.FUNCTION_CONTROL_CONST_MASK:
return FunctionControlConstMask;
default:
throw new IllegalArgumentException("Cannot translate constant into enum value!");
}
}
}