libcmo21/CodeGen/ErrorsWriter.java

25 lines
679 B
Java
Raw Normal View History

2023-08-20 16:10:22 +08:00
import java.io.OutputStreamWriter;
2023-08-20 12:13:40 +08:00
/**
2023-08-20 21:38:16 +08:00
* The nameof values writer for CKERROR
2023-08-20 12:13:40 +08:00
*/
public class ErrorsWriter {
2023-08-26 20:34:51 +08:00
public static void writeAccVals(OutputStreamWriter writer, EnumsHelper.Enum_t errors) throws Exception {
2023-08-20 16:10:22 +08:00
IndentHelper indent = new IndentHelper(writer);
indent.puts("const CkErrorReflectionArray CKERROR {");
indent.inc();
for (EnumsHelper.EnumEntry_t entry : errors.mEntries) {
String comment = CommonHelper.escapeString(entry.mEntryComment);
if (comment == null)
comment = "";
indent.printf("{ LibCmo::CK2::CKERROR::%s, { \"%s\", \"%s\" } },", entry.mEntryName, entry.mEntryName,
comment);
}
indent.dec();
indent.puts("};");
}
2023-08-20 12:13:40 +08:00
}