35#if OGRE_THREAD_SUPPORT
104 bool dirs =
false)
const;
147 return resZipArchive;
181 size_t read(
void* buf,
size_t count);
183 size_t write(
void* buf,
size_t count);
struct zzip_file ZZIP_FILE
union _zzip_plugin_io zzip_plugin_io_handlers
Abstract factory class, archive codec plugins can register concrete subclasses of this.
Archive(const String &name, const String &archType)
Constructor - don't call direct, used by ArchiveFactory.
DataStream(uint16 accessMode=READ)
Constructor for creating unnamed streams.
static void removeEmbbeddedFile(const String &name)
Remove an embedded file to the embedded file list.
static zzip_plugin_io_handlers * mPluginIo
A static pointer to file io alternative implementation for the embedded files.
EmbeddedZipArchiveFactory()
Archive * createInstance(const String &name, bool readOnly)
Creates a new object.
bool(* DecryptEmbeddedZipFileFunc)(size_t pos, void *buf, size_t len)
a function type to decrypt embedded zip file
static void addEmbbeddedFile(const String &name, const uint8 *fileData, size_t fileSize, DecryptEmbeddedZipFileFunc decryptFunc)
Add an embedded file to the embedded file list.
const String & getType(void) const
Returns the factory type.
virtual ~EmbeddedZipArchiveFactory()
Template version of cache based on static array.
Specialisation of ArchiveFactory for Zip files.
Archive * createInstance(const String &name, bool readOnly)
Creates a new object.
const String & getType(void) const
Returns the factory type.
void destroyInstance(Archive *ptr)
Destroys an object which was created by this factory.
virtual ~ZipArchiveFactory()
Specialisation of the Archive class to allow reading of files from a zip format source archive.
bool exists(const String &filename)
Find out if the named file exists (note: fully qualified filename required)
DataStreamPtr create(const String &filename) const
Create a new file (or overwrite one already there).
void unload()
Unloads the archive.
FileInfoList mFileList
File list (since zziplib seems to only allow scanning of dir tree once)
StringVectorPtr find(const String &pattern, bool recursive=true, bool dirs=false)
Find all file or directory names matching a given pattern in this archive.
void load()
Loads the archive.
void remove(const String &filename) const
Delete a named file.
StringVectorPtr list(bool recursive=true, bool dirs=false)
List all file names in the archive.
ZipArchive(const String &name, const String &archType, zzip_plugin_io_handlers *pluginIo=NULL)
FileInfoListPtr listFileInfo(bool recursive=true, bool dirs=false)
List all files in the archive with accompanying information.
time_t getModifiedTime(const String &filename)
Retrieve the modification time of a given file.
ZZIP_DIR * mZzipDir
Handle to root zip file.
void checkZzipError(int zzipError, const String &operation) const
Handle any errors from zzip.
zzip_plugin_io_handlers * mPluginIo
A pointer to file io alternative implementation.
FileInfoListPtr findFileInfo(const String &pattern, bool recursive=true, bool dirs=false) const
Find all files or directories matching a given pattern in this archive and get some detailed informat...
DataStreamPtr open(const String &filename, bool readOnly=true) const
Open a stream on a given file.
bool isCaseSensitive(void) const
Returns whether this archive is case sensitive in the way it matches files.
void close(void)
Close the stream; this makes further operations invalid.
bool eof(void) const
Returns true if the stream has reached the end.
ZipDataStream(ZZIP_FILE *zzipFile, size_t uncompressedSize)
Unnamed constructor.
size_t read(void *buf, size_t count)
Read the requisite number of bytes from the stream, stopping at the end of the file.
size_t tell(void) const
Repositions the read point to a specified byte.
void seek(size_t pos)
Repositions the read point to a specified byte.
ZipDataStream(const String &name, ZZIP_FILE *zzipFile, size_t uncompressedSize)
Constructor for creating named streams.
size_t write(void *buf, size_t count)
Write the requisite number of bytes from the stream (only applicable to streams that are not read-onl...
void skip(long count)
Skip a defined number of bytes.
StaticCache< 2 *OGRE_STREAM_TEMP_SIZE > mCache
We need caching because sometimes serializers step back in data stream and zziplib behaves slow.
SharedPtr< StringVector > StringVectorPtr
vector< FileInfo >::type FileInfoList
SharedPtr< DataStream > DataStreamPtr
Shared pointer to allow data streams to be passed around without worrying about deallocation.
SharedPtr< FileInfoList > FileInfoListPtr