Add sproto:exist_type and sproto:exist_proto

This commit is contained in:
Cloud Wu
2015-10-08 15:30:15 +08:00
parent 8924b86ad7
commit 8c1011c503

View File

@@ -58,6 +58,15 @@ local function querytype(self, typename)
return v
end
function sproto:exist_type(typename)
local v = self.__tcache[typename]
if not v then
return core.querytype(self.__cobj, typename) ~= nil
else
return true
end
end
function sproto:encode(typename, tbl)
local st = querytype(self, typename)
return core.encode(st, tbl)
@@ -99,6 +108,15 @@ local function queryproto(self, pname)
return v
end
function sproto:exist_proto(pname)
local v = self.__pcache[pname]
if not v then
return core.protocol(self.__cobj, pname) ~= nil
else
return true
end
end
function sproto:request_encode(protoname, tbl)
local p = queryproto(self, protoname)
local request = p.request