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

common callback defines More...

#include "ZFCallback.h"

Go to the source code of this file.

Classes

class  ZFIOCallback
 abstract base class, use ZFOutput or ZFInput More...
 

Macros

#define ZFCallbackTagKeyword_ioOwner
 for advance user only
 

Functions

zfindex ZFIOCallbackCalcFSeek (zfindex offset, zfindex length, zfindex curPos, zfindex seekByteSize, ZFSeekPos seekPos)
 util method for ZFIOCallback::ioSeek's implementations to calculate seek index
 

Detailed Description

common callback defines

Macro Definition Documentation

◆ ZFCallbackTagKeyword_ioOwner

#define ZFCallbackTagKeyword_ioOwner

for advance user only

for ZFOutput and ZFInput to achieve some additional operation

usage:
set an auto released data by ZFCallback::callbackTag, whose key is ZFCallbackTagKeyword_ioOwner and value is a ZFObject that optionally implement those method (as ZFMethod):

  • ioSeek, similar to FILE's ZFFileSeek, proto type:
    zfbool ioSeek( ZF_IN zfindex byteSize , ZF_IN ZFSeekPos pos );
    return false if the callback doesn't support seek or error occurred
  • ioTell, similar to FILE's ZFFileTell, proto type:
    zfindex ioTell(void);
    return current's index or zfindexMax() if the callback doesn't support seek
  • ioSize, get callback's size, proto type:
    zfindex ioSize(void);
    return size or zfindexMax() if the callback doesn't support
    Note
    for input callbacks, the size shows the total size of the input
    for ouput callbacks, the size shows the current size of the output, it may or may not be the actual size written to the output, usually it has no actual meaning

Function Documentation

◆ ZFIOCallbackCalcFSeek()

zfindex ZFIOCallbackCalcFSeek ( zfindex offset,
zfindex length,
zfindex curPos,
zfindex seekByteSize,
ZFSeekPos seekPos )
extern

util method for ZFIOCallback::ioSeek's implementations to calculate seek index

param:

  • (zfindex)offset callback's initial offset
  • (zfindex)length callback's length including offset (i.e. starting from original 0)
  • (zfindex)curPos callback's current position including offset (i.e. start from original 0)

return an index start from 0 (offset is included), ensured range in [offset, length]