Path Tracer
ZipArchiveIOSystem.h
Go to the documentation of this file.
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
5 
6 Copyright (c) 2006-2020, assimp team
7 
8 
9 
10 All rights reserved.
11 
12 Redistribution and use of this software in source and binary forms,
13 with or without modification, are permitted provided that the following
14 conditions are met:
15 
16 * Redistributions of source code must retain the above
17  copyright notice, this list of conditions and the
18  following disclaimer.
19 
20 * Redistributions in binary form must reproduce the above
21  copyright notice, this list of conditions and the
22  following disclaimer in the documentation and/or other
23  materials provided with the distribution.
24 
25 * Neither the name of the assimp team, nor the names of its
26  contributors may be used to endorse or promote products
27  derived from this software without specific prior
28  written permission of the assimp team.
29 
30 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 ---------------------------------------------------------------------------
42 */
43 
48 #pragma once
49 #ifndef AI_ZIPARCHIVEIOSYSTEM_H_INC
50 #define AI_ZIPARCHIVEIOSYSTEM_H_INC
51 
52 #ifdef __GNUC__
53 # pragma GCC system_header
54 #endif
55 
56 #include <assimp/IOStream.hpp>
57 #include <assimp/IOSystem.hpp>
58 
59 namespace Assimp {
60 
61 class ZipArchiveIOSystem : public IOSystem {
62 public:
64  ZipArchiveIOSystem(IOSystem* pIOHandler, const char *pFilename, const char* pMode = "r");
65  ZipArchiveIOSystem(IOSystem* pIOHandler, const std::string& rFilename, const char* pMode = "r");
66  virtual ~ZipArchiveIOSystem();
67  bool Exists(const char* pFilename) const override;
68  char getOsSeparator() const override;
69  IOStream* Open(const char* pFilename, const char* pMode = "rb") override;
70  void Close(IOStream* pFile) override;
71 
72  // Specific to ZIP
74  bool isOpen() const;
75 
78  void getFileList(std::vector<std::string>& rFileList) const;
79 
82  void getFileListExtension(std::vector<std::string>& rFileList, const std::string& extension) const;
83 
84  static bool isZipArchive(IOSystem* pIOHandler, const char *pFilename);
85  static bool isZipArchive(IOSystem* pIOHandler, const std::string& rFilename);
86 
87 private:
88  class Implement;
89  Implement *pImpl = nullptr;
90 };
91 
92 } // Namespace Assimp
93 
94 #endif // AI_ZIPARCHIVEIOSYSTEM_H_INC
IOSystem.hpp
File system wrapper for C++. Inherit this class to supply custom file handling logic to the Import li...
Assimp::ZipArchiveIOSystem::Close
void Close(IOStream *pFile) override
Closes the given file and releases all resources associated with it.
Assimp::ZipArchiveIOSystem::getFileList
void getFileList(std::vector< std::string > &rFileList) const
Assimp::ZipArchiveIOSystem::Exists
bool Exists(const char *pFilename) const override
Tests for the existence of a file at the given path.
Assimp::ZipArchiveIOSystem
Definition: ZipArchiveIOSystem.h:61
Assimp::ZipArchiveIOSystem::Open
IOStream * Open(const char *pFilename, const char *pMode="rb") override
Open a new file with a given path.
Assimp::ZipArchiveIOSystem::ZipArchiveIOSystem
ZipArchiveIOSystem(IOSystem *pIOHandler, const char *pFilename, const char *pMode="r")
Open a Zip using the proffered IOSystem.
Assimp::ZipArchiveIOSystem::getOsSeparator
char getOsSeparator() const override
Returns the system specific directory separator.
Assimp::IOSystem
CPP-API: Interface to the file system.
Definition: IOSystem.hpp:93
Assimp::ZipArchiveIOSystem::getFileListExtension
void getFileListExtension(std::vector< std::string > &rFileList, const std::string &extension) const
IOStream.hpp
File I/O wrappers for C++.
Assimp
Definition: ai_assert.h:50
Assimp::ZipArchiveIOSystem::isOpen
bool isOpen() const
The file was opened and is a ZIP.
Assimp::IOStream
CPP-API: Class to handle file I/O for C++.
Definition: IOStream.hpp:75