OgreFileSystem.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 __FileSystem_H__
#define __FileSystem_H__
#include "OgrePrerequisites.h"
#include "OgreArchive.h"
#include "OgreArchiveFactory.h"
#include "Threading/OgreThreadHeaders.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
class _OgreExport FileSystemArchive : public Archive
{
protected:
void findFiles(const String& pattern, bool recursive, bool dirs,
StringVector* simpleList, FileInfoList* detailList) const;
OGRE_AUTO_MUTEX;
public:
FileSystemArchive(const String& name, const String& archType, bool readOnly );
~FileSystemArchive();
bool isCaseSensitive(void) const;
void load();
void unload();
DataStreamPtr open(const String& filename, bool readOnly = true) const;
DataStreamPtr create(const String& filename) const;
void remove(const String& filename) const;
StringVectorPtr list(bool recursive = true, bool dirs = false);
FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false);
StringVectorPtr find(const String& pattern, bool recursive = true,
bool dirs = false);
FileInfoListPtr findFileInfo(const String& pattern, bool recursive = true,
bool dirs = false) const;
bool exists(const String& filename);
time_t getModifiedTime(const String& filename);
static void setIgnoreHidden(bool ignore)
{
msIgnoreHidden = ignore;
}
static bool getIgnoreHidden()
{
return msIgnoreHidden;
}
static bool msIgnoreHidden;
};
class _OgreExport FileSystemArchiveFactory : public ArchiveFactory
{
public:
virtual ~FileSystemArchiveFactory() {}
const String& getType(void) const;
Archive *createInstance( const String& name, bool readOnly )
{
return OGRE_NEW FileSystemArchive(name, "FileSystem", readOnly);
}
void destroyInstance(Archive* ptr) { OGRE_DELETE ptr; }
};
} // namespace Ogre
#include "OgreHeaderSuffix.h"
#endif // __FileSystem_H__
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::list
Definition: OgrePrerequisites.h:505
Ogre::FileSystemArchive::setIgnoreHidden
static void setIgnoreHidden(bool ignore)
Set whether filesystem enumeration will include hidden files or not.
Definition: OgreFileSystem.h:112
OGRE_DELETE
#define OGRE_DELETE
Definition: OgreMemoryAllocatorConfig.h:474
Ogre::StringVector
vector< String >::type StringVector
Definition: OgreStringVector.h:45
OGRE_NEW
#define OGRE_NEW
Definition: OgreMemoryAllocatorConfig.h:473
Ogre::FileSystemArchiveFactory::createInstance
Archive * createInstance(const String &name, bool readOnly)
Creates a new object.
Definition: OgreFileSystem.h:134
OgrePrerequisites.h
Ogre::FileSystemArchive::getIgnoreHidden
static bool getIgnoreHidden()
Get whether hidden files are ignored during filesystem enumeration.
Definition: OgreFileSystem.h:118
OgreArchiveFactory.h
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::FileSystemArchiveFactory::~FileSystemArchiveFactory
virtual ~FileSystemArchiveFactory()
Definition: OgreFileSystem.h:130
Ogre::ArchiveFactory
Abstract factory class, archive codec plugins can register concrete subclasses of this...
Definition: OgreArchiveFactory.h:59
OgreHeaderSuffix.h
Ogre::FileSystemArchive::OGRE_AUTO_MUTEX
OGRE_AUTO_MUTEX
Definition: OgreFileSystem.h:67
OgreThreadHeaders.h
Ogre::FileInfoList
vector< FileInfo >::type FileInfoList
Definition: OgreArchive.h:69
Ogre::FileSystemArchiveFactory
Specialisation of ArchiveFactory for FileSystem files.
Definition: OgreFileSystem.h:127
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::SharedPtr< DataStream >
OgreHeaderPrefix.h
OgreArchive.h
Ogre::Archive
Archive-handling class.
Definition: OgreArchive.h:88
Ogre::FileSystemArchiveFactory::destroyInstance
void destroyInstance(Archive *ptr)
Destroys an object which was created by this factory.
Definition: OgreFileSystem.h:139
Ogre::FileSystemArchive
Specialisation of the Archive class to allow reading of files from filesystem folders / directories...
Definition: OgreFileSystem.h:49
Ogre::FileSystemArchive::msIgnoreHidden
static bool msIgnoreHidden
Definition: OgreFileSystem.h:123

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