#include <lib_zipfile.h>
Allows to read/write ZIP files.
Private Member Functions | |
| ZipFile () | |
| ~ZipFile () | |
Alloc/Free | |
| static ZipFile * | Alloc () | 
| static void | Free (ZipFile *&p) | 
Static | |
| static Bool | CreateLocalFileName (const Filename &fn, String &str) | 
| static Bool | CreateFilename (const String &str, Filename &fn) | 
| static Bool | GetFileCRC (const Filename &fn, UInt32 &ulCRC) | 
| static UInt32 | CalcCRC32 (const void *pBuffer, Int32 lBufferLen, UInt32 ulOldCRC=0) | 
Open/Extract/Close | |
| Bool | Open (const Filename &fn, const Bool bRead, const Int32 lAppend=0) | 
| Bool | OpenEncrypted (const Filename &fn, const Bool bRead, const char *pchKey, Int32 lKeyLength, Int32 lBlockLength, UInt32 lAESFlags, const Int32 lAppend=0) | 
| Bool | SetSpanning (UInt32 ulSpan, Bool bOverwrite) | 
| Bool | ExtractToDirectory (const Filename &fnZip, const Filename &fnDir, Int32 lFlags=0x00000001, ExtractDirectoryCallback fn=nullptr, void *pData=nullptr, const char *pChPassword=nullptr) | 
| Bool | Close () | 
| Bool | Close (const char *pchGlobalComment) | 
| Bool | Close (const String &strGlobalComment) | 
Write | |
| Bool | CreateFileInZip (const String &strName, ZipWriteInfo *pInfo, void *pExtraFieldLocal, UInt32 lExtraSizeLocal, void *pExtraFieldGlobal, UInt32 lExtraSizeGlobal, String *pstrComment, ZipMethod method, INT lLevel, const char *pchPassword=nullptr, UInt32 ulCryptingCRC=0) | 
| Bool | WriteInFileInZip (const void *pBuffer, const UInt32 lLen, const Int32 lExpectedSize=-1) | 
| Bool | CopyInFileInZip (const Filename &fn, const String &str, const char *pchPassword=nullptr) | 
| Bool | CopyInFileInZip (const Filename &fn, const String &str, UInt32 ulInternalAttributes, UInt32 ulExternalAttributes, const char *pchPassword=nullptr) | 
| Bool | CloseFileInZip () | 
| Bool | CreateDirectoryInZip (const String &strName, ZipFileTime *pTime) | 
Read | |
| Bool | GetGlobalInfo (ZipFileGlobalInfo &i) | 
| Bool | GetGlobalComment (String &str) | 
| Bool | GoToFirstFile () | 
| Bool | GoToNextFile () | 
| Bool | LocateFile (const String &strName) | 
| Bool | GetCurrentFileInfo (ZipFileInfo &i) | 
| Bool | GetCurrentFileInfo (String *pstrName, String *pstrComment=nullptr, void *pExtraField=nullptr, UInt32 lExtraFieldSize=0) | 
| Bool | ExtractCurrentFile (const Filename &fnDir, BaseThread *pThread, Int32 lFlags=0x00000001, const char *pchPassword=nullptr, Filename *pfnDest=nullptr) | 
| Bool | ExtractCurrentFile (const Filename &fnDir, Int32 lFlags=0x00000001, const char *pchPassword=nullptr, Filename *pfnDest=nullptr) | 
| Bool | OpenCurrentFile (const char *pChPassword=nullptr) | 
| Bool | CloseCurrentFile () | 
| Int32 | ReadCurrentFile (void *pBuffer, UInt32 lBufferSize) | 
| Int32 | GetCurrentFileReadPosition () | 
| Bool | EndOfCurrentFile () | 
Compression Level | |
| Bool | SetCompressionLevel (Int32 lLevel) | 
| Int32 | GetCompressionLevel () const | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  static | 
      
  | 
  static | 
Creates a local file name.
| [in] | fn | The filename to create from. | 
| [out] | str | Assigned the local file name to create. | 
Creates a file name.
| [in] | str | The file string to create from. | 
| [in] | fn | Assigned the filename to create. | 
Gets a ZIP file CRC.
| [in] | fn | The filename to get the CRC for. | 
| [out] | ulCRC | The calculated CRC. | 
Calculates the CRC from a buffer.
| [in] | pBuffer | The buffer to calculate the CRC from. | 
| [in] | lBufferLen | The buffer length. | 
| [in] | ulOldCRC | The optional initial CRC value. | 
Opens a ZIP file.
| [in] | fn | The file to open. | 
| [in] | bRead | true to open for reading, otherwise false. | 
| [in] | lAppend | The append flags to append the ZIP file to an existing file: ZIP_APPEND | 
| Bool OpenEncrypted | ( | const Filename & | fn, | 
| const Bool | bRead, | ||
| const char * | pchKey, | ||
| Int32 | lKeyLength, | ||
| Int32 | lBlockLength, | ||
| UInt32 | lAESFlags, | ||
| const Int32 | lAppend = 0  | 
        ||
| ) | 
Opens an AES encrypted ZIP file, see AESFile.
| [in] | fn | The encrypted file to open. | 
| [in] | bRead | true to open for reading, otherwise false. | 
| [in] | pchKey | The decryption key. | 
| [in] | lKeyLength | The key length. Must be 128, 192 or 256 (bits). | 
| [in] | lBlockLength | The block size. Must be 128, 192 or 256 (bits). | 
| [in] | lAESFlags | Reserved for later use. Must be set to 0. | 
| [in] | lAppend | The append flags to append the ZIP file to an existing file: ZIP_APPEND | 
Sets the maximum size of the ZIP file. A new file is created with the same name and a consecutive number if it exceeds this size.
| [in] | ulSpan | The maximum size of the file. | 
| [in] | bOverwrite | If true the next file is overwritten. | 
| Bool ExtractToDirectory | ( | const Filename & | fnZip, | 
| const Filename & | fnDir, | ||
| Int32 | lFlags = 0x00000001,  | 
        ||
| ExtractDirectoryCallback | fn = nullptr,  | 
        ||
| void * | pData = nullptr,  | 
        ||
| const char * | pChPassword = nullptr  | 
        ||
| ) | 
Extracts the ZIP file to the specified directory.
| [in] | fnZip | The ZIP filename. | 
| [in] | fnDir | The directory to extract to. | 
| [in] | lFlags | The extract flags: ZIP_EXTRACT | 
| [in] | fn | The extract callback. | 
| [in] | pData | The private data for the extract callback. | 
| [in] | pChPassword | An optional password. | 
| Bool Close | ( | ) | 
Closes the ZIP file.
| Bool Close | ( | const char * | pchGlobalComment | ) | 
Closes the ZIP file and writes a comment.
| [in] | pchGlobalComment | The global comment string. | 
Closes the ZIP file and writes a comment.
| [in] | strGlobalComment | The global comment string. | 
| Bool CreateFileInZip | ( | const String & | strName, | 
| ZipWriteInfo * | pInfo, | ||
| void * | pExtraFieldLocal, | ||
| UInt32 | lExtraSizeLocal, | ||
| void * | pExtraFieldGlobal, | ||
| UInt32 | lExtraSizeGlobal, | ||
| String * | pstrComment, | ||
| ZipMethod | method, | ||
| INT | lLevel, | ||
| const char * | pchPassword = nullptr,  | 
        ||
| UInt32 | ulCryptingCRC = 0  | 
        ||
| ) | 
Creates a file in the ZIP file.
| [in] | strName | The file name. | 
| [in] | pInfo | The write information. | 
| [in] | pExtraFieldLocal | The extra local field. | 
| [in] | lExtraSizeLocal | The extra local size. | 
| [in] | pExtraFieldGlobal | The extra global field. | 
| [in] | lExtraSizeGlobal | The extra global size. | 
| [in] | pstrComment | The comment string. | 
| [in] | method | The ZIP method: ZipMethod | 
| [in] | lLevel | The ZIP compression level, between 0 and 9. | 
| [in] | pchPassword | An optional password. | 
| [in] | ulCryptingCRC | An optional encryption CRC. | 
Writes a buffer in the ZIP file.
| [in] | pBuffer | The buffer to write. | 
| [in] | lLen | The buffer length. | 
| [in] | lExpectedSize | An optional expected size. | 
| Bool CopyInFileInZip | ( | const Filename & | fn, | 
| const String & | str, | ||
| const char * | pchPassword = nullptr  | 
        ||
| ) | 
Copies a file in the ZIP file.
| [in] | fn | The file to copy. | 
| [in] | str | The destination file name. | 
| [in] | pchPassword | An optional password. | 
| Bool CopyInFileInZip | ( | const Filename & | fn, | 
| const String & | str, | ||
| UInt32 | ulInternalAttributes, | ||
| UInt32 | ulExternalAttributes, | ||
| const char * | pchPassword = nullptr  | 
        ||
| ) | 
Copies a file in the ZIP file.
| [in] | fn | The file to copy. | 
| [in] | str | The destination file name. | 
| [in] | ulInternalAttributes | The internal file attributes. | 
| [in] | ulExternalAttributes | The external file attributes. | 
| [in] | pchPassword | An optional password. | 
| Bool CloseFileInZip | ( | ) | 
Closes a file in the ZIP file.
| Bool CreateDirectoryInZip | ( | const String & | strName, | 
| ZipFileTime * | pTime | ||
| ) | 
Creates a directory in the ZIP file. A slash is added if necessary.
| [in] | strName | The directory name. | 
| [in] | pTime | The directory time. | 
| Bool GetGlobalInfo | ( | ZipFileGlobalInfo & | i | ) | 
Retrieves the global information.
| [out] | i | Filled with the global information. | 
Retrieves the global comment.
| [out] | str | Filled with the global comment. | 
| Bool GoToFirstFile | ( | ) | 
Goes to the first file.
| Bool GoToNextFile | ( | ) | 
Goes to the next file.
Locates a file.
| [in] | strName | The file name to locate. | 
| Bool GetCurrentFileInfo | ( | ZipFileInfo & | i | ) | 
Retrieves the information for the current file.
| [out] | i | Filled with the current file information. | 
| Bool GetCurrentFileInfo | ( | String * | pstrName, | 
| String * | pstrComment = nullptr,  | 
        ||
| void * | pExtraField = nullptr,  | 
        ||
| UInt32 | lExtraFieldSize = 0  | 
        ||
| ) | 
Retrieves the information for the current file.
| [out] | pstrName | Filled with the current file name. | 
| [out] | pstrComment | Filled with the current file comment. | 
| [out] | pExtraField | Filled with the current file extra field. | 
| [out] | lExtraFieldSize | Filled with the current file extra field size. | 
| Bool ExtractCurrentFile | ( | const Filename & | fnDir, | 
| BaseThread * | pThread, | ||
| Int32 | lFlags = 0x00000001,  | 
        ||
| const char * | pchPassword = nullptr,  | 
        ||
| Filename * | pfnDest = nullptr  | 
        ||
| ) | 
Extracts the contents of the current archive to the directory fnDir.
| [in] | fnDir | The directory to extract the files to. | 
| [in] | pThread | The thread for extracting in an own thread. | 
| [in] | lFlags | The extract flags: ZIP_EXTRACT | 
| [in] | pchPassword | An optional password. | 
| [out] | pfnDest | An optional filename pointer filled with the destination. | 
| Bool ExtractCurrentFile | ( | const Filename & | fnDir, | 
| Int32 | lFlags = 0x00000001,  | 
        ||
| const char * | pchPassword = nullptr,  | 
        ||
| Filename * | pfnDest = nullptr  | 
        ||
| ) | 
Extracts the contents of the current archive to the directory fnDir.
| [in] | fnDir | The directory to extract the files to. | 
| [in] | lFlags | The extract flags: ZIP_EXTRACT | 
| [in] | pchPassword | An optional password. | 
| [out] | pfnDest | An optional filename pointer filled with the destination. | 
| Bool OpenCurrentFile | ( | const char * | pChPassword = nullptr | ) | 
Opens the current file with password protection.
| [in] | pChPassword | An optional password. | 
| Bool CloseCurrentFile | ( | ) | 
Closes the current file.
Reads a buffer from the current file.
| [in,out] | pBuffer | The buffer to read to. | 
| [in,out] | lBufferSize | The buffer size. | 
| Int32 GetCurrentFileReadPosition | ( | ) | 
Gets the read position in the current file.
| Bool EndOfCurrentFile | ( | ) | 
Checks for the end of the current file.
Sets the compression level of the ZIP file.
| [in] | lLevel | The compression level, ranges from 0 (min) to 9 (max). | 
| Int32 GetCompressionLevel | ( | ) | const | 
Gets the compression level of the ZIP file.