ZFFramework
 
Loading...
Searching...
No Matches
ZFInputForImpl.h File Reference

util to create ZFInput for custom impl More...

#include "ZFObject.h"

Go to the source code of this file.

Functions

ZFInput ZFInputForImpl (const ZFListener &impl)
 util to create ZFInput for custom impl, useful for script
 

Detailed Description

util to create ZFInput for custom impl

Function Documentation

◆ ZFInputForImpl()

ZFInput ZFInputForImpl ( const ZFListener & impl)
extern

util to create ZFInput for custom impl, useful for script

impl's params: (see ZFInput)

this is useful for script to supply IO logic, lua for example:

ZFInputForImpl(function(zfargs)
local buf = zfargs:param0()
local size = zfargs:param1()
local result = zfargs:result()
if zfl_eq(size, zfindexMax()) then
-- return total input size
result:zfv(yourTotalLength)
return
end
-- write to the buf
buf:append(yourData, size)
-- return written length
result:zfv(yourWrittenLength)
end)
#define zfindexMax()
(zfindex)-1, indicate a max index value, see zfindex
Definition ZFCoreTypeDef_CoreType.h:159
ZFInput ZFInputForImpl(const ZFListener &impl)
util to create ZFInput for custom impl, useful for script