OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
manager.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_COMPONENTS_RESOURCEMANAGER_H
2 #define OPENMW_COMPONENTS_RESOURCEMANAGER_H
3 
5 
6 #include <vector>
7 #include <map>
8 
9 namespace VFS
10 {
11 
12  class Archive;
13  class File;
14 
20  class Manager
21  {
22  public:
25  Manager(bool strict);
26 
27  ~Manager();
28 
31  void addArchive(Archive* archive);
32 
34  void buildIndex();
35 
38  bool exists(const std::string& name) const;
39 
42  const std::map<std::string, File*>& getIndex() const;
43 
46  void normalizeFilename(std::string& name) const;
47 
51  Files::IStreamPtr get(const std::string& name) const;
52 
56  Files::IStreamPtr getNormalized(const std::string& normalizedName) const;
57 
58  private:
59  bool mStrict;
60 
61  std::vector<Archive*> mArchives;
62 
63  std::map<std::string, File*> mIndex;
64  };
65 
66 }
67 
68 #endif
~Manager()
Definition: manager.cpp:40
bool exists(const std::string &name) const
Definition: manager.cpp:76
bool mStrict
Definition: manager.hpp:59
Files::IStreamPtr getNormalized(const std::string &normalizedName) const
Definition: manager.cpp:68
const std::map< std::string, File * > & getIndex() const
Definition: manager.cpp:84
std::vector< Archive * > mArchives
Definition: manager.hpp:61
void addArchive(Archive *archive)
Definition: manager.cpp:47
Definition: archive.hpp:19
boost::shared_ptr< std::istream > IStreamPtr
Definition: constrainedfilestream.hpp:20
std::map< std::string, File * > mIndex
Definition: manager.hpp:63
Manager(bool strict)
Definition: manager.cpp:34
The main class responsible for loading files from a virtual file system.
Definition: manager.hpp:20
void buildIndex()
Build the file index. Should be called when all archives have been registered.
Definition: manager.cpp:52
void normalizeFilename(std::string &name) const
Definition: manager.cpp:89
const char * name
Definition: crashcatcher.cpp:59