OgreArchive.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef _Archive_H__
#define _Archive_H__
#include "OgrePrerequisites.h"
#include "OgreString.h"
#include "OgreDataStream.h"
#include "OgreSharedPtr.h"
#include "OgreStringVector.h"
#include "OgreException.h"
#include <ctime>
#include "OgreHeaderPrefix.h"
namespace Ogre {
struct FileInfo {
const Archive* archive;
String filename;
String path;
String basename;
size_t compressedSize;
size_t uncompressedSize;
};
typedef vector<FileInfo>::type FileInfoList;
typedef SharedPtr<FileInfoList> FileInfoListPtr;
class _OgreExport Archive : public ArchiveAlloc
{
protected:
String mName;
String mType;
bool mReadOnly;
public:
Archive( const String& name, const String& archType )
: mName(name), mType(archType), mReadOnly(true) {}
virtual ~Archive() {}
const String& getName(void) const { return mName; }
virtual bool isCaseSensitive(void) const = 0;
virtual void load() = 0;
virtual void unload() = 0;
virtual bool isReadOnly() const { return mReadOnly; }
virtual DataStreamPtr open(const String& filename, bool readOnly = true) const = 0;
virtual DataStreamPtr create(const String& filename) const
{
(void)filename;
OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED,
"This archive does not support creation of files.",
"Archive::create");
}
virtual void remove(const String& filename) const
{
(void)filename;
OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED,
"This archive does not support removal of files.",
"Archive::remove");
}
virtual StringVectorPtr list(bool recursive = true, bool dirs = false) = 0;
virtual FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false) = 0;
virtual StringVectorPtr find(const String& pattern, bool recursive = true,
bool dirs = false) = 0;
virtual bool exists(const String& filename) = 0;
virtual time_t getModifiedTime(const String& filename) = 0;
virtual FileInfoListPtr findFileInfo(const String& pattern,
bool recursive = true, bool dirs = false) const = 0;
const String& getType(void) const { return mType; }
};
}
#include "OgreHeaderSuffix.h"
#endif
Ogre::FileInfo::compressedSize
size_t compressedSize
Compressed size.
Definition: OgreArchive.h:64
Ogre::Archive::mReadOnly
bool mReadOnly
Read-only flag.
Definition: OgreArchive.h:96
Ogre::FileInfo
Information about a file/directory within the archive will be returned using a FileInfo struct...
Definition: OgreArchive.h:53
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::list
Definition: OgrePrerequisites.h:505
Ogre::Archive::getName
const String & getName(void) const
Get the name of this archive.
Definition: OgreArchive.h:110
OgreSharedPtr.h
Ogre::Archive::create
virtual DataStreamPtr create(const String &filename) const
Create a new file (or overwrite one already there).
Definition: OgreArchive.h:155
Ogre::Archive::mType
String mType
Archive type code.
Definition: OgreArchive.h:94
Ogre::FileInfo::basename
String basename
Base filename.
Definition: OgreArchive.h:62
Ogre::FileInfo::uncompressedSize
size_t uncompressedSize
Uncompressed size.
Definition: OgreArchive.h:66
OgreString.h
Ogre::Archive::mName
String mName
Archive name.
Definition: OgreArchive.h:92
Ogre::Archive::~Archive
virtual ~Archive()
Default destructor.
Definition: OgreArchive.h:107
Ogre::Archive::isReadOnly
virtual bool isReadOnly() const
Reports whether this Archive is read-only, or whether the contents can be updated.
Definition: OgreArchive.h:134
OgreDataStream.h
OgrePrerequisites.h
OgreStringVector.h
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::Archive::getType
const String & getType(void) const
Return the type code of this Archive.
Definition: OgreArchive.h:233
Ogre::FileInfoListPtr
SharedPtr< FileInfoList > FileInfoListPtr
Definition: OgreArchive.h:70
OgreHeaderSuffix.h
Ogre::Archive::Archive
Archive(const String &name, const String &archType)
Constructor - don&#39;t call direct, used by ArchiveFactory.
Definition: OgreArchive.h:102
Ogre::FileInfoList
vector< FileInfo >::type FileInfoList
Definition: OgreArchive.h:69
OGRE_EXCEPT
#define OGRE_EXCEPT(num, desc, src)
Definition: OgreException.h:334
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::FileInfo::archive
const Archive * archive
The archive in which the file has been found (for info when performing multi-Archive searches...
Definition: OgreArchive.h:56
OgreException.h
Ogre::SharedPtr
Reference-counted shared pointer, used for objects where implicit destruction is required.
Definition: OgrePrerequisites.h:310
Ogre::vector
Definition: OgrePrerequisites.h:491
OgreHeaderPrefix.h
Ogre::Exception::ERR_NOT_IMPLEMENTED
Definition: OgreException.h:110
Ogre::Archive
Archive-handling class.
Definition: OgreArchive.h:88
Ogre::FileInfo::filename
String filename
The file&#39;s fully qualified name.
Definition: OgreArchive.h:58
Ogre::FileInfo::path
String path
Path name; separated by &#39;/&#39; and ending with &#39;/&#39;.
Definition: OgreArchive.h:60
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.