abstract IO More...
#include "ZFIODef.h"
Go to the source code of this file.
Functions | |
const zfstring & | ZFPathType_res () |
see ZFPathInfo | |
ZFInput | ZFInputForRes (const zfstring &resFilePath) |
util to create a resource file input callback, see ZFResOpen for what resource file is | |
void | ZFResExtPathAdd (const ZFPathInfo &pathInfo) |
add an additional path to search as resource files | |
void | ZFResExtPathRemove (const ZFPathInfo &pathInfo) |
see ZFResExtPathAdd | |
ZFCoreArray< ZFPathInfo > | ZFResExtPathList () |
see ZFResExtPathAdd | |
zfbool | ZFResExtPathCheck (ZFPathInfo &resExtPath, const zfstring &resPath) |
see ZFResExtPathAdd | |
zfbool | ZFResIsExist (const zfstring &resPath) |
return true if res file specified by path is exist | |
zfbool | ZFResIsDir (const zfstring &resPath) |
return true if res file specified by path is a directory | |
zfbool | ZFResFindFirst (ZFIOFindData &fd, const zfstring &resPath) |
zfbool | ZFResFindNext (ZFIOFindData &fd) |
void | ZFResFindClose (ZFIOFindData &fd) |
void * | ZFResOpen (const zfstring &resPath) |
open a resource file for read only, see ZFFileOpen | |
zfbool | ZFResClose (void *token) |
see ZFResOpen ZFFileClose | |
zfindex | ZFResTell (void *token) |
see ZFResOpen ZFFileTell | |
zfbool | ZFResSeek (void *token, zfindex byteSize, ZFSeekPos seekPos=(ZFSeekPosBegin)) |
see ZFResOpen ZFFileSeek | |
zfindex | ZFResRead (void *token, void *buf, zfindex maxByteSize) |
see ZFResOpen ZFFileRead | |
zfindex | ZFResSize (void *token) |
see ZFResOpen, ZFFileSize | |
abstract IO
|
extern |
util to create a resource file input callback, see ZFResOpen for what resource file is
param:
auto open and auto close files, may return a null callback if open file error
|
extern |
add an additional path to search as resource files
by default, resource files are placed in a fixed builtin location, you may add additional path to search as resource files
to make things clear, while accessing resource files using a res path, we would:
this method would affect all methods that process with resource files, such as ZFResOpen, ZFResFindFirst
typically, additional resource path should be modified during startup only
|
extern |
see ZFResExtPathAdd
return the registered additional resource path if file exist, or null if not exist
if return value is not null, the final file path should be "return value + '/' + resPath"
return true if res file specified by path is exist
return true if res file specified by path is a directory
|
extern |
use empty string to find resource's root directory
|
extern |
|
extern |
|
extern |
open a resource file for read only, see ZFFileOpen
since the resource files may or may not be opened by normal method (i.e. ZFFileOpen), such as those in Android project which are located in apk/assets, so use ZFResOpen and ZFResFindFirst to access it for cross-platform
also, since the resource files may or may not be compressed into app, accessing them may or may not take much time
a resource file is a file in "zfres" directory of native project, such as "project_path/zfres/1.png" and "project_path/zfres/subdir/1.png", which should be "1.png" and "subdir/1.png" when ZFResOpen
file name could be the same if under different directories, and is recommended to keep all lower case for cross-platform
note that the token is defined same type as the one used by ZFFileOpen, it's your responsibility to make sure not to misuse it
ADVANCED:
resource can be "extended" by ZFResExtPathAdd, use ZFResRaw series to bypass the logic