ScummVM API documentation
resources.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 #ifndef GRAPHICS_MFC_LIBS_RESOURCES_H
23 #define GRAPHICS_MFC_LIBS_RESOURCES_H
24 
25 #include "common/list.h"
26 #include "common/path.h"
27 #include "common/hashmap.h"
28 #include "common/formats/winexe.h"
29 #include "graphics/mfc/minwindef.h"
30 
31 namespace Graphics {
32 namespace MFC {
33 namespace Libs {
34 
35 struct Resource {
36  Common::WinResources *_file = nullptr;
39  size_t _size = 0;
40 
41  Resource() {}
43  const Common::WinResourceID &type,
44  Common::WinResourceID &id, size_t size) :
45  _file(file), _type(type), _id(id),
46  _size(size) {}
47 };
49 
50 struct ResourceFile {
51  Common::String _filename;
52  Common::WinResources *_res = nullptr;
53 
54  ~ResourceFile() {
55  delete _res;
56  }
57 };
59 
60 class Resources : public ResList {
61 private:
62  ResCache _cache;
63 
64 public:
65  ~Resources();
66 
70  void addResources(const Common::Path &file);
71 
75  void removeResources(const Common::Path &file);
76 
77 #if 0
78  Common::WinResources *getCoreResources() const {
79  return _resources.begin()->_value;
80  }
81 #endif
82 
85  HRSRC findResource(const char *lpName, const char *lpType);
86 
90  size_t resourceSize(HRSRC res) const {
91  return ((Resource *)res)->_size;
92  }
93 
97  HGLOBAL loadResource(HRSRC hResInfo);
98 };
99 
100 } // namespace Libs
101 } // namespace MFC
102 } // namespace Graphics
103 
104 #endif
Definition: minwindef.h:153
Definition: str.h:59
Definition: resources.h:35
Definition: path.h:52
Definition: formatinfo.h:28
Definition: winexe.h:69
Definition: resources.h:60
Definition: winexe.h:110
size_t resourceSize(HRSRC res) const
Definition: resources.h:90
Definition: resources.h:50