* contrib/hbziparch/_features.h
* contrib/hbziparch/_platform.h
* contrib/hbziparch/Aes.cpp
* contrib/hbziparch/Aes.h
* contrib/hbziparch/BaseLibCompressor.cpp
* contrib/hbziparch/BaseLibCompressor.h
* contrib/hbziparch/BytesWriter.h
* contrib/hbziparch/Bzip2Compressor.cpp
* contrib/hbziparch/Bzip2Compressor.h
* contrib/hbziparch/DeflateCompressor.cpp
* contrib/hbziparch/DeflateCompressor.h
* contrib/hbziparch/DirEnumerator.cpp
* contrib/hbziparch/DirEnumerator.h
* contrib/hbziparch/FileFilter.cpp
* contrib/hbziparch/FileFilter.h
* contrib/hbziparch/FileInfo.h
* contrib/hbziparch/Hmac.cpp
* contrib/hbziparch/Hmac.h
* contrib/hbziparch/RandomPool.cpp
* contrib/hbziparch/RandomPool.h
* contrib/hbziparch/Sha1.cpp
* contrib/hbziparch/Sha1.h
* contrib/hbziparch/std_mfc.h
* contrib/hbziparch/std_stl.h
* contrib/hbziparch/Wildcard.cpp
* contrib/hbziparch/Wildcard.h
* contrib/hbziparch/ZipAbstractFile.h
* contrib/hbziparch/ZipAesCryptograph.cpp
* contrib/hbziparch/ZipAesCryptograph.h
* contrib/hbziparch/ZipArchive.cpp
* contrib/hbziparch/ZipArchive.h
* contrib/hbziparch/ZipAutoBuffer.cpp
* contrib/hbziparch/ZipAutoBuffer.h
* contrib/hbziparch/ZipBaseException.h
* contrib/hbziparch/ZipCallback.h
* contrib/hbziparch/ZipCallbackProvider.h
* contrib/hbziparch/ZipCentralDir.cpp
* contrib/hbziparch/ZipCentralDir.h
* contrib/hbziparch/ZipCollections.h
* contrib/hbziparch/ZipCollections_mfc.h
* contrib/hbziparch/ZipCollections_stl.h
* contrib/hbziparch/ZipCompatibility.cpp
* contrib/hbziparch/ZipCompatibility.h
* contrib/hbziparch/ZipCompressor.cpp
* contrib/hbziparch/ZipCompressor.h
* contrib/hbziparch/ZipCrc32Cryptograph.cpp
* contrib/hbziparch/ZipCrc32Cryptograph.h
* contrib/hbziparch/ZipCryptograph.cpp
* contrib/hbziparch/ZipCryptograph.h
* contrib/hbziparch/ZipException.cpp
* contrib/hbziparch/ZipException.h
* contrib/hbziparch/ZipExtraData.cpp
* contrib/hbziparch/ZipExtraData.h
* contrib/hbziparch/ZipExtraField.cpp
* contrib/hbziparch/ZipExtraField.h
* contrib/hbziparch/ZipFile.h
* contrib/hbziparch/ZipFile_mfc.cpp
* contrib/hbziparch/ZipFile_mfc.h
* contrib/hbziparch/ZipFile_stl.cpp
* contrib/hbziparch/ZipFile_stl.h
* contrib/hbziparch/ZipFileHeader.cpp
* contrib/hbziparch/ZipFileHeader.h
* contrib/hbziparch/ZipFileMapping.h
* contrib/hbziparch/ZipFileMapping_lnx.h
* contrib/hbziparch/ZipFileMapping_win.h
* contrib/hbziparch/ZipMemFile.cpp
* contrib/hbziparch/ZipMemFile.h
* contrib/hbziparch/ZipMutex.h
* contrib/hbziparch/ZipMutex_lnx.h
* contrib/hbziparch/ZipMutex_win.h
* contrib/hbziparch/ZipPathComponent.h
* contrib/hbziparch/ZipPlatform.h
* contrib/hbziparch/ZipPlatformComm.cpp
* contrib/hbziparch/ZipStorage.cpp
* contrib/hbziparch/ZipStorage.h
* contrib/hbziparch/ZipString.h
* contrib/hbziparch/ZipString_mfc.h
* contrib/hbziparch/ZipString_stl.h
* contrib/hbziparch/ZipStringStoreSettings.h
+ ZipArchive lib update finished.
; Pass 2/2
; Please test.
266 lines
7.0 KiB
C++
266 lines
7.0 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// This source file is part of the ZipArchive library source distribution and
|
|
// is Copyrighted 2000 - 2007 by Artpol Software - Tadeusz Dracz
|
|
//
|
|
// This program is free software; you can redistribute it and/or
|
|
// modify it under the terms of the GNU General Public License
|
|
// as published by the Free Software Foundation; either version 2
|
|
// of the License, or (at your option) any later version.
|
|
//
|
|
// For the licensing details refer to the License.txt file.
|
|
//
|
|
// Web Site: http://www.artpol-software.com
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/**
|
|
* \file ZipPlatform.h
|
|
* ZipPlatform namespace declaration.
|
|
*
|
|
*/
|
|
#if !defined(ZIPARCHIVE_ZIPPLATFORM_DOT_H)
|
|
#define ZIPARCHIVE_ZIPPLATFORM_DOT_H
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif
|
|
|
|
class CZipFileHeader;
|
|
class CZipAutoBuffer;
|
|
|
|
#include "ZipString.h"
|
|
#include "ZipPathComponent.h"
|
|
#include <sys/types.h>
|
|
#include "ZipExport.h"
|
|
|
|
/**
|
|
Includes functions that require system-specific implementation.
|
|
*/
|
|
namespace ZipPlatform
|
|
{
|
|
|
|
/**
|
|
Gets the default case-sensitivity for the current file system.
|
|
|
|
\return
|
|
\c true, if the system is case-sensitive; \c false otherwise.
|
|
*/
|
|
ZIP_API bool GetSystemCaseSensitivity();
|
|
|
|
/**
|
|
Gets the current system identifier.
|
|
|
|
\return
|
|
One of the ZipCompatibility::ZipPlatforms values.
|
|
|
|
\see
|
|
CZipArchive::SetSystemCompatibility
|
|
*/
|
|
ZIP_API int GetSystemID();
|
|
|
|
/**
|
|
Gets the default file attributes for the current system.
|
|
|
|
\return
|
|
The default file attributes.
|
|
*/
|
|
ZIP_API DWORD GetDefaultAttributes();
|
|
|
|
/**
|
|
Gets the default directory attributes for the current system.
|
|
|
|
\return
|
|
The default directory attributes.
|
|
*/
|
|
ZIP_API DWORD GetDefaultDirAttributes();
|
|
|
|
/**
|
|
Gets the free space on the given device.
|
|
|
|
\param lpszPath
|
|
Points to the device to test.
|
|
|
|
\return
|
|
The free space in bytes.
|
|
*/
|
|
ZIP_API ULONGLONG GetDeviceFreeSpace(LPCTSTR lpszPath);
|
|
|
|
/**
|
|
Gets the name of a temporary file ensuring there is enough free space in the destination directory.
|
|
|
|
\param lpszPath
|
|
The path to the directory to initially create the file in.
|
|
|
|
\param uSizeNeeded
|
|
The requested free space size in bytes. If set to <code>ZIP_SIZE_TYPE(-1)</code>, the
|
|
space availability is not checked.
|
|
*/
|
|
ZIP_API CZipString GetTmpFileName(LPCTSTR lpszPath = NULL, ZIP_SIZE_TYPE uSizeNeeded = ZIP_SIZE_TYPE(-1));
|
|
|
|
/**
|
|
\name Various operations on files and directories.
|
|
If the functions returns a \c bool value, then \c true indicates that the operation was successful.
|
|
*/
|
|
//@{
|
|
ZIP_API bool GetCurrentDirectory(CZipString& sz); ///< Gets the current directory and stores it in \a sz.
|
|
ZIP_API bool ChangeDirectory(LPCTSTR lpDirectory); ///< Changes the current directory.
|
|
ZIP_API bool SetFileAttr(LPCTSTR lpFileName, DWORD uAttr); ///< Sets the file attributes.
|
|
ZIP_API bool GetFileAttr(LPCTSTR lpFileName, DWORD& uAttr); ///< Gets the file attributes.
|
|
ZIP_API bool GetFileModTime(LPCTSTR lpFileName, time_t & ttime); ///< Gets the file modification time.
|
|
ZIP_API bool SetFileModTime(LPCTSTR lpFileName, time_t ttime); ///< Set the file modification time.
|
|
ZIP_API bool GetFileSize(LPCTSTR lpszFileName, ZIP_SIZE_TYPE& dSize); ///< Gets the file size.
|
|
ZIP_API bool CreateDirectory(LPCTSTR lpDirectory); ///< Creates a new directory.
|
|
ZIP_API bool SetVolLabel(LPCTSTR lpszPath, LPCTSTR lpszLabel); ///< Sets a label on a removable device. \c lpszPath may point to a file on the device.
|
|
ZIP_API bool ForceDirectory(LPCTSTR lpDirectory); ///< Creates nested directories at once.
|
|
ZIP_API bool RemoveFile(LPCTSTR lpszFileName, bool bThrow = true); ///< Removes a file.
|
|
ZIP_API bool RenameFile( LPCTSTR lpszOldName, LPCTSTR lpszNewName, bool bThrow = true); ///< Renames a file.
|
|
|
|
#ifdef ZIP_ARCHIVE_LNX
|
|
ZIP_API bool SetExeAttr( LPCTSTR lpFileName ); ///< Sets executable permissions for a file.
|
|
#endif
|
|
|
|
#if defined ZIP_ARCHIVE_STL || defined ZIP_FILE_USES_STL
|
|
/**
|
|
Truncates the file.
|
|
|
|
\note
|
|
Defined only in the STL version.
|
|
*/
|
|
ZIP_API bool TruncateFile(int iDes, ULONGLONG uSize);
|
|
|
|
/**
|
|
Opens the file.
|
|
|
|
\note
|
|
Defined only in the STL version.
|
|
*/
|
|
ZIP_API int OpenFile(LPCTSTR lpszFileName, UINT iMode, int iShareMode);
|
|
|
|
/**
|
|
Flushes the file to the disk.
|
|
|
|
\note
|
|
Defined only in the STL version.
|
|
*/
|
|
ZIP_API bool FlushFile(int iDes);
|
|
|
|
/**
|
|
Gets the underlying system handle.
|
|
|
|
\note
|
|
Defined only in the STL version.
|
|
*/
|
|
ZIP_API intptr_t GetFileSystemHandle(int iDes);
|
|
#endif
|
|
//@}
|
|
|
|
/**
|
|
Checks if the given directory exists.
|
|
|
|
\param lpszDir
|
|
The directory to test.
|
|
|
|
\return
|
|
\c true, if \a lpszDir exists; \c false otherwise.
|
|
*/
|
|
ZIP_API bool DirectoryExists(LPCTSTR lpszDir);
|
|
|
|
/**
|
|
Checks if the given drive is removable.
|
|
|
|
\param lpszFilePath
|
|
The path to the drive. May point to a file path or a directory on the drive.
|
|
|
|
\return
|
|
\c true. if the drive is removable; \c false otherwise.
|
|
|
|
\note
|
|
Implemented only on Windows system, on all others always returns \c true.
|
|
*/
|
|
ZIP_API bool IsDriveRemovable(LPCTSTR lpszFilePath);
|
|
|
|
/**
|
|
Checks if the given attributes represent a directory.
|
|
|
|
\param uAttr
|
|
The attributes to test.
|
|
|
|
\return
|
|
\c true if the attributes represent a directory; \c false otherwise.
|
|
*/
|
|
ZIP_API bool IsDirectory(DWORD uAttr);
|
|
|
|
/**
|
|
Performs the translation between ANSI and OEM character sets.
|
|
|
|
\param buffer
|
|
The buffer containing characters to be translated.
|
|
|
|
\param bAnsiToOem
|
|
If \c true, convert ANSI to OEM; if \c false, OEM to ANSI.
|
|
*/
|
|
ZIP_API void AnsiOem(CZipAutoBuffer& buffer, bool bAnsiToOem);
|
|
|
|
/**
|
|
Checks if the given file or directory exists.
|
|
|
|
\param lpszName
|
|
The path to the file or directory to test.
|
|
|
|
\return
|
|
One of the following values:
|
|
- \c -1 : the given file exists and is a directory
|
|
- \c 1 : the given file exists and is a regular file
|
|
- \c 0 : there is no such a file
|
|
*/
|
|
ZIP_API int FileExists(LPCTSTR lpszName);
|
|
|
|
#ifdef _UNICODE
|
|
/**
|
|
Converts a wide character string to a multi-byte character string.
|
|
|
|
\param lpszIn
|
|
The wide character string to convert.
|
|
|
|
\param szOut
|
|
The buffer to receive the converted string.
|
|
Does not contain the terminating \c NULL character.
|
|
|
|
\param uCodePage
|
|
The code page used in conversion.
|
|
|
|
\return
|
|
The \a szOut buffer length, or \c -1 when not succeeded.
|
|
|
|
\note
|
|
Defined only in the UNICODE version.
|
|
*/
|
|
ZIP_API int WideToMultiByte(LPCWSTR lpszIn, CZipAutoBuffer &szOut, UINT uCodePage);
|
|
|
|
/**
|
|
Converts a multi-byte character string to a wide character string.
|
|
|
|
\param szIn
|
|
The multi-byte character string to convert.
|
|
Should not contain the terminating \c NULL character.
|
|
|
|
\param szOut
|
|
Receives the converted string.
|
|
|
|
\param uCodePage
|
|
The code page used in conversion.
|
|
|
|
\return
|
|
The length of the string after the conversion (without the terminating \c NULL character)
|
|
or \c -1 when the function did not succeed.
|
|
|
|
\note
|
|
Defined only in the UNICODE version.
|
|
*/
|
|
ZIP_API int MultiByteToWide(const CZipAutoBuffer &szIn, CZipString& szOut, UINT uCodePage);
|
|
#endif
|
|
};
|
|
|
|
|
|
#endif // !defined(ZIPARCHIVE_ZIPPLATFORM_DOT_H)
|
|
|