JUCE
Macros
juce_PlatformDefs.h File Reference

Macros

#define JUCE_CALLTYPE
 This macro defines the C calling convention used as the standard for Juce calls. More...
 
#define JUCE_CDECL
 
#define JUCE_LOG_CURRENT_ASSERTION
 
#define JUCE_BREAK_IN_DEBUGGER   { ::kill (0, SIGTRAP); }
 This will try to break into the debugger if the app is currently being debugged. More...
 
#define JUCE_ANALYZER_NORETURN
 
#define JUCE_BLOCK_WITH_FORCED_SEMICOLON(x)   do { x } while (false)
 This is the good old C++ trick for creating a macro that forces the user to put a semicolon after it when they use it. More...
 
#define DBG(textToWrite)   JUCE_BLOCK_WITH_FORCED_SEMICOLON (juce::String tempDbgBuf; tempDbgBuf << textToWrite; juce::Logger::outputDebugString (tempDbgBuf);)
 Writes a string to the standard error stream. More...
 
#define jassertfalse   JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION; if (juce::juce_isRunningUnderDebugger()) JUCE_BREAK_IN_DEBUGGER; JUCE_ANALYZER_NORETURN)
 This will always cause an assertion failure. More...
 
#define jassert(expression)   JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
 Platform-independent assertion macro. More...
 
#define JUCE_JOIN_MACRO(item1, item2)   JUCE_JOIN_MACRO_HELPER (item1, item2)
 A good old-fashioned C macro concatenation helper. More...
 
#define JUCE_STRINGIFY(item)   JUCE_STRINGIFY_MACRO_HELPER (item)
 A handy C macro for stringifying any symbol, rather than just a macro parameter. More...
 
#define static_jassert(expression)   juce::JuceStaticAssert<expression>::dummy();
 A compile-time assertion macro. More...
 
#define JUCE_DECLARE_NON_COPYABLE(className)
 This is a shorthand macro for declaring stubs for a class's copy constructor and operator=. More...
 
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
 This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for a class. More...
 
#define JUCE_PREVENT_HEAP_ALLOCATION
 This macro can be added to class definitions to disable the use of new/delete to allocate the object on the heap, forcing it to only be used as a stack or member variable. More...
 
#define JUCE_COMPILER_WARNING(message)   _Pragma(JUCE_STRINGIFY (JUCE_WARNING_HELPER (message)))
 This macro allows you to emit a custom compiler warning message. More...
 
#define forcedinline   inline
 A platform-independent way of forcing an inline function. More...
 
#define JUCE_ALIGN(bytes)   __declspec (align (bytes))
 This can be placed before a stack or member variable declaration to tell the compiler to align it to the specified number of bytes. More...
 
#define JUCE_DEPRECATED(functionDef)
 This macro can be used to wrap a function which has been deprecated. More...
 
#define JUCE_DEPRECATED_WITH_BODY(functionDef, body)
 
#define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS   __attribute__((__optimize__("no-associative-math")))
 This can be appended to a function declaration to tell gcc to disable associative math optimisations which break some floating point algorithms. More...
 

Macro Definition Documentation

#define JUCE_CALLTYPE
#define JUCE_CDECL
#define JUCE_LOG_CURRENT_ASSERTION
#define JUCE_BREAK_IN_DEBUGGER   { ::kill (0, SIGTRAP); }

This will try to break into the debugger if the app is currently being debugged.

If called by an app that's not being debugged, the behaviour isn't defined - it may crash or not, depending on the platform.

See also
jassert()
#define JUCE_ANALYZER_NORETURN
#define JUCE_BLOCK_WITH_FORCED_SEMICOLON (   x)    do { x } while (false)

This is the good old C++ trick for creating a macro that forces the user to put a semicolon after it when they use it.

#define DBG (   textToWrite)    JUCE_BLOCK_WITH_FORCED_SEMICOLON (juce::String tempDbgBuf; tempDbgBuf << textToWrite; juce::Logger::outputDebugString (tempDbgBuf);)

Writes a string to the standard error stream.

Note that as well as a single string, you can use this to write multiple items as a stream, e.g.

1 DBG ("foo = " << foo << "bar = " << bar);

The macro is only enabled in a debug build, so be careful not to use it with expressions that have important side-effects!

See also
Logger::outputDebugString

Referenced by OSCException::OSCException(), and LeakedObjectDetector< OwnerClass >::~LeakedObjectDetector().

#define jassertfalse   JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION; if (juce::juce_isRunningUnderDebugger()) JUCE_BREAK_IN_DEBUGGER; JUCE_ANALYZER_NORETURN)
#define jassert (   expression)    JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)

Platform-independent assertion macro.

This macro gets turned into a no-op when you're building with debugging turned off, so be careful that the expression you pass to it doesn't perform any actions that are vital for the correct behaviour of your program!

See also
jassertfalse

Referenced by ListenerList< MenuBarModel::Listener >::add(), RectangleList< int >::add(), OwnedArray< MidiBuffer >::add(), ReferenceCountedArray< AudioProcessorGraph::Node >::add(), OwnedArray< MidiBuffer >::addArray(), OwnedArray< MidiBuffer >::addCopiesOf(), AudioBuffer< float >::addFrom(), AudioBuffer< float >::addFromWithRamp(), SparseSet< int >::addRange(), AudioBuffer< float >::addSample(), SortedSet< ColourSetting >::addSet(), StatisticsAccumulator< FloatType >::addValue(), RectangleList< int >::addWithoutMerging(), String::appendCharPointer(), LinkedListPointer< ObjectType >::Appender::Appender(), AudioBuffer< float >::applyGain(), AudioBuffer< float >::applyGainRamp(), VST3BufferExchange< float >::associateBufferTo(), AudioUnitHelpers::auChannelIndexToJuce(), AudioBuffer< float >::AudioBuffer(), LassoComponent< SelectableItemType >::beginLasso(), AudioBuffer< float >::clear(), AudioFormatReader::clearSamplesBeyondAvailableLength(), RectangleList< int >::clipTo(), AudioData::ConverterInstance< SourceSampleType, DestSampleType >::convertSamples(), AudioUnitHelpers::copyAudioBuffer(), AudioBuffer< float >::copyFrom(), AudioBuffer< float >::copyFromWithRamp(), LinkedListPointer< XmlElement >::copyToArray(), StandalonePluginHolder::createPlugin(), ReferenceCountedObject::decReferenceCount(), SingleThreadedReferenceCountedObject::decReferenceCount(), ReferenceCountedObject::decReferenceCountWithoutDeleting(), SingleThreadedReferenceCountedObject::decReferenceCountWithoutDeleting(), ArrayAllocationBase< ProgressBar *, DummyCriticalSection >::ensureAllocatedSize(), SpinLock::exit(), AudioBuffer< float >::findMinMax(), AudioUnitHelpers::CoreAudioBufferList::getBuffer(), OwnedArray< MidiBuffer >::getFirst(), ReferenceCountedArray< AudioProcessorGraph::Node >::getFirst(), Array< Button::Listener * >::getFirst(), RectangleList< int >::getIntersectionWith(), OwnedArray< MidiBuffer >::getLast(), ReferenceCountedArray< AudioProcessorGraph::Node >::getLast(), Array< Button::Listener * >::getLast(), AudioBuffer< float >::getMagnitude(), ReferenceCountedArray< AudioProcessorGraph::Node >::getObjectPointer(), ReferenceCountedArray< AudioProcessorGraph::Node >::getObjectPointerUnchecked(), Draggable3DOrientation::getQuaternion(), AudioBuffer< float >::getReadPointer(), Array< Button::Listener * >::getReference(), AudioBuffer< float >::getRMSLevel(), AudioBuffer< float >::getSample(), WeakReference< ObjectType, ReferenceCountingType >::Master::getSharedPointer(), SparseSet< int >::getTotalRange(), OwnedArray< MidiBuffer >::getUnchecked(), Array< Button::Listener * >::getUnchecked(), AudioBuffer< float >::getWritePointer(), OwnedArray< MidiBuffer >::insert(), ReferenceCountedArray< AudioProcessorGraph::Node >::insert(), Array< Button::Listener * >::insert(), LinkedListPointer< XmlElement >::insertAtIndex(), LinkedListPointer< XmlElement >::insertNext(), CharPointer_UTF8::isByteOrderMark(), CharPointer_UTF16::isByteOrderMarkBigEndian(), CharPointer_UTF16::isByteOrderMarkLittleEndian(), isPositiveAndBelow(), isPositiveAndNotGreaterThan(), EdgeTable::iterate(), jlimit(), jmap(), ComSmartPtr< ObjectType >::loadFrom(), negativeAwareModulo(), Quaternion< float >::normalised(), SparseSet< int >::operator!=(), CharPointer_UTF8::operator++(), ReferenceCountedObjectPtr< ImagePixelData >::operator->(), LinkedListPointer< XmlElement >::operator=(), ScopedPointer< ListViewport >::operator=(), OwnedArray< MidiBuffer >::operator[](), Array< Button::Listener * >::operator[](), LassoComponent< SelectableItemType >::paint(), AudioUnitHelpers::CoreAudioBufferList::pop(), Reverb::processMono(), Reverb::processStereo(), AudioUnitHelpers::CoreAudioBufferList::push(), ListenerList< MenuBarModel::Listener >::remove(), Array< Button::Listener * >::remove(), SparseSet< int >::removeRange(), LinkedListPointer< XmlElement >::replaceNext(), LinearSmoothedValue< float >::reset(), Array< Button::Listener * >::resize(), PluginBusUtilities::restoreBusArrangement(), AudioBuffer< float >::reverse(), ReferenceCountedArray< AudioProcessorGraph::Node >::set(), Array< Button::Listener * >::set(), AudioUnitHelpers::CoreAudioBufferList::setBuffer(), AudioBuffer< float >::setDataToReferTo(), AudioBuffer< float >::setSample(), Reverb::setSampleRate(), AudioBuffer< float >::setSize(), Array< Button::Listener * >::setUnchecked(), CharPointer_UTF8::sizeInBytes(), ScopedPointer< ListViewport >::swapWith(), toString(), Range< int64 >::withStartAndLength(), WeakReference< ObjectType, ReferenceCountingType >::Master::~Master(), ReferenceCountedObject::~ReferenceCountedObject(), and SingleThreadedReferenceCountedObject::~SingleThreadedReferenceCountedObject().

#define JUCE_JOIN_MACRO (   item1,
  item2 
)    JUCE_JOIN_MACRO_HELPER (item1, item2)

A good old-fashioned C macro concatenation helper.

This combines two items (which may themselves be macros) into a single string, avoiding the pitfalls of the ## macro operator.

#define JUCE_STRINGIFY (   item)    JUCE_STRINGIFY_MACRO_HELPER (item)

A handy C macro for stringifying any symbol, rather than just a macro parameter.

#define static_jassert (   expression)    juce::JuceStaticAssert<expression>::dummy();

A compile-time assertion macro.

If the expression parameter is false, the macro will cause a compile error. (The actual error message that the compiler generates may be completely bizarre and seem to have no relation to the place where you put the static_assert though!)

Referenced by AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::convertSamples(), operator!=(), AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::Pointer(), AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::setAsFloat(), AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::setAsInt32(), and Atomic< int >::~Atomic().

#define JUCE_DECLARE_NON_COPYABLE (   className)
Value:
className (const className&) JUCE_DELETED_FUNCTION;\
className& operator= (const className&) JUCE_DELETED_FUNCTION;
#define JUCE_DELETED_FUNCTION
This macro can be placed after a method declaration to allow the use of the C++11 feature "= delete" ...
Definition: juce_CompilerSupport.h:157

This is a shorthand macro for declaring stubs for a class's copy constructor and operator=.

For example, instead of

1 class MyClass
2 {
3  etc..
4 
5 private:
6  MyClass (const MyClass&);
7  MyClass& operator= (const MyClass&);
8 };

..you can just write:

1 class MyClass
2 {
3  etc..
4 
5 private:
6  JUCE_DECLARE_NON_COPYABLE (MyClass)
7 };

Referenced by LinkedListPointer< ObjectType >::Appender::append(), WeakReference< ObjectType, ReferenceCountingType >::Master::clear(), WeakReference< ObjectType, ReferenceCountingType >::SharedPointer::clearPointer(), AudioData::ConverterInstance< SourceSampleType, DestSampleType >::convertSamples(), ScopedPointer< ListViewport >::createCopy(), ModalCallbackFunction::forComponent(), ListenerList< ListenerClass, ArrayType >::Iterator< BailOutCheckerType, ListType >::getListener(), ListenerList< MenuBarModel::Listener >::getListeners(), CachedValue< Type >::getPropertyID(), InterProcessLock::ScopedLockType::isLocked(), GenericScopedTryLock< LockType >::isLocked(), Reverb::processMono(), PluginBusUtilities::ScopedBusRestorer::release(), ThreadLocalValue< Type >::releaseCurrentThreadStorage(), Decibels::toString(), CallbackMessage::~CallbackMessage(), GenericScopedLock< LockType >::~GenericScopedLock(), GenericScopedUnlock< LockType >::~GenericScopedUnlock(), AudioIODeviceType::Listener::~Listener(), GroupComponent::LookAndFeelMethods::~LookAndFeelMethods(), ScopedReadLock::~ScopedReadLock(), ScopedValueSetter< ValueType >::~ScopedValueSetter(), and ScopedWriteLock::~ScopedWriteLock().

#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (   className)
Value:
#define JUCE_DECLARE_NON_COPYABLE(className)
This is a shorthand macro for declaring stubs for a class&#39;s copy constructor and operator=.
Definition: juce_PlatformDefs.h:221
#define JUCE_LEAK_DETECTOR(OwnerClass)
This macro lets you embed a leak-detecting object inside a class.
Definition: juce_LeakedObjectDetector.h:136

This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for a class.

Referenced by AudioPluginInstance::AudioPluginInstance(), LADSPAPluginFormat::canScanForPlugins(), AudioUnitPluginFormat::canScanForPlugins(), VST3PluginFormat::canScanForPlugins(), VSTPluginFormat::canScanForPlugins(), AudioFormatReader::clearSamplesBeyondAvailableLength(), AudioFormatManager::end(), ModalCallbackFunction::forComponent(), ThreadWithProgressWindow::getAlertWindow(), AudioFormatReaderSource::getAudioFormatReader(), ComponentMovementWatcher::getComponent(), Component::Positioner::getComponent(), ResizableBorderComponent::getCurrentZone(), MemoryInputStream::getDataSize(), AudioProcessorPlayer::getDoublePrecisionProcessing(), PluginDirectoryScanner::getFailedFiles(), FileBasedDocument::getFile(), PropertiesFile::getFile(), OpenGLGraphicsContextCustomShader::getFragmentShaderCode(), AnimatedAppComponent::getFrameCounter(), AudioSourcePlayer::getGain(), AudioTransportSource::getGain(), OpenGLTexture::getHeight(), Graphics::getInternalContext(), FileTreeComponent::getItemHeight(), ImageConvolutionKernel::getKernelSize(), ApplicationCommandManager::getKeyMappings(), FileLogger::getLogFile(), ComponentBoundsConstrainer::getMinimumWhenOffTheRight(), MidiOutput::getName(), DynamicLibrary::getNativeHandle(), OutputStream::getNewLineString(), StretchableObjectResizer::getNumItems(), AudioProcessorGraph::AudioGraphIOProcessor::getParentGraph(), MemoryOutputStream::getPosition(), AudioParameterInt::getRange(), MemoryMappedFile::getRange(), StreamingSocket::getRawSocketHandle(), DatagramSocket::getRawSocketHandle(), AppleRemoteDevice::getRemoteId(), ResamplingAudioSource::getResamplingRatio(), FileChooser::getResults(), ValueTreeSynchroniser::getRoot(), FFT::getSize(), ApplicationProperties::getStorageParameters(), TemporaryFile::getTargetFile(), Thread::getThreadName(), DirectoryContentsList::getTimeSliceThread(), ComboBox::getTooltip(), HyperlinkButton::getURL(), LassoComponent< SelectableItemType >::hitTest(), InputStream::InputStream(), TableListBox::isAutoSizeMenuOptionShown(), ReverbAudioSource::isBypassed(), BufferingAudioSource::isLooping(), PopupMenu::CustomComponent::isTriggeredAutomatically(), FileInputStream::openedOk(), FileOutputStream::openedOk(), AudioParameterBool::operator bool(), Reverb::processMono(), HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::reset(), MemoryMappedAudioFormatReader::scanMinAndMaxInterleaved(), MidiInput::setName(), MidiEventList::toEventList(), MouseInactivityDetector::Listener::~Listener(), MenuBarModel::Listener::~Listener(), MPEInstrument::Listener::~Listener(), StretchableLayoutResizerBar::LookAndFeelMethods::~LookAndFeelMethods(), ProgressBar::LookAndFeelMethods::~LookAndFeelMethods(), TooltipWindow::LookAndFeelMethods::~LookAndFeelMethods(), ImageButton::LookAndFeelMethods::~LookAndFeelMethods(), CallOutBox::LookAndFeelMethods::~LookAndFeelMethods(), BubbleComponent::LookAndFeelMethods::~LookAndFeelMethods(), FileBrowserComponent::LookAndFeelMethods::~LookAndFeelMethods(), FilenameComponent::LookAndFeelMethods::~LookAndFeelMethods(), Label::LookAndFeelMethods::~LookAndFeelMethods(), TableHeaderComponent::LookAndFeelMethods::~LookAndFeelMethods(), and AlertWindow::LookAndFeelMethods::~LookAndFeelMethods().

#define JUCE_PREVENT_HEAP_ALLOCATION
Value:
private: \
static void* operator new (size_t) JUCE_DELETED_FUNCTION; \
static void operator delete (void*) JUCE_DELETED_FUNCTION;
#define JUCE_DELETED_FUNCTION
This macro can be placed after a method declaration to allow the use of the C++11 feature "= delete" ...
Definition: juce_CompilerSupport.h:157

This macro can be added to class definitions to disable the use of new/delete to allocate the object on the heap, forcing it to only be used as a stack or member variable.

#define JUCE_COMPILER_WARNING (   message)    _Pragma(JUCE_STRINGIFY (JUCE_WARNING_HELPER (message)))

This macro allows you to emit a custom compiler warning message.

Very handy for marking bits of code as "to-do" items, or for shaming code written by your co-workers in a way that's hard to ignore.

GCC and Clang provide the #warning directive, but MSVC doesn't, so this macro is a cross-compiler way to get the same functionality as #warning.

#define forcedinline   inline

A platform-independent way of forcing an inline function.

Use the syntax:

1 forcedinline void myfunction (int x)

Referenced by PixelARGB::blend(), and PixelARGB::getBlue().

#define JUCE_ALIGN (   bytes)    __declspec (align (bytes))

This can be placed before a stack or member variable declaration to tell the compiler to align it to the specified number of bytes.

Referenced by Atomic< int >::set().

#define JUCE_DEPRECATED (   functionDef)

This macro can be used to wrap a function which has been deprecated.

Referenced by Component::getCachedComponentImage(), String::getCharPointer(), Button::getState(), and ComboBox::getTooltip().

#define JUCE_DEPRECATED_WITH_BODY (   functionDef,
  body 
)
#define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS   __attribute__((__optimize__("no-associative-math")))

This can be appended to a function declaration to tell gcc to disable associative math optimisations which break some floating point algorithms.

Referenced by StatisticsAccumulator< FloatType >::getCount().