ScummVM API documentation
qd_file_manager.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 
23 #ifndef QDENGINE_QDCORE_QD_FILE_MANAGER_H
24 #define QDENGINE_QDCORE_QD_FILE_MANAGER_H
25 
26 #include "qdengine/qdcore/qd_file_owner.h"
27 
28 namespace Common {
29  class Archive;
30 }
31 
32 namespace QDEngine {
33 
35 public:
36  qdFilePackage();
37  ~qdFilePackage();
38 
39  const char *file_name() const;
40 
41  void set_drive_ID(int drive_id) {
42  }
43  void set_container_index(int idx) {
44  _container_index = idx;
45  }
46 
47  bool is_open() {
48  return _container != nullptr;
49  }
50 
51  void init();
52  bool open();
53  void close();
54 
55  bool check_container();
56 
57  Common::Archive *_container = nullptr;
58 
59 private:
60  int _container_index;
61 };
62 
65 public:
66  ~qdFileManager();
67 
68  bool init(int cd_count);
69  void Finit();
70 
71  void enable_packages() {}
72 
73  bool open_file(Common::SeekableReadStream **fh, const Common::Path file_name, bool err_message = true);
74 
75  int last_CD_id() const {
76  return 1;
77  }
78  void set_last_CD_id(int cd_id) {
79  }
80 
81  int CD_count() const {
82  return 1;
83  }
84  bool is_CD_available(int cd_id) const {
85  return true;
86  }
87  bool is_package_available(int idx) {
88  assert(idx >= 0 && idx < _packageCount);
89  return _packages[idx].is_open();
90  }
91  bool is_package_available(const qdFileOwner &file_owner);
92  int get_num_packages() { return _packageCount; }
93 
94  Common::Archive *get_package(int idx) {
95  if (!_packages[idx].is_open())
96  _packages[idx].open();
97 
98  return _packages[idx]._container;
99  }
100 
101  bool scan_drives(const qdFileOwner *file_owner = NULL) { return true; }
102  bool scan_drives(int cd_id) { return true; }
103  void update_packages() {}
104 
105  void toggle_silent_update_mode(bool mode) {
106  }
107 
108  bool check_drives(const char *cdkey = NULL) { return true; }
109  bool check_drive(int drive_letter) { return true; }
110 
111  static qdFileManager &instance();
112 
113 private:
114 
115  qdFileManager();
116 
117  qdFilePackage _packages[3];
118 
119  int _packageCount = 0;
120 };
121 
122 } // namespace QDEngine
123 
124 #endif // QDENGINE_QDCORE_QD_FILE_MANAGER_H
Definition: qd_file_owner.h:27
Definition: path.h:52
Менеджер файлов.
Definition: qd_file_manager.h:64
Definition: stream.h:745
Definition: qd_file_manager.h:34
Definition: archive.h:141
Базовый класс для игровых ресурсов.
Definition: console.h:28
Definition: algorithm.h:29