Browse Source

Fixed some const violation errors

tags/2021-05-28
Tom Poole 7 years ago
parent
commit
cff37f5b6a
32 changed files with 224 additions and 126 deletions
  1. +3
    -1
      examples/DSPDemo/Source/MainComponent.cpp
  2. +1
    -1
      examples/Demo/Source/Demos/WavefrontObjParser.h
  3. +6
    -1
      examples/NetworkGraphicsDemo/Source/MasterComponent.h
  4. +1
    -1
      examples/NetworkGraphicsDemo/Source/SharedCanvas.h
  5. +7
    -7
      examples/OSCMonitor/Source/OSCLogListBox.h
  6. +1
    -1
      examples/OpenGLAppExample/Source/Resources/WavefrontObjParser.h
  7. +1
    -1
      extras/Projucer/Source/CodeEditor/jucer_LiveBuildCodeEditor.h
  8. +23
    -18
      extras/Projucer/Source/LiveBuildEngine/jucer_ClassDatabase.h
  9. +1
    -1
      extras/Projucer/Source/LiveBuildEngine/jucer_ErrorList.h
  10. +2
    -2
      extras/Projucer/Source/Settings/jucer_AppearanceSettings.cpp
  11. +4
    -2
      modules/juce_audio_basics/midi/juce_MidiMessageSequence.cpp
  12. +4
    -2
      modules/juce_audio_basics/midi/juce_MidiMessageSequence.h
  13. +42
    -17
      modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp
  14. +12
    -7
      modules/juce_audio_basics/mpe/juce_MPEInstrument.h
  15. +42
    -17
      modules/juce_audio_basics/mpe/juce_MPEZoneLayout.cpp
  16. +10
    -5
      modules/juce_audio_basics/mpe/juce_MPEZoneLayout.h
  17. +4
    -2
      modules/juce_audio_formats/format/juce_AudioFormatManager.h
  18. +5
    -2
      modules/juce_audio_processors/scanning/juce_KnownPluginList.h
  19. +12
    -5
      modules/juce_blocks_basics/blocks/juce_TouchList.h
  20. +2
    -2
      modules/juce_blocks_basics/littlefoot/juce_LittleFootCompiler.h
  21. +1
    -1
      modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp
  22. +1
    -1
      modules/juce_graphics/fonts/juce_GlyphArrangement.cpp
  23. +1
    -1
      modules/juce_graphics/fonts/juce_GlyphArrangement.h
  24. +7
    -7
      modules/juce_gui_basics/components/juce_Desktop.cpp
  25. +5
    -5
      modules/juce_gui_basics/layout/juce_ConcertinaPanel.cpp
  26. +3
    -3
      modules/juce_gui_basics/layout/juce_FlexBox.cpp
  27. +4
    -4
      modules/juce_gui_basics/mouse/juce_SelectedItemSet.h
  28. +1
    -1
      modules/juce_gui_basics/widgets/juce_Slider.cpp
  29. +4
    -4
      modules/juce_osc/osc/juce_OSCBundle.cpp
  30. +6
    -1
      modules/juce_osc/osc/juce_OSCBundle.h
  31. +6
    -1
      modules/juce_osc/osc/juce_OSCMessage.cpp
  32. +2
    -2
      modules/juce_osc/osc/juce_OSCMessage.h

+ 3
- 1
examples/DSPDemo/Source/MainComponent.cpp View File

@@ -221,7 +221,7 @@ void MainContentComponent::setupDemoColours()
if (xml != nullptr)
{
auto colourSchemeTree = ValueTree::fromXml (*xml);
auto& scheme = codeEditor.getColourScheme();
CodeEditorComponent::ColourScheme scheme (codeEditor.getColourScheme());
for (auto& type : scheme.types)
{
@@ -230,6 +230,8 @@ void MainContentComponent::setupDemoColours()
if (colour.isValid())
type.colour = Colour::fromString (colour ["colour"].toString());
}
codeEditor.setColourScheme (scheme);
}
codeEditor.setScrollbarThickness (6);


+ 1
- 1
examples/Demo/Source/Demos/WavefrontObjParser.h View File

@@ -249,7 +249,7 @@ private:
};
static Shape* parseFaceGroup (const Mesh& srcMesh,
const Array<Face>& faceGroup,
Array<Face>& faceGroup,
const Material& material,
const String& name)
{


+ 6
- 1
examples/NetworkGraphicsDemo/Source/MasterComponent.h View File

@@ -369,7 +369,7 @@ private:
canvas.clients.add ({ c.name, c.centre, c.scaleFactor });
}
Client* getClient (const String& name) const
const Client* getClient (const String& name) const
{
for (auto& c : clients)
if (c.name == name)
@@ -378,6 +378,11 @@ private:
return nullptr;
}
Client* getClient (const String& name)
{
return const_cast<Client*> (static_cast<const MasterContentComponent&> (*this).getClient (name));
}
//==============================================================================
void oscMessageReceived (const OSCMessage& message) override
{


+ 1
- 1
examples/NetworkGraphicsDemo/Source/SharedCanvas.h View File

@@ -455,7 +455,7 @@ struct BlockPacketiser
while (remaining > 0)
{
const int num = jmin (maxBlockSize, remaining);
auto num = (int) jmin (maxBlockSize, remaining);
blocks.add (MemoryBlock (addBytesToPointer (data.getData(), offset), (size_t) num));
offset += num;
remaining -= num;


+ 7
- 7
examples/OSCMonitor/Source/OSCLogListBox.h View File

@@ -76,8 +76,8 @@ public:
if (! message.isEmpty())
{
for (OSCArgument* arg = message.begin(); arg != message.end(); ++arg)
addOSCMessageArgument (*arg, level + 1);
for (auto& arg : message)
addOSCMessageArgument (arg, level + 1);
}
triggerAsyncUpdate();
@@ -92,12 +92,12 @@ public:
+ "- osc bundle, time tag = "
+ timeTag.toTime().toString (true, true, true, true));
for (OSCBundle::Element* element = bundle.begin(); element != bundle.end(); ++element)
for (auto& element : bundle)
{
if (element->isMessage())
addOSCMessage (element->getMessage(), level + 1);
else if (element->isBundle())
addOSCBundle (element->getBundle(), level + 1);
if (element.isMessage())
addOSCMessage (element.getMessage(), level + 1);
else if (element.isBundle())
addOSCBundle (element.getBundle(), level + 1);
}
triggerAsyncUpdate();


+ 1
- 1
examples/OpenGLAppExample/Source/Resources/WavefrontObjParser.h View File

@@ -249,7 +249,7 @@ private:
};
static Shape* parseFaceGroup (const Mesh& srcMesh,
const Array<Face>& faceGroup,
Array<Face>& faceGroup,
const Material& material,
const String& name)
{


+ 1
- 1
extras/Projucer/Source/CodeEditor/jucer_LiveBuildCodeEditor.h View File

@@ -234,7 +234,7 @@ private:
Array<ClassDatabase::Class*> newClasses;
if (childProcess != nullptr)
childProcess->getComponentList().globalNamespace.findClassesDeclaredInFile (newClasses, file);
const_cast <ClassDatabase::ClassList&> (childProcess->getComponentList()).globalNamespace.findClassesDeclaredInFile (newClasses, file);
for (int i = newClasses.size(); --i >= 0;)
if (! newClasses.getUnchecked(i)->getInstantiationFlags().canBeInstantiated())


+ 23
- 18
extras/Projucer/Source/LiveBuildEngine/jucer_ClassDatabase.h View File

@@ -291,15 +291,20 @@ struct ClassDatabase
return classDeclaration;
}
MemberInfo* findMember (const String& memberName) const
const MemberInfo* findMember (const String& memberName) const
{
for (MemberInfo& m : members)
for (auto& m : members)
if (m.getName() == memberName)
return &m;
return nullptr;
}
MemberInfo* findMember (const String& memberName)
{
return const_cast<MemberInfo*> (static_cast<const Class&>(*this).findMember (memberName));
}
const MethodInfo* getDefaultConstructor() const
{
for (const MethodInfo& m : methods)
@@ -340,15 +345,15 @@ struct ClassDatabase
if (m->definition.isValid())
return m->definition.file;
for (MethodInfo& m : methods)
for (auto& m : methods)
if (m.definition.isValid() && File (m.definition.file).hasFileExtension ("cpp;mm"))
return m.definition.file;
for (MethodInfo& m : methods)
for (auto& m : methods)
if ((m.flags & MethodInfo::isConstructor) != 0 && m.definition.isValid())
return m.definition.file;
for (MethodInfo& m : methods)
for (auto& m : methods)
if (m.definition.isValid() && File (m.definition.file).exists())
return m.definition.file;
@@ -380,9 +385,9 @@ struct ClassDatabase
if (other.classDeclaration.isValid())
classDeclaration = other.classDeclaration;
for (const MemberInfo& m : other.members)
for (auto& m : other.members)
{
if (MemberInfo* existing = findMember (m.getName()))
if (auto* existing = findMember (m.getName()))
existing->mergeWith (m);
else
members.add (m);
@@ -496,14 +501,14 @@ struct ClassDatabase
return false;
}
Class* findClass (const String& className) const
const Class* findClass (const String& className) const
{
for (Class& c : components)
for (auto& c : components)
if (c.getName() == className)
return &c;
for (const auto& n : namespaces)
if (Class* c = n.findClass (className))
for (auto& n : namespaces)
if (auto* c = n.findClass (className))
return c;
return nullptr;
@@ -511,19 +516,19 @@ struct ClassDatabase
const MemberInfo* findClassMemberInfo (const String& className, const String& memberName) const
{
if (const Class* classInfo = findClass (className))
if (auto* classInfo = findClass (className))
return classInfo->findMember (memberName);
return nullptr;
}
void findClassesDeclaredInFile (Array<Class*>& results, const File& file) const
void findClassesDeclaredInFile (Array<Class*>& results, const File& file)
{
for (Class& c : components)
for (auto& c : components)
if (c.isDeclaredInFile (file))
results.add (&c);
for (const auto& n : namespaces)
for (auto& n : namespaces)
n.findClassesDeclaredInFile (results, file);
}
@@ -553,7 +558,7 @@ struct ClassDatabase
components.getReference (existing).mergeWith (c);
}
Namespace* findNamespace (const String& targetName) const
Namespace* findNamespace (const String& targetName)
{
for (auto& n : namespaces)
if (n.name == targetName)
@@ -593,13 +598,13 @@ struct ClassDatabase
namespaces.swapWith (other.namespaces);
}
void nudgeAllCodeRanges (const String& file, int index, int delta) const
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);
}
void fileContentChanged (const String& file) const
void fileContentChanged (const String& file)
{
for (auto& c : components) c.fileContentChanged (file);
for (auto& n : namespaces) n.fileContentChanged (file);


+ 1
- 1
extras/Projucer/Source/LiveBuildEngine/jucer_ErrorList.h View File

@@ -42,7 +42,7 @@ struct ErrorList : public ChangeBroadcaster
}
else
{
for (DiagnosticMessage& d : messages)
for (auto& d : messages)
if (d.isError())
dest.add (d);
}


+ 2
- 2
extras/Projucer/Source/Settings/jucer_AppearanceSettings.cpp View File

@@ -40,11 +40,11 @@ AppearanceSettings::AppearanceSettings (bool updateAppWhenChanged)
CPlusPlusCodeTokeniser tokeniser;
CodeEditorComponent editor (doc, &tokeniser);
const CodeEditorComponent::ColourScheme cs (editor.getColourScheme());
CodeEditorComponent::ColourScheme cs (editor.getColourScheme());
for (int i = cs.types.size(); --i >= 0;)
{
CodeEditorComponent::ColourScheme::TokenType& t = cs.types.getReference(i);
auto& t = cs.types.getReference(i);
getColourValue (t.name) = t.colour.toString();
}


+ 4
- 2
modules/juce_audio_basics/midi/juce_MidiMessageSequence.cpp View File

@@ -80,8 +80,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
{


+ 4
- 2
modules/juce_audio_basics/midi/juce_MidiMessageSequence.h View File

@@ -101,10 +101,12 @@ public:
MidiEventHolder* getEventPointer (int index) const noexcept;
/** Iterator for the list of MidiEventHolders */
MidiEventHolder** begin() const noexcept;
MidiEventHolder** begin() noexcept;
MidiEventHolder*const* begin() const noexcept;
/** Iterator for the list of MidiEventHolders */
MidiEventHolder** end() const noexcept;
MidiEventHolder** end() noexcept;
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.


+ 42
- 17
modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp View File

@@ -231,7 +231,7 @@ void MPEInstrument::processMidiAllNotesOffMessage (const MidiMessage& message)
}
}
}
else if (MPEZone* zone = zoneLayout.getZoneByMasterChannel (message.getChannel()))
else if (auto* zone = zoneLayout.getZoneByMasterChannel (message.getChannel()))
{
for (int i = notes.size(); --i >= 0;)
{
@@ -400,7 +400,7 @@ void MPEInstrument::updateDimension (int midiChannel, MPEDimension& dimension, M
}
//==============================================================================
void MPEInstrument::updateDimensionMaster (MPEZone& zone, MPEDimension& dimension, MPEValue value)
void MPEInstrument::updateDimensionMaster (const MPEZone& zone, MPEDimension& dimension, MPEValue value)
{
auto channels = zone.getNoteChannelRange();
@@ -441,7 +441,7 @@ void MPEInstrument::updateDimensionForNote (MPENote& note, MPEDimension& dimensi
}
//==============================================================================
void MPEInstrument::callListenersDimensionChanged (MPENote& note, MPEDimension& dimension)
void MPEInstrument::callListenersDimensionChanged (const MPENote& note, const MPEDimension& dimension)
{
if (&dimension == &pressureDimension) { listeners.call ([&] (Listener& l) { l.notePressureChanged (note); }); return; }
if (&dimension == &timbreDimension) { listeners.call ([&] (Listener& l) { l.noteTimbreChanged (note); }); return; }
@@ -555,7 +555,7 @@ int MPEInstrument::getNumPlayingNotes() const noexcept
MPENote MPEInstrument::getNote (int midiChannel, int midiNoteNumber) const noexcept
{
if (MPENote* note = getNotePtr (midiChannel, midiNoteNumber))
if (auto* note = getNotePtr (midiChannel, midiNoteNumber))
return *note;
return MPENote();
@@ -569,7 +569,7 @@ MPENote MPEInstrument::getNote (int index) const noexcept
//==============================================================================
MPENote MPEInstrument::getMostRecentNote (int midiChannel) const noexcept
{
if (MPENote* note = getLastNotePlayedPtr (midiChannel))
if (auto* note = getLastNotePlayedPtr (midiChannel))
return *note;
return MPENote();
@@ -579,7 +579,7 @@ MPENote MPEInstrument::getMostRecentNoteOtherThan (MPENote otherThanThisNote) co
{
for (int i = notes.size(); --i >= 0;)
{
const MPENote& note = notes.getReference (i);
auto& note = notes.getReference (i);
if (note != otherThanThisNote)
return note;
@@ -589,11 +589,11 @@ MPENote MPEInstrument::getMostRecentNoteOtherThan (MPENote otherThanThisNote) co
}
//==============================================================================
MPENote* MPEInstrument::getNotePtr (int midiChannel, int midiNoteNumber) const noexcept
const MPENote* MPEInstrument::getNotePtr (int midiChannel, int midiNoteNumber) const noexcept
{
for (int i = 0; i < notes.size(); ++i)
{
MPENote& note = notes.getReference (i);
auto& note = notes.getReference (i);
if (note.midiChannel == midiChannel && note.initialNote == midiNoteNumber)
return &note;
@@ -602,8 +602,13 @@ MPENote* MPEInstrument::getNotePtr (int midiChannel, int midiNoteNumber) const n
return nullptr;
}
MPENote* MPEInstrument::getNotePtr (int midiChannel, int midiNoteNumber) noexcept
{
return const_cast<MPENote*> (static_cast<const MPEInstrument&> (*this).getNotePtr (midiChannel, midiNoteNumber));
}
//==============================================================================
MPENote* MPEInstrument::getNotePtr (int midiChannel, TrackingMode mode) const noexcept
const MPENote* MPEInstrument::getNotePtr (int midiChannel, TrackingMode mode) const noexcept
{
// for the "all notes" tracking mode, this method can never possibly
// work because it returns 0 or 1 note but there might be more than one!
@@ -616,12 +621,17 @@ MPENote* MPEInstrument::getNotePtr (int midiChannel, TrackingMode mode) const no
return nullptr;
}
MPENote* MPEInstrument::getNotePtr (int midiChannel, TrackingMode mode) noexcept
{
return const_cast<MPENote*> (static_cast<const MPEInstrument&> (*this).getNotePtr (midiChannel, mode));
}
//==============================================================================
MPENote* MPEInstrument::getLastNotePlayedPtr (int midiChannel) const noexcept
const MPENote* MPEInstrument::getLastNotePlayedPtr (int midiChannel) const noexcept
{
for (int i = notes.size(); --i >= 0;)
{
MPENote& note = notes.getReference (i);
auto& note = notes.getReference (i);
if (note.midiChannel == midiChannel
&& (note.keyState == MPENote::keyDown || note.keyState == MPENote::keyDownAndSustained))
@@ -631,15 +641,20 @@ MPENote* MPEInstrument::getLastNotePlayedPtr (int midiChannel) const noexcept
return nullptr;
}
MPENote* MPEInstrument::getLastNotePlayedPtr (int midiChannel) noexcept
{
return const_cast<MPENote*> (static_cast<const MPEInstrument&> (*this).getLastNotePlayedPtr (midiChannel));
}
//==============================================================================
MPENote* MPEInstrument::getHighestNotePtr (int midiChannel) const noexcept
const MPENote* MPEInstrument::getHighestNotePtr (int midiChannel) const noexcept
{
int initialNoteMax = -1;
MPENote* result = nullptr;
const MPENote* result = nullptr;
for (int i = notes.size(); --i >= 0;)
{
MPENote& note = notes.getReference (i);
const auto& note = notes.getReference (i);
if (note.midiChannel == midiChannel
&& (note.keyState == MPENote::keyDown || note.keyState == MPENote::keyDownAndSustained)
@@ -653,14 +668,19 @@ MPENote* MPEInstrument::getHighestNotePtr (int midiChannel) const noexcept
return result;
}
MPENote* MPEInstrument::getLowestNotePtr (int midiChannel) const noexcept
MPENote* MPEInstrument::getHighestNotePtr (int midiChannel) noexcept
{
return const_cast<MPENote*> (static_cast<const MPEInstrument&> (*this).getHighestNotePtr (midiChannel));
}
const MPENote* MPEInstrument::getLowestNotePtr (int midiChannel) const noexcept
{
int initialNoteMin = 128;
MPENote* result = nullptr;
const MPENote* result = nullptr;
for (int i = notes.size(); --i >= 0;)
{
MPENote& note = notes.getReference (i);
auto& note = notes.getReference (i);
if (note.midiChannel == midiChannel
&& (note.keyState == MPENote::keyDown || note.keyState == MPENote::keyDownAndSustained)
@@ -674,6 +694,11 @@ MPENote* MPEInstrument::getLowestNotePtr (int midiChannel) const noexcept
return result;
}
MPENote* MPEInstrument::getLowestNotePtr (int midiChannel) noexcept
{
return const_cast<MPENote*> (static_cast<const MPEInstrument&> (*this).getLowestNotePtr (midiChannel));
}
//==============================================================================
void MPEInstrument::releaseAllNotes()
{


+ 12
- 7
modules/juce_audio_basics/mpe/juce_MPEInstrument.h View File

@@ -351,9 +351,9 @@ private:
MPEDimension pitchbendDimension, pressureDimension, timbreDimension;
void updateDimension (int midiChannel, MPEDimension&, MPEValue);
void updateDimensionMaster (MPEZone&, MPEDimension&, MPEValue);
void updateDimensionMaster (const MPEZone&, MPEDimension&, MPEValue);
void updateDimensionForNote (MPENote&, MPEDimension&, MPEValue);
void callListenersDimensionChanged (MPENote&, MPEDimension&);
void callListenersDimensionChanged (const MPENote&, const MPEDimension&);
MPEValue getInitialValueForNewNote (int midiChannel, MPEDimension&) const;
void processMidiNoteOnMessage (const MidiMessage&);
@@ -368,11 +368,16 @@ private:
void handleTimbreLSB (int midiChannel, int value) noexcept;
void handleSustainOrSostenuto (int midiChannel, bool isDown, bool isSostenuto);
MPENote* getNotePtr (int midiChannel, int midiNoteNumber) const noexcept;
MPENote* getNotePtr (int midiChannel, TrackingMode) const noexcept;
MPENote* getLastNotePlayedPtr (int midiChannel) const noexcept;
MPENote* getHighestNotePtr (int midiChannel) const noexcept;
MPENote* getLowestNotePtr (int midiChannel) const noexcept;
const MPENote* getNotePtr (int midiChannel, int midiNoteNumber) const noexcept;
MPENote* getNotePtr (int midiChannel, int midiNoteNumber) noexcept;
const MPENote* getNotePtr (int midiChannel, TrackingMode) const noexcept;
MPENote* getNotePtr (int midiChannel, TrackingMode) noexcept;
const MPENote* getLastNotePlayedPtr (int midiChannel) const noexcept;
MPENote* getLastNotePlayedPtr (int midiChannel) noexcept;
const MPENote* getHighestNotePtr (int midiChannel) const noexcept;
MPENote* getHighestNotePtr (int midiChannel) noexcept;
const MPENote* getLowestNotePtr (int midiChannel) const noexcept;
MPENote* getLowestNotePtr (int midiChannel) noexcept;
void updateNoteTotalPitchbend (MPENote&);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPEInstrument)


+ 42
- 17
modules/juce_audio_basics/mpe/juce_MPEZoneLayout.cpp View File

@@ -74,7 +74,7 @@ int MPEZoneLayout::getNumZones() const noexcept
return zones.size();
}
MPEZone* MPEZoneLayout::getZoneByIndex (int index) const noexcept
const MPEZone* MPEZoneLayout::getZoneByIndex (int index) const noexcept
{
if (zones.size() < index)
return nullptr;
@@ -82,6 +82,11 @@ MPEZone* MPEZoneLayout::getZoneByIndex (int index) const noexcept
return &(zones.getReference (index));
}
MPEZone* MPEZoneLayout::getZoneByIndex (int index) noexcept
{
return const_cast<MPEZone*> (static_cast<const MPEZoneLayout&> (*this).getZoneByIndex (index));
}
void MPEZoneLayout::clearAllZones()
{
zones.clear();
@@ -157,42 +162,62 @@ void MPEZoneLayout::processNextMidiBuffer (const MidiBuffer& buffer)
}
//==============================================================================
MPEZone* MPEZoneLayout::getZoneByChannel (int channel) const noexcept
const MPEZone* MPEZoneLayout::getZoneByChannel (int channel) const noexcept
{
for (auto* zone = zones.begin(); zone != zones.end(); ++zone)
if (zone->isUsingChannel (channel))
return zone;
for (auto& zone : zones)
if (zone.isUsingChannel (channel))
return &zone;
return nullptr;
}
MPEZone* MPEZoneLayout::getZoneByMasterChannel (int channel) const noexcept
MPEZone* MPEZoneLayout::getZoneByChannel (int channel) noexcept
{
return const_cast<MPEZone*> (static_cast<const MPEZoneLayout&> (*this).getZoneByChannel (channel));
}
const MPEZone* MPEZoneLayout::getZoneByMasterChannel (int channel) const noexcept
{
for (auto* zone = zones.begin(); zone != zones.end(); ++zone)
if (zone->getMasterChannel() == channel)
return zone;
for (auto& zone : zones)
if (zone.getMasterChannel() == channel)
return &zone;
return nullptr;
}
MPEZone* MPEZoneLayout::getZoneByFirstNoteChannel (int channel) const noexcept
MPEZone* MPEZoneLayout::getZoneByMasterChannel (int channel) noexcept
{
for (auto* zone = zones.begin(); zone != zones.end(); ++zone)
if (zone->getFirstNoteChannel() == channel)
return zone;
return const_cast<MPEZone*> (static_cast<const MPEZoneLayout&> (*this).getZoneByMasterChannel (channel));
}
const MPEZone* MPEZoneLayout::getZoneByFirstNoteChannel (int channel) const noexcept
{
for (auto& zone : zones)
if (zone.getFirstNoteChannel() == channel)
return &zone;
return nullptr;
}
MPEZone* MPEZoneLayout::getZoneByNoteChannel (int channel) const noexcept
MPEZone* MPEZoneLayout::getZoneByFirstNoteChannel (int channel) noexcept
{
return const_cast<MPEZone*> (static_cast<const MPEZoneLayout&> (*this).getZoneByFirstNoteChannel (channel));
}
const MPEZone* MPEZoneLayout::getZoneByNoteChannel (int channel) const noexcept
{
for (auto* zone = zones.begin(); zone != zones.end(); ++zone)
if (zone->isUsingChannelAsNoteChannel (channel))
return zone;
for (auto& zone : zones)
if (zone.isUsingChannelAsNoteChannel (channel))
return &zone;
return nullptr;
}
MPEZone* MPEZoneLayout::getZoneByNoteChannel (int channel) noexcept
{
return const_cast<MPEZone*> (static_cast<const MPEZoneLayout&> (*this).getZoneByNoteChannel (channel));
}
//==============================================================================
void MPEZoneLayout::addListener (Listener* const listenerToAdd) noexcept
{


+ 10
- 5
modules/juce_audio_basics/mpe/juce_MPEZoneLayout.h View File

@@ -101,27 +101,32 @@ public:
is no such zone. Zones are sorted by insertion order (most recently added
zone last).
*/
MPEZone* getZoneByIndex (int index) const noexcept;
MPEZone* getZoneByIndex (int index) noexcept;
const MPEZone* getZoneByIndex (int index) const noexcept;
/** Returns a pointer to the zone which uses the specified channel (1-16),
or nullptr if there is no such zone.
*/
MPEZone* getZoneByChannel (int midiChannel) const noexcept;
MPEZone* getZoneByChannel (int midiChannel) noexcept;
const MPEZone* getZoneByChannel (int midiChannel) const noexcept;
/** Returns a pointer to the zone which has the specified channel (1-16)
as its master channel, or nullptr if there is no such zone.
*/
MPEZone* getZoneByMasterChannel (int midiChannel) const noexcept;
MPEZone* getZoneByMasterChannel (int midiChannel) noexcept;
const MPEZone* getZoneByMasterChannel (int midiChannel) const noexcept;
/** Returns a pointer to the zone which has the specified channel (1-16)
as its first note channel, or nullptr if there is no such zone.
*/
MPEZone* getZoneByFirstNoteChannel (int midiChannel) const noexcept;
MPEZone* getZoneByFirstNoteChannel (int midiChannel) noexcept;
const MPEZone* getZoneByFirstNoteChannel (int midiChannel) const noexcept;
/** Returns a pointer to the zone which has the specified channel (1-16)
as one of its note channels, or nullptr if there is no such zone.
*/
MPEZone* getZoneByNoteChannel (int midiChannel) const noexcept;
MPEZone* getZoneByNoteChannel (int midiChannel) noexcept;
const MPEZone* getZoneByNoteChannel (int midiChannel) const noexcept;
//==============================================================================
/** Listener class. Derive from this class to allow your class to be


+ 4
- 2
modules/juce_audio_formats/format/juce_AudioFormatManager.h View File

@@ -78,10 +78,12 @@ 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(); }
AudioFormat*const* begin() const noexcept { return knownFormats.begin(); }
/** Iterator access to the list of known formats. */
AudioFormat** end() const noexcept { return knownFormats.end(); }
AudioFormat** end() noexcept { return knownFormats.end(); }
AudioFormat*const* end() const noexcept { return knownFormats.end(); }
/** Looks for which of the known formats is listed as being for a given file
extension.


+ 5
- 2
modules/juce_audio_processors/scanning/juce_KnownPluginList.h View File

@@ -61,9 +61,12 @@ public:
PluginDescription* getType (int index) const noexcept { return types [index]; }
/** Type iteration. */
PluginDescription** begin() const noexcept { return types.begin(); }
PluginDescription** begin() noexcept { return types.begin(); }
PluginDescription*const* begin() const noexcept { return types.begin(); }
/** Type iteration. */
PluginDescription** end() const noexcept { return types.end(); }
PluginDescription** end() noexcept { return types.end(); }
PluginDescription*const* end() const noexcept { return types.end(); }
/** Looks for a type in the list which comes from this file. */
PluginDescription* getTypeForFile (const String& fileOrIdentifier) const;


+ 12
- 5
modules/juce_blocks_basics/blocks/juce_TouchList.h View File

@@ -106,7 +106,7 @@ public:
/** If a touch is in the list, returns a pointer to the TouchEntry.
Otherwise, returns nullptr.
*/
TouchEntry* find (const TouchSurface::Touch& touch) const noexcept
const TouchEntry* find (const TouchSurface::Touch& touch) const noexcept
{
for (auto& t : touches)
if (matches (t.touch, touch))
@@ -115,17 +115,24 @@ public:
return nullptr;
}
TouchEntry* find (const TouchSurface::Touch& touch) noexcept
{
return const_cast<TouchEntry*> (static_cast<const TouchList&> (*this).find (touch));
}
/** Allows iterator access to the list of touch entries. */
TouchEntry* begin() const noexcept { return touches.begin(); }
TouchEntry* begin() noexcept { return touches.begin(); }
const TouchEntry* begin() const noexcept { return touches.begin(); }
/** Allows iterator access to the list of touch entries. */
TouchEntry* end() const noexcept { return touches.end(); }
TouchEntry* end() noexcept { return touches.end(); }
const TouchEntry* end() const noexcept { return touches.end(); }
/** Retrieve a reference to particular item in the list of touch entires. */
TouchEntry& operator[] (const int index) { return touches.getReference (index); }
TouchEntry& operator[] (const int index) { return touches.getReference (index); }
/** Resets all contents, doest not generate any call-backs. */
void clear() noexcept { touches.clear(); }
void clear() noexcept { touches.clear(); }
private:
//==========================================================================


+ 2
- 2
modules/juce_blocks_basics/littlefoot/juce_LittleFootCompiler.h View File

@@ -405,7 +405,7 @@ private:
f->block->simplify (*this);
}
Function* findFunction (FunctionID functionID) const noexcept
const Function* findFunction (FunctionID functionID) const noexcept
{
for (auto f : functions)
if (f->functionID == functionID)
@@ -414,7 +414,7 @@ private:
return nullptr;
}
NativeFunction* findNativeFunction (FunctionID functionID) const noexcept
const NativeFunction* findNativeFunction (FunctionID functionID) const noexcept
{
for (auto& f : nativeFunctions)
if (f.functionID == functionID)


+ 1
- 1
modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp View File

@@ -443,7 +443,7 @@ struct PhysicalTopologySource::Internal
return -1;
}
DeviceInfo* getDeviceInfoFromUID (Block::UID uid) const noexcept
const DeviceInfo* getDeviceInfoFromUID (Block::UID uid) const noexcept
{
for (auto& d : currentDeviceInfo)
if (d.uid == uid)


+ 1
- 1
modules/juce_graphics/fonts/juce_GlyphArrangement.cpp View File

@@ -148,7 +148,7 @@ void GlyphArrangement::clear()
glyphs.clear();
}
PositionedGlyph& GlyphArrangement::getGlyph (int index) const noexcept
PositionedGlyph& GlyphArrangement::getGlyph (int index) noexcept
{
return glyphs.getReference (index);
}


+ 1
- 1
modules/juce_graphics/fonts/juce_GlyphArrangement.h View File

@@ -146,7 +146,7 @@ public:
careful not to pass an out-of-range index here, as it
doesn't do any bounds-checking.
*/
PositionedGlyph& getGlyph (int index) const noexcept;
PositionedGlyph& getGlyph (int index) noexcept;
const PositionedGlyph* begin() const { return glyphs.begin(); }
const PositionedGlyph* end() const { return glyphs.end(); }


+ 7
- 7
modules/juce_gui_basics/components/juce_Desktop.cpp View File

@@ -179,13 +179,13 @@ int Desktop::getMouseWheelMoveCounter() const noexcept { return mouseWheelC
void Desktop::incrementMouseClickCounter() noexcept { ++mouseClickCounter; }
void Desktop::incrementMouseWheelCounter() noexcept { ++mouseWheelCounter; }
const Array<MouseInputSource>& Desktop::getMouseSources() const noexcept { return mouseSources->sourceArray; }
int Desktop::getNumMouseSources() const noexcept { return mouseSources->sources.size(); }
int Desktop::getNumDraggingMouseSources() const noexcept { return mouseSources->getNumDraggingMouseSources(); }
MouseInputSource* Desktop::getMouseSource (int index) const noexcept { return mouseSources->getMouseSource (index); }
MouseInputSource* Desktop::getDraggingMouseSource (int index) const noexcept { return mouseSources->getDraggingMouseSource (index); }
MouseInputSource Desktop::getMainMouseSource() const noexcept { return MouseInputSource (mouseSources->sources.getUnchecked(0)); }
void Desktop::beginDragAutoRepeat (int interval) { mouseSources->beginDragAutoRepeat (interval); }
const Array<MouseInputSource>& Desktop::getMouseSources() const noexcept { return mouseSources->sourceArray; }
int Desktop::getNumMouseSources() const noexcept { return mouseSources->sources.size(); }
int Desktop::getNumDraggingMouseSources() const noexcept { return mouseSources->getNumDraggingMouseSources(); }
MouseInputSource* Desktop::getMouseSource (int index) const noexcept { return mouseSources->getMouseSource (index); }
MouseInputSource* Desktop::getDraggingMouseSource (int index) const noexcept { return mouseSources->getDraggingMouseSource (index); }
MouseInputSource Desktop::getMainMouseSource() const noexcept { return MouseInputSource (mouseSources->sources.getUnchecked(0)); }
void Desktop::beginDragAutoRepeat (int interval) { mouseSources->beginDragAutoRepeat (interval); }
//==============================================================================
void Desktop::addFocusChangeListener (FocusChangeListener* const listener) { focusListeners.add (listener); }


+ 5
- 5
modules/juce_gui_basics/layout/juce_ConcertinaPanel.cpp View File

@@ -183,14 +183,14 @@ private:
int getTotalSize (int start, const int end) const noexcept
{
int tot = 0;
while (start < end) tot += get(start++).size;
while (start < end) tot += get (start++).size;
return tot;
}
int getMinimumSize (int start, const int end) const noexcept
{
int tot = 0;
while (start < end) tot += get(start++).minSize;
while (start < end) tot += get (start++).minSize;
return tot;
}
@@ -199,7 +199,7 @@ private:
int tot = 0;
while (start < end)
{
const int mx = get(start++).maxSize;
const int mx = get (start++).maxSize;
if (mx > 0x100000)
return mx;
@@ -429,9 +429,9 @@ void ConcertinaPanel::applyLayout (const PanelSizes& sizes, const bool animate)
for (int i = 0; i < holders.size(); ++i)
{
PanelHolder& p = *holders.getUnchecked(i);
PanelHolder& p = *holders.getUnchecked (i);
const int h = sizes.get(i).size;
const int h = sizes.get (i).size;
const Rectangle<int> pos (0, y, w, h);
if (animate)


+ 3
- 3
modules/juce_gui_basics/layout/juce_FlexBox.cpp View File

@@ -31,10 +31,10 @@ struct FlexBoxLayoutCalculation
{
using Coord = double;
FlexBoxLayoutCalculation (const FlexBox& fb, Coord w, Coord h)
FlexBoxLayoutCalculation (FlexBox& fb, Coord w, Coord h)
: owner (fb), parentWidth (w), parentHeight (h), numItems (owner.items.size()),
isRowDirection (fb.flexDirection == FlexBox::Direction::row
|| fb.flexDirection == FlexBox::Direction::rowReverse),
|| fb.flexDirection == FlexBox::Direction::rowReverse),
containerLineLength (isRowDirection ? parentWidth : parentHeight)
{
lineItems.calloc (numItems * numItems);
@@ -84,7 +84,7 @@ struct FlexBoxLayoutCalculation
Coord crossSize, lineY, totalLength;
};
const FlexBox& owner;
FlexBox& owner;
const Coord parentWidth, parentHeight;
const int numItems;
const bool isRowDirection;


+ 4
- 4
modules/juce_gui_basics/mouse/juce_SelectedItemSet.h View File

@@ -78,12 +78,12 @@ public:
if (! other.isSelected (selectedItems.getReference (i)))
itemDeselected (selectedItems.removeAndReturn (i));
for (SelectableItemType* i = other.selectedItems.begin(), *e = other.selectedItems.end(); i != e; ++i)
for (auto& i : selectedItems)
{
if (! isSelected (*i))
if (! isSelected (i))
{
selectedItems.add (*i);
itemSelected (*i);
selectedItems.add (i);
itemSelected (i);
}
}
}


+ 1
- 1
modules/juce_gui_basics/widgets/juce_Slider.cpp View File

@@ -1121,7 +1121,7 @@ public:
isVertical() ? pixelPos : (owner.getHeight() / 2.0f)));
}
ms.setScreenPosition (mousePos);
const_cast <MouseInputSource&> (ms).setScreenPosition (mousePos);
}
}
}


+ 4
- 4
modules/juce_osc/osc/juce_OSCBundle.cpp View File

@@ -195,15 +195,15 @@ private:
expect (! bundle[1].isBundle());
int numElementsCounted = 0;
for (OSCBundle::Element* element = bundle.begin(); element != bundle.end(); ++element)
for (auto& element : bundle)
{
expect (element->isMessage());
expect (! element->isBundle());
expect (element.isMessage());
expect (! element.isBundle());
++numElementsCounted;
}
expectEquals (numElementsCounted, 2);
OSCBundle::Element* e = bundle.begin();
auto* e = bundle.begin();
expect (e[0].getMessage().size() == 1);
expect (e[0].getMessage().begin()->getInt32() == testInt);
expect (e[1].getMessage().size() == 2);


+ 6
- 1
modules/juce_osc/osc/juce_OSCBundle.h View File

@@ -111,7 +111,12 @@ public:
This method does not check the range and results in undefined behaviour
in case i < 0 or i >= size().
*/
OSCBundle::Element& operator[] (const int i) const noexcept
OSCBundle::Element& operator[] (const int i) noexcept
{
return elements.getReference (i);
}
const OSCBundle::Element& operator[] (const int i) const noexcept
{
return elements.getReference (i);
}


+ 6
- 1
modules/juce_osc/osc/juce_OSCMessage.cpp View File

@@ -53,7 +53,12 @@ bool OSCMessage::isEmpty() const noexcept
return arguments.isEmpty();
}
OSCArgument& OSCMessage::operator[] (const int i) const noexcept
OSCArgument& OSCMessage::operator[] (const int i) noexcept
{
return arguments.getReference (i);
}
const OSCArgument& OSCMessage::operator[] (const int i) const noexcept
{
return arguments.getReference (i);
}


+ 2
- 2
modules/juce_osc/osc/juce_OSCMessage.h View File

@@ -93,7 +93,8 @@ public:
This method does not check the range and results in undefined behaviour
in case i < 0 or i >= size().
*/
OSCArgument& operator[] (const int i) const noexcept;
OSCArgument& operator[] (const int i) noexcept;
const OSCArgument& operator[] (const int i) const noexcept;
/** Returns a pointer to the first OSCArgument in the OSCMessage object.
This method is provided for compatibility with standard C++ iteration mechanisms.
@@ -108,7 +109,6 @@ public:
/** Removes all arguments from the OSCMessage. */
void clear();
//==============================================================================
/** Creates a new OSCArgument of type int32 with a given value
and adds it to the OSCMessage object.


Loading…
Cancel
Save