COMMON: Simplify DECLARE_SINGLETON macro

This makes it possible to write
  DECLARE_SINGLETON(foo);
instead of
  DECLARE_SINGLETON(foo)
without causing a warning about an extra semicolon.
The extra semicolon helps some editors at parsing the C++ code.

svn-id: r54258
This commit is contained in:
Max Horn 2010-11-16 08:23:13 +00:00
parent 5af8a76b48
commit abe1959d36
23 changed files with 32 additions and 35 deletions

View file

@ -27,7 +27,7 @@
#include "backends/fs/ds/ds-fs.h" #include "backends/fs/ds/ds-fs.h"
#include "dsmain.h" //for the isGBAMPAvailable() function #include "dsmain.h" //for the isGBAMPAvailable() function
DECLARE_SINGLETON(DSFilesystemFactory) DECLARE_SINGLETON(DSFilesystemFactory);
AbstractFSNode *DSFilesystemFactory::makeRootFileNode() const { AbstractFSNode *DSFilesystemFactory::makeRootFileNode() const {
if (DS::isGBAMPAvailable()) { if (DS::isGBAMPAvailable()) {

View file

@ -30,7 +30,7 @@
#include "backends/fs/ps2/ps2-fs-factory.h" #include "backends/fs/ps2/ps2-fs-factory.h"
#include "backends/fs/ps2/ps2-fs.cpp" #include "backends/fs/ps2/ps2-fs.cpp"
DECLARE_SINGLETON(Ps2FilesystemFactory) DECLARE_SINGLETON(Ps2FilesystemFactory);
AbstractFSNode *Ps2FilesystemFactory::makeRootFileNode() const { AbstractFSNode *Ps2FilesystemFactory::makeRootFileNode() const {
return new Ps2FilesystemNode(); return new Ps2FilesystemNode();

View file

@ -26,7 +26,7 @@
#include "backends/fs/psp/psp-fs-factory.h" #include "backends/fs/psp/psp-fs-factory.h"
#include "backends/fs/psp/psp-fs.cpp" #include "backends/fs/psp/psp-fs.cpp"
DECLARE_SINGLETON(PSPFilesystemFactory) DECLARE_SINGLETON(PSPFilesystemFactory);
AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const { AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const {
return new PSPFilesystemNode(); return new PSPFilesystemNode();

View file

@ -37,7 +37,7 @@
#include <smb.h> #include <smb.h>
#endif #endif
DECLARE_SINGLETON(WiiFilesystemFactory) DECLARE_SINGLETON(WiiFilesystemFactory);
WiiFilesystemFactory::WiiFilesystemFactory() : WiiFilesystemFactory::WiiFilesystemFactory() :
_dvdMounted(false), _dvdMounted(false),

View file

@ -63,7 +63,7 @@ const OSystem::GraphicsMode DisplayManager::_supportedModes[] = {
// Class VramAllocator ----------------------------------- // Class VramAllocator -----------------------------------
DECLARE_SINGLETON(VramAllocator) DECLARE_SINGLETON(VramAllocator);
//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ //#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */
//#define __PSP_DEBUG_PRINT__ //#define __PSP_DEBUG_PRINT__

View file

@ -33,7 +33,7 @@
//#define __PSP_DEBUG_PRINT__ //#define __PSP_DEBUG_PRINT__
#include "backends/platform/psp/trace.h" #include "backends/platform/psp/trace.h"
DECLARE_SINGLETON(PowerManager) DECLARE_SINGLETON(PowerManager);
// Function to debug the Power Manager (we have no output to screen) // Function to debug the Power Manager (we have no output to screen)
inline void PowerManager::debugPM() { inline void PowerManager::debugPM() {

View file

@ -37,7 +37,7 @@
// Class PspRtc --------------------------------------------------------------- // Class PspRtc ---------------------------------------------------------------
DECLARE_SINGLETON(PspRtc) DECLARE_SINGLETON(PspRtc);
void PspRtc::init() { // init our starting ticks void PspRtc::init() { // init our starting ticks
uint32 ticks[2]; uint32 ticks[2];

View file

@ -300,7 +300,7 @@ void FilePluginProvider::addCustomDirectories(Common::FSList &dirs) const {
#pragma mark - #pragma mark -
DECLARE_SINGLETON(PluginManager) DECLARE_SINGLETON(PluginManager);
PluginManager::PluginManager() { PluginManager::PluginManager() {
// Always add the static plugin provider. // Always add the static plugin provider.
@ -450,7 +450,7 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) {
#include "engines/metaengine.h" #include "engines/metaengine.h"
DECLARE_SINGLETON(EngineManager) DECLARE_SINGLETON(EngineManager);
GameDescriptor EngineManager::findGameOnePluginAtATime(const Common::String &gameName, const EnginePlugin **plugin) const { GameDescriptor EngineManager::findGameOnePluginAtATime(const Common::String &gameName, const EnginePlugin **plugin) const {
GameDescriptor result; GameDescriptor result;
@ -514,7 +514,7 @@ const EnginePlugin::List &EngineManager::getPlugins() const {
#include "sound/musicplugin.h" #include "sound/musicplugin.h"
DECLARE_SINGLETON(MusicManager) DECLARE_SINGLETON(MusicManager);
const MusicPlugin::List &MusicManager::getPlugins() const { const MusicPlugin::List &MusicManager::getPlugins() const {
return (const MusicPlugin::List &)PluginManager::instance().getPlugins(PLUGIN_TYPE_MUSIC); return (const MusicPlugin::List &)PluginManager::instance().getPlugins(PLUGIN_TYPE_MUSIC);

View file

@ -28,7 +28,7 @@
#include "common/config-manager.h" #include "common/config-manager.h"
#include "common/random.h" #include "common/random.h"
DECLARE_SINGLETON(Common::EventRecorder) DECLARE_SINGLETON(Common::EventRecorder);
namespace Common { namespace Common {

View file

@ -290,5 +290,5 @@ void SearchManager::clear() {
} // namespace Common } // namespace Common
DECLARE_SINGLETON(Common::SearchManager) DECLARE_SINGLETON(Common::SearchManager);

View file

@ -29,7 +29,7 @@
#include "common/util.h" #include "common/util.h"
#include "common/system.h" #include "common/system.h"
DECLARE_SINGLETON(Common::ConfigManager) DECLARE_SINGLETON(Common::ConfigManager);
static bool isValidDomainName(const Common::String &domName) { static bool isValidDomainName(const Common::String &domName) {
const char *p = domName.c_str(); const char *p = domName.c_str();

View file

@ -51,7 +51,7 @@
// TODO: Move gDebugLevel into namespace Common. // TODO: Move gDebugLevel into namespace Common.
int gDebugLevel = -1; int gDebugLevel = -1;
DECLARE_SINGLETON(Common::DebugManager) DECLARE_SINGLETON(Common::DebugManager);
namespace Common { namespace Common {

View file

@ -101,9 +101,7 @@ protected:
* namespace Common is referenced. * namespace Common is referenced.
*/ */
#define DECLARE_SINGLETON(T) \ #define DECLARE_SINGLETON(T) \
namespace Common { \ template<> T *Common::Singleton<T>::_singleton = 0
template<> T *Singleton<T>::_singleton = 0; \
} // End of namespace Common
} // End of namespace Common } // End of namespace Common

View file

@ -35,7 +35,7 @@
#include "common/archive.h" #include "common/archive.h"
#include "common/config-manager.h" #include "common/config-manager.h"
DECLARE_SINGLETON(Common::TranslationManager) DECLARE_SINGLETON(Common::TranslationManager);
#ifdef USE_DETECTLANG #ifdef USE_DETECTLANG
#ifndef WIN32 #ifndef WIN32

View file

@ -34,7 +34,7 @@
#include "common/endian.h" #include "common/endian.h"
#include "sound/midiparser.h" #include "sound/midiparser.h"
DECLARE_SINGLETON(Lure::SoundManager) DECLARE_SINGLETON(Lure::SoundManager);
namespace Lure { namespace Lure {

View file

@ -39,7 +39,7 @@
#include "sword25/gfx/animationtemplateregistry.h" #include "sword25/gfx/animationtemplateregistry.h"
#include "sword25/gfx/animationtemplate.h" #include "sword25/gfx/animationtemplate.h"
DECLARE_SINGLETON(Sword25::AnimationTemplateRegistry) DECLARE_SINGLETON(Sword25::AnimationTemplateRegistry);
namespace Sword25 { namespace Sword25 {

View file

@ -34,7 +34,7 @@
#include "sword25/gfx/renderobjectregistry.h" #include "sword25/gfx/renderobjectregistry.h"
DECLARE_SINGLETON(Sword25::RenderObjectRegistry) DECLARE_SINGLETON(Sword25::RenderObjectRegistry);
namespace Sword25 { namespace Sword25 {

View file

@ -39,7 +39,7 @@
#include "sword25/math/regionregistry.h" #include "sword25/math/regionregistry.h"
#include "sword25/math/region.h" #include "sword25/math/region.h"
DECLARE_SINGLETON(Sword25::RegionRegistry) DECLARE_SINGLETON(Sword25::RegionRegistry);
namespace Sword25 { namespace Sword25 {

View file

@ -27,7 +27,7 @@
#include "testbed/config-params.h" #include "testbed/config-params.h"
DECLARE_SINGLETON(Testbed::ConfigParams) DECLARE_SINGLETON(Testbed::ConfigParams);
namespace Testbed { namespace Testbed {

View file

@ -27,7 +27,7 @@
#include "common/system.h" #include "common/system.h"
#include "common/stack.h" #include "common/stack.h"
DECLARE_SINGLETON(Graphics::CursorManager) DECLARE_SINGLETON(Graphics::CursorManager);
namespace Graphics { namespace Graphics {

View file

@ -149,10 +149,10 @@ public:
#define FORWARD_DECLARE_FONT(n) \ #define FORWARD_DECLARE_FONT(n) \
extern const NewFont *n; \ extern const NewFont *n; \
extern void create_##n(); extern void create_##n()
#define INIT_FONT(n) \ #define INIT_FONT(n) \
create_##n(); create_##n()
} // End of namespace Graphics } // End of namespace Graphics

View file

@ -23,16 +23,15 @@
*/ */
#include "graphics/fontman.h" #include "graphics/fontman.h"
//#include "gui/consolefont.h"
DECLARE_SINGLETON(Graphics::FontManager) DECLARE_SINGLETON(Graphics::FontManager);
namespace Graphics { namespace Graphics {
const ScummFont *g_scummfont = 0; const ScummFont *g_scummfont = 0;
FORWARD_DECLARE_FONT(g_sysfont) FORWARD_DECLARE_FONT(g_sysfont);
FORWARD_DECLARE_FONT(g_sysfont_big) FORWARD_DECLARE_FONT(g_sysfont_big);
FORWARD_DECLARE_FONT(g_consolefont) FORWARD_DECLARE_FONT(g_consolefont);
FontManager::FontManager() { FontManager::FontManager() {
// This assert should *never* trigger, because // This assert should *never* trigger, because
@ -41,9 +40,9 @@ FontManager::FontManager() {
// reset to 0 in the desctructor of this class). // reset to 0 in the desctructor of this class).
assert(g_scummfont == 0); assert(g_scummfont == 0);
g_scummfont = new ScummFont; g_scummfont = new ScummFont;
INIT_FONT(g_sysfont) INIT_FONT(g_sysfont);
INIT_FONT(g_sysfont_big) INIT_FONT(g_sysfont_big);
INIT_FONT(g_consolefont) INIT_FONT(g_consolefont);
} }
FontManager::~FontManager() { FontManager::~FontManager() {

View file

@ -39,7 +39,7 @@
#include "graphics/cursorman.h" #include "graphics/cursorman.h"
DECLARE_SINGLETON(GUI::GuiManager) DECLARE_SINGLETON(GUI::GuiManager);
namespace GUI { namespace GUI {