00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #ifndef ZEITGEIST_FILESERVER_H
00053 #define ZEITGEIST_FILESERVER_H
00054
00055 #include <list>
00056 #include <zeitgeist/node.h>
00057 #include "filesystem.h"
00058
00059 namespace zeitgeist
00060 {
00061
00081 class FileServer : public Node
00082 {
00083
00084
00085
00086 public:
00087 typedef int THandle;
00088
00089 protected:
00090 typedef std::map<THandle, boost::shared_ptr<salt::RFile> > TFileMap;
00091
00092 public:
00094 FileServer();
00095 ~FileServer();
00096
00103 boost::shared_ptr<salt::RFile> Open(const std::string& inName);
00104
00108 THandle Register(const std::string& inName);
00109
00112 boost::shared_ptr<salt::RFile> Get(THandle handle) const;
00113
00116 void Close(THandle handle);
00117
00119 bool Exist(const std::string& inName);
00120
00129 bool Mount(const std::string& inFileSysName, const std::string& inPath);
00130
00135 bool Unmount(const std::string& inPath);
00136
00140 bool Unmount(const std::string& inClass, const std::string& inPath);
00141
00151 int ForEachFile(const std::string& directory, const std::string& name,
00152 const std::string& extension,
00153 FileSystem::TCallback callback, void* param);
00154
00155 protected:
00159 virtual void OnUnlink();
00160
00161 private:
00162 FileServer(const FileServer&);
00163 FileServer& operator=(const FileServer&);
00164
00165 protected:
00167 TFileMap mFileMap;
00168
00170 THandle mNextHandle;
00171 };
00172
00173 DECLARE_CLASS(FileServer)
00174
00175 }
00176
00177 #endif //ZEITGEIST_FILESERVER_H