Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:30:11

0001 /*
0002 ---------------------------------------------------------------------------
0003 Open Asset Import Library (assimp)
0004 ---------------------------------------------------------------------------
0005 
0006 Copyright (c) 2006-2024, assimp team
0007 
0008 All rights reserved.
0009 
0010 Redistribution and use of this software in source and binary forms,
0011 with or without modification, are permitted provided that the following
0012 conditions are met:
0013 
0014 * Redistributions of source code must retain the above
0015   copyright notice, this list of conditions and the
0016   following disclaimer.
0017 
0018 * Redistributions in binary form must reproduce the above
0019   copyright notice, this list of conditions and the
0020   following disclaimer in the documentation and/or other
0021   materials provided with the distribution.
0022 
0023 * Neither the name of the assimp team, nor the names of its
0024   contributors may be used to endorse or promote products
0025   derived from this software without specific prior
0026   written permission of the assimp team.
0027 
0028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0029 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0030 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0031 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0032 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0033 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0034 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0035 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0036 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0037 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0038 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0039 ---------------------------------------------------------------------------
0040 */
0041 
0042 /** @file ZipArchiveIOSystem.h
0043  *  @brief Implementation of IOSystem to read a ZIP file from another IOSystem
0044 */
0045 
0046 #pragma once
0047 #ifndef AI_ZIPARCHIVEIOSYSTEM_H_INC
0048 #define AI_ZIPARCHIVEIOSYSTEM_H_INC
0049 
0050 #ifdef __GNUC__
0051 #   pragma GCC system_header
0052 #endif
0053 
0054 #include <assimp/IOStream.hpp>
0055 #include <assimp/IOSystem.hpp>
0056 #include <zlib.h>
0057 
0058 namespace Assimp {
0059 
0060 class ZipArchiveIOSystem : public IOSystem {
0061 public:
0062     //! Open a Zip using the proffered IOSystem
0063     ZipArchiveIOSystem(IOSystem* pIOHandler, const char *pFilename, const char* pMode = "r");
0064     ZipArchiveIOSystem(IOSystem* pIOHandler, const std::string& rFilename, const char* pMode = "r");
0065     virtual ~ZipArchiveIOSystem() override;
0066     bool Exists(const char* pFilename) const override;
0067     char getOsSeparator() const override;
0068     IOStream* Open(const char* pFilename, const char* pMode = "rb") override;
0069     void Close(IOStream* pFile) override;
0070 
0071     // Specific to ZIP
0072     //! The file was opened and is a ZIP
0073     bool isOpen() const;
0074 
0075     //! Get the list of all files with their simplified paths
0076     //! Intended for use within Assimp library boundaries
0077     void getFileList(std::vector<std::string>& rFileList) const;
0078 
0079     //! Get the list of all files with extension (must be lowercase)
0080     //! Intended for use within Assimp library boundaries
0081     void getFileListExtension(std::vector<std::string>& rFileList, const std::string& extension) const;
0082 
0083     static bool isZipArchive(IOSystem* pIOHandler, const char *pFilename);
0084     static bool isZipArchive(IOSystem* pIOHandler, const std::string& rFilename);
0085 
0086 private:
0087     class Implement;
0088     Implement *pImpl = nullptr;
0089 };
0090 
0091 } // Namespace Assimp
0092 
0093 #endif // AI_ZIPARCHIVEIOSYSTEM_H_INC