ZipPlatform.h
Go to the documentation of this file.
1 
2 // This source file is part of the ZipArchive Library Open Source distribution
3 // and is Copyrighted 2000 - 2022 by Artpol Software - Tadeusz Dracz
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // For the licensing details refer to the License.txt file.
11 //
12 // Web Site: https://www.artpol-software.com
14 
20 #if !defined(ZIPARCHIVE_ZIPPLATFORM_DOT_H)
21 #define ZIPARCHIVE_ZIPPLATFORM_DOT_H
22 
23 #if _MSC_VER > 1000
24 #pragma once
25 #endif
26 
27 class CZipFileHeader;
28 class CZipAutoBuffer;
29 
30 #include "ZipString.h"
31 #include "ZipPathComponent.h"
32 #include <sys/types.h>
33 #include "ZipExport.h"
34 
38 namespace ZipPlatform
39 {
44  {
45  fomRegular = 0x00,
48 #if defined _ZIP_SYSTEM_WIN && defined SHFileOperation
49  ,fomRecycleBin = 0x04
50 #endif
51  };
58  ZIP_API bool GetSystemCaseSensitivity();
59 
69  ZIP_API int GetSystemID();
70 
77  ZIP_API DWORD GetDefaultAttributes();
78 
85  ZIP_API DWORD GetDefaultDirAttributes();
86 
96  ZIP_API ULONGLONG GetDeviceFreeSpace(LPCTSTR lpszPath);
97 
108  ZIP_API CZipString GetTmpFileName(LPCTSTR lpszPath = NULL, ZIP_SIZE_TYPE uSizeNeeded = 0);
109 
115  ZIP_API bool GetCurrentDirectory(CZipString& sz);
116  ZIP_API bool ChangeDirectory(LPCTSTR lpDirectory);
117  ZIP_API bool SetFileAttr(LPCTSTR lpFileName, DWORD uAttr);
118  ZIP_API bool GetFileAttr(LPCTSTR lpFileName, DWORD& uAttr);
119  ZIP_API bool GetFileTimes(LPCTSTR lpFileName, time_t* tModificationTime, time_t* tCreationTime = NULL, time_t* tLastAccessTime = NULL);
120  ZIP_API bool SetFileTimes(LPCTSTR lpFileName, const time_t* tModificationTime, const time_t* tCreationTime = NULL, const time_t* tLastAccessTime = NULL);
121  ZIP_API bool GetFileSize(LPCTSTR lpszFileName, ZIP_SIZE_TYPE& dSize);
122  ZIP_API bool CreateNewDirectory(LPCTSTR lpDirectory);
123  ZIP_API bool SetVolLabel(LPCTSTR lpszPath, LPCTSTR lpszLabel);
124  ZIP_API bool ForceDirectory(LPCTSTR lpDirectory);
125  ZIP_API bool RemoveFile(LPCTSTR lpszFileName, bool bThrow = true, int iMode = fomRegular);
126  ZIP_API bool RenameFile( LPCTSTR lpszOldName, LPCTSTR lpszNewName, bool bThrow = true);
127  void ConvertTimeToFileTime(const time_t& ttime, ZFILETIME& fileTime); // Converts time from the \c time_t format to the \c FILETIME format.
128  bool ConvertFileTimeToTime(const ZFILETIME& fileTime, time_t& ttime); // Converts time from the \c time_t format to the \c FILETIME format.
129 
130 #ifdef _ZIP_SYSTEM_LINUX
131  ZIP_API bool SetExeAttr( LPCTSTR lpFileName );
132 #endif
133 #ifdef _ZIP_SYSTEM_WIN
134  ZIP_API bool SetFileAttr(HANDLE handle, DWORD uAttr);
135  ZIP_API bool SetFileTimes(HANDLE handle, const time_t* tModificationTime, const time_t* tCreationTime = NULL, const time_t* tLastAccessTime = NULL);
136 #endif
137 
138 #if defined _ZIP_IMPL_STL || _ZIP_FILE_IMPLEMENTATION == ZIP_ZFI_STL
139 
145  ZIP_API bool TruncateFile(int iDes, ULONGLONG uSize);
146 
153  ZIP_API int OpenFile(LPCTSTR lpszFileName, UINT iMode, int iShareMode);
154 
161  ZIP_API bool FlushFile(int iDes);
162 
169  ZIP_API intptr_t GetFileSystemHandle(int iDes);
170 #endif
171 
172 
173 
186  ZIP_API bool IsDriveRemovable(LPCTSTR lpszFilePath);
187 
197  ZIP_API bool IsDirectory(DWORD uAttr);
198 
199 
209  ZIP_API void AnsiOem(CZipAutoBuffer& buffer, bool bAnsiToOem);
210 
223  ZIP_API int FileExists(LPCTSTR lpszName);
224 
225 #ifdef _UNICODE
226 
245  ZIP_API int WideToMultiByte(LPCWSTR lpszIn, CZipAutoBuffer &szOut, UINT uCodePage);
246 
269  ZIP_API int WideToMultiByte(LPCWSTR lpszIn, CZipAutoBuffer &szOut, bool bAddNull, UINT uCodePage);
270 
291  ZIP_API int MultiByteToWide(const CZipAutoBuffer &szIn, CZipString& szOut, UINT uCodePage);
292 
293 
317  ZIP_API int MultiByteToWide(const char* szIn, int iInSize, CZipString& szOut, UINT uCodePage);
318 #endif
319 };
320 
321 
322 #endif // !defined(ZIPARCHIVE_ZIPPLATFORM_DOT_H)
323 

The ZipArchive Library Copyright © 2000 - 2022 Artpol Software - Tadeusz Dracz. Generated at Sat Dec 17 2022 19:57:04.