Skip Navigation Links
Skip Navigation LinksHome > ZipArchive > How to Use > API Documentation

ZipPlatform Namespace Reference


Functions

ZIP_API void AnsiOem (CZipAutoBuffer &buffer, bool bAnsiToOem)
ZIP_API bool DirectoryExists (LPCTSTR lpszDir)
ZIP_API int FileExists (LPCTSTR lpszName)
ZIP_API DWORD GetDefaultAttributes ()
ZIP_API DWORD GetDefaultDirAttributes ()
ZIP_API ULONGLONG GetDeviceFreeSpace (LPCTSTR lpszPath)
ZIP_API bool GetSystemCaseSensitivity ()
ZIP_API int GetSystemID ()
ZIP_API CZipString GetTmpFileName (LPCTSTR lpszPath=NULL, ZIP_SIZE_TYPE uSizeNeeded=ZIP_SIZE_TYPE(-1))
ZIP_API bool IsDirectory (DWORD uAttr)
ZIP_API bool IsDriveRemovable (LPCTSTR lpszFilePath)
ZIP_API int MultiByteToWide (const CZipAutoBuffer &szIn, CZipString &szOut, UINT uCodePage)
ZIP_API int WideToMultiByte (LPCWSTR lpszIn, CZipAutoBuffer &szOut, UINT uCodePage)
Various operations on files and directories.
If the functions returns a bool value, then true indicates that the operation was successful.

ZIP_API bool ChangeDirectory (LPCTSTR lpDirectory)
 Changes the current directory.
ZIP_API bool CreateDirectory (LPCTSTR lpDirectory)
 Creates a new directory.
ZIP_API bool FlushFile (int iDes)
ZIP_API bool ForceDirectory (LPCTSTR lpDirectory)
 Creates nested directories at once.
ZIP_API bool GetCurrentDirectory (CZipString &sz)
 Gets the current directory and stores it in sz.
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 GetFileSize (LPCTSTR lpszFileName, ZIP_SIZE_TYPE &dSize)
 Gets the file size.
ZIP_API intptr_t GetFileSystemHandle (int iDes)
ZIP_API int OpenFile (LPCTSTR lpszFileName, UINT iMode, int iShareMode)
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.
ZIP_API bool SetFileAttr (LPCTSTR lpFileName, DWORD uAttr)
 Sets the file attributes.
ZIP_API bool SetFileModTime (LPCTSTR lpFileName, time_t ttime)
 Set the file modification time.
ZIP_API bool SetVolLabel (LPCTSTR lpszPath, LPCTSTR lpszLabel)
 Sets a label on a removable device. lpszPath may point to a file on the device.
ZIP_API bool TruncateFile (int iDes, ULONGLONG uSize)

Detailed Description

Includes functions that require system-specific implementation.

Function Documentation

ZIP_API void ZipPlatform::AnsiOem ( CZipAutoBuffer &  buffer,
bool  bAnsiToOem 
)

Performs the translation between ANSI and OEM character sets.

Parameters:
buffer The buffer containing characters to be translated.
bAnsiToOem If true, convert ANSI to OEM; if false, OEM to ANSI.

ZIP_API bool ZipPlatform::ChangeDirectory ( LPCTSTR  lpDirectory  ) 

Changes the current directory.

ZIP_API bool ZipPlatform::CreateDirectory ( LPCTSTR  lpDirectory  ) 

Creates a new directory.

ZIP_API bool ZipPlatform::DirectoryExists ( LPCTSTR  lpszDir  ) 

Checks if the given directory exists.

Parameters:
lpszDir The directory to test.
Returns:
true, if lpszDir exists; false otherwise.

ZIP_API int ZipPlatform::FileExists ( LPCTSTR  lpszName  ) 

Checks if the given file or directory exists.

Parameters:
lpszName The path to the file or directory to test.
Returns:
One of the following values:
  • -1 : the given file exists and is a directory
  • 1 : the given file exists and is a regular file
  • 0 : there is no such a file

ZIP_API bool ZipPlatform::FlushFile ( int  iDes  ) 

Flushes the file to the disk.

Note:
Defined only in the STL version.

ZIP_API bool ZipPlatform::ForceDirectory ( LPCTSTR  lpDirectory  ) 

Creates nested directories at once.

ZIP_API bool ZipPlatform::GetCurrentDirectory ( CZipString &  sz  ) 

Gets the current directory and stores it in sz.

ZIP_API DWORD ZipPlatform::GetDefaultAttributes (  ) 

Gets the default file attributes for the current system.

Returns:
The default file attributes.

ZIP_API DWORD ZipPlatform::GetDefaultDirAttributes (  ) 

Gets the default directory attributes for the current system.

Returns:
The default directory attributes.

ZIP_API ULONGLONG ZipPlatform::GetDeviceFreeSpace ( LPCTSTR  lpszPath  ) 

Gets the free space on the given device.

Parameters:
lpszPath Points to the device to test.
Returns:
The free space in bytes.

ZIP_API bool ZipPlatform::GetFileAttr ( LPCTSTR  lpFileName,
DWORD &  uAttr 
)

Gets the file attributes.

ZIP_API bool ZipPlatform::GetFileModTime ( LPCTSTR  lpFileName,
time_t &  ttime 
)

Gets the file modification time.

ZIP_API bool ZipPlatform::GetFileSize ( LPCTSTR  lpszFileName,
ZIP_SIZE_TYPE &  dSize 
)

Gets the file size.

ZIP_API intptr_t ZipPlatform::GetFileSystemHandle ( int  iDes  ) 

Gets the underlying system handle.

Note:
Defined only in the STL version.

ZIP_API bool ZipPlatform::GetSystemCaseSensitivity (  ) 

Gets the default case-sensitivity for the current file system.

Returns:
true, if the system is case-sensitive; false otherwise.

ZIP_API int ZipPlatform::GetSystemID (  ) 

Gets the current system identifier.

Returns:
One of the ZipCompatibility::ZipPlatforms values.
See also:
CZipArchive::SetSystemCompatibility

ZIP_API CZipString ZipPlatform::GetTmpFileName ( LPCTSTR  lpszPath = NULL,
ZIP_SIZE_TYPE  uSizeNeeded = ZIP_SIZE_TYPE(-1) 
)

Gets the name of a temporary file ensuring there is enough free space in the destination directory.

Parameters:
lpszPath The path to the directory to initially create the file in.
uSizeNeeded The requested free space size in bytes. If set to ZIP_SIZE_TYPE(-1), the space availability is not checked.

ZIP_API bool ZipPlatform::IsDirectory ( DWORD  uAttr  ) 

Checks if the given attributes represent a directory.

Parameters:
uAttr The attributes to test.
Returns:
true if the attributes represent a directory; false otherwise.

ZIP_API bool ZipPlatform::IsDriveRemovable ( LPCTSTR  lpszFilePath  ) 

Checks if the given drive is removable.

Parameters:
lpszFilePath The path to the drive. May point to a file path or a directory on the drive.
Returns:
true. if the drive is removable; false otherwise.
Note:
Implemented only on Windows system, on all others always returns true.

ZIP_API int ZipPlatform::MultiByteToWide ( const CZipAutoBuffer &  szIn,
CZipString &  szOut,
UINT  uCodePage 
)

Converts a multi-byte character string to a wide character string.

Parameters:
szIn The multi-byte character string to convert. Should not contain the terminating NULL character.
szOut Receives the converted string.
uCodePage The code page used in conversion.
Returns:
The length of the string after the conversion (without the terminating NULL character) or -1 when the function did not succeed.
Note:
Defined only in the UNICODE version.

ZIP_API int ZipPlatform::OpenFile ( LPCTSTR  lpszFileName,
UINT  iMode,
int  iShareMode 
)

Opens the file.

Note:
Defined only in the STL version.

ZIP_API bool ZipPlatform::RemoveFile ( LPCTSTR  lpszFileName,
bool  bThrow = true 
)

Removes a file.

ZIP_API bool ZipPlatform::RenameFile ( LPCTSTR  lpszOldName,
LPCTSTR  lpszNewName,
bool  bThrow = true 
)

Renames a file.

ZIP_API bool ZipPlatform::SetFileAttr ( LPCTSTR  lpFileName,
DWORD  uAttr 
)

Sets the file attributes.

ZIP_API bool ZipPlatform::SetFileModTime ( LPCTSTR  lpFileName,
time_t  ttime 
)

Set the file modification time.

ZIP_API bool ZipPlatform::SetVolLabel ( LPCTSTR  lpszPath,
LPCTSTR  lpszLabel 
)

Sets a label on a removable device. lpszPath may point to a file on the device.

ZIP_API bool ZipPlatform::TruncateFile ( int  iDes,
ULONGLONG  uSize 
)

Truncates the file.

Note:
Defined only in the STL version.

ZIP_API int ZipPlatform::WideToMultiByte ( LPCWSTR  lpszIn,
CZipAutoBuffer &  szOut,
UINT  uCodePage 
)

Converts a wide character string to a multi-byte character string.

Parameters:
lpszIn The wide character string to convert.
szOut The buffer to receive the converted string. Does not contain the terminating NULL character.
uCodePage The code page used in conversion.
Returns:
The szOut buffer length, or -1 when not succeeded.
Note:
Defined only in the UNICODE version.

Back To Top Up