feat[kotlin]: cut down kotlin protocol

This commit is contained in:
godotg committed 2024-07-06 10:59:14 +08:00
1 parent bd419e3d54
commit e7f234202e
5 files changed
+403 -547

No files matched your search

@@ -50,8 +50,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeBooleanArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeBooleanArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeBooleanArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeBooleanArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -63,11 +62,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteBooleanArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteBooleanArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeBooleanArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeBooleanArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -79,8 +74,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeBooleanBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeBooleanBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeBooleanArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeBooleanArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -92,10 +86,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteBooleanArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteBooleanArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, JavaScript, EcmaScript, TypeScript:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeBooleanArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeBooleanArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -107,8 +98,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeByteArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeByteArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -120,11 +110,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteByteArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteByteArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeByteArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeByteArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -136,8 +122,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeByteBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeByteBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -149,10 +134,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteByteArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteByteArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, JavaScript, EcmaScript, TypeScript:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeByteArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeByteArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -164,8 +146,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeShortArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeShortArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -177,11 +158,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteShortArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteShortArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeShortArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeShortArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -193,8 +170,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeShortBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeShortBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -206,10 +182,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteShortArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteShortArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, JavaScript, EcmaScript, TypeScript:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeShortArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeShortArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -221,8 +194,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeIntArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeIntArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -234,11 +206,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteIntArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteIntArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeIntArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -250,8 +218,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeIntBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeIntBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -263,10 +230,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteIntArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteIntArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, JavaScript, EcmaScript, TypeScript:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeIntArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -278,8 +242,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeLongArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeLongArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -291,11 +254,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteLongArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteLongArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeLongArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -307,8 +266,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeLongBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeLongBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -320,10 +278,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteLongArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteLongArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, JavaScript, EcmaScript, TypeScript:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeLongArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -335,8 +290,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeFloatArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeFloatArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -348,11 +302,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteFloatArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteFloatArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeFloatArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeFloatArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -364,8 +314,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeFloatBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeFloatBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -377,10 +326,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteFloatArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteFloatArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, JavaScript, EcmaScript, TypeScript:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeFloatArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeFloatArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -392,8 +338,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeDoubleArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeDoubleArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -405,11 +350,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteDoubleArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteDoubleArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeDoubleArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeDoubleArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -421,8 +362,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeDoubleBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeDoubleBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -434,10 +374,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteDoubleArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteDoubleArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, JavaScript, EcmaScript, TypeScript:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeDoubleArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeDoubleArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -449,8 +386,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeStringArray($1, {});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeStringArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeStringArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -462,11 +398,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteStringArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteStringArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeStringArray({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringArray({});", objectStr)).append(LS);
break; break;
default: default:
@@ -494,13 +426,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Cpp: case Cpp:
builder.append(StringUtils.format("buffer.writePacketArray<{}>({}, {});", protocolName, objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writePacketArray<{}>({}, {});", protocolName, objectStr, protocolId)).append(LS);
break; break;
case JavaScript: case JavaScript, EcmaScript, TypeScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writePacketArray({}, {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writePacketArray({}, {});", objectStr, protocolId)).append(LS);
break; break;
case Golang: case Golang, Protobuf, Java, Kotlin, Scala:
case Protobuf:
default: default:
flag = false; flag = false;
} }
@@ -547,9 +476,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readBooleanArray();", array)).append(LS); builder.append(StringUtils.format("var {} = buffer.readBooleanArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readBooleanArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readBooleanArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readBooleanArray();", array)).append(LS);
break; break;
default: default:
@@ -579,9 +509,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Cpp: case Cpp:
builder.append(StringUtils.format("auto {} = buffer.readBooleanArray();", array)).append(LS); builder.append(StringUtils.format("auto {} = buffer.readBooleanArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readBooleanArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readBooleanArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readBooleanArray();", array)).append(LS);
break; break;
default: default:
@@ -614,9 +545,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readByteArray();", array)).append(LS); builder.append(StringUtils.format("var {} = buffer.readByteArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readByteArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readByteArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readByteArray();", array)).append(LS);
break; break;
default: default:
@@ -646,9 +578,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Cpp: case Cpp:
builder.append(StringUtils.format("auto {} = buffer.readByteArray();", array)).append(LS); builder.append(StringUtils.format("auto {} = buffer.readByteArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readByteArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readByteArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readByteArray();", array)).append(LS);
break; break;
default: default:
@@ -681,9 +614,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readShortArray();", array)).append(LS); builder.append(StringUtils.format("var {} = buffer.readShortArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readShortArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readShortArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readShortArray();", array)).append(LS);
break; break;
default: default:
@@ -713,9 +647,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Cpp: case Cpp:
builder.append(StringUtils.format("auto {} = buffer.readShortArray();", array)).append(LS); builder.append(StringUtils.format("auto {} = buffer.readShortArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readShortArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readShortArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readShortArray();", array)).append(LS);
break; break;
default: default:
@@ -748,9 +683,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readIntArray();", array)).append(LS); builder.append(StringUtils.format("var {} = buffer.readIntArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readIntArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readIntArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readIntArray();", array)).append(LS);
break; break;
default: default:
@@ -780,9 +716,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Cpp: case Cpp:
builder.append(StringUtils.format("auto {} = buffer.readIntArray();", array)).append(LS); builder.append(StringUtils.format("auto {} = buffer.readIntArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readIntArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readIntArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readIntArray();", array)).append(LS);
break; break;
default: default:
@@ -815,9 +752,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readLongArray();", array)).append(LS); builder.append(StringUtils.format("var {} = buffer.readLongArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readLongArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readLongArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readLongArray();", array)).append(LS);
break; break;
default: default:
@@ -847,9 +785,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Cpp: case Cpp:
builder.append(StringUtils.format("auto {} = buffer.readLongArray();", array)).append(LS); builder.append(StringUtils.format("auto {} = buffer.readLongArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readLongArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readLongArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readLongArray();", array)).append(LS);
break; break;
default: default:
@@ -882,9 +821,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readFloatArray();", array)).append(LS); builder.append(StringUtils.format("var {} = buffer.readFloatArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readFloatArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readFloatArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readFloatArray();", array)).append(LS);
break; break;
default: default:
@@ -914,9 +854,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Cpp: case Cpp:
builder.append(StringUtils.format("auto {} = buffer.readFloatArray();", array)).append(LS); builder.append(StringUtils.format("auto {} = buffer.readFloatArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readFloatArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readFloatArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readFloatArray();", array)).append(LS);
break; break;
default: default:
@@ -949,9 +890,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readDoubleArray();", array)).append(LS); builder.append(StringUtils.format("var {} = buffer.readDoubleArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readDoubleArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readDoubleArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readDoubleArray();", array)).append(LS);
break; break;
default: default:
@@ -981,9 +923,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Cpp: case Cpp:
builder.append(StringUtils.format("auto {} = buffer.readDoubleArray();", array)).append(LS); builder.append(StringUtils.format("auto {} = buffer.readDoubleArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readDoubleArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readDoubleArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readDoubleArray();", array)).append(LS);
break; break;
default: default:
@@ -1016,9 +959,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readStringArray();", array)).append(LS); builder.append(StringUtils.format("var {} = buffer.readStringArray();", array)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readStringArray()", array)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readStringArray();", array)).append(LS); builder.append(StringUtils.format("const {} = buffer.readStringArray();", array)).append(LS);
break; break;
default: default:
@@ -1046,14 +990,10 @@ public class CutDownArraySerializer implements ICutDownSerializer {
case Cpp: case Cpp:
builder.append(StringUtils.format("auto {} = buffer.readPacketArray<{}>({});", array, protocolName, protocolId)).append(LS); builder.append(StringUtils.format("auto {} = buffer.readPacketArray<{}>({});", array, protocolName, protocolId)).append(LS);
break; break;
case JavaScript: case JavaScript, EcmaScript, TypeScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("const {} = buffer.readPacketArray({});", array, protocolId)).append(LS); builder.append(StringUtils.format("const {} = buffer.readPacketArray({});", array, protocolId)).append(LS);
break; break;
case Golang: case Golang, Java, Kotlin, Scala, Protobuf, Enhance:
case Protobuf:
case Enhance:
default: default:
flag = false; flag = false;
} }
@@ -49,8 +49,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeBooleanList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeBooleanList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeBooleanArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeBooleanArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -62,13 +61,12 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteBooleanArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteBooleanArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeBooleanList({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeBooleanList({});", objectStr)).append(LS);
break; break;
case Kotlin:
builder.append(StringUtils.format("buffer.writeBooleanList({})", objectStr)).append(LS);
break;
default: default:
flag = false; flag = false;
} }
@@ -78,8 +76,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeByteList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeByteList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -91,13 +88,13 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteByteArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteByteArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeByteList({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeByteList({});", objectStr)).append(LS);
break; break;
case Kotlin:
builder.append(StringUtils.format("buffer.writeByteList({})", objectStr)).append(LS);
break;
default: default:
flag = false; flag = false;
} }
@@ -107,8 +104,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeShortList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeShortList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -120,13 +116,12 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteShortArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteShortArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeShortList({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeShortList({});", objectStr)).append(LS);
break; break;
case Kotlin:
builder.append(StringUtils.format("buffer.writeShortList({})", objectStr)).append(LS);
break;
default: default:
flag = false; flag = false;
} }
@@ -136,8 +131,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeIntList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeIntList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -149,13 +143,12 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteIntArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteIntArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeIntList({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntList({});", objectStr)).append(LS);
break; break;
case Kotlin:
builder.append(StringUtils.format("buffer.writeIntList({})", objectStr)).append(LS);
break;
default: default:
flag = false; flag = false;
} }
@@ -165,8 +158,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeLongList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeLongList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -178,13 +170,12 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteLongArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteLongArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeLongList({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongList({});", objectStr)).append(LS);
break; break;
case Kotlin:
builder.append(StringUtils.format("buffer.writeLongList({})", objectStr)).append(LS);
break;
default: default:
flag = false; flag = false;
} }
@@ -195,8 +186,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeFloatList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeFloatList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -208,13 +198,12 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteFloatArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteFloatArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeFloatList({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeFloatList({});", objectStr)).append(LS);
break; break;
case Kotlin:
builder.append(StringUtils.format("buffer.writeFloatList({})", objectStr)).append(LS);
break;
default: default:
flag = false; flag = false;
} }
@@ -225,8 +214,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeDoubleList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeDoubleList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -238,13 +226,12 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteDoubleArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteDoubleArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeDoubleList({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeDoubleList({});", objectStr)).append(LS);
break; break;
case Kotlin:
builder.append(StringUtils.format("buffer.writeDoubleList({})", objectStr)).append(LS);
break;
default: default:
flag = false; flag = false;
} }
@@ -255,8 +242,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeStringList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeStringList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break; break;
case GdScript: case GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeStringArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringArray({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -268,13 +254,12 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteStringArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteStringArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeStringList({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringList({});", objectStr)).append(LS);
break; break;
case Kotlin:
builder.append(StringUtils.format("buffer.writeStringList({})", objectStr)).append(LS);
break;
default: default:
flag = false; flag = false;
} }
@@ -287,8 +272,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writePacketList($1, (List){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId))); builder.append(StringUtils.format("{}.writePacketList($1, (List){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId)));
break; break;
case GdScript: case GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writePacketArray({}, {})", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writePacketArray({}, {})", objectStr, protocolId)).append(LS);
break; break;
case Lua: case Lua:
@@ -297,17 +281,16 @@ public class CutDownListSerializer implements ICutDownSerializer {
case CSharp: case CSharp:
builder.append(StringUtils.format("buffer.WritePacketList({}, {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.WritePacketList({}, {});", objectStr, protocolId)).append(LS);
break; break;
case Cpp: case Cpp, JavaScript, EcmaScript, TypeScript:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writePacketList({}, {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writePacketList({}, {});", objectStr, protocolId)).append(LS);
break; break;
case Java: case Java:
builder.append(StringUtils.format("buffer.writePacketList({}, (short) {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writePacketList({}, (short) {});", objectStr, protocolId)).append(LS);
break; break;
case Golang: case Kotlin:
case Protobuf: builder.append(StringUtils.format("buffer.writePacketList({}, {})", objectStr, protocolId)).append(LS);
break;
case Golang, Protobuf:
default: default:
flag = false; flag = false;
} }
@@ -353,9 +336,10 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readBooleanList();", list)).append(LS); builder.append(StringUtils.format("var {} = buffer.readBooleanList();", list)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readBooleanList()", list)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readBooleanList();", list)).append(LS); builder.append(StringUtils.format("const {} = buffer.readBooleanList();", list)).append(LS);
break; break;
default: default:
@@ -388,9 +372,10 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readByteList();", list)).append(LS); builder.append(StringUtils.format("var {} = buffer.readByteList();", list)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readByteList()", list)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readByteList();", list)).append(LS); builder.append(StringUtils.format("const {} = buffer.readByteList();", list)).append(LS);
break; break;
default: default:
@@ -423,9 +408,10 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readShortList();", list)).append(LS); builder.append(StringUtils.format("var {} = buffer.readShortList();", list)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readShortList()", list)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readShortList();", list)).append(LS); builder.append(StringUtils.format("const {} = buffer.readShortList();", list)).append(LS);
break; break;
default: default:
@@ -458,9 +444,10 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readIntList();", list)).append(LS); builder.append(StringUtils.format("var {} = buffer.readIntList();", list)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readIntList()", list)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readIntList();", list)).append(LS); builder.append(StringUtils.format("const {} = buffer.readIntList();", list)).append(LS);
break; break;
default: default:
@@ -493,9 +480,10 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readLongList();", list)).append(LS); builder.append(StringUtils.format("var {} = buffer.readLongList();", list)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readLongList()", list)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readLongList();", list)).append(LS); builder.append(StringUtils.format("const {} = buffer.readLongList();", list)).append(LS);
break; break;
default: default:
@@ -528,9 +516,10 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readFloatList();", list)).append(LS); builder.append(StringUtils.format("var {} = buffer.readFloatList();", list)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readFloatList()", list)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readFloatList();", list)).append(LS); builder.append(StringUtils.format("const {} = buffer.readFloatList();", list)).append(LS);
break; break;
default: default:
@@ -563,9 +552,10 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readDoubleList();", list)).append(LS); builder.append(StringUtils.format("var {} = buffer.readDoubleList();", list)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readDoubleList()", list)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readDoubleList();", list)).append(LS); builder.append(StringUtils.format("const {} = buffer.readDoubleList();", list)).append(LS);
break; break;
default: default:
@@ -598,9 +588,10 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readStringList();", list)).append(LS); builder.append(StringUtils.format("var {} = buffer.readStringList();", list)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readStringList()", list)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readStringList();", list)).append(LS); builder.append(StringUtils.format("const {} = buffer.readStringList();", list)).append(LS);
break; break;
default: default:
@@ -633,13 +624,13 @@ public class CutDownListSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readPacketList({}.class, (short) {});", list, protocolName, protocolId)).append(LS); builder.append(StringUtils.format("var {} = buffer.readPacketList({}.class, (short) {});", list, protocolName, protocolId)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readPacketList({}::class.java, {})", list, protocolName, protocolId)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readPacketList({});", list, protocolId)).append(LS); builder.append(StringUtils.format("const {} = buffer.readPacketList({});", list, protocolId)).append(LS);
break; break;
case Golang: case Golang, Protobuf:
case Protobuf:
default: default:
flag = false; flag = false;
} }
@@ -56,8 +56,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeIntIntMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeIntIntMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true; return true;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeIntIntMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntIntMap({})", objectStr)).append(LS);
return true; return true;
case Lua: case Lua:
@@ -69,11 +68,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteIntIntMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteIntIntMap({})", objectStr)).append(LS);
return true; return true;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeIntIntMap({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntIntMap({});", objectStr)).append(LS);
return true; return true;
} }
@@ -82,8 +77,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeIntLongMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeIntLongMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true; return true;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeIntLongMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntLongMap({})", objectStr)).append(LS);
return true; return true;
case Lua: case Lua:
@@ -95,11 +89,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteIntLongMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteIntLongMap({})", objectStr)).append(LS);
return true; return true;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeIntLongMap({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntLongMap({});", objectStr)).append(LS);
return true; return true;
} }
@@ -108,8 +98,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeIntStringMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeIntStringMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true; return true;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeIntStringMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntStringMap({})", objectStr)).append(LS);
return true; return true;
case Lua: case Lua:
@@ -121,11 +110,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteIntStringMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteIntStringMap({})", objectStr)).append(LS);
return true; return true;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeIntStringMap({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntStringMap({});", objectStr)).append(LS);
return true; return true;
} }
@@ -135,8 +120,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeIntPacketMap($1, (Map){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId))); builder.append(StringUtils.format("{}.writeIntPacketMap($1, (Map){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId)));
return true; return true;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeIntPacketMap({}, {})", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writeIntPacketMap({}, {})", objectStr, protocolId)).append(LS);
return true; return true;
case Lua: case Lua:
@@ -145,10 +129,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case CSharp: case CSharp:
builder.append(StringUtils.format("buffer.WriteIntPacketMap({}, {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.WriteIntPacketMap({}, {});", objectStr, protocolId)).append(LS);
return true; return true;
case Cpp: case Cpp, JavaScript, EcmaScript, TypeScript:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeIntPacketMap({}, {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writeIntPacketMap({}, {});", objectStr, protocolId)).append(LS);
return true; return true;
case Java: case Java:
@@ -165,8 +146,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeLongIntMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeLongIntMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true; return true;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeLongIntMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongIntMap({})", objectStr)).append(LS);
return true; return true;
case Lua: case Lua:
@@ -178,11 +158,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteLongIntMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteLongIntMap({})", objectStr)).append(LS);
return true; return true;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeLongIntMap({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongIntMap({});", objectStr)).append(LS);
return true; return true;
} }
@@ -191,8 +167,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeLongLongMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeLongLongMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true; return true;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeLongLongMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongLongMap({})", objectStr)).append(LS);
return true; return true;
case Lua: case Lua:
@@ -204,11 +179,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteLongLongMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteLongLongMap({})", objectStr)).append(LS);
return true; return true;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeLongLongMap({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongLongMap({});", objectStr)).append(LS);
return true; return true;
} }
@@ -217,8 +188,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeLongStringMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeLongStringMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true; return true;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeLongStringMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongStringMap({})", objectStr)).append(LS);
return true; return true;
case Lua: case Lua:
@@ -230,11 +200,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteLongStringMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteLongStringMap({})", objectStr)).append(LS);
return true; return true;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeLongStringMap({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongStringMap({});", objectStr)).append(LS);
return true; return true;
} }
@@ -244,8 +210,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeLongPacketMap($1, (Map){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId))); builder.append(StringUtils.format("{}.writeLongPacketMap($1, (Map){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId)));
return true; return true;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeLongPacketMap({}, {})", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writeLongPacketMap({}, {})", objectStr, protocolId)).append(LS);
return true; return true;
case Lua: case Lua:
@@ -254,10 +219,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case CSharp: case CSharp:
builder.append(StringUtils.format("buffer.WriteLongPacketMap({}, {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.WriteLongPacketMap({}, {});", objectStr, protocolId)).append(LS);
return true; return true;
case Cpp: case Cpp, JavaScript, EcmaScript, TypeScript:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeLongPacketMap({}, {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writeLongPacketMap({}, {});", objectStr, protocolId)).append(LS);
return true; return true;
case Java: case Java:
@@ -274,8 +236,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeStringIntMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeStringIntMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true; return true;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeStringIntMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringIntMap({})", objectStr)).append(LS);
return true; return true;
case Lua: case Lua:
@@ -287,11 +248,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteStringIntMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteStringIntMap({})", objectStr)).append(LS);
return true; return true;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeStringIntMap({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringIntMap({});", objectStr)).append(LS);
return true; return true;
} }
@@ -300,8 +257,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeStringLongMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeStringLongMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true; return true;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeStringLongMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringLongMap({})", objectStr)).append(LS);
return true; return true;
case Lua: case Lua:
@@ -313,11 +269,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteStringLongMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteStringLongMap({})", objectStr)).append(LS);
return true; return true;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeStringLongMap({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringLongMap({});", objectStr)).append(LS);
return true; return true;
} }
@@ -326,8 +278,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeStringStringMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr)); builder.append(StringUtils.format("{}.writeStringStringMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true; return true;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeStringStringMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringStringMap({})", objectStr)).append(LS);
return true; return true;
case Lua: case Lua:
@@ -339,11 +290,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteStringStringMap({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteStringStringMap({})", objectStr)).append(LS);
return true; return true;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeStringStringMap({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringStringMap({});", objectStr)).append(LS);
return true; return true;
} }
@@ -353,8 +300,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Enhance: case Enhance:
builder.append(StringUtils.format("{}.writeStringPacketMap($1, (Map){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId))); builder.append(StringUtils.format("{}.writeStringPacketMap($1, (Map){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId)));
return true; return true;
case GdScript: case Kotlin, GdScript, Python:
case Python:
builder.append(StringUtils.format("buffer.writeStringPacketMap({}, {})", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writeStringPacketMap({}, {})", objectStr, protocolId)).append(LS);
return true; return true;
case Lua: case Lua:
@@ -363,17 +309,13 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case CSharp: case CSharp:
builder.append(StringUtils.format("buffer.WriteStringPacketMap({}, {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.WriteStringPacketMap({}, {});", objectStr, protocolId)).append(LS);
return true; return true;
case Cpp: case Cpp, JavaScript, EcmaScript, TypeScript:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeStringPacketMap({}, {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writeStringPacketMap({}, {});", objectStr, protocolId)).append(LS);
return true; return true;
case Java: case Java:
builder.append(StringUtils.format("buffer.writeStringPacketMap({}, (short) {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writeStringPacketMap({}, (short) {});", objectStr, protocolId)).append(LS);
return true; return true;
case Golang: case Golang, Protobuf:
case Protobuf:
default: default:
} }
} }
@@ -420,9 +362,10 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readIntIntMap();", map)).append(LS); builder.append(StringUtils.format("var {} = buffer.readIntIntMap();", map)).append(LS);
return map; return map;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readIntIntMap()", map)).append(LS);
case TypeScript: return map;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readIntIntMap();", map)).append(LS); builder.append(StringUtils.format("const {} = buffer.readIntIntMap();", map)).append(LS);
return map; return map;
} }
@@ -452,9 +395,10 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readIntLongMap();", map)).append(LS); builder.append(StringUtils.format("var {} = buffer.readIntLongMap();", map)).append(LS);
return map; return map;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readIntLongMap()", map)).append(LS);
case TypeScript: return map;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readIntLongMap();", map)).append(LS); builder.append(StringUtils.format("const {} = buffer.readIntLongMap();", map)).append(LS);
return map; return map;
} }
@@ -484,9 +428,10 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readIntStringMap();", map)).append(LS); builder.append(StringUtils.format("var {} = buffer.readIntStringMap();", map)).append(LS);
return map; return map;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readIntStringMap()", map)).append(LS);
case TypeScript: return map;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readIntStringMap();", map)).append(LS); builder.append(StringUtils.format("const {} = buffer.readIntStringMap();", map)).append(LS);
return map; return map;
} }
@@ -515,9 +460,10 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readIntPacketMap({}.class, (short) {});", map, protocolName, protocolId)).append(LS); builder.append(StringUtils.format("var {} = buffer.readIntPacketMap({}.class, (short) {});", map, protocolName, protocolId)).append(LS);
return map; return map;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readIntPacketMap({}::class.java, {})", map, protocolName, protocolId)).append(LS);
case TypeScript: return map;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readIntPacketMap({});", map, protocolId)).append(LS); builder.append(StringUtils.format("const {} = buffer.readIntPacketMap({});", map, protocolId)).append(LS);
return map; return map;
case Golang: case Golang:
@@ -551,9 +497,10 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readLongIntMap();", map)).append(LS); builder.append(StringUtils.format("var {} = buffer.readLongIntMap();", map)).append(LS);
return map; return map;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readLongIntMap()", map)).append(LS);
case TypeScript: return map;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readLongIntMap();", map)).append(LS); builder.append(StringUtils.format("const {} = buffer.readLongIntMap();", map)).append(LS);
return map; return map;
} }
@@ -583,9 +530,10 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readLongLongMap();", map)).append(LS); builder.append(StringUtils.format("var {} = buffer.readLongLongMap();", map)).append(LS);
return map; return map;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readLongLongMap()", map)).append(LS);
case TypeScript: return map;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readLongLongMap();", map)).append(LS); builder.append(StringUtils.format("const {} = buffer.readLongLongMap();", map)).append(LS);
return map; return map;
} }
@@ -615,9 +563,10 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readLongStringMap();", map)).append(LS); builder.append(StringUtils.format("var {} = buffer.readLongStringMap();", map)).append(LS);
return map; return map;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readLongStringMap()", map)).append(LS);
case TypeScript: return map;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readLongStringMap();", map)).append(LS); builder.append(StringUtils.format("const {} = buffer.readLongStringMap();", map)).append(LS);
return map; return map;
} }
@@ -646,9 +595,10 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readLongPacketMap({}.class, (short) {});", map, protocolName, protocolId)).append(LS); builder.append(StringUtils.format("var {} = buffer.readLongPacketMap({}.class, (short) {});", map, protocolName, protocolId)).append(LS);
return map; return map;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readLongPacketMap({}::class.java, {})", map, protocolName, protocolId)).append(LS);
case TypeScript: return map;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readLongPacketMap({});", map, protocolId)).append(LS); builder.append(StringUtils.format("const {} = buffer.readLongPacketMap({});", map, protocolId)).append(LS);
return map; return map;
case Golang: case Golang:
@@ -683,9 +633,10 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readStringIntMap();", map)).append(LS); builder.append(StringUtils.format("var {} = buffer.readStringIntMap();", map)).append(LS);
return map; return map;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readStringIntMap()", map)).append(LS);
case TypeScript: return map;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readStringIntMap();", map)).append(LS); builder.append(StringUtils.format("const {} = buffer.readStringIntMap();", map)).append(LS);
return map; return map;
} }
@@ -715,9 +666,10 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readStringLongMap();", map)).append(LS); builder.append(StringUtils.format("var {} = buffer.readStringLongMap();", map)).append(LS);
return map; return map;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readStringLongMap()", map)).append(LS);
case TypeScript: return map;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readStringLongMap();", map)).append(LS); builder.append(StringUtils.format("const {} = buffer.readStringLongMap();", map)).append(LS);
return map; return map;
} }
@@ -747,9 +699,10 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readStringStringMap();", map)).append(LS); builder.append(StringUtils.format("var {} = buffer.readStringStringMap();", map)).append(LS);
return map; return map;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readStringStringMap()", map)).append(LS);
case TypeScript: return map;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readStringStringMap();", map)).append(LS); builder.append(StringUtils.format("const {} = buffer.readStringStringMap();", map)).append(LS);
return map; return map;
} }
@@ -778,13 +731,13 @@ public class CutDownMapSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readStringPacketMap({}.class, (short) {});", map, protocolName, protocolId)).append(LS); builder.append(StringUtils.format("var {} = buffer.readStringPacketMap({}.class, (short) {});", map, protocolName, protocolId)).append(LS);
return map; return map;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readStringPacketMap({}::class.java, {})", map, protocolName, protocolId)).append(LS);
case TypeScript: return map;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readStringPacketMap({});", map, protocolId)).append(LS); builder.append(StringUtils.format("const {} = buffer.readStringPacketMap({});", map, protocolId)).append(LS);
return map; return map;
case Golang: case Golang, Protobuf:
case Protobuf:
default: default:
} }
} }
@@ -53,7 +53,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case GdScript: case GdScript:
builder.append(StringUtils.format("buffer.writeBooleanArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeBooleanArray({})", objectStr)).append(LS);
break; break;
case Python: case Python, Kotlin:
builder.append(StringUtils.format("buffer.writeBooleanSet({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeBooleanSet({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -65,11 +65,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteBooleanArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteBooleanArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeBooleanSet({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeBooleanSet({});", objectStr)).append(LS);
break; break;
default: default:
@@ -84,7 +80,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case GdScript: case GdScript:
builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS);
break; break;
case Python: case Python, Kotlin:
builder.append(StringUtils.format("buffer.writeByteSet({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeByteSet({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -96,11 +92,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteByteArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteByteArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeByteSet({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeByteSet({});", objectStr)).append(LS);
break; break;
default: default:
@@ -115,7 +107,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case GdScript: case GdScript:
builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS);
break; break;
case Python: case Python, Kotlin:
builder.append(StringUtils.format("buffer.writeShortSet({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeShortSet({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -127,11 +119,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteShortArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteShortArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeShortSet({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeShortSet({});", objectStr)).append(LS);
break; break;
default: default:
@@ -146,7 +134,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case GdScript: case GdScript:
builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS);
break; break;
case Python: case Python, Kotlin:
builder.append(StringUtils.format("buffer.writeIntSet({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntSet({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -158,11 +146,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteIntArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteIntArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeIntSet({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeIntSet({});", objectStr)).append(LS);
break; break;
default: default:
@@ -177,7 +161,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case GdScript: case GdScript:
builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS);
break; break;
case Python: case Python, Kotlin:
builder.append(StringUtils.format("buffer.writeLongSet({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongSet({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -189,11 +173,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteLongArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteLongArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeLongSet({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeLongSet({});", objectStr)).append(LS);
break; break;
default: default:
@@ -208,7 +188,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case GdScript: case GdScript:
builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS);
break; break;
case Python: case Python, Kotlin:
builder.append(StringUtils.format("buffer.writeFloatSet({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeFloatSet({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -220,11 +200,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteFloatArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteFloatArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeFloatSet({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeFloatSet({});", objectStr)).append(LS);
break; break;
default: default:
@@ -239,7 +215,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case GdScript: case GdScript:
builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS);
break; break;
case Python: case Python, Kotlin:
builder.append(StringUtils.format("buffer.writeDoubleSet({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeDoubleSet({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -251,11 +227,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteDoubleArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteDoubleArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeDoubleSet({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeDoubleSet({});", objectStr)).append(LS);
break; break;
default: default:
@@ -270,7 +242,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case GdScript: case GdScript:
builder.append(StringUtils.format("buffer.writeStringArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringArray({})", objectStr)).append(LS);
break; break;
case Python: case Python, Kotlin:
builder.append(StringUtils.format("buffer.writeStringSet({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringSet({})", objectStr)).append(LS);
break; break;
case Lua: case Lua:
@@ -282,11 +254,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Golang: case Golang:
builder.append(StringUtils.format("buffer.WriteStringArray({})", objectStr)).append(LS); builder.append(StringUtils.format("buffer.WriteStringArray({})", objectStr)).append(LS);
break; break;
case Cpp: case Cpp, Java, JavaScript, EcmaScript, TypeScript:
case Java:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writeStringSet({});", objectStr)).append(LS); builder.append(StringUtils.format("buffer.writeStringSet({});", objectStr)).append(LS);
break; break;
default: default:
@@ -304,7 +272,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case GdScript: case GdScript:
builder.append(StringUtils.format("buffer.writePacketArray({}, {})", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writePacketArray({}, {})", objectStr, protocolId)).append(LS);
break; break;
case Python: case Python, Kotlin:
builder.append(StringUtils.format("buffer.writePacketSet({}, {})", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writePacketSet({}, {})", objectStr, protocolId)).append(LS);
break; break;
case Lua: case Lua:
@@ -313,17 +281,13 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case CSharp: case CSharp:
builder.append(StringUtils.format("buffer.WritePacketSet({}, {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.WritePacketSet({}, {});", objectStr, protocolId)).append(LS);
break; break;
case Cpp: case Cpp, JavaScript, EcmaScript, TypeScript:
case JavaScript:
case EcmaScript:
case TypeScript:
builder.append(StringUtils.format("buffer.writePacketSet({}, {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writePacketSet({}, {});", objectStr, protocolId)).append(LS);
break; break;
case Java: case Java:
builder.append(StringUtils.format("buffer.writePacketSet({}, (short) {});", objectStr, protocolId)).append(LS); builder.append(StringUtils.format("buffer.writePacketSet({}, (short) {});", objectStr, protocolId)).append(LS);
break; break;
case Golang: case Golang, Protobuf:
case Protobuf:
default: default:
flag = false; flag = false;
} }
@@ -369,9 +333,10 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readBooleanSet();", set)).append(LS); builder.append(StringUtils.format("var {} = buffer.readBooleanSet();", set)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readBooleanSet()", set)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readBooleanSet();", set)).append(LS); builder.append(StringUtils.format("const {} = buffer.readBooleanSet();", set)).append(LS);
break; break;
default: default:
@@ -404,9 +369,10 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readByteSet();", set)).append(LS); builder.append(StringUtils.format("var {} = buffer.readByteSet();", set)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readByteSet()", set)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readByteSet();", set)).append(LS); builder.append(StringUtils.format("const {} = buffer.readByteSet();", set)).append(LS);
break; break;
default: default:
@@ -439,9 +405,10 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readShortSet();", set)).append(LS); builder.append(StringUtils.format("var {} = buffer.readShortSet();", set)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readShortSet()", set)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readShortSet();", set)).append(LS); builder.append(StringUtils.format("const {} = buffer.readShortSet();", set)).append(LS);
break; break;
default: default:
@@ -474,9 +441,10 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readIntSet();", set)).append(LS); builder.append(StringUtils.format("var {} = buffer.readIntSet();", set)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readIntSet()", set)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readIntSet();", set)).append(LS); builder.append(StringUtils.format("const {} = buffer.readIntSet();", set)).append(LS);
break; break;
default: default:
@@ -509,9 +477,10 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readLongSet();", set)).append(LS); builder.append(StringUtils.format("var {} = buffer.readLongSet();", set)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readLongSet()", set)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readLongSet();", set)).append(LS); builder.append(StringUtils.format("const {} = buffer.readLongSet();", set)).append(LS);
break; break;
default: default:
@@ -544,9 +513,10 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readFloatSet();", set)).append(LS); builder.append(StringUtils.format("var {} = buffer.readFloatSet();", set)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readFloatSet()", set)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readFloatSet();", set)).append(LS); builder.append(StringUtils.format("const {} = buffer.readFloatSet();", set)).append(LS);
break; break;
default: default:
@@ -579,9 +549,10 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readDoubleSet();", set)).append(LS); builder.append(StringUtils.format("var {} = buffer.readDoubleSet();", set)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readDoubleSet()", set)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readDoubleSet();", set)).append(LS); builder.append(StringUtils.format("const {} = buffer.readDoubleSet();", set)).append(LS);
break; break;
default: default:
@@ -614,9 +585,10 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readStringSet();", set)).append(LS); builder.append(StringUtils.format("var {} = buffer.readStringSet();", set)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readStringSet()", set)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readStringSet();", set)).append(LS); builder.append(StringUtils.format("const {} = buffer.readStringSet();", set)).append(LS);
break; break;
default: default:
@@ -649,13 +621,13 @@ public class CutDownSetSerializer implements ICutDownSerializer {
case Java: case Java:
builder.append(StringUtils.format("var {} = buffer.readPacketSet({}.class, (short) {});", set, protocolName, protocolId)).append(LS); builder.append(StringUtils.format("var {} = buffer.readPacketSet({}.class, (short) {});", set, protocolName, protocolId)).append(LS);
break; break;
case JavaScript: case Kotlin:
case EcmaScript: builder.append(StringUtils.format("val {} = buffer.readPacketSet({}::class.java, {})", set, protocolName, protocolId)).append(LS);
case TypeScript: break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readPacketSet({});", set, protocolId)).append(LS); builder.append(StringUtils.format("const {} = buffer.readPacketSet({});", set, protocolId)).append(LS);
break; break;
case Golang: case Golang, Protobuf:
case Protobuf:
default: default:
flag = false; flag = false;
} }
@@ -352,8 +352,8 @@ class ByteBuffer {
return String(bytes, DEFAULT_CHARSET) return String(bytes, DEFAULT_CHARSET)
} }
fun writeBooleanArray(array: BooleanArray?) { fun writeBooleanArray(array: Array<Boolean>) {
if (array == null || array.size == 0) { if (array.size == 0) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(array.size) writeInt(array.size)
@@ -364,9 +364,9 @@ class ByteBuffer {
} }
} }
fun readBooleanArray(): BooleanArray { fun readBooleanArray(): Array<Boolean> {
val size = readInt() val size = readInt()
val array = BooleanArray(size) val array = Array<Boolean>(size) { init -> false }
if (size > 0) { if (size > 0) {
for (index in 0 until size) { for (index in 0 until size) {
array[index] = readBool() array[index] = readBool()
@@ -375,8 +375,8 @@ class ByteBuffer {
return array return array
} }
fun writeByteArray(array: ByteArray?) { fun writeByteArray(array: Array<Byte>) {
if (array == null || array.size == 0) { if (array.size == 0) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(array.size) writeInt(array.size)
@@ -387,9 +387,9 @@ class ByteBuffer {
} }
} }
fun readByteArray(): ByteArray { fun readByteArray(): Array<Byte> {
val size = readInt() val size = readInt()
val array = ByteArray(size) val array = Array<Byte>(size) { init -> 0 }
if (size > 0) { if (size > 0) {
for (index in 0 until size) { for (index in 0 until size) {
array[index] = readByte() array[index] = readByte()
@@ -398,8 +398,8 @@ class ByteBuffer {
return array return array
} }
fun writeShortArray(array: ShortArray?) { fun writeShortArray(array: Array<Short>) {
if (array == null || array.size == 0) { if (array.size == 0) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(array.size) writeInt(array.size)
@@ -410,9 +410,9 @@ class ByteBuffer {
} }
} }
fun readShortArray(): ShortArray { fun readShortArray(): Array<Short> {
val size = readInt() val size = readInt()
val array = ShortArray(size) val array = Array<Short>(size) { init -> 0 }
if (size > 0) { if (size > 0) {
for (index in 0 until size) { for (index in 0 until size) {
array[index] = readShort() array[index] = readShort()
@@ -421,8 +421,8 @@ class ByteBuffer {
return array return array
} }
fun writeIntArray(array: IntArray?) { fun writeIntArray(array: Array<Int>) {
if (array == null || array.size == 0) { if (array.size == 0) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(array.size) writeInt(array.size)
@@ -433,9 +433,9 @@ class ByteBuffer {
} }
} }
fun readIntArray(): IntArray { fun readIntArray(): Array<Int> {
val size = readInt() val size = readInt()
val array = IntArray(size) val array = Array<Int>(size) { init -> 0 }
if (size > 0) { if (size > 0) {
for (index in 0 until size) { for (index in 0 until size) {
array[index] = readInt() array[index] = readInt()
@@ -444,8 +444,8 @@ class ByteBuffer {
return array return array
} }
fun writeLongArray(array: LongArray?) { fun writeLongArray(array: Array<Long>) {
if (array == null || array.size == 0) { if (array.size == 0) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(array.size) writeInt(array.size)
@@ -456,9 +456,9 @@ class ByteBuffer {
} }
} }
fun readLongArray(): LongArray { fun readLongArray(): Array<Long> {
val size = readInt() val size = readInt()
val array = LongArray(size) val array = Array<Long>(size) { init -> 0 }
if (size > 0) { if (size > 0) {
for (index in 0 until size) { for (index in 0 until size) {
array[index] = readLong() array[index] = readLong()
@@ -467,8 +467,8 @@ class ByteBuffer {
return array return array
} }
fun writeFloatArray(array: FloatArray?) { fun writeFloatArray(array: Array<Float>) {
if (array == null || array.size == 0) { if (array.size == 0) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(array.size) writeInt(array.size)
@@ -479,9 +479,9 @@ class ByteBuffer {
} }
} }
fun readFloatArray(): FloatArray { fun readFloatArray(): Array<Float> {
val size = readInt() val size = readInt()
val array = FloatArray(size) val array = Array<Float>(size) { init -> 0F }
if (size > 0) { if (size > 0) {
for (index in 0 until size) { for (index in 0 until size) {
array[index] = readFloat() array[index] = readFloat()
@@ -490,8 +490,8 @@ class ByteBuffer {
return array return array
} }
fun writeDoubleArray(array: DoubleArray?) { fun writeDoubleArray(array: Array<Double>) {
if (array == null || array.size == 0) { if (array.size == 0) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(array.size) writeInt(array.size)
@@ -502,9 +502,9 @@ class ByteBuffer {
} }
} }
fun readDoubleArray(): DoubleArray { fun readDoubleArray(): Array<Double> {
val size = readInt() val size = readInt()
val array = DoubleArray(size) val array = Array<Double>(size) { init -> 0.0 }
if (size > 0) { if (size > 0) {
for (index in 0 until size) { for (index in 0 until size) {
array[index] = readDouble() array[index] = readDouble()
@@ -513,8 +513,8 @@ class ByteBuffer {
return array return array
} }
fun writeStringArray(array: Array<String?>?) { fun writeStringArray(array: Array<String>) {
if (array == null || array.size == 0) { if (array.size == 0) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(array.size) writeInt(array.size)
@@ -525,9 +525,9 @@ class ByteBuffer {
} }
} }
fun readStringArray(): Array<String?> { fun readStringArray(): Array<String> {
val size = readInt() val size = readInt()
val array = arrayOfNulls<String>(size) val array = Array<String>(size) { init -> "" }
if (size > 0) { if (size > 0) {
for (index in 0 until size) { for (index in 0 until size) {
array[index] = readString() array[index] = readString()
@@ -536,8 +536,8 @@ class ByteBuffer {
return array return array
} }
fun writeBooleanList(list: List<Boolean>?) { fun writeBooleanList(list: List<Boolean>) {
if (list == null || list.isEmpty()) { if (list.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(list.size) writeInt(list.size)
@@ -558,8 +558,8 @@ class ByteBuffer {
return list return list
} }
fun writeByteList(list: List<Byte>?) { fun writeByteList(list: List<Byte>) {
if (list == null || list.isEmpty()) { if (list.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(list.size) writeInt(list.size)
@@ -580,8 +580,8 @@ class ByteBuffer {
return list return list
} }
fun writeShortList(list: List<Short>?) { fun writeShortList(list: List<Short>) {
if (list == null || list.isEmpty()) { if (list.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(list.size) writeInt(list.size)
@@ -602,8 +602,8 @@ class ByteBuffer {
return list return list
} }
fun writeIntList(list: List<Int>?) { fun writeIntList(list: List<Int>) {
if (list == null || list.isEmpty()) { if (list.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(list.size) writeInt(list.size)
@@ -624,8 +624,8 @@ class ByteBuffer {
return list return list
} }
fun writeLongList(list: List<Long>?) { fun writeLongList(list: List<Long>) {
if (list == null || list.isEmpty()) { if (list.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(list.size) writeInt(list.size)
@@ -646,8 +646,8 @@ class ByteBuffer {
return list return list
} }
fun writeFloatList(list: List<Float>?) { fun writeFloatList(list: List<Float>) {
if (list == null || list.isEmpty()) { if (list.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(list.size) writeInt(list.size)
@@ -668,8 +668,8 @@ class ByteBuffer {
return list return list
} }
fun writeDoubleList(list: List<Double>?) { fun writeDoubleList(list: List<Double>) {
if (list == null || list.isEmpty()) { if (list.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(list.size) writeInt(list.size)
@@ -690,8 +690,8 @@ class ByteBuffer {
return list return list
} }
fun writeStringList(list: List<String?>?) { fun writeStringList(list: List<String>) {
if (list == null || list.isEmpty()) { if (list.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(list.size) writeInt(list.size)
@@ -712,8 +712,8 @@ class ByteBuffer {
return list return list
} }
fun writePacketList(list: List<*>?, protocolId: Short) { fun writePacketList(list: List<*>, protocolId: Short) {
if (list == null || list.isEmpty()) { if (list.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
val protocolRegistration = ProtocolManager.getProtocol(protocolId) val protocolRegistration = ProtocolManager.getProtocol(protocolId)
@@ -724,7 +724,7 @@ class ByteBuffer {
} }
} }
fun <T> readPacketList(clazz: Class<T>?, protocolId: Short): List<T> { fun <T> readPacketList(clazz: Class<T>, protocolId: Short): List<T> {
val size = readInt() val size = readInt()
val list: MutableList<T> = ArrayList() val list: MutableList<T> = ArrayList()
if (size > 0) { if (size > 0) {
@@ -736,8 +736,8 @@ class ByteBuffer {
return list return list
} }
fun writeBooleanSet(set: Set<Boolean>?) { fun writeBooleanSet(set: Set<Boolean>) {
if (set == null || set.isEmpty()) { if (set.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(set.size) writeInt(set.size)
@@ -758,8 +758,8 @@ class ByteBuffer {
return set return set
} }
fun writeShortSet(set: Set<Short>?) { fun writeShortSet(set: Set<Short>) {
if (set == null || set.isEmpty()) { if (set.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(set.size) writeInt(set.size)
@@ -780,8 +780,8 @@ class ByteBuffer {
return set return set
} }
fun writeIntSet(set: Set<Int>?) { fun writeIntSet(set: Set<Int>) {
if (set == null || set.isEmpty()) { if (set.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(set.size) writeInt(set.size)
@@ -802,8 +802,8 @@ class ByteBuffer {
return set return set
} }
fun writeLongSet(set: Set<Long>?) { fun writeLongSet(set: Set<Long>) {
if (set == null || set.isEmpty()) { if (set.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(set.size) writeInt(set.size)
@@ -824,8 +824,8 @@ class ByteBuffer {
return set return set
} }
fun writeFloatSet(set: Set<Float>?) { fun writeFloatSet(set: Set<Float>) {
if (set == null || set.isEmpty()) { if (set.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(set.size) writeInt(set.size)
@@ -846,8 +846,8 @@ class ByteBuffer {
return set return set
} }
fun writeDoubleSet(set: Set<Double>?) { fun writeDoubleSet(set: Set<Double>) {
if (set == null || set.isEmpty()) { if (set.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(set.size) writeInt(set.size)
@@ -868,8 +868,8 @@ class ByteBuffer {
return set return set
} }
fun writeStringSet(set: Set<String?>?) { fun writeStringSet(set: Set<String>) {
if (set == null || set.isEmpty()) { if (set.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(set.size) writeInt(set.size)
@@ -890,8 +890,8 @@ class ByteBuffer {
return set return set
} }
fun writePacketSet(set: Set<*>?, protocolId: Short) { fun writePacketSet(set: Set<*>, protocolId: Short) {
if (set == null || set.isEmpty()) { if (set.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
val protocolRegistration = ProtocolManager.getProtocol(protocolId) val protocolRegistration = ProtocolManager.getProtocol(protocolId)
@@ -902,7 +902,7 @@ class ByteBuffer {
} }
} }
fun <T> readPacketSet(clazz: Class<T>?, protocolId: Short): Set<T> { fun <T> readPacketSet(clazz: Class<T>, protocolId: Short): Set<T> {
val size = readInt() val size = readInt()
val set: MutableSet<T> = HashSet() val set: MutableSet<T> = HashSet()
if (size > 0) { if (size > 0) {
@@ -914,8 +914,8 @@ class ByteBuffer {
return set return set
} }
fun writeIntIntMap(map: Map<Int, Int>?) { fun writeIntIntMap(map: Map<Int, Int>) {
if (map == null || map.isEmpty()) { if (map.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(map.size) writeInt(map.size)
@@ -939,8 +939,8 @@ class ByteBuffer {
return map return map
} }
fun writeIntLongMap(map: Map<Int, Long>?) { fun writeIntLongMap(map: Map<Int, Long>) {
if (map == null || map.isEmpty()) { if (map.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(map.size) writeInt(map.size)
@@ -964,8 +964,8 @@ class ByteBuffer {
return map return map
} }
fun writeIntStringMap(map: Map<Int, String?>?) { fun writeIntStringMap(map: Map<Int, String>) {
if (map == null || map.isEmpty()) { if (map.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(map.size) writeInt(map.size)
@@ -989,8 +989,8 @@ class ByteBuffer {
return map return map
} }
fun writeIntPacketMap(map: Map<Int, *>?, protocolId: Short) { fun writeIntPacketMap(map: Map<Int, *>, protocolId: Short) {
if (map == null || map.isEmpty()) { if (map.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
val protocolRegistration = ProtocolManager.getProtocol(protocolId) val protocolRegistration = ProtocolManager.getProtocol(protocolId)
@@ -1002,7 +1002,7 @@ class ByteBuffer {
} }
} }
fun <T> readIntPacketMap(clazz: Class<T>?, protocolId: Short): Map<Int, T> { fun <T> readIntPacketMap(clazz: Class<T>, protocolId: Short): Map<Int, T> {
val size = readInt() val size = readInt()
val map: MutableMap<Int, T> = HashMap() val map: MutableMap<Int, T> = HashMap()
if (size > 0) { if (size > 0) {
@@ -1016,8 +1016,8 @@ class ByteBuffer {
return map return map
} }
fun writeLongIntMap(map: Map<Long, Int>?) { fun writeLongIntMap(map: Map<Long, Int>) {
if (map == null || map.isEmpty()) { if (map.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(map.size) writeInt(map.size)
@@ -1041,8 +1041,8 @@ class ByteBuffer {
return map return map
} }
fun writeLongLongMap(map: Map<Long, Long>?) { fun writeLongLongMap(map: Map<Long, Long>) {
if (map == null || map.isEmpty()) { if (map.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(map.size) writeInt(map.size)
@@ -1066,8 +1066,8 @@ class ByteBuffer {
return map return map
} }
fun writeLongStringMap(map: Map<Long, String?>?) { fun writeLongStringMap(map: Map<Long, String>) {
if (map == null || map.isEmpty()) { if (map.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(map.size) writeInt(map.size)
@@ -1091,8 +1091,8 @@ class ByteBuffer {
return map return map
} }
fun writeLongPacketMap(map: Map<Long, *>?, protocolId: Short) { fun writeLongPacketMap(map: Map<Long, *>, protocolId: Short) {
if (map == null || map.isEmpty()) { if (map.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
val protocolRegistration = ProtocolManager.getProtocol(protocolId) val protocolRegistration = ProtocolManager.getProtocol(protocolId)
@@ -1104,7 +1104,7 @@ class ByteBuffer {
} }
} }
fun <T> readLongPacketMap(clazz: Class<T>?, protocolId: Short): Map<Long, T> { fun <T> readLongPacketMap(clazz: Class<T>, protocolId: Short): Map<Long, T> {
val size = readInt() val size = readInt()
val map: MutableMap<Long, T> = HashMap() val map: MutableMap<Long, T> = HashMap()
if (size > 0) { if (size > 0) {
@@ -1118,8 +1118,8 @@ class ByteBuffer {
return map return map
} }
fun writeStringIntMap(map: Map<String?, Int>?) { fun writeStringIntMap(map: Map<String, Int>) {
if (map == null || map.isEmpty()) { if (map.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(map.size) writeInt(map.size)
@@ -1143,8 +1143,8 @@ class ByteBuffer {
return map return map
} }
fun writeStringLongMap(map: Map<String?, Long>?) { fun writeStringLongMap(map: Map<String, Long>) {
if (map == null || map.isEmpty()) { if (map.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(map.size) writeInt(map.size)
@@ -1168,8 +1168,8 @@ class ByteBuffer {
return map return map
} }
fun writeStringStringMap(map: Map<String?, String?>?) { fun writeStringStringMap(map: Map<String, String>) {
if (map == null || map.isEmpty()) { if (map.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
writeInt(map.size) writeInt(map.size)
@@ -1193,8 +1193,8 @@ class ByteBuffer {
return map return map
} }
fun writeStringPacketMap(map: Map<String?, *>?, protocolId: Short) { fun writeStringPacketMap(map: Map<String, *>, protocolId: Short) {
if (map == null || map.isEmpty()) { if (map.isEmpty()) {
writeInt(0) writeInt(0)
} else { } else {
val protocolRegistration = ProtocolManager.getProtocol(protocolId) val protocolRegistration = ProtocolManager.getProtocol(protocolId)
@@ -1206,7 +1206,7 @@ class ByteBuffer {
} }
} }
fun <T> readStringPacketMap(clazz: Class<T>?, protocolId: Short): Map<String, T> { fun <T> readStringPacketMap(clazz: Class<T>, protocolId: Short): Map<String, T> {
val size = readInt() val size = readInt()
val map: MutableMap<String, T> = HashMap() val map: MutableMap<String, T> = HashMap()
if (size > 0) { if (size > 0) {