diff --git a/examples/Audio/MidiDemo.h b/examples/Audio/MidiDemo.h index 0f0fef92df..4f576711eb 100644 --- a/examples/Audio/MidiDemo.h +++ b/examples/Audio/MidiDemo.h @@ -56,7 +56,7 @@ struct MidiDeviceListEntry : ReferenceCountedObject std::unique_ptr inDevice; std::unique_ptr outDevice; - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; }; //============================================================================== diff --git a/extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.h b/extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.h index b5fc3d4c63..b05e1a63e4 100644 --- a/extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.h +++ b/extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.h @@ -91,7 +91,7 @@ public: void handleRedoInEditor (const String& className); void handleMissingSystemHeaders(); - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; private: //============================================================================== diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h index 80387f8a2d..07cec42835 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h @@ -234,7 +234,7 @@ public: BuildConfiguration (Project& project, const ValueTree& configNode, const ProjectExporter&); ~BuildConfiguration(); - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; //============================================================================== virtual void createConfigProperties (PropertyListBuilder&) = 0; diff --git a/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h b/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h index ddf53198d6..45c6c3099f 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h +++ b/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h @@ -308,7 +308,7 @@ public: class NonConst { public: - typedef void VoidType; + using VoidType = void; static inline void* toVoidPtr (VoidType* v) noexcept { return v; } enum { isConst = 0 }; }; @@ -316,7 +316,7 @@ public: class Const { public: - typedef const void VoidType; + using VoidType = const void; static inline void* toVoidPtr (VoidType* v) noexcept { return const_cast (v); } enum { isConst = 1 }; }; diff --git a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h index 8ad74ea896..1c2ce7f8b9 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h +++ b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h @@ -1062,7 +1062,7 @@ public: //============================================================================== /** This allows templated code that takes an AudioBuffer to access its sample type. */ - typedef Type SampleType; + using SampleType = Type; private: //============================================================================== @@ -1125,12 +1125,12 @@ private: /** A multi-channel buffer of 32-bit floating point audio samples. - This typedef is here for backwards compatibility with the older AudioSampleBuffer + This type is here for backwards compatibility with the older AudioSampleBuffer class, which was fixed for 32-bit data, but is otherwise the same as the new templated AudioBuffer class. @see AudioBuffer */ -typedef AudioBuffer AudioSampleBuffer; +using AudioSampleBuffer = AudioBuffer; } // namespace juce diff --git a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp index 4dc3a86d85..4dc44c1b64 100644 --- a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp +++ b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp @@ -37,9 +37,9 @@ namespace FloatVectorHelpers struct BasicOps32 { - typedef float Type; - typedef __m128 ParallelType; - typedef __m128 IntegerType; + using Type = float; + using ParallelType = __m128; + using IntegerType = __m128; enum { numParallel = 4 }; // Integer and parallel types are the same for SSE. On neon they have different types @@ -69,9 +69,9 @@ namespace FloatVectorHelpers struct BasicOps64 { - typedef double Type; - typedef __m128d ParallelType; - typedef __m128d IntegerType; + using Type = double; + using ParallelType = __m128d; + using IntegerType = __m128d; enum { numParallel = 2 }; // Integer and parallel types are the same for SSE. On neon they have different types @@ -102,7 +102,7 @@ namespace FloatVectorHelpers #define JUCE_BEGIN_VEC_OP \ - typedef FloatVectorHelpers::ModeType::Mode Mode; \ + using Mode = FloatVectorHelpers::ModeType::Mode; \ { \ const int numLongOps = num / Mode::numParallel; @@ -202,9 +202,9 @@ namespace FloatVectorHelpers struct BasicOps32 { - typedef float Type; - typedef float32x4_t ParallelType; - typedef uint32x4_t IntegerType; + using Type = float; + using ParallelType = float32x4_t; + using IntegerType = uint32x4_t; union signMaskUnion { ParallelType f; IntegerType i; }; enum { numParallel = 4 }; @@ -234,9 +234,9 @@ namespace FloatVectorHelpers struct BasicOps64 { - typedef double Type; - typedef double ParallelType; - typedef uint64 IntegerType; + using Type = double; + using ParallelType = double; + using IntegerType = uint64; union signMaskUnion { ParallelType f; IntegerType i; }; enum { numParallel = 1 }; @@ -265,7 +265,7 @@ namespace FloatVectorHelpers }; #define JUCE_BEGIN_VEC_OP \ - typedef FloatVectorHelpers::ModeType::Mode Mode; \ + using Mode = FloatVectorHelpers::ModeType::Mode; \ if (Mode::numParallel > 1) \ { \ const int numLongOps = num / Mode::numParallel; @@ -353,14 +353,14 @@ namespace FloatVectorHelpers union signMask64 { double d; uint64 i; }; #if JUCE_USE_SSE_INTRINSICS || JUCE_USE_ARM_NEON - template struct ModeType { typedef BasicOps32 Mode; }; - template<> struct ModeType<8> { typedef BasicOps64 Mode; }; + template struct ModeType { using Mode = BasicOps32; }; + template<> struct ModeType<8> { using Mode = BasicOps64; }; template struct MinMax { - typedef typename Mode::Type Type; - typedef typename Mode::ParallelType ParallelType; + using Type = typename Mode::Type; + using ParallelType = typename Mode::ParallelType; static Type findMinOrMax (const Type* src, int num, const bool isMinimum) noexcept { diff --git a/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp b/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp index bfc1e3dfeb..b2f2cb6a6d 100644 --- a/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp +++ b/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp @@ -2062,7 +2062,8 @@ private: class UnitTestInstrument : public MPEInstrument, private MPEInstrument::Listener { - typedef MPEInstrument Base; + using Base = MPEInstrument; + public: UnitTestInstrument() : noteOnCallCounter (0), noteOffCallCounter (0), pitchbendCallCounter (0), diff --git a/modules/juce_audio_basics/mpe/juce_MPESynthesiserBase.h b/modules/juce_audio_basics/mpe/juce_MPESynthesiserBase.h index 8adbe0b3e4..ca4c026e9e 100644 --- a/modules/juce_audio_basics/mpe/juce_MPESynthesiserBase.h +++ b/modules/juce_audio_basics/mpe/juce_MPESynthesiserBase.h @@ -165,7 +165,7 @@ public: void setLegacyModePitchbendRange (int pitchbendRange); //============================================================================== - typedef MPEInstrument::TrackingMode TrackingMode; + using TrackingMode = MPEInstrument::TrackingMode; /** Set the MPE tracking mode for the pressure dimension. */ void setPressureTrackingMode (TrackingMode modeToUse); diff --git a/modules/juce_audio_basics/synthesisers/juce_Synthesiser.h b/modules/juce_audio_basics/synthesisers/juce_Synthesiser.h index c056896e74..3215d10002 100644 --- a/modules/juce_audio_basics/synthesisers/juce_Synthesiser.h +++ b/modules/juce_audio_basics/synthesisers/juce_Synthesiser.h @@ -64,7 +64,7 @@ public: virtual bool appliesToChannel (int midiChannel) = 0; /** The class is reference-counted, so this is a handy pointer class for it. */ - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; private: diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.h b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.h index 8813d1b92c..adbfa99fdb 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.h +++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.h @@ -416,12 +416,11 @@ public: */ struct LevelMeter : public ReferenceCountedObject { - typedef ReferenceCountedObjectPtr Ptr; - LevelMeter() noexcept; - double getCurrentLevel() const noexcept; + using Ptr = ReferenceCountedObjectPtr; + private: friend class AudioDeviceManager; diff --git a/modules/juce_audio_devices/native/juce_android_Oboe.cpp b/modules/juce_audio_devices/native/juce_android_Oboe.cpp index c242495a26..09f3530eb8 100644 --- a/modules/juce_audio_devices/native/juce_android_Oboe.cpp +++ b/modules/juce_audio_devices/native/juce_android_Oboe.cpp @@ -48,8 +48,8 @@ struct OboeAudioIODeviceBufferHelpers { for (int i = 0; i < audioBuffer.getNumChannels(); ++i) { - typedef AudioData::Pointer DstSampleType; - typedef AudioData::Pointer SrcSampleType; + using DstSampleType = AudioData::Pointer; + using SrcSampleType = AudioData::Pointer; DstSampleType dstData (audioBuffer.getWritePointer (i)); SrcSampleType srcData (srcInterleaved + i, audioBuffer.getNumChannels()); @@ -61,8 +61,8 @@ struct OboeAudioIODeviceBufferHelpers { for (int i = 0; i < audioBuffer.getNumChannels(); ++i) { - typedef AudioData::Pointer DstSampleType; - typedef AudioData::Pointer SrcSampleType; + using DstSampleType = AudioData::Pointer; + using SrcSampleType = AudioData::Pointer; DstSampleType dstData (dstInterleaved + i, audioBuffer.getNumChannels()); SrcSampleType srcData (audioBuffer.getReadPointer (i)); @@ -95,8 +95,8 @@ struct OboeAudioIODeviceBufferHelpers for (int i = 0; i < audioBuffer.getNumChannels(); ++i) { - typedef AudioData::Pointer DstSampleType; - typedef AudioData::Pointer SrcSampleType; + using DstSampleType = AudioData::Pointer; + using SrcSampleType = AudioData::Pointer; DstSampleType dstData (audioBuffer.getWritePointer (i)); SrcSampleType srcData (srcInterleaved + i, audioBuffer.getNumChannels()); @@ -115,8 +115,8 @@ struct OboeAudioIODeviceBufferHelpers for (int i = 0; i < audioBuffer.getNumChannels(); ++i) { - typedef AudioData::Pointer DstSampleType; - typedef AudioData::Pointer SrcSampleType; + using DstSampleType = AudioData::Pointer; + using SrcSampleType = AudioData::Pointer; DstSampleType dstData (dstInterleaved + i, audioBuffer.getNumChannels()); SrcSampleType srcData (audioBuffer.getReadPointer (i)); diff --git a/modules/juce_audio_devices/native/juce_android_OpenSL.cpp b/modules/juce_audio_devices/native/juce_android_OpenSL.cpp index 4681903828..fa610109b8 100644 --- a/modules/juce_audio_devices/native/juce_android_OpenSL.cpp +++ b/modules/juce_audio_devices/native/juce_android_OpenSL.cpp @@ -172,8 +172,8 @@ struct BufferHelpers { for (int i = 0; i < audioBuffer.getNumChannels(); ++i) { - typedef AudioData::Pointer DstSampleType; - typedef AudioData::Pointer SrcSampleType; + using DstSampleType = AudioData::Pointer; + using SrcSampleType = AudioData::Pointer; DstSampleType dstData (audioBuffer.getWritePointer (i)); SrcSampleType srcData (srcInterleaved + i, audioBuffer.getNumChannels()); @@ -185,8 +185,8 @@ struct BufferHelpers { for (int i = 0; i < audioBuffer.getNumChannels(); ++i) { - typedef AudioData::Pointer DstSampleType; - typedef AudioData::Pointer SrcSampleType; + using DstSampleType = AudioData::Pointer; + using SrcSampleType = AudioData::Pointer; DstSampleType dstData (dstInterleaved + i, audioBuffer.getNumChannels()); SrcSampleType srcData (audioBuffer.getReadPointer (i)); @@ -231,8 +231,8 @@ struct BufferHelpers for (int i = 0; i < audioBuffer.getNumChannels(); ++i) { - typedef AudioData::Pointer DstSampleType; - typedef AudioData::Pointer SrcSampleType; + using DstSampleType = AudioData::Pointer; + using SrcSampleType = AudioData::Pointer; DstSampleType dstData (audioBuffer.getWritePointer (i)); SrcSampleType srcData (srcInterleaved + i, audioBuffer.getNumChannels()); @@ -250,8 +250,8 @@ struct BufferHelpers for (int i = 0; i < audioBuffer.getNumChannels(); ++i) { - typedef AudioData::Pointer DstSampleType; - typedef AudioData::Pointer SrcSampleType; + using DstSampleType = AudioData::Pointer; + using SrcSampleType = AudioData::Pointer; DstSampleType dstData (dstInterleaved + i, audioBuffer.getNumChannels()); SrcSampleType srcData (audioBuffer.getReadPointer (i)); @@ -383,7 +383,7 @@ public: template struct OpenSLQueueRunnerPlayer : OpenSLQueueRunner, SLPlayItf_> { - typedef OpenSLQueueRunner, SLPlayItf_> Base; + using Base = OpenSLQueueRunner, SLPlayItf_>; enum { isPlayer = 1 }; @@ -425,7 +425,7 @@ public: template struct OpenSLQueueRunnerRecorder : OpenSLQueueRunner, SLRecordItf_> { - typedef OpenSLQueueRunner, SLRecordItf_> Base; + using Base = OpenSLQueueRunner, SLRecordItf_>; enum { isPlayer = 0 }; @@ -586,7 +586,7 @@ public: int numBuffersToUse); //============================================================================== - typedef SLresult (*CreateEngineFunc)(SLObjectItf*,SLuint32,const SLEngineOption*,SLuint32,const SLInterfaceID*,const SLboolean*); + typedef SLresult (*CreateEngineFunc)(SLObjectItf*, SLuint32, const SLEngineOption*, SLuint32, const SLInterfaceID*, const SLboolean*); //============================================================================== int inputChannels, outputChannels; diff --git a/modules/juce_audio_devices/native/juce_linux_ALSA.cpp b/modules/juce_audio_devices/native/juce_linux_ALSA.cpp index 1382b9256b..b971afc725 100644 --- a/modules/juce_audio_devices/native/juce_linux_ALSA.cpp +++ b/modules/juce_audio_devices/native/juce_linux_ALSA.cpp @@ -431,7 +431,7 @@ private: { if (forInput) { - typedef AudioData::Pointer DestType; + using DestType = AudioData::Pointer ; if (isLittleEndian) return new AudioData::ConverterInstance , DestType> (numInterleavedChannels, 1); @@ -439,7 +439,7 @@ private: return new AudioData::ConverterInstance , DestType> (numInterleavedChannels, 1); } - typedef AudioData::Pointer SourceType; + using SourceType = AudioData::Pointer ; if (isLittleEndian) return new AudioData::ConverterInstance > (1, numInterleavedChannels); diff --git a/modules/juce_audio_devices/native/juce_linux_Midi.cpp b/modules/juce_audio_devices/native/juce_linux_Midi.cpp index f64f497a1b..289bb414da 100644 --- a/modules/juce_audio_devices/native/juce_linux_Midi.cpp +++ b/modules/juce_audio_devices/native/juce_linux_Midi.cpp @@ -35,24 +35,17 @@ namespace { //============================================================================== -class AlsaClient : public ReferenceCountedObject +class AlsaClient : public ReferenceCountedObject { public: - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; //============================================================================== // represents an input or output port of the supplied AlsaClient - class Port + struct Port { - public: Port (AlsaClient& c, bool forInput) noexcept - : portId (-1), - callbackEnabled (false), - client (c), - isInput (forInput), - callback (nullptr), - maxEventSize (4 * 1024), - midiInput (nullptr) + : client (c), isInput (forInput) {} ~Port() @@ -81,10 +74,9 @@ public: return client.get() != nullptr && portId >= 0; } - void setupInput(MidiInput* input, MidiInputCallback* cb) + void setupInput (MidiInput* input, MidiInputCallback* cb) { - jassert (cb && input); - + jassert (cb != nullptr && input != nullptr); callback = cb; midiInput = input; } @@ -92,7 +84,6 @@ public: void setupOutput() { jassert (! isInput); - snd_midi_event_new ((size_t) maxEventSize, &midiParser); } @@ -121,15 +112,15 @@ public: snd_seq_event_t event; snd_seq_ev_clear (&event); - long numBytes = (long) message.getRawDataSize(); + auto numBytes = (long) message.getRawDataSize(); const uint8* data = message.getRawData(); - snd_seq_t* seqHandle = client.get(); + auto* seqHandle = client.get(); bool success = true; while (numBytes > 0) { - const long numSent = snd_midi_event_encode (midiParser, data, numBytes, &event); + auto numSent = snd_midi_event_encode (midiParser, data, numBytes, &event); if (numSent <= 0) { @@ -161,22 +152,9 @@ public: return portId != -1 && portId == lhs.portId; } - int portId; - bool callbackEnabled; - - private: - friend class AlsaClient; - - AlsaClient& client; - bool isInput; - MidiInputCallback* callback; - snd_midi_event_t* midiParser; - int maxEventSize; - MidiInput* midiInput; - void createPort (const String& name, bool enableSubscription) { - if (snd_seq_t* seqHandle = client.get()) + if (auto* seqHandle = client.get()) { const unsigned int caps = isInput @@ -197,6 +175,15 @@ public: { callback->handlePartialSysexMessage (midiInput, messageData, numBytesSoFar, timeStamp); } + + AlsaClient& client; + MidiInputCallback* callback = nullptr; + snd_midi_event_t* midiParser = nullptr; + MidiInput* midiInput = nullptr; + int maxEventSize = 4096; + int portId = -1; + bool callbackEnabled = false; + bool isInput = false; }; static Ptr getInstance() @@ -212,21 +199,21 @@ public: if (inputThread == nullptr) inputThread.reset (new MidiInputThread (*this)); - if (++activeCallbacks - 1 == 0) + if (++activeCallbacks == 1) inputThread->startThread(); } void unregisterCallback() { jassert (activeCallbacks.get() > 0); + if (--activeCallbacks == 0 && inputThread->isThreadRunning()) inputThread->signalThreadShouldExit(); } void handleIncomingMidiMessage (snd_seq_event* event, const MidiMessage& message) { - if (event->dest.port < ports.size() - && ports[event->dest.port]->callbackEnabled) + if (event->dest.port < ports.size() && ports[event->dest.port]->callbackEnabled) ports[event->dest.port]->handleIncomingMidiMessage (message); } @@ -242,7 +229,7 @@ public: Port* createPort (const String& name, bool forInput, bool enableSubscription) { - Port* port = new Port (*this, forInput); + auto port = new Port (*this, forInput); port->createPort (name, enableSubscription); ports.set (port->portId, port); incReferenceCount(); @@ -256,8 +243,8 @@ public: } private: - snd_seq_t* handle; - int clientId; + snd_seq_t* handle = nullptr; + int clientId = 0; OwnedArray ports; Atomic activeCallbacks; CriticalSection callbackLock; @@ -269,8 +256,6 @@ private: friend struct ContainerDeletePolicy; AlsaClient() - : handle (nullptr), - inputThread (nullptr) { jassert (instance == nullptr); @@ -303,7 +288,7 @@ private: { public: MidiInputThread (AlsaClient& c) - : Thread ("JUCE MIDI Input"), client (c), concatenator (2048) + : Thread ("JUCE MIDI Input"), client (c) { jassert (client.get() != nullptr); } @@ -358,7 +343,7 @@ private: private: AlsaClient& client; - MidiDataConcatenator concatenator; + MidiDataConcatenator concatenator { 2048 }; }; std::unique_ptr inputThread; @@ -369,9 +354,9 @@ AlsaClient* AlsaClient::instance = nullptr; //============================================================================== static AlsaClient::Port* iterateMidiClient (const AlsaClient::Ptr& client, snd_seq_client_info_t* clientInfo, - const bool forInput, + bool forInput, StringArray& deviceNamesFound, - const int deviceIndexToOpen) + int deviceIndexToOpen) { AlsaClient::Port* port = nullptr; @@ -380,8 +365,8 @@ static AlsaClient::Port* iterateMidiClient (const AlsaClient::Ptr& client, snd_seq_port_info_alloca (&portInfo); jassert (portInfo); - int numPorts = snd_seq_client_info_get_num_ports (clientInfo); - const int sourceClient = snd_seq_client_info_get_client (clientInfo); + auto numPorts = snd_seq_client_info_get_num_ports (clientInfo); + auto sourceClient = snd_seq_client_info_get_client (clientInfo); snd_seq_port_info_set_client (portInfo, sourceClient); snd_seq_port_info_set_port (portInfo, -1); @@ -392,13 +377,14 @@ static AlsaClient::Port* iterateMidiClient (const AlsaClient::Ptr& client, && (snd_seq_port_info_get_capability (portInfo) & (forInput ? SND_SEQ_PORT_CAP_SUBS_READ : SND_SEQ_PORT_CAP_SUBS_WRITE)) != 0) { - const String portName = snd_seq_port_info_get_name(portInfo); + String portName = snd_seq_port_info_get_name(portInfo); deviceNamesFound.add (portName); if (deviceNamesFound.size() == deviceIndexToOpen + 1) { - const int sourcePort = snd_seq_port_info_get_port (portInfo); + auto sourcePort = snd_seq_port_info_get_port (portInfo); + if (sourcePort != -1) { port = client->createPort (portName, forInput, false); @@ -413,37 +399,39 @@ static AlsaClient::Port* iterateMidiClient (const AlsaClient::Ptr& client, return port; } -static AlsaClient::Port* iterateMidiDevices (const bool forInput, +static AlsaClient::Port* iterateMidiDevices (bool forInput, StringArray& deviceNamesFound, - const int deviceIndexToOpen) + int deviceIndexToOpen) { AlsaClient::Port* port = nullptr; - const AlsaClient::Ptr client (AlsaClient::getInstance()); + auto client = AlsaClient::getInstance(); - if (snd_seq_t* const seqHandle = client->get()) + if (auto* seqHandle = client->get()) { snd_seq_system_info_t* systemInfo = nullptr; snd_seq_client_info_t* clientInfo = nullptr; snd_seq_system_info_alloca (&systemInfo); - jassert(systemInfo); + jassert (systemInfo != nullptr); + if (snd_seq_system_info (seqHandle, systemInfo) == 0) { snd_seq_client_info_alloca (&clientInfo); - jassert(clientInfo); - int numClients = snd_seq_system_info_get_cur_clients (systemInfo); + jassert (clientInfo != nullptr); + + auto numClients = snd_seq_system_info_get_cur_clients (systemInfo); while (--numClients >= 0) { if (snd_seq_query_next_client (seqHandle, clientInfo) == 0) { - const int sourceClient = snd_seq_client_info_get_client (clientInfo); - if (sourceClient != client->getId() - && sourceClient != SND_SEQ_CLIENT_SYSTEM) + auto sourceClient = snd_seq_client_info_get_client (clientInfo); + + if (sourceClient != client->getId() && sourceClient != SND_SEQ_CLIENT_SYSTEM) { port = iterateMidiClient (client, clientInfo, forInput, deviceNamesFound, deviceIndexToOpen); - if (port) + if (port != nullptr) break; } } @@ -475,7 +463,7 @@ MidiOutput* MidiOutput::openDevice (int deviceIndex) MidiOutput* newDevice = nullptr; StringArray devices; - AlsaClient::Port* port = iterateMidiDevices (false, devices, deviceIndex); + auto* port = iterateMidiDevices (false, devices, deviceIndex); if (port == nullptr) return nullptr; @@ -492,12 +480,9 @@ MidiOutput* MidiOutput::openDevice (int deviceIndex) MidiOutput* MidiOutput::createNewDevice (const String& deviceName) { MidiOutput* newDevice = nullptr; - - const AlsaClient::Ptr client (AlsaClient::getInstance()); - - AlsaClient::Port* port = client->createPort (deviceName, false, true); - - jassert (port->isValid()); + auto client = AlsaClient::getInstance(); + auto* port = client->createPort (deviceName, false, true); + jassert (port != nullptr && port->isValid()); newDevice = new MidiOutput (deviceName); port->setupOutput(); @@ -509,9 +494,7 @@ MidiOutput* MidiOutput::createNewDevice (const String& deviceName) MidiOutput::~MidiOutput() { stopBackgroundThread(); - - AlsaClient::Ptr client (AlsaClient::getInstance()); - client->deletePort (static_cast (internal)); + AlsaClient::getInstance()->deletePort (static_cast (internal)); } void MidiOutput::sendMessageNow (const MidiMessage& message) @@ -528,8 +511,7 @@ MidiInput::MidiInput (const String& nm) MidiInput::~MidiInput() { stop(); - AlsaClient::Ptr client (AlsaClient::getInstance()); - client->deletePort (static_cast (internal)); + AlsaClient::getInstance()->deletePort (static_cast (internal)); } void MidiInput::start() @@ -559,7 +541,7 @@ MidiInput* MidiInput::openDevice (int deviceIndex, MidiInputCallback* callback) MidiInput* newDevice = nullptr; StringArray devices; - AlsaClient::Port* port = iterateMidiDevices (true, devices, deviceIndex); + auto* port = iterateMidiDevices (true, devices, deviceIndex); if (port == nullptr) return nullptr; @@ -577,9 +559,8 @@ MidiInput* MidiInput::createNewDevice (const String& deviceName, MidiInputCallba { MidiInput* newDevice = nullptr; - AlsaClient::Ptr client (AlsaClient::getInstance()); - - AlsaClient::Port* port = client->createPort (deviceName, true, true); + auto client = AlsaClient::getInstance(); + auto* port = client->createPort (deviceName, true, true); jassert (port->isValid()); diff --git a/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp b/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp index ed457f52e4..914215eb95 100644 --- a/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp +++ b/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp @@ -23,7 +23,7 @@ extern "C" { // Declare just the minimum number of interfaces for the DSound objects that we need.. - typedef struct typeDSBUFFERDESC + struct DSBUFFERDESC { DWORD dwSize; DWORD dwFlags; @@ -31,7 +31,7 @@ extern "C" DWORD dwReserved; LPWAVEFORMATEX lpwfxFormat; GUID guid3DAlgorithm; - } DSBUFFERDESC; + }; struct IDirectSoundBuffer; @@ -80,14 +80,14 @@ extern "C" }; //============================================================================== - typedef struct typeDSCBUFFERDESC + struct DSCBUFFERDESC { DWORD dwSize; DWORD dwFlags; DWORD dwBufferBytes; DWORD dwReserved; LPWAVEFORMATEX lpwfxFormat; - } DSCBUFFERDESC; + }; struct IDirectSoundCaptureBuffer; diff --git a/modules/juce_audio_formats/format/juce_AudioFormatReader.h b/modules/juce_audio_formats/format/juce_AudioFormatReader.h index d9342dfb03..34a981b54a 100644 --- a/modules/juce_audio_formats/format/juce_AudioFormatReader.h +++ b/modules/juce_audio_formats/format/juce_AudioFormatReader.h @@ -256,8 +256,8 @@ protected: template struct ReadHelper { - typedef AudioData::Pointer DestType; - typedef AudioData::Pointer SourceType; + using DestType = AudioData::Pointer; + using SourceType = AudioData::Pointer; template static void read (TargetType* const* destData, int destOffset, int numDestChannels, diff --git a/modules/juce_audio_formats/format/juce_AudioFormatWriter.h b/modules/juce_audio_formats/format/juce_AudioFormatWriter.h index dc178871e2..3231dc87c2 100644 --- a/modules/juce_audio_formats/format/juce_AudioFormatWriter.h +++ b/modules/juce_audio_formats/format/juce_AudioFormatWriter.h @@ -268,8 +268,8 @@ protected: template struct WriteHelper { - typedef AudioData::Pointer DestType; - typedef AudioData::Pointer SourceType; + using DestType = AudioData::Pointer ; + using SourceType = AudioData::Pointer ; static void write (void* destData, int numDestChannels, const int* const* source, int numSamples, const int sourceOffset = 0) noexcept diff --git a/modules/juce_audio_formats/format/juce_MemoryMappedAudioFormatReader.h b/modules/juce_audio_formats/format/juce_MemoryMappedAudioFormatReader.h index 05ea528595..e3fef6e30a 100644 --- a/modules/juce_audio_formats/format/juce_MemoryMappedAudioFormatReader.h +++ b/modules/juce_audio_formats/format/juce_MemoryMappedAudioFormatReader.h @@ -102,7 +102,7 @@ protected: template Range scanMinAndMaxInterleaved (int channel, int64 startSampleInFile, int64 numSamples) const noexcept { - typedef AudioData::Pointer SourceType; + using SourceType = AudioData::Pointer ; return SourceType (addBytesToPointer (sampleToPointer (startSampleInFile), ((int) bitsPerSample / 8) * channel), (int) numChannels) .findMinAndMax ((size_t) numSamples); diff --git a/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm b/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm index 674a0c2d13..53e8eae965 100644 --- a/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm +++ b/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm @@ -99,7 +99,7 @@ struct AudioProcessorHolder : public ReferenceCountedObject std::unique_ptr viewConfiguration; - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; private: std::unique_ptr processor; diff --git a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp index c5831e4cdb..439c06f8ac 100644 --- a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp @@ -58,7 +58,7 @@ public: close(); } - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; static Array& getActiveModules() { diff --git a/modules/juce_audio_processors/format_types/juce_VST3Common.h b/modules/juce_audio_processors/format_types/juce_VST3Common.h index 970f2b7777..7cba0117b2 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3Common.h +++ b/modules/juce_audio_processors/format_types/juce_VST3Common.h @@ -577,8 +577,8 @@ private: template struct VST3BufferExchange { - typedef Array Bus; - typedef Array BusMap; + using Bus = Array; + using BusMap = Array; static inline void assignRawPointer (Steinberg::Vst::AudioBusBuffers& vstBuffers, float** raw) { vstBuffers.channelBuffers32 = raw; } static inline void assignRawPointer (Steinberg::Vst::AudioBusBuffers& vstBuffers, double** raw) { vstBuffers.channelBuffers64 = raw; } diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index fe724bbf2d..e06bcd18bb 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -648,7 +648,7 @@ private: Atomic refCount; String appName; - typedef std::map ParamMapType; + using ParamMapType = std::map; ParamMapType paramToIndexMap; int getIndexOfParamID (Vst::ParamID paramID) @@ -1219,7 +1219,7 @@ struct VST3ModuleHandle : public ReferenceCountedObject } //============================================================================== - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; static VST3ModuleHandle::Ptr findOrCreateModule (const File& file, const PluginDescription& description) { @@ -1451,13 +1451,13 @@ private: ChildComponent embeddedComponent; std::unique_ptr peer; - typedef HWND HandleFormat; + using HandleFormat = HWND; #elif JUCE_MAC AutoResizingNSViewComponentWithParent embeddedComponent; - typedef NSView* HandleFormat; + using HandleFormat = NSView*; #else Component embeddedComponent; - typedef void* HandleFormat; + using HandleFormat = void*; #endif HandleFormat pluginHandle = {}; diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index 4c12a58ddd..61fd458334 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -580,7 +580,7 @@ struct ModuleHandle : public ReferenceCountedObject String pluginName; std::unique_ptr vstXml; - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; static Array& getActiveModules() { diff --git a/modules/juce_audio_processors/juce_audio_processors.cpp b/modules/juce_audio_processors/juce_audio_processors.cpp index ed56fdb87d..8c6f416a7b 100644 --- a/modules/juce_audio_processors/juce_audio_processors.cpp +++ b/modules/juce_audio_processors/juce_audio_processors.cpp @@ -82,10 +82,10 @@ static inline bool arrayContainsPlugin (const OwnedArray& lis #if JUCE_IOS #define JUCE_IOS_MAC_VIEW UIView - typedef UIViewComponent ViewComponentBaseClass; + using ViewComponentBaseClass = UIViewComponent; #else #define JUCE_IOS_MAC_VIEW NSView - typedef NSViewComponent ViewComponentBaseClass; + using ViewComponentBaseClass = NSViewComponent; #endif //============================================================================== diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp index fa607975f8..8c6b32763d 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp @@ -348,7 +348,7 @@ struct RenderSequenceBuilder } //============================================================================== - typedef AudioProcessorGraph::NodeID NodeID; + using NodeID = AudioProcessorGraph::NodeID; AudioProcessorGraph& graph; RenderSequence& sequence; diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h index f358fe8dfa..a752149d5d 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h +++ b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h @@ -58,7 +58,7 @@ public: ~AudioProcessorGraph(); /** Each node in the graph has a UID of this type. */ - typedef uint32 NodeID; + using NodeID = uint32; //============================================================================== /** A special index that represents the midi channel of a node. @@ -117,7 +117,7 @@ public: //============================================================================== /** A convenient typedef for referring to a pointer to a node object. */ - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; private: //============================================================================== diff --git a/modules/juce_box2d/juce_box2d.cpp b/modules/juce_box2d/juce_box2d.cpp index 4054b66918..fb6acae8a2 100644 --- a/modules/juce_box2d/juce_box2d.cpp +++ b/modules/juce_box2d/juce_box2d.cpp @@ -47,13 +47,12 @@ #include -typedef juce::int8 int8; -typedef juce::int16 int16; -typedef juce::int32 int32; -typedef juce::uint8 uint8; -typedef juce::uint16 uint16; -typedef juce::uint32 uint32; - +using int8 = juce::int8; +using int16 = juce::int16; +using int32 = juce::int32; +using uint8 = juce::uint8; +using uint16 = juce::uint16; +using uint32 = juce::uint32; #include "box2d/Collision/b2BroadPhase.cpp" #include "box2d/Collision/b2CollideCircle.cpp" diff --git a/modules/juce_core/containers/juce_Array.h b/modules/juce_core/containers/juce_Array.h index 0385da4c07..f3911dba4e 100644 --- a/modules/juce_core/containers/juce_Array.h +++ b/modules/juce_core/containers/juce_Array.h @@ -55,7 +55,7 @@ template ::type ParameterType; + using ParameterType = typename TypeHelpers::ParameterType::type; public: //============================================================================== @@ -1235,7 +1235,7 @@ public: inline const TypeOfCriticalSectionToUse& getLock() const noexcept { return data; } /** Returns the type of scoped lock to use for locking this array */ - typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType; + using ScopedLockType = typename TypeOfCriticalSectionToUse::ScopedLockType; //============================================================================== diff --git a/modules/juce_core/containers/juce_DynamicObject.h b/modules/juce_core/containers/juce_DynamicObject.h index 0132fb10c5..a4b8c4d682 100644 --- a/modules/juce_core/containers/juce_DynamicObject.h +++ b/modules/juce_core/containers/juce_DynamicObject.h @@ -44,7 +44,7 @@ public: DynamicObject (const DynamicObject&); ~DynamicObject(); - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; //============================================================================== /** Returns true if the object has a property with this name. diff --git a/modules/juce_core/containers/juce_ElementComparator.h b/modules/juce_core/containers/juce_ElementComparator.h index 8ce16acd56..e818992084 100644 --- a/modules/juce_core/containers/juce_ElementComparator.h +++ b/modules/juce_core/containers/juce_ElementComparator.h @@ -185,7 +185,7 @@ template class DefaultElementComparator { private: - typedef typename TypeHelpers::ParameterType::type ParameterType; + using ParameterType = typename TypeHelpers::ParameterType::type; public: static int compareElements (ParameterType first, ParameterType second) diff --git a/modules/juce_core/containers/juce_HashMap.h b/modules/juce_core/containers/juce_HashMap.h index 6fab721daf..d10ae0444f 100644 --- a/modules/juce_core/containers/juce_HashMap.h +++ b/modules/juce_core/containers/juce_HashMap.h @@ -46,7 +46,7 @@ struct DefaultHashFunctions /** Generates a simple hash from a variant. */ static int generateHash (const var& key, int upperLimit) noexcept { return generateHash (key.toString(), upperLimit); } /** Generates a simple hash from a void ptr. */ - static int generateHash (const void* key, int upperLimit) noexcept { return generateHash ((pointer_sized_uint) key, upperLimit); } + static int generateHash (const void* key, int upperLimit) noexcept { return generateHash ((uint64) (pointer_sized_uint) key, upperLimit); } /** Generates a simple hash from a UUID. */ static int generateHash (const Uuid& key, int upperLimit) noexcept { return generateHash (key.hash(), upperLimit); } }; @@ -103,8 +103,8 @@ template ::type KeyTypeParameter; - typedef typename TypeHelpers::ParameterType::type ValueTypeParameter; + using KeyTypeParameter = typename TypeHelpers::ParameterType::type; + using ValueTypeParameter = typename TypeHelpers::ParameterType::type; public: //============================================================================== diff --git a/modules/juce_core/containers/juce_ListenerList.h b/modules/juce_core/containers/juce_ListenerList.h index 493ece2a0b..164e618e81 100644 --- a/modules/juce_core/containers/juce_ListenerList.h +++ b/modules/juce_core/containers/juce_ListenerList.h @@ -182,8 +182,8 @@ public: bool shouldBailOut() const noexcept { return false; } }; - typedef ListenerList ThisType; - typedef ListenerClass ListenerType; + using ThisType = ListenerList; + using ListenerType = ListenerClass; //============================================================================== /** Iterates the listeners in a ListenerList. */ diff --git a/modules/juce_core/containers/juce_OwnedArray.h b/modules/juce_core/containers/juce_OwnedArray.h index e4634c1d8a..763db28d8d 100644 --- a/modules/juce_core/containers/juce_OwnedArray.h +++ b/modules/juce_core/containers/juce_OwnedArray.h @@ -893,7 +893,7 @@ public: inline const TypeOfCriticalSectionToUse& getLock() const noexcept { return data; } /** Returns the type of scoped lock to use for locking this array */ - typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType; + using ScopedLockType = typename TypeOfCriticalSectionToUse::ScopedLockType; //============================================================================== diff --git a/modules/juce_core/containers/juce_ReferenceCountedArray.h b/modules/juce_core/containers/juce_ReferenceCountedArray.h index a70a1e0b95..6505078ea1 100644 --- a/modules/juce_core/containers/juce_ReferenceCountedArray.h +++ b/modules/juce_core/containers/juce_ReferenceCountedArray.h @@ -50,7 +50,7 @@ template ObjectClassPtr; + using ObjectClassPtr = ReferenceCountedObjectPtr; //============================================================================== /** Creates an empty array. @@ -880,7 +880,7 @@ public: inline const TypeOfCriticalSectionToUse& getLock() const noexcept { return data; } /** Returns the type of scoped lock to use for locking this array */ - typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType; + using ScopedLockType = typename TypeOfCriticalSectionToUse::ScopedLockType; //============================================================================== diff --git a/modules/juce_core/containers/juce_SortedSet.h b/modules/juce_core/containers/juce_SortedSet.h index bf21793006..ea6e3e9888 100644 --- a/modules/juce_core/containers/juce_SortedSet.h +++ b/modules/juce_core/containers/juce_SortedSet.h @@ -473,7 +473,7 @@ public: inline const TypeOfCriticalSectionToUse& getLock() const noexcept { return data.getLock(); } /** Returns the type of scoped lock to use for locking this array */ - typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType; + using ScopedLockType = typename TypeOfCriticalSectionToUse::ScopedLockType; private: diff --git a/modules/juce_core/javascript/juce_Javascript.cpp b/modules/juce_core/javascript/juce_Javascript.cpp index 2fa9a7118f..d1e09d63c6 100644 --- a/modules/juce_core/javascript/juce_Javascript.cpp +++ b/modules/juce_core/javascript/juce_Javascript.cpp @@ -75,8 +75,8 @@ struct JavascriptEngine::RootObject : public DynamicObject Time timeout; - typedef const var::NativeFunctionArgs& Args; - typedef const char* TokenType; + using Args = const var::NativeFunctionArgs&; + using TokenType = const char*; void execute (const String& code) { @@ -263,7 +263,7 @@ struct JavascriptEngine::RootObject : public DynamicObject ResultCode perform (const Scope& s, var*) const override { getResult (s); return ok; } }; - typedef std::unique_ptr ExpPtr; + using ExpPtr = std::unique_ptr; struct BlockStatement : public Statement { diff --git a/modules/juce_core/maths/juce_Expression.cpp b/modules/juce_core/maths/juce_Expression.cpp index 782a7de676..62a43ae275 100644 --- a/modules/juce_core/maths/juce_Expression.cpp +++ b/modules/juce_core/maths/juce_Expression.cpp @@ -80,9 +80,9 @@ private: //============================================================================== struct Expression::Helpers { - typedef ReferenceCountedObjectPtr TermPtr; + using TermPtr = ReferenceCountedObjectPtr; - static void checkRecursionDepth (const int depth) + static void checkRecursionDepth (int depth) { if (depth > 256) throw EvaluationError ("Recursive symbol references"); diff --git a/modules/juce_core/maths/juce_MathsFunctions.h b/modules/juce_core/maths/juce_MathsFunctions.h index 83d2ce225b..d8e1bf364e 100644 --- a/modules/juce_core/maths/juce_MathsFunctions.h +++ b/modules/juce_core/maths/juce_MathsFunctions.h @@ -32,28 +32,28 @@ namespace juce // Definitions for the int8, int16, int32, int64 and pointer_sized_int types. /** A platform-independent 8-bit signed integer type. */ -typedef signed char int8; +using int8 = signed char; /** A platform-independent 8-bit unsigned integer type. */ -typedef unsigned char uint8; +using uint8 = unsigned char; /** A platform-independent 16-bit signed integer type. */ -typedef signed short int16; +using int16 = signed short; /** A platform-independent 16-bit unsigned integer type. */ -typedef unsigned short uint16; +using uint16 = unsigned short; /** A platform-independent 32-bit signed integer type. */ -typedef signed int int32; +using int32 = signed int; /** A platform-independent 32-bit unsigned integer type. */ typedef unsigned int uint32; #if JUCE_MSVC /** A platform-independent 64-bit integer type. */ - typedef __int64 int64; + using int64 = __int64; /** A platform-independent 64-bit unsigned integer type. */ - typedef unsigned __int64 uint64; + using uint64 = unsigned __int64; #else /** A platform-independent 64-bit integer type. */ - typedef long long int64; + using int64 = long long; /** A platform-independent 64-bit unsigned integer type. */ - typedef unsigned long long uint64; + using uint64 = unsigned long long; #endif #ifndef DOXYGEN @@ -67,23 +67,23 @@ typedef unsigned int uint32; #if JUCE_64BIT /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ - typedef int64 pointer_sized_int; + using pointer_sized_int = int64; /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ - typedef uint64 pointer_sized_uint; + using pointer_sized_uint = uint64; #elif JUCE_MSVC /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ - typedef _W64 int pointer_sized_int; + using pointer_sized_int = _W64 int; /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ - typedef _W64 unsigned int pointer_sized_uint; + using pointer_sized_uint = _W64 unsigned int; #else /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ - typedef int pointer_sized_int; + using pointer_sized_int = int; /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ - typedef unsigned int pointer_sized_uint; + using pointer_sized_uint = unsigned int; #endif #if JUCE_WINDOWS && ! JUCE_MINGW - typedef pointer_sized_int ssize_t; + using ssize_t = pointer_sized_int; #endif //============================================================================== @@ -627,24 +627,24 @@ namespace TypeHelpers @tags{Core} */ - template struct ParameterType { typedef const Type& type; }; + template struct ParameterType { using type = const Type&; }; #if ! DOXYGEN - template struct ParameterType { typedef Type& type; }; - template struct ParameterType { typedef Type* type; }; - template <> struct ParameterType { typedef char type; }; - template <> struct ParameterType { typedef unsigned char type; }; - template <> struct ParameterType { typedef short type; }; - template <> struct ParameterType { typedef unsigned short type; }; - template <> struct ParameterType { typedef int type; }; - template <> struct ParameterType { typedef unsigned int type; }; - template <> struct ParameterType { typedef long type; }; - template <> struct ParameterType { typedef unsigned long type; }; - template <> struct ParameterType { typedef int64 type; }; - template <> struct ParameterType { typedef uint64 type; }; - template <> struct ParameterType { typedef bool type; }; - template <> struct ParameterType { typedef float type; }; - template <> struct ParameterType { typedef double type; }; + template struct ParameterType { using type = Type&; }; + template struct ParameterType { using type = Type*; }; + template <> struct ParameterType { using type = char; }; + template <> struct ParameterType { using type = unsigned char; }; + template <> struct ParameterType { using type = short; }; + template <> struct ParameterType { using type = unsigned short; }; + template <> struct ParameterType { using type = int; }; + template <> struct ParameterType { using type = unsigned int; }; + template <> struct ParameterType { using type = long; }; + template <> struct ParameterType { using type = unsigned long; }; + template <> struct ParameterType { using type = int64; }; + template <> struct ParameterType { using type = uint64; }; + template <> struct ParameterType { using type = bool; }; + template <> struct ParameterType { using type = float; }; + template <> struct ParameterType { using type = double; }; #endif /** These templates are designed to take a type, and if it's a double, they return a double @@ -652,10 +652,10 @@ namespace TypeHelpers @tags{Core} */ - template struct SmallestFloatType { typedef float type; }; + template struct SmallestFloatType { using type = float; }; #if ! DOXYGEN - template <> struct SmallestFloatType { typedef double type; }; + template <> struct SmallestFloatType { using type = double; }; #endif /** These templates are designed to take an integer type, and return an unsigned int @@ -666,10 +666,10 @@ namespace TypeHelpers template struct UnsignedTypeWithSize {}; #if ! DOXYGEN - template <> struct UnsignedTypeWithSize<1> { typedef uint8 type; }; - template <> struct UnsignedTypeWithSize<2> { typedef uint16 type; }; - template <> struct UnsignedTypeWithSize<4> { typedef uint32 type; }; - template <> struct UnsignedTypeWithSize<8> { typedef uint64 type; }; + template <> struct UnsignedTypeWithSize<1> { using type = uint8; }; + template <> struct UnsignedTypeWithSize<2> { using type = uint16; }; + template <> struct UnsignedTypeWithSize<4> { using type = uint32; }; + template <> struct UnsignedTypeWithSize<8> { using type = uint64; }; #endif } diff --git a/modules/juce_core/maths/juce_NormalisableRange.h b/modules/juce_core/maths/juce_NormalisableRange.h index d3a7298627..e5bb1cd21c 100644 --- a/modules/juce_core/maths/juce_NormalisableRange.h +++ b/modules/juce_core/maths/juce_NormalisableRange.h @@ -274,7 +274,8 @@ private: return clampedValue; } - typedef std::function ConverstionFunction; + using ConverstionFunction = std::function; + ConverstionFunction convertFrom0To1Function = {}, convertTo0To1Function = {}, snapToLegalValueFunction = {}; diff --git a/modules/juce_core/memory/juce_Atomic.h b/modules/juce_core/memory/juce_Atomic.h index f1bba1d09e..2a3d1feb91 100644 --- a/modules/juce_core/memory/juce_Atomic.h +++ b/modules/juce_core/memory/juce_Atomic.h @@ -26,8 +26,8 @@ namespace juce #ifndef DOXYGEN namespace AtomicHelpers { - template struct DiffTypeHelper { typedef T Type; }; - template struct DiffTypeHelper { typedef std::ptrdiff_t Type; }; + template struct DiffTypeHelper { using Type = T; }; + template struct DiffTypeHelper { using Type = std::ptrdiff_t; }; } #endif diff --git a/modules/juce_core/memory/juce_ReferenceCountedObject.h b/modules/juce_core/memory/juce_ReferenceCountedObject.h index 5efd086be1..61000b0737 100644 --- a/modules/juce_core/memory/juce_ReferenceCountedObject.h +++ b/modules/juce_core/memory/juce_ReferenceCountedObject.h @@ -37,7 +37,7 @@ namespace juce // This is a neat way of declaring a typedef for a pointer class, // rather than typing out the full templated name each time.. - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; }; MyClass::Ptr p = new MyClass(); @@ -228,7 +228,7 @@ private: @code struct MyClass : public ReferenceCountedObject { - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; ... } @endcode @@ -242,7 +242,7 @@ class ReferenceCountedObjectPtr { public: /** The class being referenced by this pointer. */ - typedef ObjectType ReferencedType; + using ReferencedType = ObjectType; //============================================================================== /** Creates a pointer to a null object. */ diff --git a/modules/juce_core/text/juce_CharPointer_ASCII.h b/modules/juce_core/text/juce_CharPointer_ASCII.h index 6dd1c36849..a89ee81f0e 100644 --- a/modules/juce_core/text/juce_CharPointer_ASCII.h +++ b/modules/juce_core/text/juce_CharPointer_ASCII.h @@ -37,7 +37,7 @@ namespace juce class CharPointer_ASCII final { public: - typedef char CharType; + using CharType = char; inline explicit CharPointer_ASCII (const CharType* rawPointer) noexcept : data (const_cast (rawPointer)) diff --git a/modules/juce_core/text/juce_CharPointer_UTF16.h b/modules/juce_core/text/juce_CharPointer_UTF16.h index 0bff3f3570..ccffb42950 100644 --- a/modules/juce_core/text/juce_CharPointer_UTF16.h +++ b/modules/juce_core/text/juce_CharPointer_UTF16.h @@ -35,9 +35,9 @@ class CharPointer_UTF16 final { public: #if JUCE_NATIVE_WCHAR_IS_UTF16 - typedef wchar_t CharType; + using CharType = wchar_t; #else - typedef int16 CharType; + using CharType = int16; #endif inline explicit CharPointer_UTF16 (const CharType* rawPointer) noexcept diff --git a/modules/juce_core/text/juce_CharPointer_UTF32.h b/modules/juce_core/text/juce_CharPointer_UTF32.h index e842389491..c8c4a19d91 100644 --- a/modules/juce_core/text/juce_CharPointer_UTF32.h +++ b/modules/juce_core/text/juce_CharPointer_UTF32.h @@ -34,7 +34,7 @@ namespace juce class CharPointer_UTF32 final { public: - typedef juce_wchar CharType; + using CharType = juce_wchar; inline explicit CharPointer_UTF32 (const CharType* rawPointer) noexcept : data (const_cast (rawPointer)) diff --git a/modules/juce_core/text/juce_CharPointer_UTF8.h b/modules/juce_core/text/juce_CharPointer_UTF8.h index 09bda467df..9496dc3a74 100644 --- a/modules/juce_core/text/juce_CharPointer_UTF8.h +++ b/modules/juce_core/text/juce_CharPointer_UTF8.h @@ -34,7 +34,7 @@ namespace juce class CharPointer_UTF8 final { public: - typedef char CharType; + using CharType = char; inline explicit CharPointer_UTF8 (const CharType* rawPointer) noexcept : data (const_cast (rawPointer)) @@ -122,9 +122,9 @@ public: if (n < 0) { - juce_wchar bit = 0x40; + uint8 bit = 0x40; - while ((static_cast (n) & bit) != 0 && bit > 0x8) + while ((static_cast (n) & bit) != 0 && bit > 0x8) { ++data; bit >>= 1; diff --git a/modules/juce_core/text/juce_CharacterFunctions.h b/modules/juce_core/text/juce_CharacterFunctions.h index e5681ec150..7c6e55b5dd 100644 --- a/modules/juce_core/text/juce_CharacterFunctions.h +++ b/modules/juce_core/text/juce_CharacterFunctions.h @@ -39,9 +39,9 @@ namespace juce #if JUCE_NATIVE_WCHAR_IS_UTF32 || DOXYGEN /** A platform-independent 32-bit unicode character type. */ - typedef wchar_t juce_wchar; + using juce_wchar = wchar_t; #else - typedef uint32 juce_wchar; + using juce_wchar = uint32; #endif #ifndef DOXYGEN @@ -66,13 +66,13 @@ namespace juce // GNU libstdc++ does not have std::make_unsigned namespace internal { - template struct make_unsigned { typedef Type type; }; - template <> struct make_unsigned { typedef unsigned char type; }; - template <> struct make_unsigned { typedef unsigned char type; }; - template <> struct make_unsigned { typedef unsigned short type; }; - template <> struct make_unsigned { typedef unsigned int type; }; - template <> struct make_unsigned { typedef unsigned long type; }; - template <> struct make_unsigned { typedef unsigned long long type; }; + template struct make_unsigned { using type = Type; }; + template <> struct make_unsigned { using type = unsigned char; }; + template <> struct make_unsigned { using type = unsigned char; }; + template <> struct make_unsigned { using type = unsigned short; }; + template <> struct make_unsigned { using type = unsigned int; }; + template <> struct make_unsigned { using type = unsigned long; }; + template <> struct make_unsigned { using type = unsigned long long; }; } #endif @@ -383,7 +383,7 @@ public: template static IntType getIntValue (const CharPointerType text) noexcept { - typedef typename internal::make_unsigned::type UIntType; + using UIntType = typename internal::make_unsigned::type; UIntType v = 0; auto s = text.findEndOfWhitespace(); diff --git a/modules/juce_core/text/juce_String.cpp b/modules/juce_core/text/juce_String.cpp index 5f0c0005a8..c7eddc0218 100644 --- a/modules/juce_core/text/juce_String.cpp +++ b/modules/juce_core/text/juce_String.cpp @@ -35,11 +35,11 @@ NewLine newLine; #endif #if JUCE_NATIVE_WCHAR_IS_UTF8 - typedef CharPointer_UTF8 CharPointer_wchar_t; + using CharPointer_wchar_t = CharPointer_UTF8; #elif JUCE_NATIVE_WCHAR_IS_UTF16 - typedef CharPointer_UTF16 CharPointer_wchar_t; + using CharPointer_wchar_t = CharPointer_UTF16; #else - typedef CharPointer_UTF32 CharPointer_wchar_t; + using CharPointer_wchar_t = CharPointer_UTF32; #endif static inline CharPointer_wchar_t castToCharPointer_wchar_t (const void* t) noexcept @@ -64,8 +64,8 @@ class StringHolder public: StringHolder() = delete; - typedef String::CharPointerType CharPointerType; - typedef String::CharPointerType::CharType CharType; + using CharPointerType = String::CharPointerType; + using CharType = String::CharPointerType::CharType; //============================================================================== static CharPointerType createUninitialisedBytes (size_t numBytes) @@ -768,13 +768,13 @@ void String::appendCharPointer (const CharPointerType startOfTextToAppend, } } -String& String::operator+= (const wchar_t* const t) +String& String::operator+= (const wchar_t* t) { appendCharPointer (castToCharPointer_wchar_t (t)); return *this; } -String& String::operator+= (const char* const t) +String& String::operator+= (const char* t) { appendCharPointer (CharPointer_UTF8 (t)); // (using UTF8 here triggers a faster code-path than ascii) return *this; @@ -797,20 +797,20 @@ String& String::operator+= (StringRef other) return operator+= (String (other)); } -String& String::operator+= (const char ch) +String& String::operator+= (char ch) { const char asString[] = { ch, 0 }; return operator+= (asString); } -String& String::operator+= (const wchar_t ch) +String& String::operator+= (wchar_t ch) { const wchar_t asString[] = { ch, 0 }; return operator+= (asString); } #if ! JUCE_NATIVE_WCHAR_IS_UTF32 -String& String::operator+= (const juce_wchar ch) +String& String::operator+= (juce_wchar ch) { const juce_wchar asString[] = { ch, 0 }; appendCharPointer (CharPointer_UTF32 (asString)); @@ -842,42 +842,42 @@ String& String::operator+= (const int64 number) { return StringHelpers::o String& String::operator+= (const uint64 number) { return StringHelpers::operationAddAssign (*this, number); } //============================================================================== -JUCE_API String JUCE_CALLTYPE operator+ (const char* const s1, const String& s2) { String s (s1); return s += s2; } -JUCE_API String JUCE_CALLTYPE operator+ (const wchar_t* const s1, const String& s2) { String s (s1); return s += s2; } +JUCE_API String JUCE_CALLTYPE operator+ (const char* s1, const String& s2) { String s (s1); return s += s2; } +JUCE_API String JUCE_CALLTYPE operator+ (const wchar_t* s1, const String& s2) { String s (s1); return s += s2; } -JUCE_API String JUCE_CALLTYPE operator+ (const char s1, const String& s2) { return String::charToString ((juce_wchar) (uint8) s1) + s2; } -JUCE_API String JUCE_CALLTYPE operator+ (const wchar_t s1, const String& s2) { return String::charToString (s1) + s2; } +JUCE_API String JUCE_CALLTYPE operator+ (char s1, const String& s2) { return String::charToString ((juce_wchar) (uint8) s1) + s2; } +JUCE_API String JUCE_CALLTYPE operator+ (wchar_t s1, const String& s2) { return String::charToString (s1) + s2; } -JUCE_API String JUCE_CALLTYPE operator+ (String s1, const String& s2) { return s1 += s2; } -JUCE_API String JUCE_CALLTYPE operator+ (String s1, const char* const s2) { return s1 += s2; } -JUCE_API String JUCE_CALLTYPE operator+ (String s1, const wchar_t* s2) { return s1 += s2; } +JUCE_API String JUCE_CALLTYPE operator+ (String s1, const String& s2) { return s1 += s2; } +JUCE_API String JUCE_CALLTYPE operator+ (String s1, const char* s2) { return s1 += s2; } +JUCE_API String JUCE_CALLTYPE operator+ (String s1, const wchar_t* s2) { return s1 += s2; } -JUCE_API String JUCE_CALLTYPE operator+ (String s1, const char s2) { return s1 += s2; } -JUCE_API String JUCE_CALLTYPE operator+ (String s1, const wchar_t s2) { return s1 += s2; } +JUCE_API String JUCE_CALLTYPE operator+ (String s1, char s2) { return s1 += s2; } +JUCE_API String JUCE_CALLTYPE operator+ (String s1, wchar_t s2) { return s1 += s2; } #if ! JUCE_NATIVE_WCHAR_IS_UTF32 -JUCE_API String JUCE_CALLTYPE operator+ (const juce_wchar s1, const String& s2) { return String::charToString (s1) + s2; } -JUCE_API String JUCE_CALLTYPE operator+ (String s1, const juce_wchar s2) { return s1 += s2; } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const juce_wchar s2) { return s1 += s2; } +JUCE_API String JUCE_CALLTYPE operator+ (juce_wchar s1, const String& s2) { return String::charToString (s1) + s2; } +JUCE_API String JUCE_CALLTYPE operator+ (String s1, juce_wchar s2) { return s1 += s2; } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, juce_wchar s2) { return s1 += s2; } #endif -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const char s2) { return s1 += s2; } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const wchar_t s2) { return s1 += s2; } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, char s2) { return s1 += s2; } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, wchar_t s2) { return s1 += s2; } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const char* const s2) { return s1 += s2; } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const wchar_t* const s2) { return s1 += s2; } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const String& s2) { return s1 += s2; } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, StringRef s2) { return s1 += s2; } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const char* s2) { return s1 += s2; } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const wchar_t* s2) { return s1 += s2; } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const String& s2) { return s1 += s2; } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, StringRef s2) { return s1 += s2; } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, uint8 number) { return s1 += (int) number; } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const short number) { return s1 += (int) number; } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const int number) { return s1 += number; } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const long number) { return s1 += String (number); } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const unsigned long number) { return s1 += String (number); } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const int64 number) { return s1 += String (number); } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const uint64 number) { return s1 += String (number); } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const float number) { return s1 += String (number); } -JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const double number) { return s1 += String (number); } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, uint8 number) { return s1 += (int) number; } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, short number) { return s1 += (int) number; } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, int number) { return s1 += number; } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, long number) { return s1 += String (number); } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, unsigned long number) { return s1 += String (number); } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, int64 number) { return s1 += String (number); } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, uint64 number) { return s1 += String (number); } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, float number) { return s1 += String (number); } +JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, double number) { return s1 += String (number); } JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text) { @@ -902,12 +902,12 @@ JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, StringRef } //============================================================================== -int String::indexOfChar (const juce_wchar character) const noexcept +int String::indexOfChar (juce_wchar character) const noexcept { return text.indexOf (character); } -int String::indexOfChar (const int startIndex, const juce_wchar character) const noexcept +int String::indexOfChar (int startIndex, juce_wchar character) const noexcept { auto t = text; @@ -927,7 +927,7 @@ int String::indexOfChar (const int startIndex, const juce_wchar character) const return -1; } -int String::lastIndexOfChar (const juce_wchar character) const noexcept +int String::lastIndexOfChar (juce_wchar character) const noexcept { auto t = text; int last = -1; @@ -939,7 +939,7 @@ int String::lastIndexOfChar (const juce_wchar character) const noexcept return last; } -int String::indexOfAnyOf (StringRef charactersToLookFor, const int startIndex, const bool ignoreCase) const noexcept +int String::indexOfAnyOf (StringRef charactersToLookFor, int startIndex, bool ignoreCase) const noexcept { auto t = text; @@ -969,7 +969,7 @@ int String::indexOfIgnoreCase (StringRef other) const noexcept return other.isEmpty() ? 0 : CharacterFunctions::indexOfIgnoreCase (text, other.text); } -int String::indexOf (const int startIndex, StringRef other) const noexcept +int String::indexOf (int startIndex, StringRef other) const noexcept { if (other.isEmpty()) return -1; diff --git a/modules/juce_core/threads/juce_Thread.cpp b/modules/juce_core/threads/juce_Thread.cpp index a9ea95c843..2e7cce85c9 100644 --- a/modules/juce_core/threads/juce_Thread.cpp +++ b/modules/juce_core/threads/juce_Thread.cpp @@ -52,7 +52,7 @@ struct CurrentThreadHolder : public ReferenceCountedObject { CurrentThreadHolder() noexcept {} - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; ThreadLocalValue value; JUCE_DECLARE_NON_COPYABLE (CurrentThreadHolder) diff --git a/modules/juce_data_structures/app_properties/juce_PropertiesFile.h b/modules/juce_data_structures/app_properties/juce_PropertiesFile.h index bb95cbcc5a..aeefba4b6c 100644 --- a/modules/juce_data_structures/app_properties/juce_PropertiesFile.h +++ b/modules/juce_data_structures/app_properties/juce_PropertiesFile.h @@ -239,7 +239,7 @@ private: Options options; bool loadedOk = false, needsWriting = false; - typedef const std::unique_ptr ProcessScopedLock; + using ProcessScopedLock = const std::unique_ptr; InterProcessLock::ScopedLockType* createProcessLock() const; void timerCallback() override; diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index 4bed4bacf4..803e3bf277 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -30,7 +30,7 @@ namespace juce class ValueTree::SharedObject : public ReferenceCountedObject { public: - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; explicit SharedObject (const Identifier& t) noexcept : type (t) {} diff --git a/modules/juce_dsp/containers/juce_SIMDRegister.h b/modules/juce_dsp/containers/juce_SIMDRegister.h index 2e2b13a77d..23d7d5dc7c 100644 --- a/modules/juce_dsp/containers/juce_SIMDRegister.h +++ b/modules/juce_dsp/containers/juce_SIMDRegister.h @@ -64,36 +64,36 @@ struct SIMDRegister { //============================================================================== /** The type that represents the individual constituents of the SIMD Register */ - typedef Type ElementType; + using ElementType = Type; /** STL compatible value_type definition (same as ElementType). */ - typedef ElementType value_type; + using value_type = ElementType; /** The corresponding primitive integer type, for example, this will be int32_t if type is a float. */ - typedef typename SIMDInternal::MaskTypeFor::type MaskType; + using MaskType = typename SIMDInternal::MaskTypeFor::type; //============================================================================== // Here are some types which are needed internally /** The native primitive type (used internally). */ - typedef typename SIMDInternal::PrimitiveType::type PrimitiveType; + using PrimitiveType = typename SIMDInternal::PrimitiveType::type; /** The native operations for this platform and type combination (used internally) */ - typedef SIMDNativeOps NativeOps; + using NativeOps = SIMDNativeOps; /** The native type (used internally). */ - typedef typename NativeOps::vSIMDType vSIMDType; + using vSIMDType = typename NativeOps::vSIMDType; /** The corresponding integer SIMDRegister type (used internally). */ - typedef SIMDRegister vMaskType; + using vMaskType = SIMDRegister; /** The internal native type for the corresponding mask type (used internally). */ - typedef typename vMaskType::vSIMDType vMaskSIMDType; + using vMaskSIMDType = typename vMaskType::vSIMDType; /** Wrapper for operations which need to be handled differently for complex and scalar types (used internally). */ - typedef CmplxSIMDOps CmplxOps; + using CmplxOps = CmplxSIMDOps; /** Type which is returned when using the subscript operator. The returned type should be used just like the type ElementType. */ diff --git a/modules/juce_dsp/native/juce_avx_SIMDNativeOps.h b/modules/juce_dsp/native/juce_avx_SIMDNativeOps.h index 642642fcf4..f9a125dea9 100644 --- a/modules/juce_dsp/native/juce_avx_SIMDNativeOps.h +++ b/modules/juce_dsp/native/juce_avx_SIMDNativeOps.h @@ -63,7 +63,7 @@ struct SIMDNativeOps; template <> struct SIMDNativeOps { - typedef __m256 vSIMDType; + using vSIMDType = __m256; //============================================================================== DECLARE_AVX_SIMD_CONST (int32_t, kAllBitsSet); @@ -133,7 +133,7 @@ struct SIMDNativeOps template <> struct SIMDNativeOps { - typedef __m256d vSIMDType; + using vSIMDType = __m256d; //============================================================================== DECLARE_AVX_SIMD_CONST (int64_t, kAllBitsSet); @@ -200,7 +200,7 @@ struct SIMDNativeOps template <> struct SIMDNativeOps { - typedef __m256i vSIMDType; + using vSIMDType = __m256i; //============================================================================== DECLARE_AVX_SIMD_CONST (int8_t, kAllBitsSet); @@ -273,7 +273,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m256i vSIMDType; + using vSIMDType = __m256i; //============================================================================== DECLARE_AVX_SIMD_CONST (uint8_t, kHighBit); @@ -348,7 +348,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m256i vSIMDType; + using vSIMDType = __m256i; //============================================================================== DECLARE_AVX_SIMD_CONST (int16_t, kAllBitsSet); @@ -403,7 +403,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m256i vSIMDType; + using vSIMDType = __m256i; //============================================================================== DECLARE_AVX_SIMD_CONST (uint16_t, kHighBit); @@ -461,7 +461,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m256i vSIMDType; + using vSIMDType = __m256i; //============================================================================== DECLARE_AVX_SIMD_CONST (int32_t, kAllBitsSet); @@ -514,7 +514,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m256i vSIMDType; + using vSIMDType = __m256i; //============================================================================== DECLARE_AVX_SIMD_CONST (uint32_t, kAllBitsSet); @@ -570,7 +570,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m256i vSIMDType; + using vSIMDType = __m256i; //============================================================================== DECLARE_AVX_SIMD_CONST (int64_t, kAllBitsSet); @@ -608,7 +608,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m256i vSIMDType; + using vSIMDType = __m256i; //============================================================================== DECLARE_AVX_SIMD_CONST (uint64_t, kAllBitsSet); diff --git a/modules/juce_dsp/native/juce_fallback_SIMDNativeOps.h b/modules/juce_dsp/native/juce_fallback_SIMDNativeOps.h index 1502d26cbe..dad1284093 100644 --- a/modules/juce_dsp/native/juce_fallback_SIMDNativeOps.h +++ b/modules/juce_dsp/native/juce_fallback_SIMDNativeOps.h @@ -32,19 +32,19 @@ namespace dsp /** A template specialisation to find corresponding mask type for primitives. */ namespace SIMDInternal { - template struct MaskTypeFor { typedef Primitive type; }; - template <> struct MaskTypeFor { typedef uint32_t type; }; - template <> struct MaskTypeFor { typedef uint64_t type; }; - template <> struct MaskTypeFor { typedef uint8_t type; }; - template <> struct MaskTypeFor { typedef uint8_t type; }; - template <> struct MaskTypeFor { typedef uint16_t type; }; - template <> struct MaskTypeFor { typedef uint32_t type; }; - template <> struct MaskTypeFor { typedef uint64_t type; }; - template <> struct MaskTypeFor > { typedef uint32_t type; }; - template <> struct MaskTypeFor > { typedef uint64_t type; }; - - template struct PrimitiveType { typedef Primitive type; }; - template struct PrimitiveType> { typedef Primitive type; }; + template struct MaskTypeFor { using type = Primitive; }; + template <> struct MaskTypeFor { using type = uint32_t; }; + template <> struct MaskTypeFor { using type = uint64_t; }; + template <> struct MaskTypeFor { using type = uint8_t; }; + template <> struct MaskTypeFor { using type = uint8_t; }; + template <> struct MaskTypeFor { using type = uint16_t; }; + template <> struct MaskTypeFor { using type = uint32_t; }; + template <> struct MaskTypeFor { using type = uint64_t; }; + template <> struct MaskTypeFor > { using type = uint32_t; }; + template <> struct MaskTypeFor > { using type = uint64_t; }; + + template struct PrimitiveType { using type = Primitive; }; + template struct PrimitiveType> { using type = Primitive; }; template struct Log2Helper { enum { value = Log2Helper::value + 1 }; }; template <> struct Log2Helper<1> { enum { value = 0 }; }; diff --git a/modules/juce_dsp/native/juce_neon_SIMDNativeOps.h b/modules/juce_dsp/native/juce_neon_SIMDNativeOps.h index 5eef5051f6..06d9457e73 100644 --- a/modules/juce_dsp/native/juce_neon_SIMDNativeOps.h +++ b/modules/juce_dsp/native/juce_neon_SIMDNativeOps.h @@ -64,8 +64,8 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef uint32x4_t vSIMDType; - typedef SIMDFallbackOps fb; + using vSIMDType = uint32x4_t; + using fb = SIMDFallbackOps; //============================================================================== DECLARE_NEON_SIMD_CONST (uint32_t, kAllBitsSet); @@ -108,8 +108,8 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef int32x4_t vSIMDType; - typedef SIMDFallbackOps fb; + using vSIMDType = int32x4_t; + using fb = SIMDFallbackOps; //============================================================================== DECLARE_NEON_SIMD_CONST (int32_t, kAllBitsSet); @@ -153,8 +153,8 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef int8x16_t vSIMDType; - typedef SIMDFallbackOps fb; + using vSIMDType = int8x16_t; + using fb = SIMDFallbackOps; //============================================================================== DECLARE_NEON_SIMD_CONST (int8_t, kAllBitsSet); @@ -193,8 +193,8 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef uint8x16_t vSIMDType; - typedef SIMDFallbackOps fb; + using vSIMDType = uint8x16_t; + using fb = SIMDFallbackOps; //============================================================================== DECLARE_NEON_SIMD_CONST (uint8_t, kAllBitsSet); @@ -233,8 +233,8 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef int16x8_t vSIMDType; - typedef SIMDFallbackOps fb; + using vSIMDType = int16x8_t; + using fb = SIMDFallbackOps; //============================================================================== DECLARE_NEON_SIMD_CONST (int16_t, kAllBitsSet); @@ -274,8 +274,8 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef uint16x8_t vSIMDType; - typedef SIMDFallbackOps fb; + using vSIMDType = uint16x8_t; + using fb = SIMDFallbackOps; //============================================================================== DECLARE_NEON_SIMD_CONST (uint16_t, kAllBitsSet); @@ -314,8 +314,8 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef int64x2_t vSIMDType; - typedef SIMDFallbackOps fb; + using vSIMDType = int64x2_t; + using fb = SIMDFallbackOps; //============================================================================== DECLARE_NEON_SIMD_CONST (int64_t, kAllBitsSet); @@ -355,8 +355,8 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef uint64x2_t vSIMDType; - typedef SIMDFallbackOps fb; + using vSIMDType = uint64x2_t; + using fb = SIMDFallbackOps; //============================================================================== DECLARE_NEON_SIMD_CONST (uint64_t, kAllBitsSet); @@ -395,9 +395,9 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef float32x4_t vSIMDType; - typedef uint32x4_t vMaskType; - typedef SIMDFallbackOps fb; + using vSIMDType = float32x4_t; + using vMaskType = uint32x4_t; + using fb = SIMDFallbackOps; //============================================================================== DECLARE_NEON_SIMD_CONST (int32_t, kAllBitsSet); @@ -456,33 +456,33 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef struct { double v[2]; } vSIMDType; - typedef SIMDFallbackOps fb; - - static forcedinline vSIMDType expand (double s) noexcept { return {{s, s}}; } - static forcedinline vSIMDType load (const double* a) noexcept { return {{a[0], a[1]}}; } - static forcedinline void store (vSIMDType v, double* a) noexcept { a[0] = v.v[0]; a[1] = v.v[1]; } - static forcedinline double get (vSIMDType v, size_t i) noexcept { return v.v[i]; } - static forcedinline vSIMDType set (vSIMDType v, size_t i, double s) noexcept { v.v[i] = s; return v; } - static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return {{a.v[0] + b.v[0], a.v[1] + b.v[1]}}; } - static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return {{a.v[0] - b.v[0], a.v[1] - b.v[1]}}; } - static forcedinline vSIMDType mul (vSIMDType a, vSIMDType b) noexcept { return {{a.v[0] * b.v[0], a.v[1] * b.v[1]}}; } - static forcedinline vSIMDType bit_and (vSIMDType a, vSIMDType b) noexcept { return fb::bit_and (a, b); } - static forcedinline vSIMDType bit_or (vSIMDType a, vSIMDType b) noexcept { return fb::bit_or (a, b); } - static forcedinline vSIMDType bit_xor (vSIMDType a, vSIMDType b) noexcept { return fb::bit_xor (a, b); } - static forcedinline vSIMDType bit_notand (vSIMDType a, vSIMDType b) noexcept { return fb::bit_notand (a, b); } - static forcedinline vSIMDType bit_not (vSIMDType a) noexcept { return fb::bit_not (a); } - static forcedinline vSIMDType min (vSIMDType a, vSIMDType b) noexcept { return fb::min (a, b); } - static forcedinline vSIMDType max (vSIMDType a, vSIMDType b) noexcept { return fb::max (a, b); } - static forcedinline vSIMDType equal (vSIMDType a, vSIMDType b) noexcept { return fb::equal (a, b); } - static forcedinline vSIMDType notEqual (vSIMDType a, vSIMDType b) noexcept { return fb::notEqual (a, b); } - static forcedinline vSIMDType greaterThan (vSIMDType a, vSIMDType b) noexcept { return fb::greaterThan (a, b); } - static forcedinline vSIMDType greaterThanOrEqual (vSIMDType a, vSIMDType b) noexcept { return fb::greaterThanOrEqual (a, b); } - static forcedinline bool allEqual (vSIMDType a, vSIMDType b) noexcept { return fb::allEqual (a, b); } + using vSIMDType = struct { double v[2]; }; + using fb = SIMDFallbackOps; + + static forcedinline vSIMDType expand (double s) noexcept { return {{s, s}}; } + static forcedinline vSIMDType load (const double* a) noexcept { return {{a[0], a[1]}}; } + static forcedinline void store (vSIMDType v, double* a) noexcept { a[0] = v.v[0]; a[1] = v.v[1]; } + static forcedinline double get (vSIMDType v, size_t i) noexcept { return v.v[i]; } + static forcedinline vSIMDType set (vSIMDType v, size_t i, double s) noexcept { v.v[i] = s; return v; } + static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return {{a.v[0] + b.v[0], a.v[1] + b.v[1]}}; } + static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return {{a.v[0] - b.v[0], a.v[1] - b.v[1]}}; } + static forcedinline vSIMDType mul (vSIMDType a, vSIMDType b) noexcept { return {{a.v[0] * b.v[0], a.v[1] * b.v[1]}}; } + static forcedinline vSIMDType bit_and (vSIMDType a, vSIMDType b) noexcept { return fb::bit_and (a, b); } + static forcedinline vSIMDType bit_or (vSIMDType a, vSIMDType b) noexcept { return fb::bit_or (a, b); } + static forcedinline vSIMDType bit_xor (vSIMDType a, vSIMDType b) noexcept { return fb::bit_xor (a, b); } + static forcedinline vSIMDType bit_notand (vSIMDType a, vSIMDType b) noexcept { return fb::bit_notand (a, b); } + static forcedinline vSIMDType bit_not (vSIMDType a) noexcept { return fb::bit_not (a); } + static forcedinline vSIMDType min (vSIMDType a, vSIMDType b) noexcept { return fb::min (a, b); } + static forcedinline vSIMDType max (vSIMDType a, vSIMDType b) noexcept { return fb::max (a, b); } + static forcedinline vSIMDType equal (vSIMDType a, vSIMDType b) noexcept { return fb::equal (a, b); } + static forcedinline vSIMDType notEqual (vSIMDType a, vSIMDType b) noexcept { return fb::notEqual (a, b); } + static forcedinline vSIMDType greaterThan (vSIMDType a, vSIMDType b) noexcept { return fb::greaterThan (a, b); } + static forcedinline vSIMDType greaterThanOrEqual (vSIMDType a, vSIMDType b) noexcept { return fb::greaterThanOrEqual (a, b); } + static forcedinline bool allEqual (vSIMDType a, vSIMDType b) noexcept { return fb::allEqual (a, b); } static forcedinline vSIMDType multiplyAdd (vSIMDType a, vSIMDType b, vSIMDType c) noexcept { return fb::multiplyAdd (a, b, c); } - static forcedinline vSIMDType cmplxmul (vSIMDType a, vSIMDType b) noexcept { return fb::cmplxmul (a, b); } - static forcedinline double sum (vSIMDType a) noexcept { return fb::sum (a); } - static forcedinline vSIMDType oddevensum (vSIMDType a) noexcept { return a; } + static forcedinline vSIMDType cmplxmul (vSIMDType a, vSIMDType b) noexcept { return fb::cmplxmul (a, b); } + static forcedinline double sum (vSIMDType a) noexcept { return fb::sum (a); } + static forcedinline vSIMDType oddevensum (vSIMDType a) noexcept { return a; } }; #endif diff --git a/modules/juce_dsp/native/juce_sse_SIMDNativeOps.h b/modules/juce_dsp/native/juce_sse_SIMDNativeOps.h index dd80cd00db..c4c320e9e1 100644 --- a/modules/juce_dsp/native/juce_sse_SIMDNativeOps.h +++ b/modules/juce_dsp/native/juce_sse_SIMDNativeOps.h @@ -64,7 +64,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m128 vSIMDType; + using vSIMDType = __m128; //============================================================================== DECLARE_SSE_SIMD_CONST (int32_t, kAllBitsSet); @@ -129,7 +129,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m128d vSIMDType; + using vSIMDType = __m128d; //============================================================================== DECLARE_SSE_SIMD_CONST (int64_t, kAllBitsSet); @@ -195,7 +195,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m128i vSIMDType; + using vSIMDType = __m128i; //============================================================================== DECLARE_SSE_SIMD_CONST (int8_t, kAllBitsSet); @@ -266,7 +266,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m128i vSIMDType; + using vSIMDType = __m128i; //============================================================================== DECLARE_SSE_SIMD_CONST (uint8_t, kHighBit); @@ -335,7 +335,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m128i vSIMDType; + using vSIMDType = __m128i; //============================================================================== DECLARE_SSE_SIMD_CONST (int16_t, kAllBitsSet); @@ -388,7 +388,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m128i vSIMDType; + using vSIMDType = __m128i; //============================================================================== DECLARE_SSE_SIMD_CONST (uint16_t, kHighBit); @@ -448,7 +448,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m128i vSIMDType; + using vSIMDType = __m128i; //============================================================================== DECLARE_SSE_SIMD_CONST (int32_t, kAllBitsSet); @@ -527,7 +527,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m128i vSIMDType; + using vSIMDType = __m128i; //============================================================================== DECLARE_SSE_SIMD_CONST (uint32_t, kAllBitsSet); @@ -608,7 +608,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m128i vSIMDType; + using vSIMDType = __m128i; //============================================================================== DECLARE_SSE_SIMD_CONST (int64_t, kAllBitsSet); @@ -665,7 +665,7 @@ template <> struct SIMDNativeOps { //============================================================================== - typedef __m128i vSIMDType; + using vSIMDType = __m128i; //============================================================================== DECLARE_SSE_SIMD_CONST (uint64_t, kAllBitsSet); diff --git a/modules/juce_events/messages/juce_Message.h b/modules/juce_events/messages/juce_Message.h index 49021e52f4..cdd79de331 100644 --- a/modules/juce_events/messages/juce_Message.h +++ b/modules/juce_events/messages/juce_Message.h @@ -48,7 +48,7 @@ public: Message() noexcept; ~Message(); - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; //============================================================================== private: diff --git a/modules/juce_events/messages/juce_MessageManager.h b/modules/juce_events/messages/juce_MessageManager.h index dc507472cf..345b80349e 100644 --- a/modules/juce_events/messages/juce_MessageManager.h +++ b/modules/juce_events/messages/juce_MessageManager.h @@ -182,7 +182,7 @@ public: virtual void messageCallback() = 0; bool post(); - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; JUCE_DECLARE_NON_COPYABLE (MessageBase) }; diff --git a/modules/juce_graphics/fonts/juce_Typeface.h b/modules/juce_graphics/fonts/juce_Typeface.h index 14d04e35cb..425e2d06bf 100644 --- a/modules/juce_graphics/fonts/juce_Typeface.h +++ b/modules/juce_graphics/fonts/juce_Typeface.h @@ -49,7 +49,7 @@ class JUCE_API Typeface : public ReferenceCountedObject public: //============================================================================== /** A handy typedef for a pointer to a typeface. */ - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; //============================================================================== /** Returns the font family of the typeface. diff --git a/modules/juce_graphics/images/juce_Image.h b/modules/juce_graphics/images/juce_Image.h index 8b2aa05a46..a35440979c 100644 --- a/modules/juce_graphics/images/juce_Image.h +++ b/modules/juce_graphics/images/juce_Image.h @@ -448,7 +448,7 @@ public: ImagePixelData (Image::PixelFormat, int width, int height); ~ImagePixelData(); - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; /** Creates a context that will draw into this image. */ virtual LowLevelGraphicsContext* createLowLevelContext() = 0; diff --git a/modules/juce_graphics/native/juce_RenderingHelpers.h b/modules/juce_graphics/native/juce_RenderingHelpers.h index ba1bd27723..9ac3ae20b1 100644 --- a/modules/juce_graphics/native/juce_RenderingHelpers.h +++ b/modules/juce_graphics/native/juce_RenderingHelpers.h @@ -1632,7 +1632,7 @@ struct ClipRegions Base() {} virtual ~Base() {} - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; virtual Ptr clone() const = 0; virtual Ptr applyClipTo (const Ptr& target) const = 0; @@ -1669,7 +1669,7 @@ struct ClipRegions EdgeTableRegion (const EdgeTableRegion& other) : Base(), edgeTable (other.edgeTable) {} EdgeTableRegion& operator= (const EdgeTableRegion&) = delete; - typedef typename Base::Ptr Ptr; + using Ptr = typename Base::Ptr; Ptr clone() const override { return new EdgeTableRegion (*this); } Ptr applyClipTo (const Ptr& target) const override { return target->clipToEdgeTable (edgeTable); } @@ -1850,7 +1850,7 @@ struct ClipRegions RectangleListRegion (const RectangleList& r) : clip (r) {} RectangleListRegion (const RectangleListRegion& other) : Base(), clip (other.clip) {} - typedef typename Base::Ptr Ptr; + using Ptr = typename Base::Ptr; Ptr clone() const override { return new RectangleListRegion (*this); } Ptr applyClipTo (const Ptr& target) const override { return target->clipToRectangleList (clip); } @@ -2080,9 +2080,9 @@ template class SavedStateBase { public: - typedef typename ClipRegions::Base BaseRegionType; - typedef typename ClipRegions::EdgeTableRegion EdgeTableRegionType; - typedef typename ClipRegions::RectangleListRegion RectangleListRegionType; + using BaseRegionType = typename ClipRegions::Base; + using EdgeTableRegionType = typename ClipRegions::EdgeTableRegion; + using RectangleListRegionType = typename ClipRegions::RectangleListRegion; SavedStateBase (Rectangle initialClip) : clip (new RectangleListRegionType (initialClip)), @@ -2516,7 +2516,7 @@ public: //============================================================================== class SoftwareRendererSavedState : public SavedStateBase { - typedef SavedStateBase BaseClass; + using BaseClass = SavedStateBase; public: SoftwareRendererSavedState (const Image& im, Rectangle clipBounds) @@ -2564,7 +2564,7 @@ public: } } - typedef GlyphCache, SoftwareRendererSavedState> GlyphCacheType; + using GlyphCacheType = GlyphCache, SoftwareRendererSavedState>; static void clearGlyphCache() { diff --git a/modules/juce_graphics/native/juce_freetype_Fonts.cpp b/modules/juce_graphics/native/juce_freetype_Fonts.cpp index 9da1efc1c1..367d3b26bc 100644 --- a/modules/juce_graphics/native/juce_freetype_Fonts.cpp +++ b/modules/juce_graphics/native/juce_freetype_Fonts.cpp @@ -46,7 +46,7 @@ struct FTLibWrapper : public ReferenceCountedObject FT_Library library; - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FTLibWrapper) }; @@ -79,7 +79,7 @@ struct FTFaceWrapper : public ReferenceCountedObject FTLibWrapper::Ptr library; MemoryBlock savedFaceData; - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FTFaceWrapper) }; diff --git a/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp b/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp index 445712f237..dea82eb6b9 100644 --- a/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp +++ b/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp @@ -39,7 +39,7 @@ class Win32NativeFileChooser : public ReferenceCountedObject, private Thread { public: - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; enum { charsAvailableForResult = 32768 }; diff --git a/modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp b/modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp index 82333141ae..ec05152e2a 100644 --- a/modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp +++ b/modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp @@ -76,7 +76,7 @@ public: class SharedKeyWindow : public ReferenceCountedObject { public: - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; //============================================================================== Window getHandle() { return keyProxy; } diff --git a/modules/juce_opengl/geometry/juce_Draggable3DOrientation.h b/modules/juce_opengl/geometry/juce_Draggable3DOrientation.h index ccad03a897..9869b2bd84 100644 --- a/modules/juce_opengl/geometry/juce_Draggable3DOrientation.h +++ b/modules/juce_opengl/geometry/juce_Draggable3DOrientation.h @@ -36,8 +36,8 @@ namespace juce class Draggable3DOrientation { public: - typedef Vector3D VectorType; - typedef Quaternion QuaternionType; + using VectorType = Vector3D; + using QuaternionType = Quaternion; /** Creates a Draggable3DOrientation, initially set up to be aligned along the X axis. */ Draggable3DOrientation (float objectRadius = 0.5f) noexcept @@ -65,7 +65,7 @@ public: rectangle is assumed to be the centre of the object that will be rotated, and the size of the rectangle will be used to scale the object radius - see setRadius(). */ - void setViewport (const Rectangle& newArea) noexcept + void setViewport (Rectangle newArea) noexcept { area = newArea; } @@ -95,9 +95,9 @@ public: template void mouseDrag (Point mousePos) noexcept { - const VectorType oldPos (projectOnSphere (lastMouse)); + auto oldPos = projectOnSphere (lastMouse); lastMouse = mousePosToProportion (mousePos.toFloat()); - const VectorType newPos (projectOnSphere (lastMouse)); + auto newPos = projectOnSphere (lastMouse); quaternion *= rotationFromMove (oldPos, newPos); } @@ -122,36 +122,36 @@ private: QuaternionType quaternion; Point lastMouse; - Point mousePosToProportion (const Point mousePos) const noexcept + Point mousePosToProportion (Point mousePos) const noexcept { - const int scale = (jmin (area.getWidth(), area.getHeight()) / 2); + auto scale = jmin (area.getWidth(), area.getHeight()) / 2; // You must call setViewport() to give this object a valid window size before // calling any of the mouse input methods! jassert (scale > 0); - return Point ((mousePos.x - (float) area.getCentreX()) / (float) scale, - ((float) area.getCentreY() - mousePos.y) / (float) scale); + return { (mousePos.x - (float) area.getCentreX()) / (float) scale, + ((float) area.getCentreY() - mousePos.y) / (float) scale }; } - VectorType projectOnSphere (const Point pos) const noexcept + VectorType projectOnSphere (Point pos) const noexcept { - const float radiusSquared = radius * radius; - const float xySquared = pos.x * pos.x + pos.y * pos.y; + auto radiusSquared = radius * radius; + auto xySquared = pos.x * pos.x + pos.y * pos.y; - return VectorType (pos.x, pos.y, - xySquared < radiusSquared * 0.5f ? std::sqrt (radiusSquared - xySquared) - : (radiusSquared / (2.0f * std::sqrt (xySquared)))); + return { pos.x, pos.y, + xySquared < radiusSquared * 0.5f ? std::sqrt (radiusSquared - xySquared) + : (radiusSquared / (2.0f * std::sqrt (xySquared))) }; } QuaternionType rotationFromMove (const VectorType& from, const VectorType& to) const noexcept { - VectorType rotationAxis (to ^ from); + auto rotationAxis = (to ^ from); if (rotationAxis.lengthIsBelowEpsilon()) rotationAxis = VectorType::xAxis(); - const float d = jlimit (-1.0f, 1.0f, (from - to).length() / (2.0f * radius)); + auto d = jlimit (-1.0f, 1.0f, (from - to).length() / (2.0f * radius)); return QuaternionType::fromAngle (2.0f * std::asin (d), rotationAxis); } diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.h b/modules/juce_opengl/opengl/juce_OpenGLContext.h index 496a2c29d7..ef5e15edf0 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.h +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.h @@ -334,7 +334,7 @@ private: //============================================================================== struct AsyncWorker : public ReferenceCountedObject { - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; virtual void operator() (OpenGLContext&) = 0; virtual ~AsyncWorker() {} }; diff --git a/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp index 464021d11f..869a28b728 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp @@ -140,7 +140,7 @@ struct CachedImageList : public ReferenceCountedObject, JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CachedImage) }; - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; private: OpenGLContext& context; @@ -375,7 +375,7 @@ struct ShaderPrograms : public ReferenceCountedObject maskTexture (context) {} - typedef ReferenceCountedObjectPtr Ptr; + using Ptr = ReferenceCountedObjectPtr; //============================================================================== struct ShaderProgramHolder @@ -1579,7 +1579,7 @@ private: //============================================================================== struct SavedState : public RenderingHelpers::SavedStateBase { - typedef RenderingHelpers::SavedStateBase BaseClass; + using BaseClass = RenderingHelpers::SavedStateBase; SavedState (GLState* s) : BaseClass (s->target.bounds), state (s) {} @@ -1630,7 +1630,7 @@ struct SavedState : public RenderingHelpers::SavedStateBase } } - typedef RenderingHelpers::GlyphCache, SavedState> GlyphCacheType; + using GlyphCacheType = RenderingHelpers::GlyphCache, SavedState>; void drawGlyph (int glyphNumber, const AffineTransform& trans) { diff --git a/modules/juce_osc/osc/juce_OSCAddress.cpp b/modules/juce_osc/osc/juce_OSCAddress.cpp index b2e36b0512..9af4bd27ab 100644 --- a/modules/juce_osc/osc/juce_OSCAddress.cpp +++ b/modules/juce_osc/osc/juce_OSCAddress.cpp @@ -33,7 +33,7 @@ namespace template class OSCPatternMatcherImpl { - typedef CharPointerType CharPtr; + using CharPtr = CharPointerType; public: //============================================================================== @@ -266,7 +266,7 @@ namespace template struct OSCAddressTokeniser { - typedef OSCAddressTokeniserTraits Traits; + using Traits = OSCAddressTokeniserTraits; //============================================================================== static bool isPrintableASCIIChar (juce_wchar c) noexcept diff --git a/modules/juce_osc/osc/juce_OSCReceiver.cpp b/modules/juce_osc/osc/juce_OSCReceiver.cpp index a007cbd150..d197f7b75d 100644 --- a/modules/juce_osc/osc/juce_OSCReceiver.cpp +++ b/modules/juce_osc/osc/juce_OSCReceiver.cpp @@ -525,7 +525,7 @@ private: //============================================================================== void callListeners (const OSCBundle::Element& content) { - typedef OSCReceiver::Listener Listener; + using Listener = OSCReceiver::Listener; if (content.isMessage()) { @@ -541,7 +541,7 @@ private: void callRealtimeListeners (const OSCBundle::Element& content) { - typedef OSCReceiver::Listener Listener; + using Listener = OSCReceiver::Listener; if (content.isMessage()) { diff --git a/modules/juce_osc/osc/juce_OSCReceiver.h b/modules/juce_osc/osc/juce_OSCReceiver.h index c234bcc2ad..1f78122bcd 100644 --- a/modules/juce_osc/osc/juce_OSCReceiver.h +++ b/modules/juce_osc/osc/juce_OSCReceiver.h @@ -200,7 +200,7 @@ public: The arguments passed are the pointer to and the data of the buffer that the OSCReceiver has failed to parse. */ - typedef std::function FormatErrorHandler; + using FormatErrorHandler = std::function; /** Installs a custom error handler which is called in case the receiver encounters a stream it cannot parse as an OSC bundle or OSC message.