| @@ -243,7 +243,7 @@ private: | |||
| }; | |||
| static Shape* parseFaceGroup (const Mesh& srcMesh, | |||
| const Array<Face>& faceGroup, | |||
| Array<Face>& faceGroup, | |||
| const Material& material, | |||
| const String& name) | |||
| { | |||
| @@ -263,7 +263,7 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| MPENote* findActiveNote (int noteID) const noexcept | |||
| const MPENote* findActiveNote (int noteID) const noexcept | |||
| { | |||
| for (auto& note : activeNotes) | |||
| if (note.noteID == noteID) | |||
| @@ -64,7 +64,7 @@ public: | |||
| helloWorldLabel.setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |||
| addAndMakeVisible (quitButton); | |||
| quitButton.onClick = [this] { JUCEApplication::quit(); }; | |||
| quitButton.onClick = [] { JUCEApplication::quit(); }; | |||
| setSize (600, 300); | |||
| } | |||
| @@ -191,7 +191,7 @@ public: | |||
| recordButton.onClick = [this] { startRecording(); }; | |||
| addAndMakeVisible (recordButton); | |||
| roomSizeSlider.onValueChange = [this] { setParameterValue ("roomSize", roomSizeSlider.getValue()); }; | |||
| roomSizeSlider.onValueChange = [this] { setParameterValue ("roomSize", (float) roomSizeSlider.getValue()); }; | |||
| roomSizeSlider.setRange (0.0, 1.0); | |||
| addAndMakeVisible (roomSizeSlider); | |||
| @@ -260,7 +260,7 @@ private: | |||
| { | |||
| if (auto* processor = getAudioProcessor()) | |||
| { | |||
| const OwnedArray<AudioProcessorParameter>& params = processor->getParameters(); | |||
| auto& params = processor->getParameters(); | |||
| for (auto p : params) | |||
| { | |||
| @@ -94,7 +94,7 @@ private: | |||
| { | |||
| auto callbackLevel = maxLevel.exchange (0.0); | |||
| auto decayFactor = 0.95; | |||
| float decayFactor = 0.95f; | |||
| if (callbackLevel > level) | |||
| level = callbackLevel; | |||
| @@ -265,13 +265,13 @@ public: | |||
| // meter values directly from the audio thread. | |||
| struct MeterListener | |||
| { | |||
| virtual ~MeterListener() {}; | |||
| virtual ~MeterListener() {} | |||
| virtual void handleNewMeterValue (int, float) = 0; | |||
| }; | |||
| void addMeterListener (MeterListener& listener) { meterListeners.add (&listener); }; | |||
| void removeMeterListener (MeterListener& listener) { meterListeners.remove (&listener); }; | |||
| void addMeterListener (MeterListener& listener) { meterListeners.add (&listener); } | |||
| void removeMeterListener (MeterListener& listener) { meterListeners.remove (&listener); } | |||
| private: | |||
| @@ -100,7 +100,7 @@ class MoveOnlyFifo final | |||
| { | |||
| public: | |||
| explicit MoveOnlyFifo (int size) | |||
| : buffer (size), | |||
| : buffer ((size_t) size), | |||
| abstractFifo (size) | |||
| {} | |||
| @@ -115,12 +115,12 @@ public: | |||
| if (writer.blockSize1 == 1) | |||
| { | |||
| buffer[writer.startIndex1] = move (item); | |||
| buffer[(size_t) writer.startIndex1] = move (item); | |||
| item = {}; | |||
| } | |||
| else if (writer.blockSize2 == 1) | |||
| { | |||
| buffer[writer.startIndex2] = move (item); | |||
| buffer[(size_t) writer.startIndex2] = move (item); | |||
| item = {}; | |||
| } | |||
| @@ -132,10 +132,10 @@ public: | |||
| auto reader = abstractFifo.read (1); | |||
| if (reader.blockSize1 == 1) | |||
| return move (buffer[reader.startIndex1]); | |||
| return move (buffer[(size_t) reader.startIndex1]); | |||
| if (reader.blockSize2 == 1) | |||
| return move (buffer[reader.startIndex2]); | |||
| return move (buffer[(size_t) reader.startIndex2]); | |||
| return {}; | |||
| } | |||
| @@ -2178,14 +2178,14 @@ public: | |||
| auto numVoices = synthesiser.getNumVoices(); | |||
| // Update the current playback positions | |||
| for (auto i = 0; i != maxVoices; ++i) | |||
| for (auto i = 0; i < maxVoices; ++i) | |||
| { | |||
| auto* voicePtr = dynamic_cast<MPESamplerVoice*> (synthesiser.getVoice (i)); | |||
| if (i < numVoices && voicePtr != nullptr) | |||
| playbackPositions[i] = static_cast<float> (voicePtr->getCurrentSamplePosition() / loadedSamplerSound->getSample()->getSampleRate()); | |||
| playbackPositions[(size_t) i] = static_cast<float> (voicePtr->getCurrentSamplePosition() / loadedSamplerSound->getSample()->getSampleRate()); | |||
| else | |||
| playbackPositions[i] = 0.0f; | |||
| playbackPositions[(size_t) i] = 0.0f; | |||
| } | |||
| } | |||
| @@ -2207,8 +2207,8 @@ public: | |||
| void operator() (SamplerAudioProcessor& proc) | |||
| { | |||
| proc.readerFactory = move (readerFactory); | |||
| auto samplerSound = proc.samplerSound.load(); | |||
| samplerSound->setSample (move (sample)); | |||
| auto sound = proc.samplerSound.load(); | |||
| sound->setSample (move (sample)); | |||
| auto numberOfVoices = proc.synthesiser.getNumVoices(); | |||
| proc.synthesiser.clearVoices(); | |||
| @@ -2322,15 +2322,11 @@ public: | |||
| void operator() (SamplerAudioProcessor& proc) | |||
| { | |||
| if (newVoices.size() < proc.synthesiser.getNumVoices()) | |||
| if (newVoices.size() < (size_t) proc.synthesiser.getNumVoices()) | |||
| proc.synthesiser.reduceNumVoices (int (newVoices.size())); | |||
| else | |||
| { | |||
| for (auto it = begin (newVoices); proc.synthesiser.getNumVoices() < newVoices.size(); ++it) | |||
| { | |||
| for (auto it = begin (newVoices); (size_t) proc.synthesiser.getNumVoices() < newVoices.size(); ++it) | |||
| proc.synthesiser.addVoice (it->release()); | |||
| } | |||
| } | |||
| } | |||
| private: | |||
| @@ -2340,7 +2336,7 @@ public: | |||
| numberOfVoices = std::min (maxVoices, numberOfVoices); | |||
| auto loadedSamplerSound = samplerSound.load(); | |||
| std::vector<std::unique_ptr<MPESamplerVoice>> newSamplerVoices; | |||
| newSamplerVoices.reserve (numberOfVoices); | |||
| newSamplerVoices.reserve ((size_t) numberOfVoices); | |||
| for (auto i = 0; i != numberOfVoices; ++i) | |||
| newSamplerVoices.emplace_back (new MPESamplerVoice (loadedSamplerSound)); | |||
| @@ -2355,7 +2351,7 @@ public: | |||
| // been updated to remove some voices in the meantime, so the returned | |||
| // value won't correspond to an existing voice. | |||
| int getNumVoices() const { return synthesiser.getNumVoices(); } | |||
| float getPlaybackPosition (int voice) const { return playbackPositions.at (voice); } | |||
| float getPlaybackPosition (int voice) const { return playbackPositions.at ((size_t) voice); } | |||
| private: | |||
| //============================================================================== | |||
| @@ -2373,7 +2369,7 @@ private: | |||
| { | |||
| std::vector<float> ret; | |||
| auto voices = p.getNumVoices(); | |||
| ret.reserve (voices); | |||
| ret.reserve ((size_t) voices); | |||
| for (auto i = 0; i != voices; ++i) | |||
| ret.emplace_back (p.getPlaybackPosition (i)); | |||
| @@ -524,12 +524,16 @@ struct ClassDatabase | |||
| void findClassesDeclaredInFile (Array<Class*>& results, const File& file) | |||
| { | |||
| for (auto& c : components) | |||
| for (int i = 0; i < components.size(); ++i) | |||
| { | |||
| auto c = components.getReference (i); | |||
| if (c.isDeclaredInFile (file)) | |||
| results.add (&c); | |||
| } | |||
| for (auto& n : namespaces) | |||
| n.findClassesDeclaredInFile (results, file); | |||
| for (int i = 0; i < namespaces.size(); ++i) | |||
| namespaces.getReference (i).findClassesDeclaredInFile (results, file); | |||
| } | |||
| void merge (const Namespace& other) | |||
| @@ -560,9 +564,13 @@ struct ClassDatabase | |||
| Namespace* findNamespace (const String& targetName) | |||
| { | |||
| for (auto& n : namespaces) | |||
| for (int i = 0; i < namespaces.size(); ++i) | |||
| { | |||
| auto& n = namespaces.getReference (i); | |||
| if (n.name == targetName) | |||
| return &n; | |||
| } | |||
| return nullptr; | |||
| } | |||
| @@ -575,7 +583,7 @@ struct ClassDatabase | |||
| Namespace* getOrCreateNamespace (const String& newName) | |||
| { | |||
| if (Namespace* existing = findNamespace (newName)) | |||
| if (auto* existing = findNamespace (newName)) | |||
| return existing; | |||
| return createNamespace (newName); | |||
| @@ -600,14 +608,20 @@ struct ClassDatabase | |||
| void nudgeAllCodeRanges (const String& file, int index, int delta) | |||
| { | |||
| for (auto& c : components) c.nudgeAllCodeRanges (file, index, delta); | |||
| for (auto& n : namespaces) n.nudgeAllCodeRanges (file, index, delta); | |||
| for (int i = 0; i < components.size(); ++i) | |||
| components.getReference (i).nudgeAllCodeRanges (file, index, delta); | |||
| for (int i = 0; i < namespaces.size(); ++i) | |||
| namespaces.getReference (i).nudgeAllCodeRanges (file, index, delta); | |||
| } | |||
| void fileContentChanged (const String& file) | |||
| { | |||
| for (auto& c : components) c.fileContentChanged (file); | |||
| for (auto& n : namespaces) n.fileContentChanged (file); | |||
| for (int i = 0; i < components.size(); ++i) | |||
| components.getReference (i).fileContentChanged (file); | |||
| for (int i = 0; i < namespaces.size(); ++i) | |||
| namespaces.getReference (i).fileContentChanged (file); | |||
| } | |||
| bool matches (const Namespace& other) const | |||
| @@ -617,7 +631,7 @@ struct ClassDatabase | |||
| && namespaces.size() == other.namespaces.size()) | |||
| { | |||
| for (int i = namespaces.size(); --i >= 0;) | |||
| if (! namespaces.getReference (i).matches (other.namespaces.getReference(i))) | |||
| if (! namespaces.getReference (i).matches (other.namespaces.getReference (i))) | |||
| return false; | |||
| return true; | |||
| @@ -419,14 +419,14 @@ static var parseJUCEHeaderMetadata (const StringArray& lines) | |||
| for (auto& line : lines) | |||
| { | |||
| line = trimCommentCharsFromStartOfLine (line); | |||
| auto trimmedLine = trimCommentCharsFromStartOfLine (line); | |||
| auto colon = line.indexOfChar (':'); | |||
| auto colon = trimmedLine.indexOfChar (':'); | |||
| if (colon >= 0) | |||
| { | |||
| auto key = line.substring (0, colon).trim(); | |||
| auto value = line.substring (colon + 1).trim(); | |||
| auto key = trimmedLine.substring (0, colon).trim(); | |||
| auto value = trimmedLine.substring (colon + 1).trim(); | |||
| o->setProperty (key, value); | |||
| } | |||
| @@ -87,8 +87,10 @@ MidiMessageSequence::MidiEventHolder* MidiMessageSequence::getEventPointer (int | |||
| return list[index]; | |||
| } | |||
| MidiMessageSequence::MidiEventHolder** MidiMessageSequence::begin() const noexcept { return list.begin(); } | |||
| MidiMessageSequence::MidiEventHolder** MidiMessageSequence::end() const noexcept { return list.end(); } | |||
| MidiMessageSequence::MidiEventHolder** MidiMessageSequence::begin() noexcept { return list.begin(); } | |||
| MidiMessageSequence::MidiEventHolder* const* MidiMessageSequence::begin() const noexcept { return list.begin(); } | |||
| MidiMessageSequence::MidiEventHolder** MidiMessageSequence::end() noexcept { return list.end(); } | |||
| MidiMessageSequence::MidiEventHolder* const* MidiMessageSequence::end() const noexcept { return list.end(); } | |||
| double MidiMessageSequence::getTimeOfMatchingKeyUp (int index) const noexcept | |||
| { | |||
| @@ -103,10 +103,16 @@ public: | |||
| MidiEventHolder* getEventPointer (int index) const noexcept; | |||
| /** Iterator for the list of MidiEventHolders */ | |||
| MidiEventHolder** begin() const noexcept; | |||
| MidiEventHolder** begin() noexcept; | |||
| /** Iterator for the list of MidiEventHolders */ | |||
| MidiEventHolder** end() const noexcept; | |||
| MidiEventHolder* const* begin() const noexcept; | |||
| /** Iterator for the list of MidiEventHolders */ | |||
| MidiEventHolder** end() noexcept; | |||
| /** Iterator for the list of MidiEventHolders */ | |||
| MidiEventHolder* const* end() const noexcept; | |||
| /** Returns the time of the note-up that matches the note-on at this index. | |||
| If the event at this index isn't a note-on, it'll just return 0. | |||
| @@ -726,7 +726,7 @@ MPENote* MPEInstrument::getLastNotePlayedPtr (int midiChannel) noexcept | |||
| const MPENote* MPEInstrument::getHighestNotePtr (int midiChannel) const noexcept | |||
| { | |||
| int initialNoteMax = -1; | |||
| MPENote* result = nullptr; | |||
| const MPENote* result = nullptr; | |||
| for (auto i = notes.size(); --i >= 0;) | |||
| { | |||
| @@ -752,7 +752,7 @@ MPENote* MPEInstrument::getHighestNotePtr (int midiChannel) noexcept | |||
| const MPENote* MPEInstrument::getLowestNotePtr (int midiChannel) const noexcept | |||
| { | |||
| int initialNoteMin = 128; | |||
| MPENote* result = nullptr; | |||
| const MPENote* result = nullptr; | |||
| for (auto i = notes.size(); --i >= 0;) | |||
| { | |||
| @@ -81,10 +81,16 @@ public: | |||
| AudioFormat* getKnownFormat (int index) const; | |||
| /** Iterator access to the list of known formats. */ | |||
| AudioFormat** begin() const noexcept { return knownFormats.begin(); } | |||
| AudioFormat** begin() noexcept { return knownFormats.begin(); } | |||
| /** Iterator access to the list of known formats. */ | |||
| AudioFormat** end() const noexcept { return knownFormats.end(); } | |||
| AudioFormat* const* begin() const noexcept { return knownFormats.begin(); } | |||
| /** Iterator access to the list of known formats. */ | |||
| AudioFormat** end() noexcept { return knownFormats.end(); } | |||
| /** Iterator access to the list of known formats. */ | |||
| AudioFormat* const* end() const noexcept { return knownFormats.end(); } | |||
| /** Looks for which of the known formats is listed as being for a given file | |||
| extension. | |||
| @@ -2298,7 +2298,8 @@ public: | |||
| bool setStateFromPresetFile (const MemoryBlock& rawData) | |||
| { | |||
| ComSmartPtr<Steinberg::MemoryStream> memoryStream = new Steinberg::MemoryStream (rawData.getData(), (int) rawData.getSize()); | |||
| MemoryBlock rawDataCopy (rawData); | |||
| ComSmartPtr<Steinberg::MemoryStream> memoryStream = new Steinberg::MemoryStream (rawDataCopy.getData(), (int) rawDataCopy.getSize()); | |||
| if (memoryStream == nullptr || holder->component == nullptr) | |||
| return false; | |||
| @@ -97,8 +97,8 @@ String AudioProcessorParameterGroup::getName() const | |||
| String AudioProcessorParameterGroup::getSeparator() const { return separator; } | |||
| const AudioProcessorParameterGroup* AudioProcessorParameterGroup::getParent() const noexcept { return parent; } | |||
| const AudioProcessorParameterGroup::AudioProcessorParameterNode** AudioProcessorParameterGroup::begin() const noexcept { return const_cast<const AudioProcessorParameterNode**> (children.begin()); } | |||
| const AudioProcessorParameterGroup::AudioProcessorParameterNode** AudioProcessorParameterGroup::end() const noexcept { return const_cast<const AudioProcessorParameterNode**> (children.end()); } | |||
| const AudioProcessorParameterGroup::AudioProcessorParameterNode* const* AudioProcessorParameterGroup::begin() const noexcept { return const_cast<const AudioProcessorParameterNode**> (children.begin()); } | |||
| const AudioProcessorParameterGroup::AudioProcessorParameterNode* const* AudioProcessorParameterGroup::end() const noexcept { return const_cast<const AudioProcessorParameterNode**> (children.end()); } | |||
| void AudioProcessorParameterGroup::append (std::unique_ptr<AudioProcessorParameter> newParameter) | |||
| { | |||
| @@ -162,8 +162,8 @@ public: | |||
| const AudioProcessorParameterGroup* getParent() const noexcept; | |||
| //============================================================================== | |||
| const AudioProcessorParameterNode** begin() const noexcept; | |||
| const AudioProcessorParameterNode** end() const noexcept; | |||
| const AudioProcessorParameterNode* const* begin() const noexcept; | |||
| const AudioProcessorParameterNode* const* end() const noexcept; | |||
| //============================================================================== | |||
| /** Returns all subgroups of this group. | |||
| @@ -210,9 +210,12 @@ public: | |||
| // These methods have been deprecated! When getting the list of plugin types you should instead use | |||
| // the getTypes() method which returns a copy of the internal PluginDescription array and can be accessed | |||
| // in a thread-safe way. | |||
| JUCE_DEPRECATED_WITH_BODY (PluginDescription* getType (int index) const noexcept, { return &types.getReference (index); }) | |||
| JUCE_DEPRECATED_WITH_BODY (PluginDescription** begin() const noexcept, { jassertfalse; return nullptr; }) | |||
| JUCE_DEPRECATED_WITH_BODY (PluginDescription** end() const noexcept, { jassertfalse; return nullptr; }) | |||
| JUCE_DEPRECATED_WITH_BODY (PluginDescription* getType (int index) noexcept, { return &types.getReference (index); }) | |||
| JUCE_DEPRECATED_WITH_BODY (const PluginDescription* getType (int index) const noexcept, { return &types.getReference (index); }) | |||
| JUCE_DEPRECATED_WITH_BODY (PluginDescription** begin() noexcept, { jassertfalse; return nullptr; }) | |||
| JUCE_DEPRECATED_WITH_BODY (PluginDescription* const* begin() const noexcept, { jassertfalse; return nullptr; }) | |||
| JUCE_DEPRECATED_WITH_BODY (PluginDescription** end() noexcept, { jassertfalse; return nullptr; }) | |||
| JUCE_DEPRECATED_WITH_BODY (PluginDescription* const* end() const noexcept, { jassertfalse; return nullptr; }) | |||
| private: | |||
| //============================================================================== | |||
| @@ -555,7 +555,7 @@ private: | |||
| return -1; | |||
| } | |||
| DeviceInfo* getDeviceInfoFromUID (Block::UID uid) const noexcept | |||
| DeviceInfo* getDeviceInfoFromUID (Block::UID uid) noexcept | |||
| { | |||
| for (auto& d : currentDeviceInfo) | |||
| if (d.uid == uid) | |||
| @@ -564,7 +564,7 @@ private: | |||
| return nullptr; | |||
| } | |||
| DeviceInfo* getDeviceInfoFromIndex (BlocksProtocol::TopologyIndex index) const noexcept | |||
| DeviceInfo* getDeviceInfoFromIndex (BlocksProtocol::TopologyIndex index) noexcept | |||
| { | |||
| for (auto& d : currentDeviceInfo) | |||
| if (d.index == index) | |||
| @@ -264,7 +264,21 @@ public: | |||
| @param index the index of the element being requested (0 is the first element in the array) | |||
| @see operator[], getFirst, getLast | |||
| */ | |||
| inline ElementType& getReference (int index) const noexcept | |||
| inline ElementType& getReference (int index) noexcept | |||
| { | |||
| const ScopedLockType lock (getLock()); | |||
| return values[index]; | |||
| } | |||
| /** Returns a direct reference to one of the elements in the array, without checking the index passed in. | |||
| This is like getUnchecked, but returns a direct reference to the element. Obviously | |||
| this can be dangerous, so only use it when absolutely necessary. | |||
| @param index the index of the element being requested (0 is the first element in the array) | |||
| @see operator[], getFirst, getLast | |||
| */ | |||
| inline const ElementType& getReference (int index) const noexcept | |||
| { | |||
| const ScopedLockType lock (getLock()); | |||
| return values[index]; | |||
| @@ -298,11 +312,28 @@ public: | |||
| return values.begin(); | |||
| } | |||
| /** Returns a pointer to the actual array data. | |||
| This pointer will only be valid until the next time a non-const method | |||
| is called on the array. | |||
| */ | |||
| inline const ElementType* getRawDataPointer() const noexcept | |||
| { | |||
| return values.begin(); | |||
| } | |||
| //============================================================================== | |||
| /** Returns a pointer to the first element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline ElementType* begin() const noexcept | |||
| inline ElementType* begin() noexcept | |||
| { | |||
| return values.begin(); | |||
| } | |||
| /** Returns a pointer to the first element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline const ElementType* begin() const noexcept | |||
| { | |||
| return values.begin(); | |||
| } | |||
| @@ -310,7 +341,15 @@ public: | |||
| /** Returns a pointer to the element which follows the last element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline ElementType* end() const noexcept | |||
| inline ElementType* end() noexcept | |||
| { | |||
| return values.end(); | |||
| } | |||
| /** Returns a pointer to the element which follows the last element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline const ElementType* end() const noexcept | |||
| { | |||
| return values.end(); | |||
| } | |||
| @@ -318,7 +357,15 @@ public: | |||
| /** Returns a pointer to the first element in the array. | |||
| This method is provided for compatibility with the standard C++ containers. | |||
| */ | |||
| inline ElementType* data() const noexcept | |||
| inline ElementType* data() noexcept | |||
| { | |||
| return begin(); | |||
| } | |||
| /** Returns a pointer to the first element in the array. | |||
| This method is provided for compatibility with the standard C++ containers. | |||
| */ | |||
| inline const ElementType* data() const noexcept | |||
| { | |||
| return begin(); | |||
| } | |||
| @@ -136,7 +136,14 @@ public: | |||
| } | |||
| //============================================================================== | |||
| inline ElementType& operator[] (const int index) const noexcept | |||
| inline ElementType& operator[] (const int index) noexcept | |||
| { | |||
| jassert (elements != nullptr); | |||
| jassert (isPositiveAndBelow (index, numUsed)); | |||
| return elements[index]; | |||
| } | |||
| inline const ElementType& operator[] (const int index) const noexcept | |||
| { | |||
| jassert (elements != nullptr); | |||
| jassert (isPositiveAndBelow (index, numUsed)); | |||
| @@ -159,17 +166,32 @@ public: | |||
| } | |||
| //============================================================================== | |||
| inline ElementType* begin() const noexcept | |||
| inline ElementType* begin() noexcept | |||
| { | |||
| return elements; | |||
| } | |||
| inline const ElementType* begin() const noexcept | |||
| { | |||
| return elements; | |||
| } | |||
| inline ElementType* end() const noexcept | |||
| inline ElementType* end() noexcept | |||
| { | |||
| return elements + numUsed; | |||
| } | |||
| inline const ElementType* end() const noexcept | |||
| { | |||
| return elements + numUsed; | |||
| } | |||
| inline ElementType* data() const noexcept | |||
| inline ElementType* data() noexcept | |||
| { | |||
| return elements; | |||
| } | |||
| inline const ElementType* data() const noexcept | |||
| { | |||
| return elements; | |||
| } | |||
| @@ -147,7 +147,16 @@ var NamedValueSet::getWithDefault (const Identifier& name, const var& defaultRet | |||
| return defaultReturnValue; | |||
| } | |||
| var* NamedValueSet::getVarPointer (const Identifier& name) const noexcept | |||
| var* NamedValueSet::getVarPointer (const Identifier& name) noexcept | |||
| { | |||
| for (auto& i : values) | |||
| if (i.name == name) | |||
| return &(i.value); | |||
| return {}; | |||
| } | |||
| const var* NamedValueSet::getVarPointer (const Identifier& name) const noexcept | |||
| { | |||
| for (auto& i : values) | |||
| if (i.name == name) | |||
| @@ -236,7 +245,15 @@ const var& NamedValueSet::getValueAt (const int index) const noexcept | |||
| return getNullVarRef(); | |||
| } | |||
| var* NamedValueSet::getVarPointerAt (int index) const noexcept | |||
| var* NamedValueSet::getVarPointerAt (int index) noexcept | |||
| { | |||
| if (isPositiveAndBelow (index, values.size())) | |||
| return &(values.getReference (index).value); | |||
| return {}; | |||
| } | |||
| const var* NamedValueSet::getVarPointerAt (int index) const noexcept | |||
| { | |||
| if (isPositiveAndBelow (index, values.size())) | |||
| return &(values.getReference (index).value); | |||
| @@ -132,7 +132,17 @@ public: | |||
| Also note that the pointer returned may become invalid as soon as any subsequent | |||
| methods are called on the NamedValueSet. | |||
| */ | |||
| var* getVarPointer (const Identifier& name) const noexcept; | |||
| var* getVarPointer (const Identifier& name) noexcept; | |||
| /** Returns a pointer to the var that holds a named value, or null if there is | |||
| no value with this name. | |||
| Do not use this method unless you really need access to the internal var object | |||
| for some reason - for normal reading and writing always prefer operator[]() and set(). | |||
| Also note that the pointer returned may become invalid as soon as any subsequent | |||
| methods are called on the NamedValueSet. | |||
| */ | |||
| const var* getVarPointer (const Identifier& name) const noexcept; | |||
| /** Returns the value of the item at a given index. | |||
| The index must be between 0 and size() - 1. | |||
| @@ -144,7 +154,14 @@ public: | |||
| Also note that the pointer returned may become invalid as soon as any subsequent | |||
| methods are called on the NamedValueSet. | |||
| */ | |||
| var* getVarPointerAt (int index) const noexcept; | |||
| var* getVarPointerAt (int index) noexcept; | |||
| /** Returns the value of the item at a given index. | |||
| The index must be between 0 and size() - 1, or this will return a nullptr | |||
| Also note that the pointer returned may become invalid as soon as any subsequent | |||
| methods are called on the NamedValueSet. | |||
| */ | |||
| const var* getVarPointerAt (int index) const noexcept; | |||
| /** Returns the index of the given name, or -1 if it's not found. */ | |||
| int indexOf (const Identifier& name) const noexcept; | |||
| @@ -198,15 +198,31 @@ public: | |||
| /** Returns a pointer to the first element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline ObjectClass** begin() const noexcept | |||
| inline ObjectClass** begin() noexcept | |||
| { | |||
| return values.begin(); | |||
| } | |||
| /** Returns a pointer to the first element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline ObjectClass* const* begin() const noexcept | |||
| { | |||
| return values.begin(); | |||
| } | |||
| /** Returns a pointer to the element which follows the last element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline ObjectClass** end() noexcept | |||
| { | |||
| return values.end(); | |||
| } | |||
| /** Returns a pointer to the element which follows the last element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline ObjectClass** end() const noexcept | |||
| inline ObjectClass* const* end() const noexcept | |||
| { | |||
| return values.end(); | |||
| } | |||
| @@ -228,7 +244,7 @@ public: | |||
| int indexOf (const ObjectClass* objectToLookFor) const noexcept | |||
| { | |||
| const ScopedLockType lock (getLock()); | |||
| auto** e = values.begin(); | |||
| auto* e = values.begin(); | |||
| for (; e != values.end(); ++e) | |||
| if (objectToLookFor == *e) | |||
| @@ -245,7 +261,7 @@ public: | |||
| bool contains (const ObjectClass* objectToLookFor) const noexcept | |||
| { | |||
| const ScopedLockType lock (getLock()); | |||
| auto** e = values.begin(); | |||
| auto* e = values.begin(); | |||
| for (; e != values.end(); ++e) | |||
| if (objectToLookFor == *e) | |||
| @@ -795,7 +811,7 @@ public: | |||
| */ | |||
| template <class ElementComparator> | |||
| void sort (ElementComparator& comparator, | |||
| bool retainOrderOfEquivalentItems = false) const noexcept | |||
| bool retainOrderOfEquivalentItems = false) noexcept | |||
| { | |||
| // If you pass in an object with a static compareElements() method, this | |||
| // avoids getting warning messages about the parameter being unused | |||
| @@ -240,7 +240,15 @@ public: | |||
| /** Returns a pointer to the first element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline ObjectClass** begin() const noexcept | |||
| inline ObjectClass** begin() noexcept | |||
| { | |||
| return values.begin(); | |||
| } | |||
| /** Returns a pointer to the first element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline ObjectClass* const* begin() const noexcept | |||
| { | |||
| return values.begin(); | |||
| } | |||
| @@ -248,15 +256,31 @@ public: | |||
| /** Returns a pointer to the element which follows the last element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline ObjectClass** end() const noexcept | |||
| inline ObjectClass** end() noexcept | |||
| { | |||
| return values.end(); | |||
| } | |||
| /** Returns a pointer to the element which follows the last element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline ObjectClass* const* end() const noexcept | |||
| { | |||
| return values.end(); | |||
| } | |||
| /** Returns a pointer to the first element in the array. | |||
| This method is provided for compatibility with the standard C++ containers. | |||
| */ | |||
| inline ObjectClass** data() noexcept | |||
| { | |||
| return begin(); | |||
| } | |||
| /** Returns a pointer to the first element in the array. | |||
| This method is provided for compatibility with the standard C++ containers. | |||
| */ | |||
| inline ObjectClass** data() const noexcept | |||
| inline ObjectClass* const* data() const noexcept | |||
| { | |||
| return begin(); | |||
| } | |||
| @@ -270,8 +294,8 @@ public: | |||
| int indexOf (const ObjectClass* objectToLookFor) const noexcept | |||
| { | |||
| const ScopedLockType lock (getLock()); | |||
| auto** e = values.begin(); | |||
| auto** endPointer = values.end(); | |||
| auto* e = values.begin(); | |||
| auto* endPointer = values.end(); | |||
| while (e != endPointer) | |||
| { | |||
| @@ -299,8 +323,8 @@ public: | |||
| bool contains (const ObjectClass* objectToLookFor) const noexcept | |||
| { | |||
| const ScopedLockType lock (getLock()); | |||
| auto** e = values.begin(); | |||
| auto** endPointer = values.end(); | |||
| auto* e = values.begin(); | |||
| auto* endPointer = values.end(); | |||
| while (e != endPointer) | |||
| { | |||
| @@ -58,7 +58,6 @@ class SortedSet | |||
| public: | |||
| //============================================================================== | |||
| /** Creates an empty set. */ | |||
| // VS2013 doesn't allow defaulted noexcept constructors. | |||
| SortedSet() = default; | |||
| /** Creates a copy of another set. */ | |||
| @@ -169,7 +168,16 @@ public: | |||
| @param index the index of the element being requested (0 is the first element in the array) | |||
| */ | |||
| inline ElementType& getReference (const int index) const noexcept | |||
| inline ElementType& getReference (const int index) noexcept | |||
| { | |||
| return data.getReference (index); | |||
| } | |||
| /** Returns a direct reference to one of the elements in the set, without checking the index passed in. | |||
| @param index the index of the element being requested (0 is the first element in the array) | |||
| */ | |||
| inline const ElementType& getReference (const int index) const noexcept | |||
| { | |||
| return data.getReference (index); | |||
| } | |||
| @@ -194,7 +202,7 @@ public: | |||
| /** Returns a pointer to the first element in the set. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline ElementType* begin() const noexcept | |||
| inline const ElementType* begin() const noexcept | |||
| { | |||
| return data.begin(); | |||
| } | |||
| @@ -202,7 +210,7 @@ public: | |||
| /** Returns a pointer to the element which follows the last element in the set. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline ElementType* end() const noexcept | |||
| inline const ElementType* end() const noexcept | |||
| { | |||
| return data.end(); | |||
| } | |||
| @@ -88,19 +88,36 @@ public: | |||
| Note that the pointer returned will probably become invalid when the | |||
| block is resized. | |||
| */ | |||
| void* getData() const noexcept { return data; } | |||
| void* getData() noexcept { return data; } | |||
| /** Returns a void pointer to the data. | |||
| Note that the pointer returned will probably become invalid when the | |||
| block is resized. | |||
| */ | |||
| const void* getData() const noexcept { return data; } | |||
| /** Returns a byte from the memory block. | |||
| This returns a reference, so you can also use it to set a byte. | |||
| */ | |||
| template <typename Type> | |||
| char& operator[] (const Type offset) const noexcept { return data [offset]; } | |||
| char& operator[] (const Type offset) noexcept { return data [offset]; } | |||
| /** Returns a byte from the memory block. */ | |||
| template <typename Type> | |||
| const char& operator[] (const Type offset) const noexcept { return data [offset]; } | |||
| /** Returns an iterator for the data. */ | |||
| char* begin() noexcept { return data; } | |||
| /** Returns an iterator for the data. */ | |||
| char* begin() const noexcept { return data; } | |||
| const char* begin() const noexcept { return data; } | |||
| /** Returns an end-iterator for the data. */ | |||
| char* end() noexcept { return begin() + getSize(); } | |||
| /** Returns an end-iterator for the data. */ | |||
| char* end() const noexcept { return begin() + getSize(); } | |||
| const char* end() const noexcept { return begin() + getSize(); } | |||
| //============================================================================== | |||
| /** Returns the block's current allocated size, in bytes. */ | |||
| @@ -155,12 +155,23 @@ public: | |||
| /** Returns a pointer to the first String in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline String* begin() const noexcept { return strings.begin(); } | |||
| inline String* begin() noexcept { return strings.begin(); } | |||
| /** Returns a pointer to the first String in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline const String* begin() const noexcept { return strings.begin(); } | |||
| /** Returns a pointer to the String which follows the last element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline String* end() const noexcept { return strings.end(); } | |||
| inline String* end() noexcept { return strings.end(); } | |||
| /** Returns a pointer to the String which follows the last element in the array. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| inline const String* end() const noexcept { return strings.end(); } | |||
| /** Searches for a string in the array. | |||
| @@ -40,7 +40,7 @@ void Displays::init (Desktop& desktop) | |||
| const Displays::Display& Displays::findDisplayForRect (Rectangle<int> rect, bool isPhysical) const noexcept | |||
| { | |||
| int maxArea = -1; | |||
| Display* retVal = nullptr; | |||
| const Display* retVal = nullptr; | |||
| for (auto& display : displays) | |||
| { | |||
| @@ -65,7 +65,7 @@ const Displays::Display& Displays::findDisplayForRect (Rectangle<int> rect, bool | |||
| const Displays::Display& Displays::findDisplayForPoint (Point<int> point, bool isPhysical) const noexcept | |||
| { | |||
| auto minDistance = std::numeric_limits<int>::max(); | |||
| Display* retVal = nullptr; | |||
| const Display* retVal = nullptr; | |||
| for (auto& display : displays) | |||
| { | |||
| @@ -198,7 +198,7 @@ bool operator!= (const Displays::Display& d1, const Displays::Display& d2) noexc | |||
| const Displays::Display& Displays::getDisplayContaining (Point<int> position) const noexcept | |||
| { | |||
| JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED | |||
| auto* best = &displays.getReference (0); | |||
| const auto* best = &displays.getReference (0); | |||
| auto bestDistance = std::numeric_limits<int>::max(); | |||
| for (auto& d : displays) | |||
| @@ -249,7 +249,7 @@ struct DisplayNode | |||
| }; | |||
| /** Recursive - will calculate and set the logicalArea member of current. */ | |||
| static void processDisplay (DisplayNode* currentNode, const Array<DisplayNode>& allNodes) | |||
| static void processDisplay (DisplayNode* currentNode, Array<DisplayNode>& allNodes) | |||
| { | |||
| const auto physicalArea = currentNode->display->totalArea.toDouble(); | |||
| const auto scale = currentNode->display->scale; | |||
| @@ -66,7 +66,8 @@ struct ConcertinaPanel::PanelSizes | |||
| Array<Panel> sizes; | |||
| Panel& get (const int index) const noexcept { return sizes.getReference(index); } | |||
| Panel& get (const int index) noexcept { return sizes.getReference (index); } | |||
| const Panel& get (const int index) const noexcept { return sizes.getReference (index); } | |||
| PanelSizes withMovedPanel (const int index, int targetPosition, int totalSpace) const | |||
| { | |||
| @@ -81,7 +81,7 @@ Colour LookAndFeel::findColour (int colourID) const noexcept | |||
| auto index = colours.indexOf (c); | |||
| if (index >= 0) | |||
| return colours.getReference (index).colour; | |||
| return colours[index].colour; | |||
| jassertfalse; | |||
| return Colours::black; | |||
| @@ -682,7 +682,7 @@ struct MouseInputSource::SourceList : public Timer | |||
| return &sourceArray.getReference (sourceArray.size() - 1); | |||
| } | |||
| MouseInputSource* getMouseSource (int index) const noexcept | |||
| MouseInputSource* getMouseSource (int index) noexcept | |||
| { | |||
| return isPositiveAndBelow (index, sourceArray.size()) ? &sourceArray.getReference (index) | |||
| : nullptr; | |||
| @@ -724,7 +724,7 @@ struct MouseInputSource::SourceList : public Timer | |||
| return num; | |||
| } | |||
| MouseInputSource* getDraggingMouseSource (int index) const noexcept | |||
| MouseInputSource* getDraggingMouseSource (int index) noexcept | |||
| { | |||
| int num = 0; | |||
| @@ -274,10 +274,15 @@ public: | |||
| const ItemArray& getItemArray() const noexcept { return selectedItems; } | |||
| /** Provides iterator access to the array of items. */ | |||
| SelectableItemType* begin() const noexcept { return selectedItems.begin(); } | |||
| SelectableItemType* begin() noexcept { return selectedItems.begin(); } | |||
| const SelectableItemType* begin() const noexcept { return selectedItems.begin(); } | |||
| /** Provides iterator access to the array of items. */ | |||
| SelectableItemType* end() noexcept { return selectedItems.end(); } | |||
| /** Provides iterator access to the array of items. */ | |||
| SelectableItemType* end() const noexcept { return selectedItems.end(); } | |||
| const SelectableItemType* end() const noexcept { return selectedItems.end(); } | |||
| //============================================================================== | |||
| /** Can be overridden to do special handling when an item is selected. | |||
| @@ -4457,7 +4457,7 @@ void Desktop::allowedOrientationsChanged() {} | |||
| //============================================================================== | |||
| static const Displays::Display* getCurrentDisplayFromScaleFactor (HWND hwnd) | |||
| { | |||
| Array<Displays::Display*> candidateDisplays; | |||
| Array<const Displays::Display*> candidateDisplays; | |||
| double scaleToLookFor = -1.0; | |||
| if (auto* peer = HWNDComponentPeer::getOwnerOfWindow (hwnd)) | |||
| @@ -4483,7 +4483,7 @@ static const Displays::Display* getCurrentDisplayFromScaleFactor (HWND hwnd) | |||
| else | |||
| bounds = Desktop::getInstance().getDisplays().physicalToLogical (rectangleFromRECT (getWindowRect (hwnd))); | |||
| Displays::Display* retVal = nullptr; | |||
| const Displays::Display* retVal = nullptr; | |||
| int maxArea = -1; | |||
| for (auto* d : candidateDisplays) | |||
| @@ -127,10 +127,16 @@ public: | |||
| void addElement (const OSCBundle::Element& element) { elements.add (element); } | |||
| /** Returns a pointer to the first element of the OSCBundle. */ | |||
| OSCBundle::Element* begin() const noexcept { return elements.begin(); } | |||
| OSCBundle::Element* begin() noexcept { return elements.begin(); } | |||
| /** Returns a pointer to the first element of the OSCBundle. */ | |||
| const OSCBundle::Element* begin() const noexcept { return elements.begin(); } | |||
| /** Returns a pointer past the last element of the OSCBundle. */ | |||
| OSCBundle::Element* end() noexcept { return elements.end(); } | |||
| /** Returns a pointer past the last element of the OSCBundle. */ | |||
| OSCBundle::Element* end() const noexcept { return elements.end(); } | |||
| const OSCBundle::Element* end() const noexcept { return elements.end(); } | |||
| private: | |||
| //============================================================================== | |||
| @@ -63,12 +63,22 @@ const OSCArgument& OSCMessage::operator[] (const int i) const noexcept | |||
| return arguments.getReference (i); | |||
| } | |||
| OSCArgument* OSCMessage::begin() const noexcept | |||
| OSCArgument* OSCMessage::begin() noexcept | |||
| { | |||
| return arguments.begin(); | |||
| } | |||
| OSCArgument* OSCMessage::end() const noexcept | |||
| const OSCArgument* OSCMessage::begin() const noexcept | |||
| { | |||
| return arguments.begin(); | |||
| } | |||
| OSCArgument* OSCMessage::end() noexcept | |||
| { | |||
| return arguments.end(); | |||
| } | |||
| const OSCArgument* OSCMessage::end() const noexcept | |||
| { | |||
| return arguments.end(); | |||
| } | |||
| @@ -99,12 +99,22 @@ public: | |||
| /** Returns a pointer to the first OSCArgument in the OSCMessage object. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| OSCArgument* begin() const noexcept; | |||
| OSCArgument* begin() noexcept; | |||
| /** Returns a pointer to the first OSCArgument in the OSCMessage object. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| const OSCArgument* begin() const noexcept; | |||
| /** Returns a pointer to the last OSCArgument in the OSCMessage object. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| OSCArgument* end() noexcept; | |||
| /** Returns a pointer to the last OSCArgument in the OSCMessage object. | |||
| This method is provided for compatibility with standard C++ iteration mechanisms. | |||
| */ | |||
| OSCArgument* end() const noexcept; | |||
| const OSCArgument* end() const noexcept; | |||
| /** Removes all arguments from the OSCMessage. */ | |||
| void clear(); | |||