mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Singleton: Add new macros to simplify singleton creation
The INLINE macros allow singletons to be declared and defined in one line, without requiring a separate JUCE_IMPLEMENT_SINGLETON statement.
This commit is contained in:
parent
5179f4e720
commit
80ac9a78a0
44 changed files with 69 additions and 138 deletions
|
|
@ -591,6 +591,3 @@ void LatestVersionCheckerAndUpdater::downloadAndInstall (const VersionInfo::Asse
|
|||
}
|
||||
}));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
JUCE_IMPLEMENT_SINGLETON (LatestVersionCheckerAndUpdater)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public:
|
|||
void checkForNewVersion (bool isBackgroundCheck);
|
||||
|
||||
//==============================================================================
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL (LatestVersionCheckerAndUpdater)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE (LatestVersionCheckerAndUpdater)
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -81,6 +81,4 @@ void Analytics::setSuspended (bool shouldBeSuspended)
|
|||
isSuspended = shouldBeSuspended;
|
||||
}
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (Analytics)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public:
|
|||
void setSuspended (bool shouldBeSuspended);
|
||||
|
||||
#ifndef DOXYGEN
|
||||
JUCE_DECLARE_SINGLETON (Analytics, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (Analytics, false)
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1879,7 +1879,7 @@ struct MidiService final : public DeletedAtShutdown
|
|||
return *getInstance()->internal.get();
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON (MidiService, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (MidiService, false)
|
||||
|
||||
private:
|
||||
std::unique_ptr<MidiServiceType> internal;
|
||||
|
|
@ -1889,8 +1889,6 @@ private:
|
|||
} };
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (MidiService)
|
||||
|
||||
//==============================================================================
|
||||
static int findDefaultDeviceIndex (const Array<MidiDeviceInfo>& available, const MidiDeviceInfo& defaultDevice)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -135,6 +135,15 @@ struct SingletonHolder : private MutexType // (inherited so we can use the empt
|
|||
std::atomic<Type*> instance { nullptr };
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN
|
||||
#define JUCE_PRIVATE_DECLARE_SINGLETON(Classname, mutex, doNotRecreate, inlineToken, getter) \
|
||||
static inlineToken juce::SingletonHolder<Classname, mutex, doNotRecreate> singletonHolder; \
|
||||
friend juce::SingletonHolder<Classname, mutex, doNotRecreate>; \
|
||||
static Classname* JUCE_CALLTYPE getInstance() { return singletonHolder.getter(); } \
|
||||
static Classname* JUCE_CALLTYPE getInstanceWithoutCreating() noexcept { return singletonHolder.instance; } \
|
||||
static void JUCE_CALLTYPE deleteInstance() noexcept { singletonHolder.deleteInstance(); } \
|
||||
void clearSingletonInstance() noexcept { singletonHolder.clear (this); }
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
|
|
@ -194,27 +203,28 @@ struct SingletonHolder : private MutexType // (inherited so we can use the empt
|
|||
@see JUCE_IMPLEMENT_SINGLETON, JUCE_DECLARE_SINGLETON_SINGLETHREADED
|
||||
*/
|
||||
#define JUCE_DECLARE_SINGLETON(Classname, doNotRecreateAfterDeletion) \
|
||||
\
|
||||
static juce::SingletonHolder<Classname, juce::CriticalSection, doNotRecreateAfterDeletion> singletonHolder; \
|
||||
friend juce::SingletonHolder<Classname, juce::CriticalSection, doNotRecreateAfterDeletion>; \
|
||||
\
|
||||
static Classname* JUCE_CALLTYPE getInstance() { return singletonHolder.get(); } \
|
||||
static Classname* JUCE_CALLTYPE getInstanceWithoutCreating() noexcept { return singletonHolder.instance; } \
|
||||
static void JUCE_CALLTYPE deleteInstance() noexcept { singletonHolder.deleteInstance(); } \
|
||||
void clearSingletonInstance() noexcept { singletonHolder.clear (this); }
|
||||
JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::CriticalSection, doNotRecreateAfterDeletion, , get)
|
||||
|
||||
/**
|
||||
The same as JUCE_DECLARE_SINGLETON, but does not require a matching
|
||||
JUCE_IMPLEMENT_SINGLETON definition.
|
||||
*/
|
||||
#define JUCE_DECLARE_SINGLETON_INLINE(Classname, doNotRecreateAfterDeletion) \
|
||||
JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::CriticalSection, doNotRecreateAfterDeletion, inline, get)
|
||||
|
||||
//==============================================================================
|
||||
/** This is a counterpart to the JUCE_DECLARE_SINGLETON macros.
|
||||
|
||||
After adding the JUCE_DECLARE_SINGLETON to the class definition, this macro has
|
||||
to be used in the cpp file.
|
||||
|
||||
This macro is not required for singletons declared with the INLINE macros, specifically
|
||||
JUCE_DECLARE_SINGLETON_INLINE, JUCE_DECLARE_SINGLETON_SINGLETHREADED_INLINE, and
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE.
|
||||
*/
|
||||
#define JUCE_IMPLEMENT_SINGLETON(Classname) \
|
||||
\
|
||||
decltype (Classname::singletonHolder) Classname::singletonHolder;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Macro to declare member variables and methods for a singleton class.
|
||||
|
|
@ -236,15 +246,14 @@ struct SingletonHolder : private MutexType // (inherited so we can use the empt
|
|||
@see JUCE_IMPLEMENT_SINGLETON, JUCE_DECLARE_SINGLETON, JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL
|
||||
*/
|
||||
#define JUCE_DECLARE_SINGLETON_SINGLETHREADED(Classname, doNotRecreateAfterDeletion) \
|
||||
\
|
||||
static juce::SingletonHolder<Classname, juce::DummyCriticalSection, doNotRecreateAfterDeletion> singletonHolder; \
|
||||
friend decltype (singletonHolder); \
|
||||
\
|
||||
static Classname* JUCE_CALLTYPE getInstance() { return singletonHolder.get(); } \
|
||||
static Classname* JUCE_CALLTYPE getInstanceWithoutCreating() noexcept { return singletonHolder.instance; } \
|
||||
static void JUCE_CALLTYPE deleteInstance() noexcept { singletonHolder.deleteInstance(); } \
|
||||
void clearSingletonInstance() noexcept { singletonHolder.clear (this); }
|
||||
JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::DummyCriticalSection, doNotRecreateAfterDeletion, , get)
|
||||
|
||||
/**
|
||||
The same as JUCE_DECLARE_SINGLETON_SINGLETHREADED, but does not require a matching
|
||||
JUCE_IMPLEMENT_SINGLETON definition.
|
||||
*/
|
||||
#define JUCE_DECLARE_SINGLETON_SINGLETHREADED_INLINE(Classname, doNotRecreateAfterDeletion) \
|
||||
JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::DummyCriticalSection, doNotRecreateAfterDeletion, inline, get)
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
|
|
@ -262,15 +271,14 @@ struct SingletonHolder : private MutexType // (inherited so we can use the empt
|
|||
@see JUCE_IMPLEMENT_SINGLETON, JUCE_DECLARE_SINGLETON
|
||||
*/
|
||||
#define JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL(Classname) \
|
||||
\
|
||||
static juce::SingletonHolder<Classname, juce::DummyCriticalSection, false> singletonHolder; \
|
||||
friend decltype (singletonHolder); \
|
||||
\
|
||||
static Classname* JUCE_CALLTYPE getInstance() { return singletonHolder.getWithoutChecking(); } \
|
||||
static Classname* JUCE_CALLTYPE getInstanceWithoutCreating() noexcept { return singletonHolder.instance; } \
|
||||
static void JUCE_CALLTYPE deleteInstance() noexcept { singletonHolder.deleteInstance(); } \
|
||||
void clearSingletonInstance() noexcept { singletonHolder.clear (this); }
|
||||
JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::DummyCriticalSection, false, , getWithoutChecking)
|
||||
|
||||
/**
|
||||
The same as JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL, but does not require a matching
|
||||
JUCE_IMPLEMENT_SINGLETON definition.
|
||||
*/
|
||||
#define JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE(Classname) \
|
||||
JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::DummyCriticalSection, false, inline, getWithoutChecking)
|
||||
|
||||
//==============================================================================
|
||||
#ifndef DOXYGEN
|
||||
|
|
|
|||
|
|
@ -55,6 +55,4 @@ void ChildProcessManager::checkProcesses()
|
|||
timer.stopTimer();
|
||||
}
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (ChildProcessManager)
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace juce
|
|||
{
|
||||
public:
|
||||
#ifndef DOXYGEN
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL (ChildProcessManager)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE (ChildProcessManager)
|
||||
#endif
|
||||
|
||||
/** Creates a new ChildProcess and starts it with the provided arguments.
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Android
|
|||
Handler() : nativeHandler (LocalRef<jobject> (getEnv()->NewObject (AndroidHandler, AndroidHandler.constructor))) {}
|
||||
~Handler() { clearSingletonInstance(); }
|
||||
|
||||
JUCE_DECLARE_SINGLETON (Handler, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (Handler, false)
|
||||
|
||||
bool post (jobject runnable)
|
||||
{
|
||||
|
|
@ -74,14 +74,12 @@ namespace Android
|
|||
|
||||
GlobalRef nativeHandler;
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (Handler)
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
struct AndroidMessageQueue final : private Android::Runnable
|
||||
{
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED (AndroidMessageQueue, true)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_INLINE (AndroidMessageQueue, true)
|
||||
|
||||
AndroidMessageQueue()
|
||||
: self (CreateJavaInterface (this, "java/lang/Runnable"))
|
||||
|
|
@ -124,8 +122,6 @@ private:
|
|||
Android::Handler handler;
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (AndroidMessageQueue)
|
||||
|
||||
//==============================================================================
|
||||
void MessageManager::doPlatformSpecificInitialisation() { AndroidMessageQueue::getInstance(); }
|
||||
void MessageManager::doPlatformSpecificShutdown() { AndroidMessageQueue::deleteInstance(); }
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public:
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
JUCE_DECLARE_SINGLETON (InternalMessageQueue, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (InternalMessageQueue, false)
|
||||
|
||||
private:
|
||||
CriticalSection lock;
|
||||
|
|
@ -115,8 +115,6 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (InternalMessageQueue)
|
||||
|
||||
//==============================================================================
|
||||
/*
|
||||
Stores callbacks associated with file descriptors (FD).
|
||||
|
|
@ -230,7 +228,7 @@ public:
|
|||
void removeListener (LinuxEventLoopInternal::Listener& listener) { listeners.remove (&listener); }
|
||||
|
||||
//==============================================================================
|
||||
JUCE_DECLARE_SINGLETON (InternalRunLoop, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (InternalRunLoop, false)
|
||||
|
||||
private:
|
||||
using SharedCallback = std::shared_ptr<std::function<void()>>;
|
||||
|
|
@ -282,8 +280,6 @@ private:
|
|||
ListenerList<LinuxEventLoopInternal::Listener> listeners;
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (InternalRunLoop)
|
||||
|
||||
//==============================================================================
|
||||
namespace LinuxErrorHandling
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public:
|
|||
clearSingletonInstance();
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON (InternalMessageQueue, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (InternalMessageQueue, false)
|
||||
|
||||
//==============================================================================
|
||||
void broadcastMessage (const String& message)
|
||||
|
|
@ -260,8 +260,6 @@ private:
|
|||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (InternalMessageQueue)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (InternalMessageQueue)
|
||||
|
||||
const TCHAR InternalMessageQueue::messageWindowName[] = _T("JUCEWindow");
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -88,7 +88,4 @@ String WinRTWrapper::hStringToString (HSTRING hstr)
|
|||
return {};
|
||||
}
|
||||
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (WinRTWrapper)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public:
|
|||
~WinRTWrapper();
|
||||
bool isInitialised() const noexcept { return initialised; }
|
||||
|
||||
JUCE_DECLARE_SINGLETON (WinRTWrapper, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (WinRTWrapper, false)
|
||||
|
||||
//==============================================================================
|
||||
template <class ComClass>
|
||||
|
|
|
|||
|
|
@ -77,11 +77,9 @@ private:
|
|||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ShutdownDetector)
|
||||
JUCE_DECLARE_NON_MOVEABLE (ShutdownDetector)
|
||||
JUCE_DECLARE_SINGLETON (ShutdownDetector, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (ShutdownDetector, false)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (ShutdownDetector)
|
||||
|
||||
class Timer::TimerThread final : private Thread,
|
||||
private ShutdownDetector::Listener
|
||||
{
|
||||
|
|
|
|||
|
|
@ -85,16 +85,13 @@ namespace
|
|||
: configureArrangement (args);
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON (GlyphArrangementCache<ArrangementArgs>, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (GlyphArrangementCache<ArrangementArgs>, false)
|
||||
|
||||
private:
|
||||
LruCache<ArrangementArgs, ConfiguredArrangement> cache;
|
||||
CriticalSection lock;
|
||||
};
|
||||
|
||||
template <typename ArrangementArgs>
|
||||
juce::SingletonHolder<GlyphArrangementCache<ArrangementArgs>, juce::CriticalSection, false> GlyphArrangementCache<ArrangementArgs>::singletonHolder;
|
||||
|
||||
//==============================================================================
|
||||
template <typename Type>
|
||||
Rectangle<Type> coordsToRectangle (Type x, Type y, Type w, Type h) noexcept
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public:
|
|||
clearSingletonInstance();
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON (TypefaceCache, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (TypefaceCache, false)
|
||||
|
||||
void setSize (const int numToCache)
|
||||
{
|
||||
|
|
@ -170,8 +170,6 @@ private:
|
|||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TypefaceCache)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (TypefaceCache)
|
||||
|
||||
void Typeface::setTypefaceCacheSize (int numFontsToCache)
|
||||
{
|
||||
TypefaceCache::getInstance()->setSize (numFontsToCache);
|
||||
|
|
|
|||
|
|
@ -61,14 +61,12 @@ public:
|
|||
return cachedTypefaces.get (key, std::forward<Fn> (getTypeface));
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL (TypefaceFileCache)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE (TypefaceFileCache)
|
||||
|
||||
private:
|
||||
LruCache<TypefaceFileAndIndex, Typeface::Ptr> cachedTypefaces;
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (TypefaceFileCache)
|
||||
|
||||
} // namespace juce
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ struct ImageCache::Pimpl : private Timer,
|
|||
clearSingletonInstance();
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON (ImageCache::Pimpl, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (ImageCache::Pimpl, false)
|
||||
|
||||
Image getFromHashCode (const int64 hashCode) noexcept
|
||||
{
|
||||
|
|
@ -124,9 +124,6 @@ struct ImageCache::Pimpl : private Timer,
|
|||
JUCE_DECLARE_NON_COPYABLE (Pimpl)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (ImageCache::Pimpl)
|
||||
|
||||
|
||||
//==============================================================================
|
||||
Image ImageCache::getFromHashCode (const int64 hashCode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@
|
|||
namespace juce
|
||||
{
|
||||
|
||||
#if JUCE_DIRECT2D_METRICS
|
||||
JUCE_IMPLEMENT_SINGLETON (Direct2DMetricsHub)
|
||||
#endif
|
||||
|
||||
struct ScopedBlendCopy
|
||||
{
|
||||
explicit ScopedBlendCopy (ComSmartPtr<ID2D1DeviceContext1> c)
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ public:
|
|||
|
||||
static constexpr int magicNumber = 0xd2d1;
|
||||
|
||||
JUCE_DECLARE_SINGLETON (Direct2DMetricsHub, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (Direct2DMetricsHub, false)
|
||||
|
||||
private:
|
||||
static String getProcessString() noexcept;
|
||||
|
|
|
|||
|
|
@ -176,15 +176,13 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON (MemoryFontCache, true)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (MemoryFontCache, true)
|
||||
|
||||
private:
|
||||
std::map<Key, Value> cache;
|
||||
mutable std::mutex mutex;
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (MemoryFontCache)
|
||||
|
||||
StringArray Font::findAllTypefaceNames()
|
||||
{
|
||||
auto results = [&]
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ public:
|
|||
faces.erase (iter);
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL (FTTypefaceList)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE (FTTypefaceList)
|
||||
|
||||
FTLibWrapper::Ptr getLibrary() const { return library; }
|
||||
|
||||
|
|
@ -373,8 +373,6 @@ private:
|
|||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FTTypefaceList)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (FTTypefaceList)
|
||||
|
||||
//==============================================================================
|
||||
class FreeTypeTypeface final : public Typeface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -108,9 +108,6 @@ ModalComponentManager::~ModalComponentManager()
|
|||
clearSingletonInstance();
|
||||
}
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (ModalComponentManager)
|
||||
|
||||
|
||||
//==============================================================================
|
||||
void ModalComponentManager::startModal (Key, Component* component, bool autoDelete)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
#ifndef DOXYGEN
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL (ModalComponentManager)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE (ModalComponentManager)
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public:
|
|||
clearSingletonInstance();
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL (TopLevelWindowManager)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE (TopLevelWindowManager)
|
||||
|
||||
static void checkCurrentlyFocusedTopLevelWindow()
|
||||
{
|
||||
|
|
@ -140,6 +140,4 @@ private:
|
|||
JUCE_DECLARE_NON_COPYABLE (TopLevelWindowManager)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (TopLevelWindowManager)
|
||||
|
||||
} // namespace juce::detail
|
||||
|
|
|
|||
|
|
@ -263,11 +263,9 @@ struct SpVoiceWrapper final : public DeletedAtShutdown
|
|||
|
||||
ComSmartPtr<ISpVoice> voice;
|
||||
|
||||
JUCE_DECLARE_SINGLETON (SpVoiceWrapper, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (SpVoiceWrapper, false)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (SpVoiceWrapper)
|
||||
|
||||
|
||||
void AccessibilityHandler::postAnnouncement (const String& announcementString, AnnouncementPriority priority)
|
||||
{
|
||||
|
|
@ -329,8 +327,6 @@ namespace WindowsAccessibility
|
|||
}
|
||||
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (WindowsUIAWrapper)
|
||||
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ public:
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL (WindowsUIAWrapper)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE (WindowsUIAWrapper)
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -311,14 +311,12 @@ namespace DragAndDropHelpers
|
|||
clearSingletonInstance();
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED (ThreadPoolHolder, false)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_INLINE (ThreadPoolHolder, false)
|
||||
|
||||
// We need to make sure we don't do simultaneous text and file drag and drops,
|
||||
// so use a pool that can only run a single job.
|
||||
ThreadPool pool { ThreadPoolOptions{}.withNumberOfThreads (1) };
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (ThreadPoolHolder)
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -71,11 +71,9 @@ struct JuceMainMenuBarHolder final : private DeletedAtShutdown
|
|||
|
||||
NSMenu* mainMenuBar = nil;
|
||||
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED (JuceMainMenuBarHolder, true)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_INLINE (JuceMainMenuBarHolder, true)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (JuceMainMenuBarHolder)
|
||||
|
||||
//==============================================================================
|
||||
class JuceMainMenuHandler final : private MenuBarModel::Listener,
|
||||
private DeletedAtShutdown
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ public:
|
|||
threads.end());
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED (VBlankDispatcher, false)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_INLINE (VBlankDispatcher, false)
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
@ -304,6 +304,4 @@ private:
|
|||
JUCE_DECLARE_NON_MOVEABLE (VBlankDispatcher)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (VBlankDispatcher)
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
|
|
@ -424,12 +424,10 @@ struct DisplaySettingsChangeCallback final : private DeletedAtShutdown
|
|||
|
||||
std::function<void()> forceDisplayUpdate;
|
||||
|
||||
JUCE_DECLARE_SINGLETON (DisplaySettingsChangeCallback, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (DisplaySettingsChangeCallback, false)
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DisplaySettingsChangeCallback)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (DisplaySettingsChangeCallback)
|
||||
|
||||
static Rectangle<int> convertDisplayRect (NSRect r, CGFloat mainScreenBottom)
|
||||
{
|
||||
r.origin.y = mainScreenBottom - (r.origin.y + r.size.height);
|
||||
|
|
|
|||
|
|
@ -2290,7 +2290,7 @@ private:
|
|||
|
||||
LPCTSTR getWindowClassName() const noexcept { return (LPCTSTR) (pointer_sized_uint) atom; }
|
||||
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL (WindowClassHolder)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE (WindowClassHolder)
|
||||
|
||||
private:
|
||||
ATOM atom;
|
||||
|
|
@ -5556,8 +5556,6 @@ JUCE_API ComponentPeer* createNonRepaintingEmbeddedWindowsPeer (Component& compo
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (HWNDComponentPeer::WindowClassHolder)
|
||||
|
||||
//==============================================================================
|
||||
bool KeyPress::isKeyCurrentlyDown (const int keyCode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -243,7 +243,4 @@ bool X11Symbols::loadAllSymbols()
|
|||
return true;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
JUCE_IMPLEMENT_SINGLETON (X11Symbols)
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
|
|
@ -596,7 +596,7 @@ public:
|
|||
#endif
|
||||
|
||||
//==============================================================================
|
||||
JUCE_DECLARE_SINGLETON (X11Symbols, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (X11Symbols, false)
|
||||
|
||||
private:
|
||||
X11Symbols() = default;
|
||||
|
|
|
|||
|
|
@ -3999,8 +3999,6 @@ void XWindowSystem::windowMessageReceive (XEvent& event)
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
JUCE_IMPLEMENT_SINGLETON (XWindowSystem)
|
||||
|
||||
Image createSnapshotOfNativeWindow (void* window)
|
||||
{
|
||||
::Window root;
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ public:
|
|||
bool isParentWindowOf (::Window, ::Window possibleChild) const;
|
||||
|
||||
//==============================================================================
|
||||
JUCE_DECLARE_SINGLETON (XWindowSystem, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (XWindowSystem, false)
|
||||
|
||||
private:
|
||||
XWindowSystem();
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public:
|
|||
AllComponentRepainter() {}
|
||||
~AllComponentRepainter() override { clearSingletonInstance(); }
|
||||
|
||||
JUCE_DECLARE_SINGLETON (AllComponentRepainter, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (AllComponentRepainter, false)
|
||||
|
||||
void trigger()
|
||||
{
|
||||
|
|
@ -94,9 +94,6 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (AllComponentRepainter)
|
||||
JUCE_IMPLEMENT_SINGLETON (ValueList)
|
||||
|
||||
//==============================================================================
|
||||
int64 parseInt (String s)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ namespace juce::LiveConstantEditor
|
|||
ValueList();
|
||||
~ValueList() override;
|
||||
|
||||
JUCE_DECLARE_SINGLETON (ValueList, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (ValueList, false)
|
||||
|
||||
template <typename Type>
|
||||
LiveValue<Type>& getValue (const char* file, int line, const Type& initialValue)
|
||||
|
|
|
|||
|
|
@ -81,8 +81,6 @@ PushNotifications::Notification::Notification (const Notification& other)
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
JUCE_IMPLEMENT_SINGLETON (PushNotifications)
|
||||
|
||||
PushNotifications::PushNotifications()
|
||||
#if JUCE_PUSH_NOTIFICATIONS
|
||||
: pimpl (new Pimpl (*this))
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class JUCE_API PushNotifications : private DeletedAtShutdown
|
|||
{
|
||||
public:
|
||||
#ifndef DOXYGEN
|
||||
JUCE_DECLARE_SINGLETON (PushNotifications, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (PushNotifications, false)
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ public:
|
|||
(gpointer), void)
|
||||
|
||||
//==============================================================================
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL (WebKitSymbols)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE (WebKitSymbols)
|
||||
|
||||
private:
|
||||
WebKitSymbols() = default;
|
||||
|
|
@ -417,8 +417,6 @@ private:
|
|||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WebKitSymbols)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (WebKitSymbols)
|
||||
|
||||
//==============================================================================
|
||||
extern "C" int juce_gtkWebkitMain (int argc, const char* const* argv);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ namespace juce
|
|||
{
|
||||
|
||||
//==============================================================================
|
||||
JUCE_IMPLEMENT_SINGLETON (InAppPurchases)
|
||||
|
||||
InAppPurchases::InAppPurchases()
|
||||
#if JUCE_ANDROID || JUCE_IOS || JUCE_MAC
|
||||
: pimpl (new Pimpl (*this))
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class JUCE_API InAppPurchases : private DeletedAtShutdown
|
|||
{
|
||||
public:
|
||||
#ifndef DOXYGEN
|
||||
JUCE_DECLARE_SINGLETON (InAppPurchases, false)
|
||||
JUCE_DECLARE_SINGLETON_INLINE (InAppPurchases, false)
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -849,7 +849,7 @@ private:
|
|||
bool isRegistered() const noexcept { return atom != 0; }
|
||||
LPCTSTR getWindowClassName() const noexcept { return (LPCTSTR) (pointer_sized_uint) MAKELONG (atom, 0); }
|
||||
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL (NativeWindowClass)
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE (NativeWindowClass)
|
||||
|
||||
private:
|
||||
NativeWindowClass()
|
||||
|
|
@ -965,5 +965,3 @@ private:
|
|||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Pimpl)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (VideoComponent::Pimpl::DirectShowContext::NativeWindowClass)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue