diff --git a/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownArraySerializer.java b/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownArraySerializer.java index 94c91b33..75f9db06 100644 --- a/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownArraySerializer.java +++ b/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownArraySerializer.java @@ -56,6 +56,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeBooleanArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeBooleanArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteBooleanArray({});", objectStr)).append(LS); break; @@ -80,6 +83,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeBooleanArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeBooleanArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteBooleanArray({});", objectStr)).append(LS); break; @@ -104,6 +110,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeByteArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeByteArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteByteArray({});", objectStr)).append(LS); break; @@ -128,6 +137,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeByteArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeByteArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteByteArray({});", objectStr)).append(LS); break; @@ -152,6 +164,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeShortArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeShortArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteShortArray({});", objectStr)).append(LS); break; @@ -176,6 +191,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeShortArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeShortArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteShortArray({});", objectStr)).append(LS); break; @@ -200,6 +218,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeIntArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeIntArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteIntArray({});", objectStr)).append(LS); break; @@ -224,6 +245,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeIntArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeIntArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteIntArray({});", objectStr)).append(LS); break; @@ -248,6 +272,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeLongArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeLongArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteLongArray({});", objectStr)).append(LS); break; @@ -272,6 +299,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeLongArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeLongArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteLongArray({});", objectStr)).append(LS); break; @@ -296,6 +326,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeFloatArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeFloatArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteFloatArray({});", objectStr)).append(LS); break; @@ -320,6 +353,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeFloatArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeFloatArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteFloatArray({});", objectStr)).append(LS); break; @@ -344,6 +380,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeDoubleArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeDoubleArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteDoubleArray({});", objectStr)).append(LS); break; @@ -368,6 +407,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeDoubleArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeDoubleArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteDoubleArray({});", objectStr)).append(LS); break; @@ -392,6 +434,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeStringArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeStringArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteStringArray({});", objectStr)).append(LS); break; @@ -420,6 +465,9 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writePacketArray({}, {})", objectStr, protocolId)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writePacketArray({}, {});", objectStr, protocolId)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WritePacketArray<{}>({}, {});", protocolName, objectStr, protocolId)).append(LS); break; @@ -464,6 +512,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readBooleanArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readBooleanArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadBooleanArray();", array)).append(LS); break; @@ -503,6 +555,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readBooleanArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readBooleanArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadBooleanArray();", array)).append(LS); break; @@ -539,6 +595,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readByteArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readByteArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadByteArray();", array)).append(LS); break; @@ -578,6 +638,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readByteArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readByteArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadByteArray();", array)).append(LS); break; @@ -614,6 +678,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readShortArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readShortArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadShortArray();", array)).append(LS); break; @@ -653,6 +721,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readShortArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readShortArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadShortArray();", array)).append(LS); break; @@ -689,6 +761,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readIntArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readIntArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadIntArray();", array)).append(LS); break; @@ -728,6 +804,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readIntArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readIntArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadIntArray();", array)).append(LS); break; @@ -764,6 +844,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readLongArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readLongArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadLongArray();", array)).append(LS); break; @@ -803,6 +887,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readLongArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readLongArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadLongArray();", array)).append(LS); break; @@ -839,6 +927,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readFloatArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = buffer->readFloatArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadFloatArray();", array)).append(LS); break; @@ -878,6 +970,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readFloatArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = buffer->readFloatArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadFloatArray();", array)).append(LS); break; @@ -914,6 +1010,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readDoubleArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readDoubleArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadDoubleArray();", array)).append(LS); break; @@ -953,6 +1053,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readDoubleArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readDoubleArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadDoubleArray();", array)).append(LS); break; @@ -989,6 +1093,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readStringArray()", array)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readStringArray();", array)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadStringArray();", array)).append(LS); break; @@ -1029,6 +1137,10 @@ public class CutDownArraySerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readPacketArray({})", array, protocolId)).append(LS); break; + case Php: + array = "$" + array; + builder.append(StringUtils.format("{} = $buffer->readPacketArray({});", array, protocolId)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadPacketArray<{}>({});", array, protocolName, protocolId)).append(LS); break; diff --git a/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownListSerializer.java b/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownListSerializer.java index 847a2634..8da3aec1 100644 --- a/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownListSerializer.java +++ b/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownListSerializer.java @@ -55,6 +55,9 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeBooleanArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeBooleanArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteBooleanList({});", objectStr)).append(LS); break; @@ -82,6 +85,9 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeByteArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeByteArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteByteList({});", objectStr)).append(LS); break; @@ -110,6 +116,9 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeShortArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeShortArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteShortList({});", objectStr)).append(LS); break; @@ -137,6 +146,9 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeIntArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeIntArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteIntList({});", objectStr)).append(LS); break; @@ -164,6 +176,9 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeLongArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeLongArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteLongList({});", objectStr)).append(LS); break; @@ -192,6 +207,9 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeFloatArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeFloatArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteFloatList({});", objectStr)).append(LS); break; @@ -220,6 +238,9 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeDoubleArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeDoubleArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteDoubleList({});", objectStr)).append(LS); break; @@ -248,6 +269,9 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeStringArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeStringArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteStringList({});", objectStr)).append(LS); break; @@ -278,6 +302,9 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writePacketArray({}, {})", objectStr, protocolId)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writePacketArray({}, {});", objectStr, protocolId)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WritePacketList({}, {});", objectStr, protocolId)).append(LS); break; @@ -324,6 +351,10 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readBooleanArray()", list)).append(LS); break; + case Php: + list = "$" + list; + builder.append(StringUtils.format("{} = buffer->readBooleanArray();", list)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadBooleanList();", list)).append(LS); break; @@ -363,6 +394,10 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readByteArray()", list)).append(LS); break; + case Php: + list = "$" + list; + builder.append(StringUtils.format("{} = $buffer->readByteArray();", list)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadByteList();", list)).append(LS); break; @@ -402,6 +437,10 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readShortArray()", list)).append(LS); break; + case Php: + list = "$" + list; + builder.append(StringUtils.format("{} = $buffer->readShortArray();", list)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadShortList();", list)).append(LS); break; @@ -441,6 +480,10 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readIntArray()", list)).append(LS); break; + case Php: + list = "$" + list; + builder.append(StringUtils.format("{} = $buffer->readIntArray();", list)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadIntList();", list)).append(LS); break; @@ -480,6 +523,10 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readLongArray()", list)).append(LS); break; + case Php: + list = "$" + list; + builder.append(StringUtils.format("{} = $buffer->readLongArray();", list)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadLongList();", list)).append(LS); break; @@ -519,6 +566,10 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readFloatArray()", list)).append(LS); break; + case Php: + list = "$" + list; + builder.append(StringUtils.format("{} = $buffer->readFloatArray();", list)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadFloatList();", list)).append(LS); break; @@ -558,6 +609,10 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readDoubleArray()", list)).append(LS); break; + case Php: + list = "$" + list; + builder.append(StringUtils.format("{} = $buffer->readDoubleArray();", list)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadDoubleList();", list)).append(LS); break; @@ -597,6 +652,10 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readStringArray()", list)).append(LS); break; + case Php: + list = "$" + list; + builder.append(StringUtils.format("{} = $buffer->readStringArray();", list)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadStringList();", list)).append(LS); break; @@ -639,6 +698,10 @@ public class CutDownListSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readPacketArray({})", list, protocolId)).append(LS); break; + case Php: + list = "$" + list; + builder.append(StringUtils.format("{} = $buffer->readPacketArray({});", list, protocolId)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadPacketList<{}>({});", list, protocolName, protocolId)).append(LS); break; diff --git a/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownMapSerializer.java b/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownMapSerializer.java index 75df83d9..86f256fb 100644 --- a/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownMapSerializer.java +++ b/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownMapSerializer.java @@ -62,6 +62,9 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeIntIntMap({})", objectStr)).append(LS); return true; + case Php: + builder.append(StringUtils.format("$buffer->writeIntIntMap({});", objectStr)).append(LS); + return true; case CSharp: builder.append(StringUtils.format("buffer.WriteIntIntMap({});", objectStr)).append(LS); return true; @@ -83,6 +86,9 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeIntLongMap({})", objectStr)).append(LS); return true; + case Php: + builder.append(StringUtils.format("$buffer->writeIntLongMap({});", objectStr)).append(LS); + return true; case CSharp: builder.append(StringUtils.format("buffer.WriteIntLongMap({});", objectStr)).append(LS); return true; @@ -104,6 +110,9 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeIntStringMap({})", objectStr)).append(LS); return true; + case Php: + builder.append(StringUtils.format("$buffer->writeIntStringMap({});", objectStr)).append(LS); + return true; case CSharp: builder.append(StringUtils.format("buffer.WriteIntStringMap({});", objectStr)).append(LS); return true; @@ -126,6 +135,9 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeIntPacketMap({}, {})", objectStr, protocolId)).append(LS); return true; + case Php: + builder.append(StringUtils.format("$buffer->writeIntPacketMap({}, {});", objectStr, protocolId)).append(LS); + return true; case CSharp: builder.append(StringUtils.format("buffer.WriteIntPacketMap({}, {});", objectStr, protocolId)).append(LS); return true; @@ -152,6 +164,9 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeLongIntMap({})", objectStr)).append(LS); return true; + case Php: + builder.append(StringUtils.format("$buffer->writeLongIntMap({});", objectStr)).append(LS); + return true; case CSharp: builder.append(StringUtils.format("buffer.WriteLongIntMap({});", objectStr)).append(LS); return true; @@ -173,6 +188,9 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeLongLongMap({})", objectStr)).append(LS); return true; + case Php: + builder.append(StringUtils.format("$buffer->writeLongLongMap({});", objectStr)).append(LS); + return true; case CSharp: builder.append(StringUtils.format("buffer.WriteLongLongMap({});", objectStr)).append(LS); return true; @@ -194,6 +212,9 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeLongStringMap({})", objectStr)).append(LS); return true; + case Php: + builder.append(StringUtils.format("$buffer->writeLongStringMap({});", objectStr)).append(LS); + return true; case CSharp: builder.append(StringUtils.format("buffer.WriteLongStringMap({});", objectStr)).append(LS); return true; @@ -216,6 +237,9 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeLongPacketMap({}, {})", objectStr, protocolId)).append(LS); return true; + case Php: + builder.append(StringUtils.format("$buffer->writeLongPacketMap({}, {});", objectStr, protocolId)).append(LS); + return true; case CSharp: builder.append(StringUtils.format("buffer.WriteLongPacketMap({}, {});", objectStr, protocolId)).append(LS); return true; @@ -242,6 +266,9 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeStringIntMap({})", objectStr)).append(LS); return true; + case Php: + builder.append(StringUtils.format("$buffer->writeStringIntMap({});", objectStr)).append(LS); + return true; case CSharp: builder.append(StringUtils.format("buffer.WriteStringIntMap({});", objectStr)).append(LS); return true; @@ -263,6 +290,9 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeStringLongMap({})", objectStr)).append(LS); return true; + case Php: + builder.append(StringUtils.format("$buffer->writeStringLongMap({});", objectStr)).append(LS); + return true; case CSharp: builder.append(StringUtils.format("buffer.WriteStringLongMap({});", objectStr)).append(LS); return true; @@ -284,6 +314,9 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeStringStringMap({})", objectStr)).append(LS); return true; + case Php: + builder.append(StringUtils.format("$buffer->writeStringStringMap({});", objectStr)).append(LS); + return true; case CSharp: builder.append(StringUtils.format("buffer.WriteStringStringMap({});", objectStr)).append(LS); return true; @@ -306,6 +339,9 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeStringPacketMap({}, {})", objectStr, protocolId)).append(LS); return true; + case Php: + builder.append(StringUtils.format("$buffer->writeStringPacketMap({}, {});", objectStr, protocolId)).append(LS); + return true; case CSharp: builder.append(StringUtils.format("buffer.WriteStringPacketMap({}, {});", objectStr, protocolId)).append(LS); return true; @@ -350,6 +386,10 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readIntIntMap()", map)).append(LS); return map; + case Php: + map = "$" + map; + builder.append(StringUtils.format("{} = $buffer->readIntIntMap();", map)).append(LS); + return map; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadIntIntMap();", map)).append(LS); return map; @@ -386,6 +426,10 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readIntLongMap()", map)).append(LS); return map; + case Php: + map = "$" + map; + builder.append(StringUtils.format("{} = $buffer->readIntLongMap();", map)).append(LS); + return map; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadIntLongMap();", map)).append(LS); return map; @@ -422,6 +466,10 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readIntStringMap()", map)).append(LS); return map; + case Php: + map = "$" + map; + builder.append(StringUtils.format("{} = $buffer->readIntStringMap();", map)).append(LS); + return map; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadIntStringMap();", map)).append(LS); return map; @@ -460,6 +508,10 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readIntPacketMap({})", map, protocolId)).append(LS); return map; + case Php: + map = "$" + map; + builder.append(StringUtils.format("{} = $buffer->readIntPacketMap({});", map, protocolId)).append(LS); + return map; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadIntPacketMap<{}>({});", map, protocolName, protocolId)).append(LS); return map; @@ -497,6 +549,10 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readLongIntMap()", map)).append(LS); return map; + case Php: + map = "$" + map; + builder.append(StringUtils.format("{} = $buffer->readLongIntMap();", map)).append(LS); + return map; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadLongIntMap();", map)).append(LS); return map; @@ -533,6 +589,10 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readLongLongMap()", map)).append(LS); return map; + case Php: + map = "$" + map; + builder.append(StringUtils.format("{} = $buffer->readLongLongMap();", map)).append(LS); + return map; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadLongLongMap();", map)).append(LS); return map; @@ -569,6 +629,10 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readLongStringMap()", map)).append(LS); return map; + case Php: + map = "$" + map; + builder.append(StringUtils.format("{} = $buffer->readLongStringMap();", map)).append(LS); + return map; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadLongStringMap();", map)).append(LS); return map; @@ -607,6 +671,10 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readLongPacketMap({})", map, protocolId)).append(LS); return map; + case Php: + map = "$" + map; + builder.append(StringUtils.format("{} = $buffer->readLongPacketMap({});", map, protocolId)).append(LS); + return map; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadLongPacketMap<{}>({});", map, protocolName, protocolId)).append(LS); return map; @@ -645,6 +713,10 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readStringIntMap()", map)).append(LS); return map; + case Php: + map = "$" + map; + builder.append(StringUtils.format("{} = $buffer->readStringIntMap();", map)).append(LS); + return map; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadStringIntMap();", map)).append(LS); return map; @@ -681,6 +753,10 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readStringLongMap()", map)).append(LS); return map; + case Php: + map = "$" + map; + builder.append(StringUtils.format("{} = $buffer->readStringLongMap();", map)).append(LS); + return map; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadStringLongMap();", map)).append(LS); return map; @@ -717,6 +793,10 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readStringStringMap()", map)).append(LS); return map; + case Php: + map = "$" + map; + builder.append(StringUtils.format("{} = $buffer->readStringStringMap();", map)).append(LS); + return map; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadStringStringMap();", map)).append(LS); return map; @@ -755,6 +835,10 @@ public class CutDownMapSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readStringPacketMap({})", map, protocolId)).append(LS); return map; + case Php: + map = "$" + map; + builder.append(StringUtils.format("{} = $buffer->readStringPacketMap({});", map, protocolId)).append(LS); + return map; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadStringPacketMap<{}>({});", map, protocolName, protocolId)).append(LS); return map; diff --git a/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownSetSerializer.java b/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownSetSerializer.java index bac238da..8c8d9f0e 100644 --- a/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownSetSerializer.java +++ b/protocol/src/main/java/com/zfoo/protocol/serializer/CutDownSetSerializer.java @@ -59,6 +59,9 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeBooleanArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeBooleanArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteBooleanSet({});", objectStr)).append(LS); break; @@ -86,6 +89,9 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeByteArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeByteArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteByteSet({});", objectStr)).append(LS); break; @@ -113,6 +119,9 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeShortArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeShortArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteShortSet({});", objectStr)).append(LS); break; @@ -140,6 +149,9 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeIntArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeIntArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteIntSet({});", objectStr)).append(LS); break; @@ -167,6 +179,9 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeLongArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeLongArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteLongSet({});", objectStr)).append(LS); break; @@ -194,6 +209,9 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeFloatArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeFloatArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteFloatSet({});", objectStr)).append(LS); break; @@ -221,6 +239,9 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeDoubleArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeDoubleArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteDoubleSet({});", objectStr)).append(LS); break; @@ -248,6 +269,9 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writeStringArray({})", objectStr)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writeStringArray({});", objectStr)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WriteStringSet({});", objectStr)).append(LS); break; @@ -278,6 +302,9 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("buffer:writePacketArray({}, {})", objectStr, protocolId)).append(LS); break; + case Php: + builder.append(StringUtils.format("$buffer->writePacketArray({}, {});", objectStr, protocolId)).append(LS); + break; case CSharp: builder.append(StringUtils.format("buffer.WritePacketSet({}, {});", objectStr, protocolId)).append(LS); break; @@ -321,6 +348,10 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readBooleanArray()", set)).append(LS); break; + case Php: + set = "$" + set; + builder.append(StringUtils.format("{} = $buffer->readBooleanArray();", set)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadBooleanSet();", set)).append(LS); break; @@ -360,6 +391,10 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readByteArray()", set)).append(LS); break; + case Php: + set = "$" + set; + builder.append(StringUtils.format("{} = $buffer->readByteArray();", set)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadByteSet();", set)).append(LS); break; @@ -399,6 +434,10 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readShortArray()", set)).append(LS); break; + case Php: + set = "$" + set; + builder.append(StringUtils.format("{} = $buffer->readShortArray();", set)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadShortSet();", set)).append(LS); break; @@ -438,6 +477,10 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readIntArray()", set)).append(LS); break; + case Php: + set = "$" + set; + builder.append(StringUtils.format("{} = $buffer->readIntArray();", set)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadIntSet();", set)).append(LS); break; @@ -477,6 +520,10 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readLongArray()", set)).append(LS); break; + case Php: + set = "$" + set; + builder.append(StringUtils.format("{} = $buffer->readLongArray();", set)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadLongSet();", set)).append(LS); break; @@ -516,6 +563,10 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readFloatArray()", set)).append(LS); break; + case Php: + set = "$" + set; + builder.append(StringUtils.format("{} = $buffer->readFloatArray();", set)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadFloatSet();", set)).append(LS); break; @@ -555,6 +606,10 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readDoubleArray()", set)).append(LS); break; + case Php: + set = "$" + set; + builder.append(StringUtils.format("{} = $buffer->readDoubleArray();", set)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadDoubleSet();", set)).append(LS); break; @@ -594,6 +649,10 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readStringArray()", set)).append(LS); break; + case Php: + set = "$" + set; + builder.append(StringUtils.format("{} = $buffer->readStringArray();", set)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadStringSet();", set)).append(LS); break; @@ -636,6 +695,10 @@ public class CutDownSetSerializer implements ICutDownSerializer { case Lua: builder.append(StringUtils.format("local {} = buffer:readPacketArray({})", set, protocolId)).append(LS); break; + case Php: + set = "$" + set; + builder.append(StringUtils.format("{} = $buffer->readPacketArray({});", set, protocolId)).append(LS); + break; case CSharp: builder.append(StringUtils.format("var {} = buffer.ReadPacketSet<{}>({});", set, protocolName, protocolId)).append(LS); break;