RCS file: /cvsroot/scummvm/scummvm/base/plugins.h,v
retrieving revision 1.24
diff -u -d -r1.24 plugins.h
|
|
|
117 | 117 | |
118 | 118 | bool tryLoadPlugin(Plugin *plugin); |
119 | 119 | |
120 | | friend SingletonBaseType *makeInstance<>(); |
| 120 | friend class Common::Singleton<SingletonBaseType>; |
121 | 121 | PluginManager(); |
122 | 122 | |
123 | 123 | public: |
RCS file: /cvsroot/scummvm/scummvm/common/config-manager.h,v
retrieving revision 1.21
diff -u -d -r1.21 config-manager.h
|
|
|
114 | 114 | */ |
115 | 115 | |
116 | 116 | private: |
117 | | friend SingletonBaseType *makeInstance<>(); |
| 117 | friend class Singleton<SingletonBaseType>; |
118 | 118 | ConfigManager(); |
119 | 119 | |
120 | 120 | void loadFile(const String &filename); |
RCS file: /cvsroot/scummvm/scummvm/common/singleton.h,v
retrieving revision 1.9
diff -u -d -r1.9 singleton.h
|
|
|
23 | 23 | #ifndef COMMON_SINGLETON_H |
24 | 24 | #define COMMON_SINGLETON_H |
25 | 25 | |
26 | | /** |
27 | | * The default object factory used by the template class Singleton. |
28 | | * By specialising this template function, one can make a singleton use a |
29 | | * custom object factory. For example, to support encapsulation, your |
30 | | * singleton class might be pure virtual (or "abstract" in Java terminology), |
31 | | * and you specialise makeInstance to return an instance of a subclass. |
32 | | */ |
33 | | template <class T> |
34 | | T* makeInstance() { |
35 | | return new T(); |
36 | | } |
37 | | |
38 | 26 | namespace Common { |
39 | 27 | |
40 | 28 | /** |
… |
… |
|
49 | 37 | |
50 | 38 | static T* _singleton; |
51 | 39 | |
| 40 | /** |
| 41 | * The default object factory used by the template class Singleton. |
| 42 | * By specialising this template function, one can make a singleton use a |
| 43 | * custom object factory. For example, to support encapsulation, your |
| 44 | * singleton class might be pure virtual (or "abstract" in Java terminology), |
| 45 | * and you specialise makeInstance to return an instance of a subclass. |
| 46 | */ |
| 47 | //template <class T> |
| 48 | static T* makeInstance() { |
| 49 | return new T(); |
| 50 | } |
| 51 | |
| 52 | |
52 | 53 | public: |
53 | 54 | static T& instance() { |
54 | 55 | // TODO: We aren't thread safe. For now we ignore it since the |
… |
… |
|
59 | 60 | // order might become an issue. There are various approaches |
60 | 61 | // to solve that problem, but for now this is sufficient |
61 | 62 | if (!_singleton) |
62 | | _singleton = makeInstance<T>(); |
| 63 | _singleton = makeInstance(); |
| 64 | // _singleton = makeInstance<T>(); |
63 | 65 | return *_singleton; |
64 | 66 | } |
65 | 67 | protected: |
RCS file: /cvsroot/scummvm/scummvm/common/system.cpp,v
retrieving revision 1.16
diff -u -d -r1.16 system.cpp
|
|
|
34 | 34 | DECLARE_SINGLETON(OSystem); |
35 | 35 | |
36 | 36 | template <> |
37 | | OSystem *makeInstance<>() { |
| 37 | OSystem *Common::Singleton<OSystem>::makeInstance() { |
38 | 38 | // Attention: Do not call parseGraphicsMode() here, nor any other function |
39 | 39 | // which needs to access the OSystem instance, else you get stuck in an |
40 | 40 | // endless loop. |
RCS file: /cvsroot/scummvm/scummvm/common/system.h,v
retrieving revision 1.78
diff -u -d -r1.78 system.h
|
|
|
35 | 35 | * Custome object factory for OSystem. |
36 | 36 | */ |
37 | 37 | template <> |
38 | | OSystem *makeInstance<>(); |
| 38 | OSystem *Common::Singleton<OSystem>::makeInstance(); |
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.h,v
retrieving revision 1.49
diff -u -d -r1.49 newgui.h
|
|
|
56 | 56 | class NewGui : public Common::Singleton<NewGui> { |
57 | 57 | typedef Common::String String; |
58 | 58 | friend class Dialog; |
59 | | friend SingletonBaseType *makeInstance<>(); |
| 59 | friend class Common::Singleton<SingletonBaseType>; |
60 | 60 | NewGui(); |
61 | 61 | public: |
62 | 62 | |
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.cpp,v
retrieving revision 1.141
diff -u -d -r1.141 smush_player.cpp
|
|
|
172 | 172 | } |
173 | 173 | }; |
174 | 174 | |
175 | | static StringResource *getStrings(const char *file, bool is_encoded) { |
| 175 | static StringResource *getStrings(ScummEngine *vm, const char *file, bool is_encoded) { |
176 | 176 | debugC(DEBUG_SMUSH, "trying to read text ressources from %s", file); |
177 | | File theFile; |
| 177 | ScummFile theFile; |
178 | 178 | |
179 | | theFile.open(file); |
| 179 | vm->openFile(theFile, file); |
180 | 180 | if (!theFile.isOpen()) { |
181 | 181 | return 0; |
182 | 182 | } |
… |
… |
|
195 | 195 | |
196 | 196 | if (type != TYPE_ETRS) { |
197 | 197 | delete [] filebuffer; |
198 | | return getStrings(file, false); |
| 198 | return getStrings(vm, file, false); |
199 | 199 | } |
200 | 200 | |
201 | 201 | char *old = filebuffer; |
… |
… |
|
651 | 651 | char fname[260]; |
652 | 652 | memcpy(fname, file, i - file); |
653 | 653 | strcpy(fname + (i - file), ".trs"); |
654 | | if ((_strings = getStrings(fname, false)) != 0) { |
| 654 | if ((_strings = getStrings(_vm, fname, false)) != 0) { |
655 | 655 | return true; |
656 | 656 | } |
657 | 657 | |
658 | | if ((_strings = getStrings("digtxt.trs", true)) != 0) { |
| 658 | if ((_strings = getStrings(_vm, "digtxt.trs", true)) != 0) { |
659 | 659 | return true; |
660 | 660 | } |
661 | 661 | return false; |
RCS file: /cvsroot/scummvm/scummvm/sound/audiocd.h,v
retrieving revision 1.7
diff -u -d -r1.7 audiocd.h
|
|
|
54 | 54 | Status getStatus() const; |
55 | 55 | |
56 | 56 | private: |
57 | | friend SingletonBaseType *makeInstance<>(); |
| 57 | friend class Common::Singleton<SingletonBaseType>; |
58 | 58 | AudioCDManager(); |
59 | 59 | |
60 | 60 | int getCachedTrack(int track); |