Project

General

Profile

SO3Engine
SO3ScolFileSystem.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
29#ifndef __SO3_SCOL_PARTITION_H__
30#define __SO3_SCOL_PARTITION_H__
31
33#include <boost/filesystem.hpp>
34namespace SO3
35{
36
37class SO3ScolFileSystemArchive : public Ogre::Archive
38{
39protected:
52 void findFiles(const Ogre::String& pattern, bool recursive, bool dirs, Ogre::StringVector* simpleList, Ogre::FileInfoList* detailList) const;
53
54 static bool is_reserved_dir(const char *fn);
55 static boost::filesystem::path concatenate_path(const Ogre::String base, const Ogre::String name);
56
58#ifdef ANDROID
59 bool mApk;
60 AAssetManager* mAssetManager;
61 Ogre::String mPathPreFix;
62#endif
63public:
64 SO3ScolFileSystemArchive(const Ogre::String& name, const Ogre::String& archType, bool readOnly);
66
68 virtual bool isCaseSensitive(void) const;
69
70#ifdef ANDROID
71 bool isApk(void) const;
72#endif
73
75 virtual void load();
77 virtual void unload();
78
80 virtual Ogre::DataStreamPtr open(const Ogre::String& filename, bool readOnly = true) const;
81
83 virtual Ogre::DataStreamPtr create(const Ogre::String& filename);
84
86 virtual void remove(const Ogre::String& filename);
87
89 virtual Ogre::StringVectorPtr list(bool recursive = true, bool dirs = false) const;
90
92 virtual Ogre::FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false) const;
93
95 virtual Ogre::StringVectorPtr find(const Ogre::String& pattern, bool recursive = true, bool dirs = false) const;
96
98 virtual Ogre::FileInfoListPtr findFileInfo(const Ogre::String& pattern, bool recursive = true, bool dirs = false) const;
99
101 virtual bool exists(const Ogre::String& filename) const;
102
104 virtual time_t getModifiedTime(const Ogre::String& filename) const;
105
109 static void setIgnoreHidden(bool ignore)
110 {
111 msIgnoreHidden = ignore;
112 }
113
115 static bool getIgnoreHidden()
116 {
117 return msIgnoreHidden;
118 }
119
120 static bool msIgnoreHidden;
121};
122
124class SO3ScolFileSystemArchiveFactory : public Ogre::ArchiveFactory
125{
126public:
129 const Ogre::String& getType(void) const;
131 Ogre::Archive *createInstance(const Ogre::String& name, bool readOnly)
132 {
133 return OGRE_NEW SO3ScolFileSystemArchive(name, "ScolFileSystem", readOnly);
134 }
136 void destroyInstance(Ogre::Archive* ptr) { OGRE_DELETE ptr; }
137};
138
139}
140
141#endif
librairies include
void destroyInstance(Ogre::Archive *ptr)
const Ogre::String & getType(void) const
Ogre::Archive * createInstance(const Ogre::String &name, bool readOnly)
virtual bool isCaseSensitive(void) const
virtual time_t getModifiedTime(const Ogre::String &filename) const
void findFiles(const Ogre::String &pattern, bool recursive, bool dirs, Ogre::StringVector *simpleList, Ogre::FileInfoList *detailList) const
static boost::filesystem::path concatenate_path(const Ogre::String base, const Ogre::String name)
static bool getIgnoreHidden()
Get whether hidden files are ignored during filesystem enumeration.
virtual Ogre::StringVectorPtr list(bool recursive=true, bool dirs=false) const
virtual void remove(const Ogre::String &filename)
virtual Ogre::FileInfoListPtr findFileInfo(const Ogre::String &pattern, bool recursive=true, bool dirs=false) const
static bool is_reserved_dir(const char *fn)
virtual Ogre::DataStreamPtr open(const Ogre::String &filename, bool readOnly=true) const
virtual Ogre::FileInfoListPtr listFileInfo(bool recursive=true, bool dirs=false) const
static void setIgnoreHidden(bool ignore)
virtual Ogre::DataStreamPtr create(const Ogre::String &filename)
virtual Ogre::StringVectorPtr find(const Ogre::String &pattern, bool recursive=true, bool dirs=false) const
virtual bool exists(const Ogre::String &filename) const