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

util to create ZFOutput for custom impl More...

#include "ZFObject.h"

Go to the source code of this file.

Functions

ZFOutput ZFOutputForImpl (const ZFListener &impl)
 util to create ZFOutput for custom impl, useful for script
 

Detailed Description

util to create ZFOutput for custom impl

Function Documentation

◆ ZFOutputForImpl()

ZFOutput ZFOutputForImpl ( const ZFListener & impl)
extern

util to create ZFOutput for custom impl, useful for script

impl's params: (see ZFOutput)

  • param0 holds a v_zfstring indicates a source that impl should output
  • param1 holds a v_zfindex indicates the source's size
  • result holds a v_zfindex that has source length as init value, impl may update the result value to indicates bytes actually written

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

ZFOutputForImpl(function(zfargs)
local src = zfargs:param0()
local size = zfargs:param1()
local result = zfargs:result()
local yourWrittenLength = yourOutput(buf, count)
-- return size actually written
result:zfv(yourWrittenLength)
end)
ZFOutput ZFOutputForImpl(const ZFListener &impl)
util to create ZFOutput for custom impl, useful for script