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-2012 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 00039 namespace Ogre { 00040 00052 struct FileInfo { 00055 const Archive* archive; 00057 String filename; 00059 String path; 00061 String basename; 00063 size_t compressedSize; 00065 size_t uncompressedSize; 00066 }; 00067 00068 typedef vector<FileInfo>::type FileInfoList; 00069 typedef SharedPtr<FileInfoList> FileInfoListPtr; 00070 00087 class _OgreExport Archive : public ArchiveAlloc 00088 { 00089 protected: 00091 String mName; 00093 String mType; 00095 bool mReadOnly; 00096 public: 00097 00098 00101 Archive( const String& name, const String& archType ) 00102 : mName(name), mType(archType), mReadOnly(true) {} 00103 00106 virtual ~Archive() {} 00107 00109 const String& getName(void) const { return mName; } 00110 00112 virtual bool isCaseSensitive(void) const = 0; 00113 00121 virtual void load() = 0; 00122 00128 virtual void unload() = 0; 00129 00133 virtual bool isReadOnly() const { return mReadOnly; } 00134 00146 virtual DataStreamPtr open(const String& filename, bool readOnly = true) const = 0; 00147 00154 virtual DataStreamPtr create(const String& filename) const 00155 { 00156 (void)filename; 00157 OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, 00158 "This archive does not support creation of files.", 00159 "Archive::create"); 00160 } 00161 00166 virtual void remove(const String& filename) const 00167 { 00168 (void)filename; 00169 OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, 00170 "This archive does not support removal of files.", 00171 "Archive::remove"); 00172 } 00173 00184 virtual StringVectorPtr list(bool recursive = true, bool dirs = false) = 0; 00185 00194 virtual FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false) = 0; 00195 00208 virtual StringVectorPtr find(const String& pattern, bool recursive = true, 00209 bool dirs = false) = 0; 00210 00212 virtual bool exists(const String& filename) = 0; 00213 00215 virtual time_t getModifiedTime(const String& filename) = 0; 00216 00217 00228 virtual FileInfoListPtr findFileInfo(const String& pattern, 00229 bool recursive = true, bool dirs = false) const = 0; 00230 00232 const String& getType(void) const { return mType; } 00233 00234 }; 00238 } 00239 00240 #endif
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:36:23 2012