del[lua]: remove unused code

This commit is contained in:
godotg
2023-10-18 16:57:43 +08:00
parent d3d79b3738
commit 468a1bdc6d
2 changed files with 0 additions and 80 deletions
@@ -1,42 +0,0 @@
/*
* Copyright (C) 2020 The zfoo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the License.
*/
package com.zfoo.protocol.serializer.lua;
import com.zfoo.protocol.generate.GenerateProtocolFile;
import com.zfoo.protocol.registration.field.IFieldRegistration;
import com.zfoo.protocol.util.StringUtils;
import java.lang.reflect.Field;
import static com.zfoo.protocol.util.FileUtils.LS;
/**
* @author godotg
*/
public class LuaCharSerializer implements ILuaSerializer {
@Override
public void writeObject(StringBuilder builder, String objectStr, int deep, Field field, IFieldRegistration fieldRegistration) {
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("buffer:writeChar({})", objectStr)).append(LS);
}
@Override
public String readObject(StringBuilder builder, int deep, Field field, IFieldRegistration fieldRegistration) {
String result = "result" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("local {} = buffer:readChar()", result)).append(LS);
return result;
}
}
@@ -408,21 +408,6 @@ function ByteBuffer:readString()
return self:readBuffer(length)
end
--char
function ByteBuffer:writeChar(charValue)
if charValue == nil or #charValue == 0 then
self:writeString("")
return
end
local str = utf8sub(charValue, 1, 1)
self:writeString(str)
return self
end
function ByteBuffer:readChar()
return self:readString()
end
--- Write a encoded char array into buf
function ByteBuffer:writeBuffer(str)
for i = 1, #str do
@@ -641,29 +626,6 @@ function ByteBuffer:readDoubleArray()
return array
end
function ByteBuffer:writeCharArray(array)
if array == null then
self:writeInt(0)
else
self:writeInt(#array);
for index, element in pairs(array) do
self:writeChar(element)
end
end
return self
end
function ByteBuffer:readCharArray()
local array = {}
local size = self:readInt()
if size > 0 then
for index = 1, size do
table.insert(array, self:readChar())
end
end
return array
end
function ByteBuffer:writeStringArray(array)
if array == null then
self:writeInt(0)