OGRE  1.9.0
OgreArchive.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef _Archive_H__
29#define _Archive_H__
30
31#include "OgrePrerequisites.h"
32#include "OgreString.h"
33#include "OgreDataStream.h"
34#include "OgreSharedPtr.h"
35#include "OgreStringVector.h"
36#include "OgreException.h"
37#include <ctime>
38#include "OgreHeaderPrefix.h"
39
40namespace Ogre {
41
68
71
89 {
90 protected:
97 public:
98
99
102 Archive( const String& name, const String& archType )
103 : mName(name), mType(archType), mReadOnly(true) {}
104
107 virtual ~Archive() {}
108
110 const String& getName(void) const { return mName; }
111
113 virtual bool isCaseSensitive(void) const = 0;
114
122 virtual void load() = 0;
123
129 virtual void unload() = 0;
130
134 virtual bool isReadOnly() const { return mReadOnly; }
135
147 virtual DataStreamPtr open(const String& filename, bool readOnly = true) const = 0;
148
155 virtual DataStreamPtr create(const String& filename) const;
156
161 virtual void remove(const String& filename) const;
162
173 virtual StringVectorPtr list(bool recursive = true, bool dirs = false) = 0;
174
183 virtual FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false) = 0;
184
197 virtual StringVectorPtr find(const String& pattern, bool recursive = true,
198 bool dirs = false) = 0;
199
201 virtual bool exists(const String& filename) = 0;
202
204 virtual time_t getModifiedTime(const String& filename) = 0;
205
206
217 virtual FileInfoListPtr findFileInfo(const String& pattern,
218 bool recursive = true, bool dirs = false) const = 0;
219
221 const String& getType(void) const { return mType; }
222
223 };
224
226
227}
228
229#include "OgreHeaderSuffix.h"
230
231#endif
#define _OgreExport
Archive-handling class.
Definition OgreArchive.h:89
virtual DataStreamPtr create(const String &filename) const
Create a new file (or overwrite one already there).
virtual bool isReadOnly() const
Reports whether this Archive is read-only, or whether the contents can be updated.
virtual ~Archive()
Default destructor.
virtual bool isCaseSensitive(void) const =0
Returns whether this archive is case sensitive in the way it matches files.
virtual time_t getModifiedTime(const String &filename)=0
Retrieve the modification time of a given file.
virtual FileInfoListPtr listFileInfo(bool recursive=true, bool dirs=false)=0
List all files in the archive with accompanying information.
virtual void unload()=0
Unloads the archive.
virtual void load()=0
Loads the archive.
virtual StringVectorPtr list(bool recursive=true, bool dirs=false)=0
List all file names in the archive.
virtual void remove(const String &filename) const
Delete a named file.
virtual StringVectorPtr find(const String &pattern, bool recursive=true, bool dirs=false)=0
Find all file or directory names matching a given pattern in this archive.
virtual DataStreamPtr open(const String &filename, bool readOnly=true) const =0
Open a stream on a given file.
virtual FileInfoListPtr findFileInfo(const String &pattern, bool recursive=true, bool dirs=false) const =0
Find all files or directories matching a given pattern in this archive and get some detailed informat...
Archive(const String &name, const String &archType)
Constructor - don't call direct, used by ArchiveFactory.
String mName
Archive name.
Definition OgreArchive.h:92
const String & getType(void) const
Return the type code of this Archive.
String mType
Archive type code.
Definition OgreArchive.h:94
bool mReadOnly
Read-only flag.
Definition OgreArchive.h:96
virtual bool exists(const String &filename)=0
Find out if the named file exists (note: fully qualified filename required)
const String & getName(void) const
Get the name of this archive.
Reference-counted shared pointer, used for objects where implicit destruction is required.
SharedPtr< StringVector > StringVectorPtr
vector< FileInfo >::type FileInfoList
Definition OgreArchive.h:69
SharedPtr< DataStream > DataStreamPtr
Shared pointer to allow data streams to be passed around without worrying about deallocation.
SharedPtr< FileInfoList > FileInfoListPtr
Definition OgreArchive.h:70
GeneralAllocatedObject ArchiveAlloc
_StringBase String
Information about a file/directory within the archive will be returned using a FileInfo struct.
Definition OgreArchive.h:53
const Archive * archive
The archive in which the file has been found (for info when performing multi-Archive searches,...
Definition OgreArchive.h:56
size_t uncompressedSize
Uncompressed size.
Definition OgreArchive.h:66
String filename
The file's fully qualified name.
Definition OgreArchive.h:58
String basename
Base filename.
Definition OgreArchive.h:62
size_t compressedSize
Compressed size.
Definition OgreArchive.h:64
String path
Path name; separated by '/' and ending with '/'.
Definition OgreArchive.h:60
std::vector< T, A > type