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

common callback defines More...

#include "ZFIOCallback_fwd.h"

Go to the source code of this file.

Classes

class  ZFOutput
 general output callback More...
 

Macros

#define ZFCallbackSerializeType_ZFOutputDummy
 see ZFCALLBACK_SERIALIZE_TYPE_DEFINE
 

Functions

ZFOutput ZFOutputDummy (void)
 a dummy output that always output nothing with success state
 
ZFOutput ZFOutputForString (zfstring &s)
 create a output callback to output to a zfstring
 
ZFOutput ZFOutputForBufferUnsafe (void *buf, zfindex maxCount=((zfindex) -1), zfbool autoAppendNullToken=_ZFT_t_zftrue)
 create a output callback to output to a buffer
 

Detailed Description

common callback defines

Macro Definition Documentation

◆ ZFCallbackSerializeType_ZFOutputDummy

#define ZFCallbackSerializeType_ZFOutputDummy

see ZFCALLBACK_SERIALIZE_TYPE_DEFINE

serializable data:

<ZFCallback callbackType="ZFOutputDummy">
// dummy input has no contents
callback used by ZFFramework
Definition ZFCallback.h:96

Function Documentation

◆ ZFOutputForString()

ZFOutput ZFOutputForString ( zfstring & s)
extern

create a output callback to output to a zfstring

Note
you must ensure the string to output is alive while the callback is still under use

◆ ZFOutputForBufferUnsafe()

ZFOutput ZFOutputForBufferUnsafe ( void * buf,
zfindex maxCount = ((zfindex) -1),
zfbool autoAppendNullToken = _ZFT_t_zftrue )
extern

create a output callback to output to a buffer

params:

  • (void *) buffer to write to
  • (zfindex) max buffer size or zfindexMax() for no limit (you must make sure buffer is enough), if autoAppendNullToken, maxCount should contain the extra '\0' size
  • (zfbool) whether auto append '\0' to tail each time write