63#define IOINTF_INVALIDNAME -11
67#define IOINTF_NOTFOUND -12
71#define IOINTF_EXIST -13
75#define IOINTF_ENOENT -14
79#define IOINTF_NOACCESS -15
83#define IOINTF_NOTEMPTY -16
87#define IOINTF_NOSPACE -17
91#define IOINTF_IOERROR -18
97#define IOINTF_LOCKED -20
102#define IOINTF_NOIMPLEMENTATION -50
106#define IOINTF_BUFTOOSMALL -51
111#define IOINTF_NOZIPLIB -100
116#define IOINTF_NOTCOMPRESSED -101
120#define IOINTF_ZIPERROR -102
127#define IOINTF_NOAESLIB -200
131#define IOINTF_AES_NO_SUPPORT -201
134#define IOINTF_NO_PASSWORD -202
138#define IOINTF_WRONG_PASSWORD -203
144#define IOINTF_AES_WRONG_AUTH -204
151#define IOINTF_AES_COMPROMISED -205
158typedef struct IoIntf* IoIntfPtr;
160typedef struct DirIntf* DirIntfPtr;
162typedef struct ResIntf* ResIntfPtr;
178#define OpenRes_READ 1
181#define OpenRes_WRITE 2
184#define OpenRes_APPEND 4
202 IoIntfPtr o,
const char* password,
size_t passwordLen);
216 IoIntfPtr o, BaBool passwordRequired, BaBool passwordBin);
245 IoIntfPtr o,
const char* name,BaBool* isEncrypted);
261 IoIntfPtr io,
const char* name,
int* status,
const char** ecode);
270 ResIntfPtr resPtr,
const char* name,
ThreadMutex* m,
271 BaFileSize* size, BaBool* isCompressed);
308 int* status,
const char** ecode);
333 U32 mode,
int* status,
344 int* status,
const char** ecode);
348typedef int (*
IoIntf_MkDir)(IoIntfPtr o,
const char* name,
const char** ecode);
356typedef int (*
IoIntf_Remove)(IoIntfPtr o,
const char* name,
const char** ecode);
360typedef int (*
IoIntf_RmDir)(IoIntfPtr o,
const char* name,
const char** ecode);
362typedef int (*IoIntf_SeekAndRead)(
363 ResIntfPtr super, BaFileSize offset,
void* buf,
size_t maxSize,
size_t* size);
366typedef void (*IoIntf_OnTerminate)(IoIntfPtr o, IoIntfPtr io);
419 struct IoIntf* attachedIo;
420 IoIntf_OnTerminate onTerminate;
426#define IoIntf_constructorRW(o, property, closeDir, mkDir, rename,\
427 openDir, openRes, openResGzip, rm,\
429 (o)->propertyFp=property;\
430 (o)->closeDirFp=closeDir;\
432 (o)->renameFp=rename;\
433 (o)->openDirFp=openDir;\
434 (o)->openResFp=openRes;\
435 (o)->openResGzipFp=openResGzip;\
447#define IoIntf_constructorR(o, property, closeDir, openDir,\
448 openRes, openResGzip, st) do {\
449 (o)->propertyFp=property;\
450 (o)->closeDirFp=closeDir;\
453 (o)->openDirFp=openDir;\
454 (o)->openResFp=openRes;\
455 (o)->openResGzipFp=openResGzip;\
471typedef const char* (*DirIntf_GetName)(DirIntfPtr o);
506#define DirIntf_constructor(o, read, getName, st) do {\
508 (o)->getNameFp=getName;\
515 ResIntfPtr o,
void* buf,
size_t maxSize,
size_t* size);
516typedef int (*ResIntf_Write)(ResIntfPtr o,
const void* buf,
size_t size);
517typedef int (*ResIntf_Seek)(ResIntfPtr o, BaFileSize offset);
518typedef int (*ResIntf_Flush)(ResIntfPtr o);
519typedef int (*ResIntf_Close)(ResIntfPtr o);
538#define ResIntf_constructor(o, read, write, seek, flush, close) do {\
ResIntfPtr(* IoIntf_InflateGzip)(IoIntfPtr io, const char *name, int *status, const char **ecode)
Open a file for writing.
Definition: IoIntf.h:260
int(* IoIntf_Stat)(IoIntfPtr o, const char *name, IoStat *st)
Fetch resource information.
Definition: IoIntf.h:312
BA_API char * IoIntf_getAbspath(IoIntfPtr o, const char *path)
wrapper for IoIntf_Property: 'abs'.
int(* IoIntf_Rename)(IoIntfPtr o, const char *from, const char *to, const char **ecode)
Close an open directory iterator.
Definition: IoIntf.h:352
ResIntfPtr(* IoIntf_OpenRes)(IoIntfPtr o, const char *name, U32 mode, int *status, const char **ecode)
Open a file for reading or writing.
Definition: IoIntf.h:332
int(* IoIntf_MkDir)(IoIntfPtr o, const char *name, const char **ecode)
Create a new directory.
Definition: IoIntf.h:348
struct IoIntf IoIntf
The IoIntf class specifies an abstract file API, implementations include ZipIo, DiskIo,...
int(* IoIntf_RmDir)(IoIntfPtr o, const char *name, const char **ecode)
delete an empty directory.
Definition: IoIntf.h:360
int(* IoIntf_Remove)(IoIntfPtr o, const char *name, const char **ecode)
Delete a file.
Definition: IoIntf.h:356
ResIntfPtr(* IoIntf_OpenResGzip)(IoIntfPtr o, const char *name, ThreadMutex *m, BaFileSize *size, int *status, const char **ecode)
Returns data as a compressed gzip file.
Definition: IoIntf.h:342
int(* DirIntf_Read)(DirIntfPtr o)
Iterate to next resource in directory.
Definition: IoIntf.h:467
BA_API int IoIntf_setPassword(IoIntfPtr o, const char *password, size_t passwordLen)
wrapper for IoIntf_Property: 'pl'.
struct DirIntf DirIntf
Directory handle for a directory opened with IoIntf_OpenDir.
ResIntfPtr(* IoIntf_DeflateGzip)(ResIntfPtr resPtr, const char *name, ThreadMutex *m, BaFileSize *size, BaBool *isCompressed)
Deflate a file or portion of a file to temporary storage.
Definition: IoIntf.h:269
const char *(* DirIntf_GetName)(DirIntfPtr o)
Returns the resource name.
Definition: IoIntf.h:471
struct ResIntf ResIntf
Resource handle for a directory opened with IoIntf_OpenRes.
BA_API void IoIntf_destructor(IoIntfPtr o)
Virtual destructor.
int(* DirIntf_Stat)(DirIntfPtr o, IoStat *st)
Returns resource information.
Definition: IoIntf.h:475
int(* ResIntf_Read)(ResIntfPtr o, void *buf, size_t maxSize, size_t *size)
Abstract Resource Interface.
Definition: IoIntf.h:514
BA_API int IoIntf_isEncrypted(IoIntfPtr o, const char *name, BaBool *isEncrypted)
wrapper for IoIntf_Property: 'aes'.
int(* IoIntf_CloseDir)(IoIntfPtr o, DirIntfPtr *dirIntf)
Close an open directory iterator.
Definition: IoIntf.h:338
DirIntfPtr(* IoIntf_OpenDir)(IoIntfPtr o, const char *dirname, int *status, const char **ecode)
Open a directory for reading.
Definition: IoIntf.h:307
BA_API int IoIntf_setPasswordProp(IoIntfPtr o, BaBool passwordRequired, BaBool passwordBin)
wrapper for IoIntf_Property: 'pp'.
int(* IoIntf_Property)(IoIntfPtr o, const char *name, void *a, void *b)
Set or get properties.
Definition: IoIntf.h:302
BA_API int IoIntf_getType(IoIntfPtr o, const char **type, const char **platform)
wrapper for IoIntf_Property: 'type'.
S64 BaTime
An arithmetic type representing calendar time with epoch of 1970-01-01 00:00:10 GMT – i....
Definition: GenPrimT.h:93
Directory handle for a directory opened with IoIntf_OpenDir.
Definition: IoIntf.h:495
DirIntf_Read readFp
Iterate the resources in the file system.
Definition: IoIntf.h:498
DirIntf_GetName getNameFp
Get resource name.
Definition: IoIntf.h:500
DirIntf_Stat statFp
Get resource information.
Definition: IoIntf.h:502
The IoIntf class specifies an abstract file API, implementations include ZipIo, DiskIo,...
Definition: IoIntf.h:377
IoIntf_Rename renameFp
Rename resource.
Definition: IoIntf.h:392
IoIntf_RmDir rmDirFp
Remove directory.
Definition: IoIntf.h:412
IoIntf_OpenDir openDirFp
Open directory.
Definition: IoIntf.h:396
IoIntf_OpenResGzip openResGzipFp
Open file as a compressed gzip file.
Definition: IoIntf.h:404
IoIntf_Property propertyFp
Set or get property.
Definition: IoIntf.h:380
IoIntf_Remove removeFp
Remove file.
Definition: IoIntf.h:408
IoIntf_OpenRes openResFp
Open resource.
Definition: IoIntf.h:400
IoIntf_Stat statFp
Get resource information.
Definition: IoIntf.h:416
IoIntf_MkDir mkDirFp
Make directory.
Definition: IoIntf.h:388
IoIntf_CloseDir closeDirFp
Close directory.
Definition: IoIntf.h:384
Resource information.
Definition: IoIntf.h:168
BaFileSize size
Get size.
Definition: IoIntf.h:172
BaTime lastModified
Get lastModified time.
Definition: IoIntf.h:170
BaBool isDir
Resource type.
Definition: IoIntf.h:174
Resource handle for a directory opened with IoIntf_OpenRes.
Definition: IoIntf.h:525
ResIntf_Seek seekFp
Seek to position in resource.
Definition: IoIntf.h:531
ResIntf_Close closeFp
Close the resource and release any data.
Definition: IoIntf.h:535
ResIntf_Flush flushFp
Flush resource.
Definition: IoIntf.h:533
ResIntf_Read readFp
Read from resource.
Definition: IoIntf.h:527
ResIntf_Write writeFp
Write to resource.
Definition: IoIntf.h:529
A mutual exclusion class.
Definition: ThreadLib.h:186