PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: FileSearchZip.h * 00003 * 00004 * Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLCORE_FILESEARCH_ZIP_H__ 00024 #define __PLCORE_FILESEARCH_ZIP_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLCore/File/ZipHandle.h" 00032 #include "PLCore/File/FileSearchImpl.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLCore { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Classes ] 00043 //[-------------------------------------------------------] 00044 /** 00045 * @brief 00046 * ZIP implementation of 'FileSearchImpl' 00047 */ 00048 class FileSearchZip : public FileSearchImpl { 00049 00050 00051 //[-------------------------------------------------------] 00052 //[ Friends ] 00053 //[-------------------------------------------------------] 00054 friend class FileSearch; 00055 friend class FileZip; 00056 00057 00058 //[-------------------------------------------------------] 00059 //[ Private functions ] 00060 //[-------------------------------------------------------] 00061 private: 00062 /** 00063 * @brief 00064 * Constructor 00065 * 00066 * @param[in] sZipFile 00067 * Path to the ZIP-file 00068 * @param[in] sPathInZip 00069 * Path inside the ZIP-file 00070 * @param[in] pAccess 00071 * Additional file access information (can be a null pointer) 00072 * 00073 * @note 00074 * - sPathInZip *must* end with '/'! 00075 */ 00076 FileSearchZip(const String &sZipFile, const String &sPathInZip, const FileAccess *pAccess); 00077 00078 /** 00079 * @brief 00080 * Destructor 00081 */ 00082 virtual ~FileSearchZip(); 00083 00084 00085 //[-------------------------------------------------------] 00086 //[ Private virtual FileSearchImpl functions ] 00087 //[-------------------------------------------------------] 00088 private: 00089 virtual bool HasNextFile() override; 00090 virtual String GetNextFile() override; 00091 00092 00093 //[-------------------------------------------------------] 00094 //[ Private functions ] 00095 //[-------------------------------------------------------] 00096 private: 00097 /** 00098 * @brief 00099 * Find next file in the selected directory 00100 */ 00101 bool FindNextFile(); 00102 bool CheckFile(const String &sFilename); 00103 00104 00105 //[-------------------------------------------------------] 00106 //[ Private data ] 00107 //[-------------------------------------------------------] 00108 private: 00109 String m_sZipFile; /**< File name of ZIP-file */ 00110 String m_sPathInZip; /**< Path inside the ZIP-file */ 00111 ZipHandle m_cZipFile; /**< ZIP file handle */ 00112 00113 00114 }; 00115 00116 00117 //[-------------------------------------------------------] 00118 //[ Namespace ] 00119 //[-------------------------------------------------------] 00120 } // PLCore 00121 00122 00123 #endif // __PLCORE_FILESEARCH_ZIP_H__
|