file utility More...
#include "ZFFile_fwd.h"
Go to the source code of this file.
Classes | |
class | ZFPathInfoImpl |
callback data for ZFPATHTYPE_FILEIO_REGISTER More... | |
class | v_ZFPathInfoImpl |
type wrapper for ZFTypeId::Value More... | |
Macros | |
#define | ZFPATHTYPE_FILEIO_REGISTER(registerSig, pathType, ...) |
register pathType for generic file processing | |
#define | ZFCallbackSerializeType_ZFInputForPathInfo |
see ZFCALLBACK_SERIALIZE_TYPE_DEFINE | |
#define | ZFCallbackSerializeType_ZFOutputForPathInfo |
see ZFCALLBACK_SERIALIZE_TYPE_DEFINE | |
#define | ZFCallbackSerializeType_ZFInputForLocal |
see ZFCALLBACK_SERIALIZE_TYPE_DEFINE | |
#define | ZFCallbackSerializeType_ZFOutputForLocal |
see ZFCALLBACK_SERIALIZE_TYPE_DEFINE | |
#define | ZFPathInfoChainCharMap() |
see ZFPathInfoChainDecode | |
Typedefs | |
typedef zfbool(* | ZFPathInfoCallbackIsExist) (const zfchar *pathData) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackIsDir) (const zfchar *pathData) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackToFileName) (zfstring &ret, const zfchar *pathData) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackToChild) (zfstring &ret, const zfchar *pathData, const zfchar *childName) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackToParent) (zfstring &ret, const zfchar *pathData) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackPathCreate) (const zfchar *pathData, zfbool autoMakeParent) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackRemove) (const zfchar *pathData, zfbool isRecursive, zfbool isForce) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackMove) (const zfchar *pathDataFrom, const zfchar *pathDataTo, zfbool isForce) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackFindFirst) (ZFFileFindData &fd, const zfchar *pathData) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackFindNext) (ZFFileFindData &fd) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef void(* | ZFPathInfoCallbackFindClose) (ZFFileFindData &fd) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef void *(* | ZFPathInfoCallbackOpen) (const zfchar *pathData, ZFFileOpenOptionFlags flag, zfbool autoCreateParent) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackClose) (void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfindex(* | ZFPathInfoCallbackTell) (void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackSeek) (void *token, zfindex byteSize, ZFSeekPos position) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfindex(* | ZFPathInfoCallbackRead) (void *token, void *buf, zfindex maxByteSize) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfindex(* | ZFPathInfoCallbackWrite) (void *token, const void *src, zfindex maxByteSize) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef void(* | ZFPathInfoCallbackFlush) (void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackIsEof) (void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfbool(* | ZFPathInfoCallbackIsError) (void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
typedef zfindex(* | ZFPathInfoCallbackSize) (void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
Functions | |
zfbool | ZFPathInfoCallbackIsExistDefault (const zfchar *pathData) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackIsDirDefault (const zfchar *pathData) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackToFileNameDefault (zfstring &ret, const zfchar *pathData) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackToChildDefault (zfstring &ret, const zfchar *pathData, const zfchar *childName) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackToParentDefault (zfstring &ret, const zfchar *pathData) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackPathCreateDefault (const zfchar *pathData, zfbool autoMakeParent=_ZFT_t_zftrue) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackRemoveDefault (const zfchar *pathData, zfbool isRecursive=_ZFT_t_zftrue, zfbool isForce=_ZFT_t_zftrue) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackMoveDefault (const zfchar *pathDataFrom, const zfchar *pathDataTo, zfbool isForce=_ZFT_t_zftrue) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackFindFirstDefault (ZFFileFindData &fd, const zfchar *pathData) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackFindNextDefault (ZFFileFindData &fd) |
see ZFPATHTYPE_FILEIO_REGISTER | |
void | ZFPathInfoCallbackFindCloseDefault (ZFFileFindData &fd) |
see ZFPATHTYPE_FILEIO_REGISTER | |
void * | ZFPathInfoCallbackOpenDefault (const zfchar *pathData, ZFFileOpenOptionFlags flag=v_ZFFileOpenOption::e_Read, zfbool autoCreateParent=_ZFT_t_zftrue) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackCloseDefault (void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfindex | ZFPathInfoCallbackTellDefault (void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackSeekDefault (void *token, zfindex byteSize, ZFSeekPos position=ZFSeekPosBegin) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfindex | ZFPathInfoCallbackReadDefault (void *token, void *buf, zfindex maxByteSize) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfindex | ZFPathInfoCallbackWriteDefault (void *token, const void *src, zfindex maxByteSize=((zfindex) -1)) |
see ZFPATHTYPE_FILEIO_REGISTER | |
void | ZFPathInfoCallbackFlushDefault (void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackIsEofDefault (void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCallbackIsErrorDefault (void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfindex | ZFPathInfoCallbackSizeDefault (void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoIsExist (const ZFPathInfo &pathInfo) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoIsDir (const ZFPathInfo &pathInfo) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoToFileName (zfstring &ret, const ZFPathInfo &pathInfo) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoToChild (zfstring &ret, const ZFPathInfo &pathInfo, const zfchar *childName) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoToParent (zfstring &ret, const ZFPathInfo &pathInfo) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoPathCreate (const ZFPathInfo &pathInfo, zfbool autoMakeParent=(_ZFT_t_zftrue)) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoRemove (const ZFPathInfo &pathInfo, zfbool isRecursive=(_ZFT_t_zftrue), zfbool isForce=(_ZFT_t_zftrue)) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoMove (const ZFPathInfo &pathInfoFrom, const zfchar *pathDataTo, zfbool isForce=(_ZFT_t_zftrue)) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoFindFirst (const ZFPathInfo &pathInfo, ZFFileFindData &fd) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoFindNext (const ZFPathInfo &pathInfo, ZFFileFindData &fd) |
see ZFPATHTYPE_FILEIO_REGISTER | |
void | ZFPathInfoFindClose (const ZFPathInfo &pathInfo, ZFFileFindData &fd) |
see ZFPATHTYPE_FILEIO_REGISTER | |
void * | ZFPathInfoOpen (const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flag=(v_ZFFileOpenOption::e_Read), zfbool autoCreateParent=(_ZFT_t_zftrue)) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoClose (const ZFPathInfo &pathInfo, void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfindex | ZFPathInfoTell (const ZFPathInfo &pathInfo, void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoSeek (const ZFPathInfo &pathInfo, void *token, zfindex byteSize, ZFSeekPos position=(ZFSeekPosBegin)) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfindex | ZFPathInfoRead (const ZFPathInfo &pathInfo, void *token, void *buf, zfindex maxByteSize) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfindex | ZFPathInfoWrite (const ZFPathInfo &pathInfo, void *token, const void *src, zfindex maxByteSize=(((zfindex) -1))) |
see ZFPATHTYPE_FILEIO_REGISTER | |
void | ZFPathInfoFlush (const ZFPathInfo &pathInfo, void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoIsEof (const ZFPathInfo &pathInfo, void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoIsError (const ZFPathInfo &pathInfo, void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfindex | ZFPathInfoSize (const ZFPathInfo &pathInfo, void *token) |
see ZFPATHTYPE_FILEIO_REGISTER | |
zfbool | ZFPathInfoCopy (const ZFPathInfo &srcPath, const ZFPathInfo &dstPath, zfbool isRecursive=(_ZFT_t_zftrue), zfbool isForce=(_ZFT_t_zftrue)) |
copy a file or directory from srcPath to dstPath | |
const zfstring & | ZFTypeId_ZFPathInfoImpl (void) |
const ZFPathInfoImpl * | ZFPathInfoImplForPathType (const zfstring &pathType) |
get data registered by ZFPATHTYPE_FILEIO_REGISTER | |
void | ZFPathInfoImplGetAllT (ZFCoreArray< zfstring > &ret) |
get all data registered by ZFPATHTYPE_FILEIO_REGISTER | |
ZFCoreArray< zfstring > | ZFPathInfoImplGetAll () |
get all data registered by ZFPATHTYPE_FILEIO_REGISTER | |
ZFPathInfo | ZFLocalPathInfo (const zfstring &localPath=(zft_zfnull)) |
return local path info for current context | |
zfbool | ZFPathInfoForLocalT (ZFPathInfo &ret, const ZFPathInfo &pathInfo, const zfchar *childPath) |
util to make a child path info relative to existing one, see also ZFPathInfoCallbackToChild | |
zfbool | ZFPathInfoForLocalT (zfstring &ret, const ZFPathInfo &pathInfo, const zfchar *childPath) |
util to make a child path info relative to existing one, see also ZFPathInfoCallbackToChild | |
ZFPathInfo | ZFPathInfoForLocal (const ZFPathInfo &pathInfo, const zfchar *childPath) |
see ZFPathInfoForLocalT | |
ZFInput | ZFInputForPathInfo (const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flags=(v_ZFFileOpenOption::e_Read)) |
util to create a file input callback | |
zfbool | ZFInputForPathInfoT (ZFCallback &ret, const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flags=(v_ZFFileOpenOption::e_Read)) |
see ZFInputForPathInfo | |
ZFInput | ZFInputForPathInfoToken (void *token, const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flags=(v_ZFFileOpenOption::e_Read), zfbool autoClose=(_ZFT_t_zftrue)) |
see ZFInputForPathInfo | |
zfbool | ZFInputForPathInfoTokenT (ZFCallback &ret, void *token, const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flags=(v_ZFFileOpenOption::e_Read), zfbool autoClose=(_ZFT_t_zftrue)) |
see ZFInputForPathInfo | |
ZFOutput | ZFOutputForPathInfo (const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flags=(v_ZFFileOpenOption::e_Create)) |
util to create a file output callback | |
zfbool | ZFOutputForPathInfoT (ZFCallback &ret, const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flags=(v_ZFFileOpenOption::e_Create)) |
see ZFOutputForPathInfo | |
ZFOutput | ZFOutputForPathInfoToken (void *token, const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flags=(v_ZFFileOpenOption::e_Create), zfbool autoClose=(_ZFT_t_zftrue)) |
see ZFOutputForPathInfo | |
zfbool | ZFOutputForPathInfoTokenT (ZFCallback &ret, void *token, const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flags=(v_ZFFileOpenOption::e_Create), zfbool autoClose=(_ZFT_t_zftrue)) |
see ZFOutputForPathInfo | |
ZFInput | ZFInputForLocal (const zfchar *localPath, const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flags=(v_ZFFileOpenOption::e_Read)) |
util to create a file input callback | |
zfbool | ZFInputForLocalT (ZFCallback &ret, const zfchar *localPath, const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flags=(v_ZFFileOpenOption::e_Read)) |
see ZFInputForLocal | |
ZFOutput | ZFOutputForLocal (const zfchar *localPath, const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flags=(v_ZFFileOpenOption::e_Create)) |
util to create a file output callback | |
zfbool | ZFOutputForLocalT (ZFCallback &ret, const zfchar *localPath, const ZFPathInfo &pathInfo, ZFFileOpenOptionFlags flags=(v_ZFFileOpenOption::e_Create)) |
see ZFOutputForLocal | |
zfbool | ZFPathInfoChainDecode (ZFPathInfo &chainPathInfo, zfstring &pathData, const zfchar *pathDataOrig) |
util for impl to parse chained path data | |
zfbool | ZFPathInfoChainDecodeString (zfstring &chainPathInfoString, zfstring &pathData, const zfchar *pathDataOrig) |
see ZFPathInfoChainDecode | |
void | ZFPathInfoChainEncodeT (zfstring &ret, const ZFPathInfo &chainPathInfo, const zfchar *pathData) |
see ZFPathInfoChainDecode | |
zfstring | ZFPathInfoChainEncode (const ZFPathInfo &chainPathInfo, const zfchar *pathData) |
see ZFPathInfoChainDecode | |
file utility
#define ZFPATHTYPE_FILEIO_REGISTER | ( | registerSig, | |
pathType, | |||
... ) |
register pathType for generic file processing
there may be many different file processing methods (normal file, resource file, ftp file, etc), which have quite similar read/write functions, so we introduced this generic version to achieve advanced file processing
to use, register your path type by this macro, then use ZFPathInfoOpen series to process files
#define ZFCallbackSerializeType_ZFInputForPathInfo |
see ZFCALLBACK_SERIALIZE_TYPE_DEFINE
serializable data:
#define ZFCallbackSerializeType_ZFOutputForPathInfo |
see ZFCALLBACK_SERIALIZE_TYPE_DEFINE
serializable data:
#define ZFCallbackSerializeType_ZFInputForLocal |
see ZFCALLBACK_SERIALIZE_TYPE_DEFINE
serializable data:
#define ZFCallbackSerializeType_ZFOutputForLocal |
see ZFCALLBACK_SERIALIZE_TYPE_DEFINE
serializable data:
#define ZFPathInfoChainCharMap | ( | ) |
|
extern |
copy a file or directory from srcPath to dstPath
if both src and dst exist, but one is file and another is dir, return zffalse
merge directory if dst is an existing dir (if isForce not set, would return false if dst has a child file with the same path in src)
override file if dst is an existing file and isForce is zftrue
|
inline |
|
extern |
return local path info for current context
this method is designed for script only, when called from cpp side, it always return a dummy path info
|
extern |
util to create a file input callback
param:
auto open and auto close files, may return a null callback if open file error
note, additional impl can be attached by ZFPATHTYPE_FILEIO_REGISTER
|
extern |
this method is designed for performance for further impl, by:
|
extern |
util to create a file output callback
param:
auto open and auto close files, may return a null callback if open file error
note, additional impl can be attached by ZFPATHTYPE_FILEIO_REGISTER
|
extern |
this method is designed for performance for further impl, by:
|
extern |
util to create a file input callback
param:
auto open and auto close files, may return a null callback if open file error
note, additional impl can be attached by ZFPATHTYPE_FILEIO_REGISTER
|
extern |
util to create a file output callback
param:
auto open and auto close files, may return a null callback if open file error
note, additional impl can be attached by ZFPATHTYPE_FILEIO_REGISTER
|
extern |
util for impl to parse chained path data
chained path info format: 'pathType1:pathType2:pathData2|pathData1'
or, if recursively chained: 'pathType1:pathType2:pathType3:pathData3%7cpathData2|pathData1'
note if the chained path info contains the special '|' char, it must be escaped by '%7c', or use ZFCoreDataEncode with ZFPathInfoChainCharMap
typical case: