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

common callback defines More...

#include "ZFIOCallback_fwd.h"

Go to the source code of this file.

Classes

class  ZFInput
 general input callback More...
 

Macros

#define ZFCallbackSerializeType_ZFInputDummy
 see ZFCALLBACK_SERIALIZE_TYPE_DEFINE
 
#define ZFCallbackSerializeType_ZFInputForInputInRange
 see ZFCALLBACK_SERIALIZE_TYPE_DEFINE
 
#define ZFSerializableKeyword_ZFInputForInputInRange_input
 keyword for serialize
 
#define ZFSerializableKeyword_ZFInputForInputInRange_start
 keyword for serialize
 
#define ZFSerializableKeyword_ZFInputForInputInRange_count
 keyword for serialize
 
#define ZFSerializableKeyword_ZFInputForInputInRange_autoRestorePos
 keyword for serialize
 
#define ZFCallbackSerializeType_ZFInputForBuffer
 see ZFCALLBACK_SERIALIZE_TYPE_DEFINE
 
#define ZFSerializableKeyword_ZFInputForBuffer_buf
 keyword for serialize
 

Functions

ZFInput ZFInputDummy (void)
 a dummy input that always read zero byte with success state
 
ZFInput ZFInputForInputInRange (const ZFInput &inputCallback, zfindex start=0, zfindex count=((zfindex) -1), zfbool autoRestorePos=_ZFT_t_zftrue)
 create a intput callback from another input callback, specified in range
 
ZFInput ZFInputForBufferUnsafe (const void *src, zfindex count=((zfindex) -1), zfbool serializable=_ZFT_t_zffalse)
 create a intput callback input from a const void *, you must ensure the buffer is alive during the callback's life time
 
ZFInput ZFInputForBuffer (const void *src, zfindex count=((zfindex) -1), zfbool serializable=_ZFT_t_zffalse)
 see ZFInputForBufferUnsafe, copy the contents and auto free it
 
ZFInput ZFInputForString (const zfstring &src, zfbool serializable=_ZFT_t_zffalse)
 create a input callback from string
 

Detailed Description

common callback defines

Macro Definition Documentation

◆ ZFCallbackSerializeType_ZFInputDummy

#define ZFCallbackSerializeType_ZFInputDummy

see ZFCALLBACK_SERIALIZE_TYPE_DEFINE

serializable data:

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

◆ ZFCallbackSerializeType_ZFInputForInputInRange

#define ZFCallbackSerializeType_ZFInputForInputInRange

see ZFCALLBACK_SERIALIZE_TYPE_DEFINE

serializable data:

callbackType="ZFInputForInputInRange"
start="zfindex" // optional, 0 by default
count="zfindex" // optional, zfindexMax() by default
autoRestorePos="zfbool" // optional, zftrue by default
>
<something category="input" ... /> // required, the source input callback

◆ ZFCallbackSerializeType_ZFInputForBuffer

#define ZFCallbackSerializeType_ZFInputForBuffer

see ZFCALLBACK_SERIALIZE_TYPE_DEFINE

serializable data:

callbackType="ZFInputForBuffer"
buf="xxx" // optional, the buffer contents encoded by ZFCoreDataEncode
>

Function Documentation

◆ ZFInputForInputInRange()

ZFInput ZFInputForInputInRange ( const ZFInput & inputCallback,
zfindex start = 0,
zfindex count = ((zfindex) -1),
zfbool autoRestorePos = _ZFT_t_zftrue )
extern

create a intput callback from another input callback, specified in range

params:

  • (const ZFInput &) input callback to use
  • (zfindex) src's start index
  • (zfindex) src's count or zfindexMax() to use whole
  • (zfbool) whether to restore src input callback's position after result callback deleted

seeking the result input callback would ensure in range [start, start + count]
src must support seek, otherwise a null callback would be returned

◆ ZFInputForBufferUnsafe()

ZFInput ZFInputForBufferUnsafe ( const void * src,
zfindex count = ((zfindex) -1),
zfbool serializable = _ZFT_t_zffalse )
extern

create a intput callback input from a const void *, you must ensure the buffer is alive during the callback's life time

params:

  • (const void *) src to use
  • (zfindex) src's count or zfindexMax() to calculate automatically (treated as const zfchar *), zfindexMax() by default

◆ ZFInputForString()

ZFInput ZFInputForString ( const zfstring & src,
zfbool serializable = _ZFT_t_zffalse )
extern

create a input callback from string

the source string would be retained until the result ZFInput destroyed