mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-30 12:50:51 +00:00
Fix our DECLARE_SINGLETON macro to conform to the C++ specs.
We need to use a namespace Common { } there to make strict C++ compilers like clang++ and comeau happy. I also added a slight comment about why that is needed to the macro definition and a note that you need to use it from the global namespace. svn-id: r48254
This commit is contained in:
parent
958fa8d5cb
commit
40562798d6
@ -26,7 +26,7 @@
|
||||
#include "backends/fs/palmos/palmos-fs-factory.h"
|
||||
#include "backends/fs/palmos/palmos-fs.cpp"
|
||||
|
||||
DECLARE_SINGLETON(PalmOSFilesystemFactory);
|
||||
DECLARE_SINGLETON(PalmOSFilesystemFactory)
|
||||
|
||||
AbstractFSNode *PalmOSFilesystemFactory::makeRootFileNode() const {
|
||||
return new PalmOSFilesystemNode();
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "backends/fs/ps2/ps2-fs-factory.h"
|
||||
#include "backends/fs/ps2/ps2-fs.cpp"
|
||||
|
||||
DECLARE_SINGLETON(Ps2FilesystemFactory);
|
||||
DECLARE_SINGLETON(Ps2FilesystemFactory)
|
||||
|
||||
AbstractFSNode *Ps2FilesystemFactory::makeRootFileNode() const {
|
||||
return new Ps2FilesystemNode();
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "backends/fs/psp/psp-fs-factory.h"
|
||||
#include "backends/fs/psp/psp-fs.cpp"
|
||||
|
||||
DECLARE_SINGLETON(PSPFilesystemFactory);
|
||||
DECLARE_SINGLETON(PSPFilesystemFactory)
|
||||
|
||||
AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const {
|
||||
return new PSPFilesystemNode();
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <smb.h>
|
||||
#endif
|
||||
|
||||
DECLARE_SINGLETON(WiiFilesystemFactory);
|
||||
DECLARE_SINGLETON(WiiFilesystemFactory)
|
||||
|
||||
WiiFilesystemFactory::WiiFilesystemFactory() :
|
||||
_dvdMounted(false),
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "./trace.h"
|
||||
#include "engine.h"
|
||||
|
||||
DECLARE_SINGLETON(PowerManager);
|
||||
DECLARE_SINGLETON(PowerManager)
|
||||
|
||||
#ifdef __PSP_DEBUG_SUSPEND__
|
||||
void PowerManager::debugPM() {
|
||||
|
@ -51,7 +51,7 @@ extern char __plugin_hole_start; // Indicates start of hole in program file for
|
||||
extern char __plugin_hole_end; // Indicates end of hole in program file
|
||||
extern char _gp[]; // Value of gp register
|
||||
|
||||
DECLARE_SINGLETON(ShortSegmentManager); // For singleton
|
||||
DECLARE_SINGLETON(ShortSegmentManager) // For singleton
|
||||
|
||||
// Get rid of symbol table in memory
|
||||
void DLObject::discard_symtab() {
|
||||
|
@ -283,7 +283,7 @@ void FilePluginProvider::addCustomDirectories(Common::FSList &dirs) const {
|
||||
|
||||
#pragma mark -
|
||||
|
||||
DECLARE_SINGLETON(PluginManager);
|
||||
DECLARE_SINGLETON(PluginManager)
|
||||
|
||||
PluginManager::PluginManager() {
|
||||
// Always add the static plugin provider.
|
||||
@ -375,7 +375,7 @@ bool PluginManager::tryLoadPlugin(Plugin *plugin) {
|
||||
|
||||
#include "engines/metaengine.h"
|
||||
|
||||
DECLARE_SINGLETON(EngineManager);
|
||||
DECLARE_SINGLETON(EngineManager)
|
||||
|
||||
GameDescriptor EngineManager::findGame(const Common::String &gameName, const EnginePlugin **plugin) const {
|
||||
// Find the GameDescriptor for this target
|
||||
@ -421,7 +421,7 @@ const EnginePlugin::List &EngineManager::getPlugins() const {
|
||||
|
||||
#include "sound/musicplugin.h"
|
||||
|
||||
DECLARE_SINGLETON(MusicManager);
|
||||
DECLARE_SINGLETON(MusicManager)
|
||||
|
||||
const MusicPlugin::List &MusicManager::getPlugins() const {
|
||||
return (const MusicPlugin::List &)PluginManager::instance().getPlugins(PLUGIN_TYPE_MUSIC);
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "common/config-manager.h"
|
||||
|
||||
DECLARE_SINGLETON(Common::EventRecorder);
|
||||
DECLARE_SINGLETON(Common::EventRecorder)
|
||||
|
||||
namespace Common {
|
||||
|
||||
|
@ -270,8 +270,6 @@ SeekableReadStream *SearchSet::createReadStreamForMember(const String &name) con
|
||||
}
|
||||
|
||||
|
||||
DECLARE_SINGLETON(SearchManager);
|
||||
|
||||
SearchManager::SearchManager() {
|
||||
clear(); // Force a reset
|
||||
}
|
||||
@ -291,3 +289,6 @@ void SearchManager::clear() {
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
|
||||
DECLARE_SINGLETON(Common::SearchManager)
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "common/util.h"
|
||||
#include "common/system.h"
|
||||
|
||||
DECLARE_SINGLETON(Common::ConfigManager);
|
||||
DECLARE_SINGLETON(Common::ConfigManager)
|
||||
|
||||
static bool isValidDomainName(const Common::String &domName) {
|
||||
const char *p = domName.c_str();
|
||||
|
@ -91,7 +91,18 @@ protected:
|
||||
typedef T SingletonBaseType;
|
||||
};
|
||||
|
||||
#define DECLARE_SINGLETON(T) template<> T *Common::Singleton<T>::_singleton = 0
|
||||
/**
|
||||
* Note that you need to use this macro from the global namespace.
|
||||
*
|
||||
* This is because C++ requires initial explicit specialization
|
||||
* to be placed in the same namespace as the template.
|
||||
* It has to be put in the global namespace to assure the correct
|
||||
* namespace Common is referenced.
|
||||
*/
|
||||
#define DECLARE_SINGLETON(T) \
|
||||
namespace Common { \
|
||||
template<> T *Singleton<T>::_singleton = 0; \
|
||||
} // End of namespace Common
|
||||
|
||||
} // End of namespace Common
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "common/endian.h"
|
||||
#include "sound/midiparser.h"
|
||||
|
||||
DECLARE_SINGLETON(Lure::SoundManager);
|
||||
DECLARE_SINGLETON(Lure::SoundManager)
|
||||
|
||||
namespace Lure {
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "common/system.h"
|
||||
#include "common/stack.h"
|
||||
|
||||
DECLARE_SINGLETON(Graphics::CursorManager);
|
||||
DECLARE_SINGLETON(Graphics::CursorManager)
|
||||
|
||||
namespace Graphics {
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "graphics/fontman.h"
|
||||
//#include "gui/consolefont.h"
|
||||
|
||||
DECLARE_SINGLETON(Graphics::FontManager);
|
||||
DECLARE_SINGLETON(Graphics::FontManager)
|
||||
|
||||
namespace Graphics {
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
#include "graphics/cursorman.h"
|
||||
|
||||
DECLARE_SINGLETON(GUI::GuiManager);
|
||||
DECLARE_SINGLETON(GUI::GuiManager)
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "common/util.h"
|
||||
#include "common/system.h"
|
||||
|
||||
DECLARE_SINGLETON(Audio::AudioCDManager);
|
||||
DECLARE_SINGLETON(Audio::AudioCDManager)
|
||||
|
||||
namespace Audio {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user