00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright (c) 2000-2013 Torus Knot Software Ltd 00008 00009 Permission is hereby granted, free of charge, to any person obtaining a copy 00010 of this software and associated documentation files (the "Software"), to deal 00011 in the Software without restriction, including without limitation the rights 00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00013 copies of the Software, and to permit persons to whom the Software is 00014 furnished to do so, subject to the following conditions: 00015 00016 The above copyright notice and this permission notice shall be included in 00017 all copies or substantial portions of the Software. 00018 00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00025 THE SOFTWARE. 00026 ----------------------------------------------------------------------------- 00027 */ 00028 #ifndef _Archive_H__ 00029 #define _Archive_H__ 00030 00031 #include "OgrePrerequisites.h" 00032 #include "OgreString.h" 00033 #include "OgreDataStream.h" 00034 #include "OgreSharedPtr.h" 00035 #include "OgreStringVector.h" 00036 #include "OgreException.h" 00037 #include <ctime> 00038 #include "OgreHeaderPrefix.h" 00039 00040 namespace Ogre { 00041 00053 struct FileInfo { 00056 const Archive* archive; 00058 String filename; 00060 String path; 00062 String basename; 00064 size_t compressedSize; 00066 size_t uncompressedSize; 00067 }; 00068 00069 typedef vector<FileInfo>::type FileInfoList; 00070 typedef SharedPtr<FileInfoList> FileInfoListPtr; 00071 00088 class _OgreExport Archive : public ArchiveAlloc 00089 { 00090 protected: 00092 String mName; 00094 String mType; 00096 bool mReadOnly; 00097 public: 00098 00099 00102 Archive( const String& name, const String& archType ) 00103 : mName(name), mType(archType), mReadOnly(true) {} 00104 00107 virtual ~Archive() {} 00108 00110 const String& getName(void) const { return mName; } 00111 00113 virtual bool isCaseSensitive(void) const = 0; 00114 00122 virtual void load() = 0; 00123 00129 virtual void unload() = 0; 00130 00134 virtual bool isReadOnly() const { return mReadOnly; } 00135 00147 virtual DataStreamPtr open(const String& filename, bool readOnly = true) const = 0; 00148 00155 virtual DataStreamPtr create(const String& filename) const 00156 { 00157 (void)filename; 00158 OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, 00159 "This archive does not support creation of files.", 00160 "Archive::create"); 00161 } 00162 00167 virtual void remove(const String& filename) const 00168 { 00169 (void)filename; 00170 OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, 00171 "This archive does not support removal of files.", 00172 "Archive::remove"); 00173 } 00174 00185 virtual StringVectorPtr list(bool recursive = true, bool dirs = false) = 0; 00186 00195 virtual FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false) = 0; 00196 00209 virtual StringVectorPtr find(const String& pattern, bool recursive = true, 00210 bool dirs = false) = 0; 00211 00213 virtual bool exists(const String& filename) = 0; 00214 00216 virtual time_t getModifiedTime(const String& filename) = 0; 00217 00218 00229 virtual FileInfoListPtr findFileInfo(const String& pattern, 00230 bool recursive = true, bool dirs = false) const = 0; 00231 00233 const String& getType(void) const { return mType; } 00234 00235 }; 00239 } 00240 00241 #include "OgreHeaderSuffix.h" 00242 00243 #endif
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:40