cocos2d-x
3.3
|
Zip file - reader helper class. More...
#include <ZipUtils.h>
Public Member Functions | |
ZipFile (const std::string &zipFile, const std::string &filter=std::string()) | |
Constructor, open zip file and store file list. More... | |
virtual | ~ZipFile () |
bool | setFilter (const std::string &filter) |
Regenerate accessible file list based on a new filter string. More... | |
bool | fileExists (const std::string &fileName) const |
Check does a file exists or not in zip file. More... | |
unsigned char * | getFileData (const std::string &fileName, ssize_t *size) |
Get resource file data from a zip file. More... | |
std::string | getFirstFilename () |
std::string | getNextFilename () |
Static Public Member Functions | |
static ZipFile * | createWithBuffer (const void *buffer, unsigned long size) |
Zip file - reader helper class.
It will cache the file list of a particular zip file with positions inside an archive, so it would be much faster to read some particular files or to check their existance.
ZipFile | ( | const std::string & | zipFile, |
const std::string & | filter = std::string() |
||
) |
Constructor, open zip file and store file list.
zipFile | Zip file name |
filter | The first part of file names, which should be accessible. For example, "assets/". Other files will be missed. |
|
virtual |
|
static |
bool fileExists | ( | const std::string & | fileName | ) | const |
Check does a file exists or not in zip file.
fileName | File to be checked on existance |
unsigned char* getFileData | ( | const std::string & | fileName, |
ssize_t * | size | ||
) |
Get resource file data from a zip file.
fileName | File name | |
[out] | pSize | If the file read operation succeeds, it will be the data size, otherwise 0. |
std::string getFirstFilename | ( | ) |
std::string getNextFilename | ( | ) |
bool setFilter | ( | const std::string & | filter | ) |
Regenerate accessible file list based on a new filter string.
filter | New filter string (first part of files names) |