3 Copyright 2009 Antoine Chavasse <a.chavasse@gmail.com>
5 This file is part of Fail.
7 Fail is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 3
9 as published by the Free Software Foundation.
11 Fail is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef FAIL_VFS_VFS_H_
20 #define FAIL_VFS_VFS_H_
22 #include "core/core.h"
24 #include "FileSystem_i.h"
25 #include "vfs/vfs_export.h"
27 namespace fail
{ namespace vfs
29 class FLVFS_EXPORT VFS
32 static shared_ptr
< VFS
> GetInstance()
35 ms_pInstance
= shared_ptr
< VFS
>( new VFS
);
39 void registerLoader( string extension
, shared_ptr
< Loader_i
> pLoader
);
40 void registerFileSystem( string name
, shared_ptr
< FileSystem_i
> pFS
);
42 shared_ptr
< Serializable
> loadObject( string path
);
43 shared_ptr
< io::SeekableInputStream
> openRead( string path
);
44 shared_ptr
< io::SeekableOutputStream
> openWrite( string path
);
48 static void splicePath( const string
& path
, string
& out_fsname
, string
& out_filename
);
49 shared_ptr
< Loader_i
> getLoader( const string
& extension
) const;
50 shared_ptr
< FileSystem_i
> getFileSystem( const string
& fsname
) const;
52 static shared_ptr
< VFS
> ms_pInstance
;
54 unordered_map
< string
, shared_ptr
< Loader_i
> > m_Loaders
;
55 unordered_map
< string
, shared_ptr
< FileSystem_i
> > m_FileSystems
;
56 shared_ptr
< FileSystem_i
> m_pDefaultFS
;