Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

OgreFileSystem.h

Go to the documentation of this file.
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-2005 The OGRE Team
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 #ifndef __FileSystem_H__
00026 #define __FileSystem_H__
00027 
00028 #include "OgrePrerequisites.h"
00029 
00030 #include "OgreArchive.h"
00031 #include "OgreArchiveFactory.h"
00032 
00033 namespace Ogre {
00034 
00038     class _OgreExport FileSystemArchive : public Archive 
00039     {
00040     public:
00041         OGRE_AUTO_MUTEX
00042     protected:
00044         String mBasePath;
00045 
00047         typedef std::deque<String> DirectoryStack;
00048         mutable DirectoryStack mDirectoryStack;
00049 
00050         #define OGRE_MAX_PATH 256
00051 
00052         mutable char mTmpPath[OGRE_MAX_PATH];
00053 
00062         void findFiles(const String& pattern, bool recursive, StringVector* simpleList,
00063             FileInfoList* detailList, const String& currentDir = "");
00064 
00066         void changeDirectory(const String& dir) const;
00068         void pushDirectory(const String& dir) const;
00070         void popDirectory(void) const;
00071 
00072     public:
00073         FileSystemArchive(const String& name, const String& archType );
00074         ~FileSystemArchive();
00075 
00077         bool isCaseSensitive(void) const;
00078 
00080         void load();
00082         void unload();
00083 
00085         DataStreamPtr open(const String& filename) const;
00086 
00088         StringVectorPtr list(bool recursive = true );
00089 
00091         FileInfoListPtr listFileInfo(bool recursive = true );
00092 
00094         StringVectorPtr find(const String& pattern, bool recursive = true);
00095 
00097         FileInfoListPtr findFileInfo(const String& pattern, bool recursive = true);
00098 
00100         bool exists(const String& filename);
00101 
00102     };
00103 
00105     class _OgrePrivate FileSystemArchiveFactory : public ArchiveFactory
00106     {
00107     public:
00108         virtual ~FileSystemArchiveFactory() {}
00110         const String& getType(void) const;
00112         Archive *createInstance( const String& name ) 
00113         {
00114             return new FileSystemArchive(name, "FileSystem");
00115         }
00117         void destroyInstance( Archive* arch) { delete arch; }
00118     };
00119 
00120 
00121 }
00122 
00123 #endif

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:40 2006