|
@@ -0,0 +1,43 @@
|
|
1
|
+/*
|
|
2
|
+ * To change this license header, choose License Headers in Project Properties.
|
|
3
|
+ * To change this template file, choose Tools | Templates
|
|
4
|
+ * and open the template in the editor.
|
|
5
|
+ */
|
|
6
|
+package org.openzen.zenscript.formatter;
|
|
7
|
+
|
|
8
|
+import org.openzen.zenscript.codemodel.Modifiers;
|
|
9
|
+
|
|
10
|
+/**
|
|
11
|
+ *
|
|
12
|
+ * @author Hoofdgebruiker
|
|
13
|
+ */
|
|
14
|
+public class FormattingUtils {
|
|
15
|
+ private FormattingUtils() {}
|
|
16
|
+
|
|
17
|
+ public static void formatModifiers(StringBuilder output, int modifiers) {
|
|
18
|
+ if (Modifiers.isPrivate(modifiers))
|
|
19
|
+ output.append("private ");
|
|
20
|
+ if (Modifiers.isProtected(modifiers))
|
|
21
|
+ output.append("protected ");
|
|
22
|
+ if (Modifiers.isPublic(modifiers))
|
|
23
|
+ output.append("public ");
|
|
24
|
+ if (Modifiers.isExport(modifiers))
|
|
25
|
+ output.append("export ");
|
|
26
|
+ if (Modifiers.isStatic(modifiers))
|
|
27
|
+ output.append("static ");
|
|
28
|
+ if (Modifiers.isAbstract(modifiers))
|
|
29
|
+ output.append("abstract ");
|
|
30
|
+ if (Modifiers.isVirtual(modifiers))
|
|
31
|
+ output.append("virtual ");
|
|
32
|
+ if (Modifiers.isFinal(modifiers))
|
|
33
|
+ output.append("final ");
|
|
34
|
+ if (Modifiers.isExtern(modifiers))
|
|
35
|
+ output.append("extern ");
|
|
36
|
+ if (Modifiers.isImplicit(modifiers))
|
|
37
|
+ output.append("implicit ");
|
|
38
|
+ if (Modifiers.isConst(modifiers))
|
|
39
|
+ output.append("const ");
|
|
40
|
+ if (Modifiers.isConstOptional(modifiers))
|
|
41
|
+ output.append("const? ");
|
|
42
|
+ }
|
|
43
|
+}
|