From c7506df13f7b50e056f3b18c50ef71ee33fa7de7 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 22 May 2013 23:05:53 -0600 Subject: [PATCH] Changed some pass-by-references to pass-by-value to improve compiler optimisation. --- .../Code Editor/jucer_SourceCodeEditor.cpp | 4 +- .../Code Editor/jucer_SourceCodeEditor.h | 4 +- .../paintelements/jucer_PaintElementPath.cpp | 2 +- .../buffers/juce_AudioDataConverters.h | 82 +++++++++---------- .../codecs/juce_WavAudioFormat.cpp | 2 +- .../codecs/juce_WavAudioFormat.h | 2 +- .../format/juce_AudioFormatReader.cpp | 2 +- .../juce_MemoryMappedAudioFormatReader.h | 6 +- .../scanning/juce_KnownPluginList.cpp | 2 +- .../gui/juce_MidiKeyboardComponent.cpp | 6 +- .../gui/juce_MidiKeyboardComponent.h | 6 +- .../containers/juce_NamedValueSet.cpp | 18 ++-- .../juce_core/containers/juce_NamedValueSet.h | 18 ++-- modules/juce_core/containers/juce_SparseSet.h | 10 +-- modules/juce_core/containers/juce_Variant.cpp | 18 ++-- modules/juce_core/containers/juce_Variant.h | 18 ++-- modules/juce_core/files/juce_File.cpp | 12 +-- modules/juce_core/files/juce_File.h | 6 +- modules/juce_core/maths/juce_Range.h | 20 ++--- .../juce_core/text/juce_CharPointer_ASCII.h | 48 +++++------ .../juce_core/text/juce_CharPointer_UTF16.h | 48 +++++------ .../juce_core/text/juce_CharPointer_UTF32.h | 46 +++++------ .../juce_core/text/juce_CharPointer_UTF8.h | 42 +++++----- .../juce_core/text/juce_CharacterFunctions.h | 10 +-- modules/juce_core/text/juce_Identifier.cpp | 2 +- modules/juce_core/text/juce_Identifier.h | 6 +- modules/juce_core/text/juce_String.cpp | 58 ++++++------- modules/juce_core/text/juce_String.h | 38 ++++----- modules/juce_core/time/juce_RelativeTime.cpp | 28 +++---- modules/juce_core/time/juce_RelativeTime.h | 24 +++--- modules/juce_core/time/juce_Time.cpp | 28 +++---- modules/juce_core/time/juce_Time.h | 24 +++--- .../juce_cryptography/hashing/juce_MD5.cpp | 2 +- modules/juce_cryptography/hashing/juce_MD5.h | 2 +- .../juce_cryptography/hashing/juce_SHA256.cpp | 2 +- .../juce_cryptography/hashing/juce_SHA256.h | 2 +- .../values/juce_ValueTree.cpp | 62 +++++++------- .../values/juce_ValueTree.h | 26 +++--- modules/juce_graphics/colour/juce_Colour.cpp | 18 ++-- modules/juce_graphics/colour/juce_Colour.h | 10 +-- .../colour/juce_ColourGradient.cpp | 8 +- .../colour/juce_ColourGradient.h | 10 +-- modules/juce_graphics/colour/juce_Colours.cpp | 2 +- modules/juce_graphics/colour/juce_Colours.h | 2 +- .../juce_graphics/colour/juce_FillType.cpp | 6 +- modules/juce_graphics/colour/juce_FillType.h | 4 +- .../juce_graphics/colour/juce_PixelFormats.h | 6 +- .../contexts/juce_GraphicsContext.cpp | 6 +- .../contexts/juce_GraphicsContext.h | 8 +- .../juce_LowLevelGraphicsSoftwareRenderer.cpp | 2 +- .../juce_LowLevelGraphicsSoftwareRenderer.h | 2 +- .../effects/juce_DropShadowEffect.cpp | 2 +- .../effects/juce_DropShadowEffect.h | 2 +- .../juce_graphics/effects/juce_GlowEffect.cpp | 2 +- .../juce_graphics/effects/juce_GlowEffect.h | 2 +- .../fonts/juce_AttributedString.cpp | 14 ++-- .../fonts/juce_AttributedString.h | 14 ++-- .../juce_graphics/fonts/juce_TextLayout.cpp | 10 +-- modules/juce_graphics/fonts/juce_TextLayout.h | 6 +- modules/juce_graphics/geometry/juce_Path.cpp | 24 +++--- modules/juce_graphics/geometry/juce_Path.h | 24 +++--- modules/juce_graphics/geometry/juce_Point.h | 18 ++-- modules/juce_graphics/images/juce_Image.cpp | 6 +- modules/juce_graphics/images/juce_Image.h | 6 +- .../native/juce_RenderingHelpers.h | 36 ++++---- .../juce_win32_Direct2DGraphicsContext.cpp | 8 +- .../buttons/juce_ArrowButton.cpp | 2 +- .../buttons/juce_ArrowButton.h | 2 +- .../buttons/juce_ImageButton.cpp | 6 +- .../buttons/juce_ImageButton.h | 6 +- .../commands/juce_ApplicationCommandInfo.cpp | 2 +- .../commands/juce_ApplicationCommandInfo.h | 2 +- .../components/juce_Component.cpp | 52 ++++++------ .../components/juce_Component.h | 40 ++++----- .../components/juce_Desktop.cpp | 4 +- .../juce_gui_basics/components/juce_Desktop.h | 6 +- .../drawables/juce_Drawable.cpp | 2 +- .../juce_gui_basics/drawables/juce_Drawable.h | 2 +- .../drawables/juce_DrawablePath.cpp | 4 +- .../drawables/juce_DrawablePath.h | 4 +- .../drawables/juce_DrawableText.cpp | 4 +- .../drawables/juce_DrawableText.h | 6 +- .../drawables/juce_SVGParser.cpp | 11 +-- .../juce_DirectoryContentsList.cpp | 4 +- .../filebrowser/juce_DirectoryContentsList.h | 4 +- .../keyboard/juce_KeyPress.cpp | 2 +- .../juce_gui_basics/keyboard/juce_KeyPress.h | 2 +- .../keyboard/juce_ModifierKeys.cpp | 2 +- .../keyboard/juce_ModifierKeys.h | 6 +- .../layout/juce_ResizableBorderComponent.cpp | 2 +- .../layout/juce_ResizableBorderComponent.h | 2 +- .../juce_gui_basics/layout/juce_ScrollBar.cpp | 4 +- .../juce_gui_basics/layout/juce_ScrollBar.h | 4 +- .../juce_gui_basics/layout/juce_Viewport.cpp | 4 +- .../juce_gui_basics/layout/juce_Viewport.h | 6 +- .../menus/juce_MenuBarComponent.cpp | 4 +- .../menus/juce_MenuBarComponent.h | 4 +- .../juce_gui_basics/menus/juce_PopupMenu.cpp | 12 +-- .../juce_gui_basics/menus/juce_PopupMenu.h | 2 +- .../misc/juce_BubbleComponent.cpp | 2 +- .../misc/juce_BubbleComponent.h | 2 +- .../mouse/juce_DragAndDropContainer.cpp | 12 +-- .../mouse/juce_DragAndDropTarget.h | 2 +- .../mouse/juce_MouseCursor.cpp | 4 +- .../juce_gui_basics/mouse/juce_MouseEvent.cpp | 12 +-- .../juce_gui_basics/mouse/juce_MouseEvent.h | 12 +-- .../mouse/juce_MouseInputSource.cpp | 58 ++++++------- .../mouse/juce_MouseInputSource.h | 6 +- .../mouse/juce_SelectedItemSet.h | 6 +- .../native/juce_android_Windowing.cpp | 2 +- .../native/juce_ios_Windowing.mm | 2 +- .../native/juce_linux_Windowing.cpp | 2 +- .../native/juce_mac_MainMenu.mm | 2 +- .../native/juce_mac_Windowing.mm | 2 +- .../native/juce_win32_Windowing.cpp | 10 +-- .../juce_RelativeParallelogram.cpp | 6 +- .../positioning/juce_RelativeParallelogram.h | 6 +- .../positioning/juce_RelativePoint.cpp | 6 +- .../positioning/juce_RelativePoint.h | 6 +- .../juce_gui_basics/widgets/juce_ListBox.cpp | 2 +- .../juce_gui_basics/widgets/juce_ListBox.h | 2 +- .../widgets/juce_TextEditor.cpp | 22 ++--- .../juce_gui_basics/widgets/juce_TextEditor.h | 12 +-- .../juce_gui_basics/widgets/juce_TreeView.cpp | 2 +- .../windows/juce_ComponentPeer.cpp | 8 +- .../windows/juce_ComponentPeer.h | 6 +- .../code_editor/juce_CodeEditorComponent.cpp | 6 +- .../code_editor/juce_CodeEditorComponent.h | 10 +-- .../misc/juce_ColourSelector.cpp | 2 +- .../juce_gui_extra/misc/juce_ColourSelector.h | 2 +- .../misc/juce_KeyMappingEditorComponent.cpp | 4 +- .../misc/juce_KeyMappingEditorComponent.h | 4 +- .../opengl/juce_Draggable3DOrientation.h | 4 +- .../opengl/juce_OpenGLFrameBuffer.cpp | 6 +- .../opengl/juce_OpenGLFrameBuffer.h | 6 +- .../opengl/juce_OpenGLGraphicsContext.cpp | 24 +++--- .../juce_opengl/opengl/juce_OpenGLHelpers.cpp | 10 +-- .../juce_opengl/opengl/juce_OpenGLHelpers.h | 10 +-- .../juce_opengl/opengl/juce_OpenGLTexture.cpp | 4 +- .../juce_opengl/opengl/juce_OpenGLTexture.h | 4 +- 140 files changed, 762 insertions(+), 761 deletions(-) diff --git a/extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.cpp b/extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.cpp index b1f11b0af6..626ef96f77 100644 --- a/extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.cpp +++ b/extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.cpp @@ -155,7 +155,7 @@ void SourceCodeEditor::setEditor (CodeEditorComponent* newEditor) editor->getDocument().addListener (this); } -void SourceCodeEditor::scrollToKeepRangeOnScreen (const Range& range) +void SourceCodeEditor::scrollToKeepRangeOnScreen (Range range) { const int space = jmin (10, editor->getNumLinesOnScreen() / 3); const CodeDocument::Position start (editor->getDocument(), range.getStart()); @@ -164,7 +164,7 @@ void SourceCodeEditor::scrollToKeepRangeOnScreen (const Range& range) editor->scrollToKeepLinesOnScreen (Range (start.getLineNumber() - space, end.getLineNumber() + space)); } -void SourceCodeEditor::highlight (const Range& range, bool cursorAtStart) +void SourceCodeEditor::highlight (Range range, bool cursorAtStart) { scrollToKeepRangeOnScreen (range); diff --git a/extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.h b/extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.h index c1af293e2c..b5022d3226 100644 --- a/extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.h +++ b/extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.h @@ -146,8 +146,8 @@ public: void createEditor (CodeDocument& codeDocument); void setEditor (CodeEditorComponent*); - void scrollToKeepRangeOnScreen (const Range& range); - void highlight (const Range& range, bool cursorAtStart); + void scrollToKeepRangeOnScreen (Range range); + void highlight (Range range, bool cursorAtStart); ScopedPointer editor; diff --git a/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_PaintElementPath.cpp b/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_PaintElementPath.cpp index 4d0af31691..9f60746922 100644 --- a/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_PaintElementPath.cpp +++ b/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_PaintElementPath.cpp @@ -231,7 +231,7 @@ void PaintElementPath::rescalePoint (RelativePositionedRectangle& pos, int dx, i } //============================================================================== -static void drawArrow (Graphics& g, const Point& p1, const Point& p2) +static void drawArrow (Graphics& g, const Point p1, const Point p2) { g.drawArrow (Line (p1.x, p1.y, (p1.x + p2.x) * 0.5f, (p1.y + p2.y) * 0.5f), 1.0f, 8.0f, 10.0f); g.drawLine (p1.x + (p2.x - p1.x) * 0.49f, p1.y + (p2.y - p1.y) * 0.49f, p2.x, p2.y); diff --git a/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h b/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h index 16db9136bc..cf872a6288 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h +++ b/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h @@ -71,22 +71,22 @@ public: class BigEndian { public: - template static inline float getAsFloat (SampleFormatType& s) noexcept { return s.getAsFloatBE(); } - template static inline void setAsFloat (SampleFormatType& s, float newValue) noexcept { s.setAsFloatBE (newValue); } - template static inline int32 getAsInt32 (SampleFormatType& s) noexcept { return s.getAsInt32BE(); } - template static inline void setAsInt32 (SampleFormatType& s, int32 newValue) noexcept { s.setAsInt32BE (newValue); } - template static inline void copyFrom (DestType& dest, SourceType& source) noexcept { dest.copyFromBE (source); } + template static inline float getAsFloat (SampleFormatType s) noexcept { return s.getAsFloatBE(); } + template static inline void setAsFloat (SampleFormatType s, float newValue) noexcept { s.setAsFloatBE (newValue); } + template static inline int32 getAsInt32 (SampleFormatType s) noexcept { return s.getAsInt32BE(); } + template static inline void setAsInt32 (SampleFormatType s, int32 newValue) noexcept { s.setAsInt32BE (newValue); } + template static inline void copyFrom (DestType dest, SourceType source) noexcept { dest.copyFromBE (source); } enum { isBigEndian = 1 }; }; class LittleEndian { public: - template static inline float getAsFloat (SampleFormatType& s) noexcept { return s.getAsFloatLE(); } - template static inline void setAsFloat (SampleFormatType& s, float newValue) noexcept { s.setAsFloatLE (newValue); } - template static inline int32 getAsInt32 (SampleFormatType& s) noexcept { return s.getAsInt32LE(); } - template static inline void setAsInt32 (SampleFormatType& s, int32 newValue) noexcept { s.setAsInt32LE (newValue); } - template static inline void copyFrom (DestType& dest, SourceType& source) noexcept { dest.copyFromLE (source); } + template static inline float getAsFloat (SampleFormatType s) noexcept { return s.getAsFloatLE(); } + template static inline void setAsFloat (SampleFormatType s, float newValue) noexcept { s.setAsFloatLE (newValue); } + template static inline int32 getAsInt32 (SampleFormatType s) noexcept { return s.getAsInt32LE(); } + template static inline void setAsInt32 (SampleFormatType s, int32 newValue) noexcept { s.setAsInt32LE (newValue); } + template static inline void copyFrom (DestType dest, SourceType source) noexcept { dest.copyFromLE (source); } enum { isBigEndian = 0 }; }; @@ -114,9 +114,9 @@ public: inline void setAsInt32BE (int newValue) noexcept { setAsInt32LE (newValue); } inline void clear() noexcept { *data = 0; } inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;} - template inline void copyFromLE (SourceType& source) noexcept { setAsInt32LE (source.getAsInt32()); } - template inline void copyFromBE (SourceType& source) noexcept { setAsInt32BE (source.getAsInt32()); } - inline void copyFromSameType (Int8& source) noexcept { *data = *source.data; } + template inline void copyFromLE (SourceType source) noexcept { setAsInt32LE (source.getAsInt32()); } + template inline void copyFromBE (SourceType source) noexcept { setAsInt32BE (source.getAsInt32()); } + inline void copyFromSameType (Int8 source) noexcept { *data = *source.data; } int8* data; enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 }; @@ -139,9 +139,9 @@ public: inline void setAsInt32BE (int newValue) noexcept { setAsInt32LE (newValue); } inline void clear() noexcept { *data = 128; } inline void clearMultiple (int num) noexcept { memset (data, 128, (size_t) num) ;} - template inline void copyFromLE (SourceType& source) noexcept { setAsInt32LE (source.getAsInt32()); } - template inline void copyFromBE (SourceType& source) noexcept { setAsInt32BE (source.getAsInt32()); } - inline void copyFromSameType (UInt8& source) noexcept { *data = *source.data; } + template inline void copyFromLE (SourceType source) noexcept { setAsInt32LE (source.getAsInt32()); } + template inline void copyFromBE (SourceType source) noexcept { setAsInt32BE (source.getAsInt32()); } + inline void copyFromSameType (UInt8 source) noexcept { *data = *source.data; } uint8* data; enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 }; @@ -164,9 +164,9 @@ public: inline void setAsInt32BE (int32 newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint16) (newValue >> 16)); } inline void clear() noexcept { *data = 0; } inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;} - template inline void copyFromLE (SourceType& source) noexcept { setAsInt32LE (source.getAsInt32()); } - template inline void copyFromBE (SourceType& source) noexcept { setAsInt32BE (source.getAsInt32()); } - inline void copyFromSameType (Int16& source) noexcept { *data = *source.data; } + template inline void copyFromLE (SourceType source) noexcept { setAsInt32LE (source.getAsInt32()); } + template inline void copyFromBE (SourceType source) noexcept { setAsInt32BE (source.getAsInt32()); } + inline void copyFromSameType (Int16 source) noexcept { *data = *source.data; } uint16* data; enum { bytesPerSample = 2, maxValue = 0x7fff, resolution = (1 << 16), isFloat = 0 }; @@ -189,9 +189,9 @@ public: inline void setAsInt32BE (int32 newValue) noexcept { ByteOrder::bigEndian24BitToChars (newValue >> 8, data); } inline void clear() noexcept { data[0] = 0; data[1] = 0; data[2] = 0; } inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;} - template inline void copyFromLE (SourceType& source) noexcept { setAsInt32LE (source.getAsInt32()); } - template inline void copyFromBE (SourceType& source) noexcept { setAsInt32BE (source.getAsInt32()); } - inline void copyFromSameType (Int24& source) noexcept { data[0] = source.data[0]; data[1] = source.data[1]; data[2] = source.data[2]; } + template inline void copyFromLE (SourceType source) noexcept { setAsInt32LE (source.getAsInt32()); } + template inline void copyFromBE (SourceType source) noexcept { setAsInt32BE (source.getAsInt32()); } + inline void copyFromSameType (Int24 source) noexcept { data[0] = source.data[0]; data[1] = source.data[1]; data[2] = source.data[2]; } char* data; enum { bytesPerSample = 3, maxValue = 0x7fffff, resolution = (1 << 8), isFloat = 0 }; @@ -214,9 +214,9 @@ public: inline void setAsInt32BE (int32 newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) newValue); } inline void clear() noexcept { *data = 0; } inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;} - template inline void copyFromLE (SourceType& source) noexcept { setAsInt32LE (source.getAsInt32()); } - template inline void copyFromBE (SourceType& source) noexcept { setAsInt32BE (source.getAsInt32()); } - inline void copyFromSameType (Int32& source) noexcept { *data = *source.data; } + template inline void copyFromLE (SourceType source) noexcept { setAsInt32LE (source.getAsInt32()); } + template inline void copyFromBE (SourceType source) noexcept { setAsInt32BE (source.getAsInt32()); } + inline void copyFromSameType (Int32 source) noexcept { *data = *source.data; } uint32* data; enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = 1, isFloat = 0 }; @@ -246,9 +246,9 @@ public: inline void setAsInt32BE (int32 newValue) noexcept { setAsFloatBE ((float) (newValue * (1.0 / (1.0 + maxValue)))); } inline void clear() noexcept { *data = 0; } inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;} - template inline void copyFromLE (SourceType& source) noexcept { setAsFloatLE (source.getAsFloat()); } - template inline void copyFromBE (SourceType& source) noexcept { setAsFloatBE (source.getAsFloat()); } - inline void copyFromSameType (Float32& source) noexcept { *data = *source.data; } + template inline void copyFromLE (SourceType source) noexcept { setAsFloatLE (source.getAsFloat()); } + template inline void copyFromBE (SourceType source) noexcept { setAsFloatBE (source.getAsFloat()); } + inline void copyFromSameType (Float32 source) noexcept { *data = *source.data; } float* data; enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = (1 << 8), isFloat = 1 }; @@ -262,10 +262,10 @@ public: inline NonInterleaved (const NonInterleaved&) noexcept {} inline NonInterleaved (const int) noexcept {} inline void copyFrom (const NonInterleaved&) noexcept {} - template inline void advanceData (SampleFormatType& s) noexcept { s.advance(); } - template inline void advanceDataBy (SampleFormatType& s, int numSamples) noexcept { s.skip (numSamples); } - template inline void clear (SampleFormatType& s, int numSamples) noexcept { s.clearMultiple (numSamples); } - template inline static int getNumBytesBetweenSamples (const SampleFormatType&) noexcept { return SampleFormatType::bytesPerSample; } + template inline void advanceData (SampleFormatType s) noexcept { s.advance(); } + template inline void advanceDataBy (SampleFormatType s, int numSamples) noexcept { s.skip (numSamples); } + template inline void clear (SampleFormatType s, int numSamples) noexcept { s.clearMultiple (numSamples); } + template inline static int getNumBytesBetweenSamples (const SampleFormatType) noexcept { return SampleFormatType::bytesPerSample; } enum { isInterleavedType = 0, numInterleavedChannels = 1 }; }; @@ -276,11 +276,11 @@ public: inline Interleaved() noexcept : numInterleavedChannels (1) {} inline Interleaved (const Interleaved& other) noexcept : numInterleavedChannels (other.numInterleavedChannels) {} inline Interleaved (const int numInterleavedChans) noexcept : numInterleavedChannels (numInterleavedChans) {} - inline void copyFrom (const Interleaved& other) noexcept { numInterleavedChannels = other.numInterleavedChannels; } - template inline void advanceData (SampleFormatType& s) noexcept { s.skip (numInterleavedChannels); } - template inline void advanceDataBy (SampleFormatType& s, int numSamples) noexcept { s.skip (numInterleavedChannels * numSamples); } - template inline void clear (SampleFormatType& s, int numSamples) noexcept { while (--numSamples >= 0) { s.clear(); s.skip (numInterleavedChannels); } } - template inline int getNumBytesBetweenSamples (const SampleFormatType&) const noexcept { return numInterleavedChannels * SampleFormatType::bytesPerSample; } + inline void copyFrom (const Interleaved other) noexcept { numInterleavedChannels = other.numInterleavedChannels; } + template inline void advanceData (SampleFormatType s) noexcept { s.skip (numInterleavedChannels); } + template inline void advanceDataBy (SampleFormatType s, int numSamples) noexcept { s.skip (numInterleavedChannels * numSamples); } + template inline void clear (SampleFormatType s, int numSamples) noexcept { while (--numSamples >= 0) { s.clear(); s.skip (numInterleavedChannels); } } + template inline int getNumBytesBetweenSamples (const SampleFormatType) const noexcept { return numInterleavedChannels * SampleFormatType::bytesPerSample; } int numInterleavedChannels; enum { isInterleavedType = 1 }; }; @@ -362,7 +362,7 @@ public: { } - Pointer& operator= (const Pointer& other) noexcept + Pointer operator= (const Pointer other) noexcept { InterleavingType::operator= (other); data = other.data; @@ -407,13 +407,13 @@ public: } /** Moves the pointer along to the next sample. */ - inline Pointer& operator++() noexcept { advance(); return *this; } + inline Pointer operator++() noexcept { advance(); return *this; } /** Moves the pointer back to the previous sample. */ - inline Pointer& operator--() noexcept { this->advanceDataBy (data, -1); return *this; } + inline Pointer operator--() noexcept { this->advanceDataBy (data, -1); return *this; } /** Adds a number of samples to the pointer's position. */ - Pointer& operator+= (int samplesToJump) noexcept { this->advanceDataBy (data, samplesToJump); return *this; } + Pointer operator+= (int samplesToJump) noexcept { this->advanceDataBy (data, samplesToJump); return *this; } /** Writes a stream of samples into this pointer from another pointer. This will copy the specified number of samples, converting between formats appropriately. diff --git a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp index e70e2afd57..503d85f730 100644 --- a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp @@ -38,7 +38,7 @@ const char* const WavAudioFormat::bwavCodingHistory = "bwav coding history"; StringPairArray WavAudioFormat::createBWAVMetadata (const String& description, const String& originator, const String& originatorRef, - const Time& date, + const Time date, const int64 timeReferenceSamples, const String& codingHistory) { diff --git a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.h b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.h index 56bcf02e5b..b67bf615d8 100644 --- a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.h +++ b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.h @@ -106,7 +106,7 @@ public: static StringPairArray createBWAVMetadata (const String& description, const String& originator, const String& originatorRef, - const Time& dateAndTime, + const Time dateAndTime, const int64 timeReferenceSamples, const String& codingHistory); diff --git a/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp b/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp index 74856ab23e..e10e52b30d 100644 --- a/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp +++ b/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp @@ -395,7 +395,7 @@ bool MemoryMappedAudioFormatReader::mapEntireFile() return mapSectionOfFile (Range (0, lengthInSamples)); } -bool MemoryMappedAudioFormatReader::mapSectionOfFile (const Range& samplesToMap) +bool MemoryMappedAudioFormatReader::mapSectionOfFile (Range samplesToMap) { if (map == nullptr || samplesToMap != mappedSection) { diff --git a/modules/juce_audio_formats/format/juce_MemoryMappedAudioFormatReader.h b/modules/juce_audio_formats/format/juce_MemoryMappedAudioFormatReader.h index 28155f7f06..43ce81b0da 100644 --- a/modules/juce_audio_formats/format/juce_MemoryMappedAudioFormatReader.h +++ b/modules/juce_audio_formats/format/juce_MemoryMappedAudioFormatReader.h @@ -62,16 +62,16 @@ public: bool mapEntireFile(); /** Attempts to map a section of the file into memory. */ - bool mapSectionOfFile (const Range& samplesToMap); + bool mapSectionOfFile (Range samplesToMap); /** Returns the sample range that's currently memory-mapped and available for reading. */ - const Range& getMappedSection() const noexcept { return mappedSection; } + Range getMappedSection() const noexcept { return mappedSection; } /** Touches the memory for the given sample, to force it to be loaded into active memory. */ void touchSample (int64 sample) const noexcept; /** Returns the number of bytes currently being mapped */ - size_t getNumBytesUsed() const { return map != nullptr ? map->getSize() : 0; } + size_t getNumBytesUsed() const { return map != nullptr ? map->getSize() : 0; } protected: File file; diff --git a/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp b/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp index 1e8d0956c3..0169bc00cf 100644 --- a/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp +++ b/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp @@ -89,7 +89,7 @@ namespace return Time(); } - bool timesAreDifferent (const Time& t1, const Time& t2) noexcept + bool timesAreDifferent (const Time t1, const Time t2) noexcept { return t1 != t2 || t1 == Time(); } diff --git a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp index d09207983f..093c7d35f1 100644 --- a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp +++ b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp @@ -266,7 +266,7 @@ int MidiKeyboardComponent::getKeyStartPosition (const int midiNoteNumber) const const uint8 MidiKeyboardComponent::whiteNotes[] = { 0, 2, 4, 5, 7, 9, 11 }; const uint8 MidiKeyboardComponent::blackNotes[] = { 1, 3, 6, 8, 10 }; -int MidiKeyboardComponent::xyToNote (const Point& pos, float& mousePositionVelocity) +int MidiKeyboardComponent::xyToNote (Point pos, float& mousePositionVelocity) { if (! reallyContains (pos, false)) return -1; @@ -286,7 +286,7 @@ int MidiKeyboardComponent::xyToNote (const Point& pos, float& mousePosition return remappedXYToNote (p + Point (xOffset, 0), mousePositionVelocity); } -int MidiKeyboardComponent::remappedXYToNote (const Point& pos, float& mousePositionVelocity) const +int MidiKeyboardComponent::remappedXYToNote (Point pos, float& mousePositionVelocity) const { if (pos.getY() < blackNoteLength) { @@ -692,7 +692,7 @@ void MidiKeyboardComponent::updateNoteUnderMouse (const MouseEvent& e, bool isDo updateNoteUnderMouse (e.getPosition(), isDown, e.source.getIndex()); } -void MidiKeyboardComponent::updateNoteUnderMouse (const Point& pos, bool isDown, int fingerNum) +void MidiKeyboardComponent::updateNoteUnderMouse (Point pos, bool isDown, int fingerNum) { float mousePositionVelocity = 0.0f; const int newNote = xyToNote (pos, mousePositionVelocity); diff --git a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h index 2711709977..edbca1ff3f 100644 --- a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h +++ b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h @@ -398,10 +398,10 @@ private: static const uint8 blackNotes[]; void getKeyPos (int midiNoteNumber, int& x, int& w) const; - int xyToNote (const Point&, float& mousePositionVelocity); - int remappedXYToNote (const Point&, float& mousePositionVelocity) const; + int xyToNote (Point, float& mousePositionVelocity); + int remappedXYToNote (Point, float& mousePositionVelocity) const; void resetAnyKeysInUse(); - void updateNoteUnderMouse (const Point&, bool isDown, int fingerNum); + void updateNoteUnderMouse (Point, bool isDown, int fingerNum); void updateNoteUnderMouse (const MouseEvent&, bool isDown); void repaintNote (const int midiNoteNumber); void setLowestVisibleKeyFloat (float noteNumber); diff --git a/modules/juce_core/containers/juce_NamedValueSet.cpp b/modules/juce_core/containers/juce_NamedValueSet.cpp index 1ee00b57cb..6a0535e333 100644 --- a/modules/juce_core/containers/juce_NamedValueSet.cpp +++ b/modules/juce_core/containers/juce_NamedValueSet.cpp @@ -27,7 +27,7 @@ NamedValueSet::NamedValue::NamedValue() noexcept { } -inline NamedValueSet::NamedValue::NamedValue (const Identifier& n, const var& v) +inline NamedValueSet::NamedValue::NamedValue (const Identifier n, const var& v) : name (n), value (v) { } @@ -52,7 +52,7 @@ NamedValueSet::NamedValue::NamedValue (NamedValue&& other) noexcept { } -inline NamedValueSet::NamedValue::NamedValue (const Identifier& n, var&& v) +inline NamedValueSet::NamedValue::NamedValue (const Identifier n, var&& v) : name (n), value (static_cast (v)) { } @@ -138,7 +138,7 @@ int NamedValueSet::size() const noexcept return values.size(); } -const var& NamedValueSet::operator[] (const Identifier& name) const +const var& NamedValueSet::operator[] (const Identifier name) const { for (NamedValue* i = values; i != nullptr; i = i->nextListItem) if (i->name == name) @@ -147,7 +147,7 @@ const var& NamedValueSet::operator[] (const Identifier& name) const return var::null; } -var NamedValueSet::getWithDefault (const Identifier& name, const var& defaultReturnValue) const +var NamedValueSet::getWithDefault (const Identifier name, const var& defaultReturnValue) const { if (const var* const v = getVarPointer (name)) return *v; @@ -155,7 +155,7 @@ 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) const noexcept { for (NamedValue* i = values; i != nullptr; i = i->nextListItem) if (i->name == name) @@ -165,7 +165,7 @@ var* NamedValueSet::getVarPointer (const Identifier& name) const noexcept } #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS -bool NamedValueSet::set (const Identifier& name, var&& newValue) +bool NamedValueSet::set (const Identifier name, var&& newValue) { LinkedListPointer* i = &values; @@ -190,7 +190,7 @@ bool NamedValueSet::set (const Identifier& name, var&& newValue) } #endif -bool NamedValueSet::set (const Identifier& name, const var& newValue) +bool NamedValueSet::set (const Identifier name, const var& newValue) { LinkedListPointer* i = &values; @@ -214,12 +214,12 @@ bool NamedValueSet::set (const Identifier& name, const var& newValue) return true; } -bool NamedValueSet::contains (const Identifier& name) const +bool NamedValueSet::contains (const Identifier name) const { return getVarPointer (name) != nullptr; } -bool NamedValueSet::remove (const Identifier& name) +bool NamedValueSet::remove (const Identifier name) { LinkedListPointer* i = &values; diff --git a/modules/juce_core/containers/juce_NamedValueSet.h b/modules/juce_core/containers/juce_NamedValueSet.h index 6c07f976fa..f5d20f464d 100644 --- a/modules/juce_core/containers/juce_NamedValueSet.h +++ b/modules/juce_core/containers/juce_NamedValueSet.h @@ -71,35 +71,35 @@ public: If the name isn't found, this will return a void variant. @see getProperty */ - const var& operator[] (const Identifier& name) const; + const var& operator[] (const Identifier name) const; /** Tries to return the named value, but if no such value is found, this will instead return the supplied default value. */ - var getWithDefault (const Identifier& name, const var& defaultReturnValue) const; + var getWithDefault (const Identifier name, const var& defaultReturnValue) const; /** Changes or adds a named value. @returns true if a value was changed or added; false if the value was already set the the value passed-in. */ - bool set (const Identifier& name, const var& newValue); + bool set (const Identifier name, const var& newValue); #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS /** Changes or adds a named value. @returns true if a value was changed or added; false if the value was already set the the value passed-in. */ - bool set (const Identifier& name, var&& newValue); + bool set (const Identifier name, var&& newValue); #endif /** Returns true if the set contains an item with the specified name. */ - bool contains (const Identifier& name) const; + bool contains (const Identifier name) const; /** Removes a value from the set. @returns true if a value was removed; false if there was no value with the name that was given. */ - bool remove (const Identifier& name); + bool remove (const Identifier name); /** Returns the name of the value at a given index. The index must be between 0 and size() - 1. @@ -121,7 +121,7 @@ public: 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(). */ - var* getVarPointer (const Identifier& name) const noexcept; + var* getVarPointer (const Identifier name) const noexcept; //============================================================================== /** Sets properties to the values of all of an XML element's attributes. */ @@ -139,11 +139,11 @@ private: public: NamedValue() noexcept; NamedValue (const NamedValue&); - NamedValue (const Identifier& name, const var& value); + NamedValue (const Identifier name, const var& value); NamedValue& operator= (const NamedValue&); #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS NamedValue (NamedValue&&) noexcept; - NamedValue (const Identifier& name, var&& value); + NamedValue (const Identifier name, var&& value); NamedValue& operator= (NamedValue&&) noexcept; #endif bool operator== (const NamedValue& other) const noexcept; diff --git a/modules/juce_core/containers/juce_SparseSet.h b/modules/juce_core/containers/juce_SparseSet.h index 70586f459f..8ffa9c9da7 100644 --- a/modules/juce_core/containers/juce_SparseSet.h +++ b/modules/juce_core/containers/juce_SparseSet.h @@ -162,7 +162,7 @@ public: /** Adds a range of contiguous values to the set. e.g. addRange (Range \ (10, 14)) will add (10, 11, 12, 13) to the set. */ - void addRange (const Range& range) + void addRange (const Range range) { jassert (range.getLength() >= 0); if (range.getLength() > 0) @@ -179,7 +179,7 @@ public: /** Removes a range of values from the set. e.g. removeRange (Range\ (10, 14)) will remove (10, 11, 12, 13) from the set. */ - void removeRange (const Range& rangeToRemove) + void removeRange (const Range rangeToRemove) { jassert (rangeToRemove.getLength() >= 0); @@ -216,7 +216,7 @@ public: } /** Does an XOR of the values in a given range. */ - void invertRange (const Range& range) + void invertRange (const Range range) { SparseSet newItems; newItems.addRange (range); @@ -231,7 +231,7 @@ public: } /** Checks whether any part of a given range overlaps any part of this set. */ - bool overlapsRange (const Range& range) + bool overlapsRange (const Range range) { if (range.getLength() > 0) { @@ -249,7 +249,7 @@ public: } /** Checks whether the whole of a given range is contained within this one. */ - bool containsRange (const Range& range) + bool containsRange (const Range range) { if (range.getLength() > 0) { diff --git a/modules/juce_core/containers/juce_Variant.cpp b/modules/juce_core/containers/juce_Variant.cpp index dd1d63a1b8..4f7c49f1f6 100644 --- a/modules/juce_core/containers/juce_Variant.cpp +++ b/modules/juce_core/containers/juce_Variant.cpp @@ -495,7 +495,7 @@ bool operator!= (const var& v1, const char* const v2) { return v1.toString //============================================================================== -var var::operator[] (const Identifier& propertyName) const +var var::operator[] (const Identifier propertyName) const { if (DynamicObject* const o = getDynamicObject()) return o->getProperty (propertyName); @@ -508,7 +508,7 @@ var var::operator[] (const char* const propertyName) const return operator[] (Identifier (propertyName)); } -var var::getProperty (const Identifier& propertyName, const var& defaultReturnValue) const +var var::getProperty (const Identifier propertyName, const var& defaultReturnValue) const { if (DynamicObject* const o = getDynamicObject()) return o->getProperties().getWithDefault (propertyName, defaultReturnValue); @@ -516,7 +516,7 @@ var var::getProperty (const Identifier& propertyName, const var& defaultReturnVa return defaultReturnValue; } -var var::invoke (const Identifier& method, const var* arguments, int numArguments) const +var var::invoke (const Identifier method, const var* arguments, int numArguments) const { if (DynamicObject* const o = getDynamicObject()) return o->invokeMethod (method, arguments, numArguments); @@ -534,35 +534,35 @@ var var::invokeMethod (DynamicObject* const target, const var* const arguments, return var::null; } -var var::call (const Identifier& method) const +var var::call (const Identifier method) const { return invoke (method, nullptr, 0); } -var var::call (const Identifier& method, const var& arg1) const +var var::call (const Identifier method, const var& arg1) const { return invoke (method, &arg1, 1); } -var var::call (const Identifier& method, const var& arg1, const var& arg2) const +var var::call (const Identifier method, const var& arg1, const var& arg2) const { var args[] = { arg1, arg2 }; return invoke (method, args, 2); } -var var::call (const Identifier& method, const var& arg1, const var& arg2, const var& arg3) +var var::call (const Identifier method, const var& arg1, const var& arg2, const var& arg3) { var args[] = { arg1, arg2, arg3 }; return invoke (method, args, 3); } -var var::call (const Identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const +var var::call (const Identifier method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const { var args[] = { arg1, arg2, arg3, arg4 }; return invoke (method, args, 4); } -var var::call (const Identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const +var var::call (const Identifier method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const { var args[] = { arg1, arg2, arg3, arg4, arg5 }; return invoke (method, args, 5); diff --git a/modules/juce_core/containers/juce_Variant.h b/modules/juce_core/containers/juce_Variant.h index 5f733576b1..19b8abd1d5 100644 --- a/modules/juce_core/containers/juce_Variant.h +++ b/modules/juce_core/containers/juce_Variant.h @@ -220,27 +220,27 @@ public: //============================================================================== /** If this variant is an object, this returns one of its properties. */ - var operator[] (const Identifier& propertyName) const; + var operator[] (const Identifier propertyName) const; /** If this variant is an object, this returns one of its properties. */ var operator[] (const char* propertyName) const; /** If this variant is an object, this returns one of its properties, or a default fallback value if the property is not set. */ - var getProperty (const Identifier& propertyName, const var& defaultReturnValue) const; + var getProperty (const Identifier propertyName, const var& defaultReturnValue) const; /** If this variant is an object, this invokes one of its methods with no arguments. */ - var call (const Identifier& method) const; + var call (const Identifier method) const; /** If this variant is an object, this invokes one of its methods with one argument. */ - var call (const Identifier& method, const var& arg1) const; + var call (const Identifier method, const var& arg1) const; /** If this variant is an object, this invokes one of its methods with 2 arguments. */ - var call (const Identifier& method, const var& arg1, const var& arg2) const; + var call (const Identifier method, const var& arg1, const var& arg2) const; /** If this variant is an object, this invokes one of its methods with 3 arguments. */ - var call (const Identifier& method, const var& arg1, const var& arg2, const var& arg3); + var call (const Identifier method, const var& arg1, const var& arg2, const var& arg3); /** If this variant is an object, this invokes one of its methods with 4 arguments. */ - var call (const Identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const; + var call (const Identifier method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const; /** If this variant is an object, this invokes one of its methods with 5 arguments. */ - var call (const Identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const; + var call (const Identifier method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const; /** If this variant is an object, this invokes one of its methods with a list of arguments. */ - var invoke (const Identifier& method, const var* arguments, int numArguments) const; + var invoke (const Identifier method, const var* arguments, int numArguments) const; //============================================================================== /** Writes a binary representation of this value to a stream. diff --git a/modules/juce_core/files/juce_File.cpp b/modules/juce_core/files/juce_File.cpp index 567810efb1..2ae4e02c82 100644 --- a/modules/juce_core/files/juce_File.cpp +++ b/modules/juce_core/files/juce_File.cpp @@ -457,13 +457,13 @@ Result File::createDirectory() const } //============================================================================== -Time File::getLastModificationTime() const { int64 m, a, c; getFileTimesInternal (m, a, c); return Time (m); } -Time File::getLastAccessTime() const { int64 m, a, c; getFileTimesInternal (m, a, c); return Time (a); } -Time File::getCreationTime() const { int64 m, a, c; getFileTimesInternal (m, a, c); return Time (c); } +Time File::getLastModificationTime() const { int64 m, a, c; getFileTimesInternal (m, a, c); return Time (m); } +Time File::getLastAccessTime() const { int64 m, a, c; getFileTimesInternal (m, a, c); return Time (a); } +Time File::getCreationTime() const { int64 m, a, c; getFileTimesInternal (m, a, c); return Time (c); } -bool File::setLastModificationTime (const Time& t) const { return setFileTimesInternal (t.toMilliseconds(), 0, 0); } -bool File::setLastAccessTime (const Time& t) const { return setFileTimesInternal (0, t.toMilliseconds(), 0); } -bool File::setCreationTime (const Time& t) const { return setFileTimesInternal (0, 0, t.toMilliseconds()); } +bool File::setLastModificationTime (Time t) const { return setFileTimesInternal (t.toMilliseconds(), 0, 0); } +bool File::setLastAccessTime (Time t) const { return setFileTimesInternal (0, t.toMilliseconds(), 0); } +bool File::setCreationTime (Time t) const { return setFileTimesInternal (0, 0, t.toMilliseconds()); } //============================================================================== bool File::loadFileAsData (MemoryBlock& destBlock) const diff --git a/modules/juce_core/files/juce_File.h b/modules/juce_core/files/juce_File.h index 25bd0f1013..bb6cf085b3 100644 --- a/modules/juce_core/files/juce_File.h +++ b/modules/juce_core/files/juce_File.h @@ -392,7 +392,7 @@ public: @returns true if it manages to change the file's time. @see getLastModificationTime, setLastAccessTime, setCreationTime */ - bool setLastModificationTime (const Time& newTime) const; + bool setLastModificationTime (Time newTime) const; /** Changes the last-access time for this file. @@ -400,7 +400,7 @@ public: @returns true if it manages to change the file's time. @see getLastAccessTime, setLastModificationTime, setCreationTime */ - bool setLastAccessTime (const Time& newTime) const; + bool setLastAccessTime (Time newTime) const; /** Changes the creation date for this file. @@ -408,7 +408,7 @@ public: @returns true if it manages to change the file's time. @see getCreationTime, setLastModificationTime, setLastAccessTime */ - bool setCreationTime (const Time& newTime) const; + bool setCreationTime (Time newTime) const; /** If possible, this will try to create a version string for the given file. diff --git a/modules/juce_core/maths/juce_Range.h b/modules/juce_core/maths/juce_Range.h index 95a675d7a7..1edad8b195 100644 --- a/modules/juce_core/maths/juce_Range.h +++ b/modules/juce_core/maths/juce_Range.h @@ -58,7 +58,7 @@ public: } /** Copies another range object. */ - Range& operator= (const Range& other) noexcept + Range& operator= (Range other) noexcept { start = other.start; end = other.end; @@ -167,7 +167,7 @@ public: //============================================================================== /** Adds an amount to the start and end of the range. */ - inline const Range& operator+= (const ValueType amountToAdd) noexcept + inline Range operator+= (const ValueType amountToAdd) noexcept { start += amountToAdd; end += amountToAdd; @@ -175,7 +175,7 @@ public: } /** Subtracts an amount from the start and end of the range. */ - inline const Range& operator-= (const ValueType amountToSubtract) noexcept + inline Range operator-= (const ValueType amountToSubtract) noexcept { start -= amountToSubtract; end -= amountToSubtract; @@ -197,8 +197,8 @@ public: return Range (start - amountToSubtract, end - amountToSubtract); } - bool operator== (const Range& other) const noexcept { return start == other.start && end == other.end; } - bool operator!= (const Range& other) const noexcept { return start != other.start || end != other.end; } + bool operator== (Range other) const noexcept { return start == other.start && end == other.end; } + bool operator!= (Range other) const noexcept { return start != other.start || end != other.end; } //============================================================================== /** Returns true if the given position lies inside this range. */ @@ -214,27 +214,27 @@ public: } /** Returns true if the given range lies entirely inside this range. */ - bool contains (const Range& other) const noexcept + bool contains (Range other) const noexcept { return start <= other.start && end >= other.end; } /** Returns true if the given range intersects this one. */ - bool intersects (const Range& other) const noexcept + bool intersects (Range other) const noexcept { return other.start < end && start < other.end; } /** Returns the range that is the intersection of the two ranges, or an empty range with an undefined start position if they don't overlap. */ - Range getIntersectionWith (const Range& other) const noexcept + Range getIntersectionWith (Range other) const noexcept { return Range (jmax (start, other.start), jmin (end, other.end)); } /** Returns the smallest range that contains both this one and the other one. */ - Range getUnionWith (const Range& other) const noexcept + Range getUnionWith (Range other) const noexcept { return Range (jmin (start, other.start), jmax (end, other.end)); @@ -250,7 +250,7 @@ public: will be the new range, shifted forwards or backwards so that it doesn't extend beyond this one, but keeping its original length. */ - Range constrainRange (const Range& rangeToConstrain) const noexcept + Range constrainRange (Range rangeToConstrain) const noexcept { const ValueType otherLen = rangeToConstrain.getLength(); return getLength() <= otherLen diff --git a/modules/juce_core/text/juce_CharPointer_ASCII.h b/modules/juce_core/text/juce_CharPointer_ASCII.h index d029a0a77c..9bf8c9f89d 100644 --- a/modules/juce_core/text/juce_CharPointer_ASCII.h +++ b/modules/juce_core/text/juce_CharPointer_ASCII.h @@ -51,25 +51,25 @@ public: { } - inline CharPointer_ASCII& operator= (const CharPointer_ASCII& other) noexcept + inline CharPointer_ASCII operator= (const CharPointer_ASCII other) noexcept { data = other.data; return *this; } - inline CharPointer_ASCII& operator= (const CharType* text) noexcept + inline CharPointer_ASCII operator= (const CharType* text) noexcept { data = const_cast (text); return *this; } /** This is a pointer comparison, it doesn't compare the actual text. */ - inline bool operator== (const CharPointer_ASCII& other) const noexcept { return data == other.data; } - inline bool operator!= (const CharPointer_ASCII& other) const noexcept { return data != other.data; } - inline bool operator<= (const CharPointer_ASCII& other) const noexcept { return data <= other.data; } - inline bool operator< (const CharPointer_ASCII& other) const noexcept { return data < other.data; } - inline bool operator>= (const CharPointer_ASCII& other) const noexcept { return data >= other.data; } - inline bool operator> (const CharPointer_ASCII& other) const noexcept { return data > other.data; } + inline bool operator== (CharPointer_ASCII other) const noexcept { return data == other.data; } + inline bool operator!= (CharPointer_ASCII other) const noexcept { return data != other.data; } + inline bool operator<= (CharPointer_ASCII other) const noexcept { return data <= other.data; } + inline bool operator< (CharPointer_ASCII other) const noexcept { return data < other.data; } + inline bool operator>= (CharPointer_ASCII other) const noexcept { return data >= other.data; } + inline bool operator> (CharPointer_ASCII other) const noexcept { return data > other.data; } /** Returns the address that this pointer is pointing to. */ inline CharType* getAddress() const noexcept { return data; } @@ -84,14 +84,14 @@ public: inline juce_wchar operator*() const noexcept { return (juce_wchar) (uint8) *data; } /** Moves this pointer along to the next character in the string. */ - inline CharPointer_ASCII& operator++() noexcept + inline CharPointer_ASCII operator++() noexcept { ++data; return *this; } /** Moves this pointer to the previous character in the string. */ - inline CharPointer_ASCII& operator--() noexcept + inline CharPointer_ASCII operator--() noexcept { --data; return *this; @@ -168,7 +168,7 @@ public: } /** Returns the number of characters in this string, or up to the given end pointer, whichever is lower. */ - size_t lengthUpTo (const CharPointer_ASCII& end) const noexcept + size_t lengthUpTo (const CharPointer_ASCII end) const noexcept { return CharacterFunctions::lengthUpTo (*this, end); } @@ -194,7 +194,7 @@ public: The value returned does NOT include the terminating null character. */ template - static size_t getBytesRequiredFor (const CharPointer& text) noexcept + static size_t getBytesRequiredFor (const CharPointer text) noexcept { return text.length(); } @@ -207,13 +207,13 @@ public: /** Copies a source string to this pointer, advancing this pointer as it goes. */ template - void writeAll (const CharPointer& src) noexcept + void writeAll (const CharPointer src) noexcept { CharacterFunctions::copyAll (*this, src); } /** Copies a source string to this pointer, advancing this pointer as it goes. */ - void writeAll (const CharPointer_ASCII& src) noexcept + void writeAll (const CharPointer_ASCII src) noexcept { strcpy (data, src.data); } @@ -223,7 +223,7 @@ public: to the destination buffer before stopping. */ template - size_t writeWithDestByteLimit (const CharPointer& src, const size_t maxDestBytes) noexcept + size_t writeWithDestByteLimit (const CharPointer src, const size_t maxDestBytes) noexcept { return CharacterFunctions::copyWithDestByteLimit (*this, src, maxDestBytes); } @@ -233,45 +233,45 @@ public: written to the destination buffer before stopping (including the terminating null). */ template - void writeWithCharLimit (const CharPointer& src, const int maxChars) noexcept + void writeWithCharLimit (const CharPointer src, const int maxChars) noexcept { CharacterFunctions::copyWithCharLimit (*this, src, maxChars); } /** Compares this string with another one. */ template - int compare (const CharPointer& other) const noexcept + int compare (const CharPointer other) const noexcept { return CharacterFunctions::compare (*this, other); } /** Compares this string with another one. */ - int compare (const CharPointer_ASCII& other) const noexcept + int compare (const CharPointer_ASCII other) const noexcept { return strcmp (data, other.data); } /** Compares this string with another one, up to a specified number of characters. */ template - int compareUpTo (const CharPointer& other, const int maxChars) const noexcept + int compareUpTo (const CharPointer other, const int maxChars) const noexcept { return CharacterFunctions::compareUpTo (*this, other, maxChars); } /** Compares this string with another one, up to a specified number of characters. */ - int compareUpTo (const CharPointer_ASCII& other, const int maxChars) const noexcept + int compareUpTo (const CharPointer_ASCII other, const int maxChars) const noexcept { return strncmp (data, other.data, (size_t) maxChars); } /** Compares this string with another one. */ template - int compareIgnoreCase (const CharPointer& other) const + int compareIgnoreCase (const CharPointer other) const { return CharacterFunctions::compareIgnoreCase (*this, other); } - int compareIgnoreCase (const CharPointer_ASCII& other) const + int compareIgnoreCase (const CharPointer_ASCII other) const { #if JUCE_WINDOWS return stricmp (data, other.data); @@ -282,14 +282,14 @@ public: /** Compares this string with another one, up to a specified number of characters. */ template - int compareIgnoreCaseUpTo (const CharPointer& other, const int maxChars) const noexcept + int compareIgnoreCaseUpTo (const CharPointer other, const int maxChars) const noexcept { return CharacterFunctions::compareIgnoreCaseUpTo (*this, other, maxChars); } /** Returns the character index of a substring, or -1 if it isn't found. */ template - int indexOf (const CharPointer& stringToFind) const noexcept + int indexOf (const CharPointer stringToFind) const noexcept { return CharacterFunctions::indexOf (*this, stringToFind); } diff --git a/modules/juce_core/text/juce_CharPointer_UTF16.h b/modules/juce_core/text/juce_CharPointer_UTF16.h index 89aadca6cb..e2fe25b86b 100644 --- a/modules/juce_core/text/juce_CharPointer_UTF16.h +++ b/modules/juce_core/text/juce_CharPointer_UTF16.h @@ -52,25 +52,25 @@ public: { } - inline CharPointer_UTF16& operator= (const CharPointer_UTF16& other) noexcept + inline CharPointer_UTF16 operator= (CharPointer_UTF16 other) noexcept { data = other.data; return *this; } - inline CharPointer_UTF16& operator= (const CharType* text) noexcept + inline CharPointer_UTF16 operator= (const CharType* text) noexcept { data = const_cast (text); return *this; } /** This is a pointer comparison, it doesn't compare the actual text. */ - inline bool operator== (const CharPointer_UTF16& other) const noexcept { return data == other.data; } - inline bool operator!= (const CharPointer_UTF16& other) const noexcept { return data != other.data; } - inline bool operator<= (const CharPointer_UTF16& other) const noexcept { return data <= other.data; } - inline bool operator< (const CharPointer_UTF16& other) const noexcept { return data < other.data; } - inline bool operator>= (const CharPointer_UTF16& other) const noexcept { return data >= other.data; } - inline bool operator> (const CharPointer_UTF16& other) const noexcept { return data > other.data; } + inline bool operator== (CharPointer_UTF16 other) const noexcept { return data == other.data; } + inline bool operator!= (CharPointer_UTF16 other) const noexcept { return data != other.data; } + inline bool operator<= (CharPointer_UTF16 other) const noexcept { return data <= other.data; } + inline bool operator< (CharPointer_UTF16 other) const noexcept { return data < other.data; } + inline bool operator>= (CharPointer_UTF16 other) const noexcept { return data >= other.data; } + inline bool operator> (CharPointer_UTF16 other) const noexcept { return data > other.data; } /** Returns the address that this pointer is pointing to. */ inline CharType* getAddress() const noexcept { return data; } @@ -93,7 +93,7 @@ public: } /** Moves this pointer along to the next character in the string. */ - CharPointer_UTF16& operator++() noexcept + CharPointer_UTF16 operator++() noexcept { const juce_wchar n = *data++; @@ -104,7 +104,7 @@ public: } /** Moves this pointer back to the previous character in the string. */ - CharPointer_UTF16& operator--() noexcept + CharPointer_UTF16 operator--() noexcept { const juce_wchar n = *--data; @@ -231,7 +231,7 @@ public: } /** Returns the number of characters in this string, or up to the given end pointer, whichever is lower. */ - size_t lengthUpTo (const CharPointer_UTF16& end) const noexcept + size_t lengthUpTo (const CharPointer_UTF16 end) const noexcept { return CharacterFunctions::lengthUpTo (*this, end); } @@ -281,13 +281,13 @@ public: /** Copies a source string to this pointer, advancing this pointer as it goes. */ template - void writeAll (const CharPointer& src) noexcept + void writeAll (const CharPointer src) noexcept { CharacterFunctions::copyAll (*this, src); } /** Copies a source string to this pointer, advancing this pointer as it goes. */ - void writeAll (const CharPointer_UTF16& src) noexcept + void writeAll (const CharPointer_UTF16 src) noexcept { const CharType* s = src.data; @@ -303,7 +303,7 @@ public: to the destination buffer before stopping. */ template - size_t writeWithDestByteLimit (const CharPointer& src, const size_t maxDestBytes) noexcept + size_t writeWithDestByteLimit (const CharPointer src, const size_t maxDestBytes) noexcept { return CharacterFunctions::copyWithDestByteLimit (*this, src, maxDestBytes); } @@ -313,51 +313,51 @@ public: written to the destination buffer before stopping (including the terminating null). */ template - void writeWithCharLimit (const CharPointer& src, const int maxChars) noexcept + void writeWithCharLimit (const CharPointer src, const int maxChars) noexcept { CharacterFunctions::copyWithCharLimit (*this, src, maxChars); } /** Compares this string with another one. */ template - int compare (const CharPointer& other) const noexcept + int compare (const CharPointer other) const noexcept { return CharacterFunctions::compare (*this, other); } /** Compares this string with another one, up to a specified number of characters. */ template - int compareUpTo (const CharPointer& other, const int maxChars) const noexcept + int compareUpTo (const CharPointer other, const int maxChars) const noexcept { return CharacterFunctions::compareUpTo (*this, other, maxChars); } /** Compares this string with another one. */ template - int compareIgnoreCase (const CharPointer& other) const noexcept + int compareIgnoreCase (const CharPointer other) const noexcept { return CharacterFunctions::compareIgnoreCase (*this, other); } /** Compares this string with another one, up to a specified number of characters. */ template - int compareIgnoreCaseUpTo (const CharPointer& other, const int maxChars) const noexcept + int compareIgnoreCaseUpTo (const CharPointer other, const int maxChars) const noexcept { return CharacterFunctions::compareIgnoreCaseUpTo (*this, other, maxChars); } #if JUCE_WINDOWS && ! DOXYGEN - int compareIgnoreCase (const CharPointer_UTF16& other) const noexcept + int compareIgnoreCase (const CharPointer_UTF16 other) const noexcept { return _wcsicmp (data, other.data); } - int compareIgnoreCaseUpTo (const CharPointer_UTF16& other, int maxChars) const noexcept + int compareIgnoreCaseUpTo (const CharPointer_UTF16 other, int maxChars) const noexcept { return _wcsnicmp (data, other.data, (size_t) maxChars); } - int indexOf (const CharPointer_UTF16& stringToFind) const noexcept + int indexOf (const CharPointer_UTF16 stringToFind) const noexcept { const CharType* const t = wcsstr (data, stringToFind.getAddress()); return t == nullptr ? -1 : (int) (t - data); @@ -366,7 +366,7 @@ public: /** Returns the character index of a substring, or -1 if it isn't found. */ template - int indexOf (const CharPointer& stringToFind) const noexcept + int indexOf (const CharPointer stringToFind) const noexcept { return CharacterFunctions::indexOf (*this, stringToFind); } @@ -466,7 +466,7 @@ public: } /** Atomically swaps this pointer for a new value, returning the previous value. */ - CharPointer_UTF16 atomicSwap (const CharPointer_UTF16& newValue) + CharPointer_UTF16 atomicSwap (const CharPointer_UTF16 newValue) { return CharPointer_UTF16 (reinterpret_cast &> (data).exchange (newValue.data)); } diff --git a/modules/juce_core/text/juce_CharPointer_UTF32.h b/modules/juce_core/text/juce_CharPointer_UTF32.h index f7aa6df79d..8028a0b5f9 100644 --- a/modules/juce_core/text/juce_CharPointer_UTF32.h +++ b/modules/juce_core/text/juce_CharPointer_UTF32.h @@ -48,25 +48,25 @@ public: { } - inline CharPointer_UTF32& operator= (const CharPointer_UTF32& other) noexcept + inline CharPointer_UTF32 operator= (CharPointer_UTF32 other) noexcept { data = other.data; return *this; } - inline CharPointer_UTF32& operator= (const CharType* text) noexcept + inline CharPointer_UTF32 operator= (const CharType* text) noexcept { data = const_cast (text); return *this; } /** This is a pointer comparison, it doesn't compare the actual text. */ - inline bool operator== (const CharPointer_UTF32& other) const noexcept { return data == other.data; } - inline bool operator!= (const CharPointer_UTF32& other) const noexcept { return data != other.data; } - inline bool operator<= (const CharPointer_UTF32& other) const noexcept { return data <= other.data; } - inline bool operator< (const CharPointer_UTF32& other) const noexcept { return data < other.data; } - inline bool operator>= (const CharPointer_UTF32& other) const noexcept { return data >= other.data; } - inline bool operator> (const CharPointer_UTF32& other) const noexcept { return data > other.data; } + inline bool operator== (CharPointer_UTF32 other) const noexcept { return data == other.data; } + inline bool operator!= (CharPointer_UTF32 other) const noexcept { return data != other.data; } + inline bool operator<= (CharPointer_UTF32 other) const noexcept { return data <= other.data; } + inline bool operator< (CharPointer_UTF32 other) const noexcept { return data < other.data; } + inline bool operator>= (CharPointer_UTF32 other) const noexcept { return data >= other.data; } + inline bool operator> (CharPointer_UTF32 other) const noexcept { return data > other.data; } /** Returns the address that this pointer is pointing to. */ inline CharType* getAddress() const noexcept { return data; } @@ -81,14 +81,14 @@ public: inline juce_wchar operator*() const noexcept { return *data; } /** Moves this pointer along to the next character in the string. */ - inline CharPointer_UTF32& operator++() noexcept + inline CharPointer_UTF32 operator++() noexcept { ++data; return *this; } /** Moves this pointer to the previous character in the string. */ - inline CharPointer_UTF32& operator--() noexcept + inline CharPointer_UTF32 operator--() noexcept { --data; return *this; @@ -172,7 +172,7 @@ public: } /** Returns the number of characters in this string, or up to the given end pointer, whichever is lower. */ - size_t lengthUpTo (const CharPointer_UTF32& end) const noexcept + size_t lengthUpTo (const CharPointer_UTF32 end) const noexcept { return CharacterFunctions::lengthUpTo (*this, end); } @@ -198,7 +198,7 @@ public: The value returned does NOT include the terminating null character. */ template - static size_t getBytesRequiredFor (const CharPointer& text) noexcept + static size_t getBytesRequiredFor (const CharPointer text) noexcept { return sizeof (CharType) * text.length(); } @@ -211,13 +211,13 @@ public: /** Copies a source string to this pointer, advancing this pointer as it goes. */ template - void writeAll (const CharPointer& src) noexcept + void writeAll (const CharPointer src) noexcept { CharacterFunctions::copyAll (*this, src); } /** Copies a source string to this pointer, advancing this pointer as it goes. */ - void writeAll (const CharPointer_UTF32& src) noexcept + void writeAll (const CharPointer_UTF32 src) noexcept { const CharType* s = src.data; @@ -233,7 +233,7 @@ public: to the destination buffer before stopping. */ template - size_t writeWithDestByteLimit (const CharPointer& src, const size_t maxDestBytes) noexcept + size_t writeWithDestByteLimit (const CharPointer src, const size_t maxDestBytes) noexcept { return CharacterFunctions::copyWithDestByteLimit (*this, src, maxDestBytes); } @@ -243,21 +243,21 @@ public: written to the destination buffer before stopping (including the terminating null). */ template - void writeWithCharLimit (const CharPointer& src, const int maxChars) noexcept + void writeWithCharLimit (const CharPointer src, const int maxChars) noexcept { CharacterFunctions::copyWithCharLimit (*this, src, maxChars); } /** Compares this string with another one. */ template - int compare (const CharPointer& other) const noexcept + int compare (const CharPointer other) const noexcept { return CharacterFunctions::compare (*this, other); } #if JUCE_NATIVE_WCHAR_IS_UTF32 && ! JUCE_ANDROID /** Compares this string with another one. */ - int compare (const CharPointer_UTF32& other) const noexcept + int compare (const CharPointer_UTF32 other) const noexcept { return wcscmp (data, other.data); } @@ -265,28 +265,28 @@ public: /** Compares this string with another one, up to a specified number of characters. */ template - int compareUpTo (const CharPointer& other, const int maxChars) const noexcept + int compareUpTo (const CharPointer other, const int maxChars) const noexcept { return CharacterFunctions::compareUpTo (*this, other, maxChars); } /** Compares this string with another one. */ template - int compareIgnoreCase (const CharPointer& other) const + int compareIgnoreCase (const CharPointer other) const { return CharacterFunctions::compareIgnoreCase (*this, other); } /** Compares this string with another one, up to a specified number of characters. */ template - int compareIgnoreCaseUpTo (const CharPointer& other, const int maxChars) const noexcept + int compareIgnoreCaseUpTo (const CharPointer other, const int maxChars) const noexcept { return CharacterFunctions::compareIgnoreCaseUpTo (*this, other, maxChars); } /** Returns the character index of a substring, or -1 if it isn't found. */ template - int indexOf (const CharPointer& stringToFind) const noexcept + int indexOf (const CharPointer stringToFind) const noexcept { return CharacterFunctions::indexOf (*this, stringToFind); } @@ -362,7 +362,7 @@ public: } /** Atomically swaps this pointer for a new value, returning the previous value. */ - CharPointer_UTF32 atomicSwap (const CharPointer_UTF32& newValue) + CharPointer_UTF32 atomicSwap (const CharPointer_UTF32 newValue) { return CharPointer_UTF32 (reinterpret_cast &> (data).exchange (newValue.data)); } diff --git a/modules/juce_core/text/juce_CharPointer_UTF8.h b/modules/juce_core/text/juce_CharPointer_UTF8.h index 92f018d30e..2a254aff70 100644 --- a/modules/juce_core/text/juce_CharPointer_UTF8.h +++ b/modules/juce_core/text/juce_CharPointer_UTF8.h @@ -47,25 +47,25 @@ public: { } - inline CharPointer_UTF8& operator= (const CharPointer_UTF8& other) noexcept + inline CharPointer_UTF8 operator= (CharPointer_UTF8 other) noexcept { data = other.data; return *this; } - inline CharPointer_UTF8& operator= (const CharType* text) noexcept + inline CharPointer_UTF8 operator= (const CharType* text) noexcept { data = const_cast (text); return *this; } /** This is a pointer comparison, it doesn't compare the actual text. */ - inline bool operator== (const CharPointer_UTF8& other) const noexcept { return data == other.data; } - inline bool operator!= (const CharPointer_UTF8& other) const noexcept { return data != other.data; } - inline bool operator<= (const CharPointer_UTF8& other) const noexcept { return data <= other.data; } - inline bool operator< (const CharPointer_UTF8& other) const noexcept { return data < other.data; } - inline bool operator>= (const CharPointer_UTF8& other) const noexcept { return data >= other.data; } - inline bool operator> (const CharPointer_UTF8& other) const noexcept { return data > other.data; } + inline bool operator== (CharPointer_UTF8 other) const noexcept { return data == other.data; } + inline bool operator!= (CharPointer_UTF8 other) const noexcept { return data != other.data; } + inline bool operator<= (CharPointer_UTF8 other) const noexcept { return data <= other.data; } + inline bool operator< (CharPointer_UTF8 other) const noexcept { return data < other.data; } + inline bool operator>= (CharPointer_UTF8 other) const noexcept { return data >= other.data; } + inline bool operator> (CharPointer_UTF8 other) const noexcept { return data > other.data; } /** Returns the address that this pointer is pointing to. */ inline CharType* getAddress() const noexcept { return data; } @@ -132,7 +132,7 @@ public: } /** Moves this pointer back to the previous character in the string. */ - CharPointer_UTF8& operator--() noexcept + CharPointer_UTF8 operator--() noexcept { int count = 0; @@ -271,7 +271,7 @@ public: } /** Returns the number of characters in this string, or up to the given end pointer, whichever is lower. */ - size_t lengthUpTo (const CharPointer_UTF8& end) const noexcept + size_t lengthUpTo (const CharPointer_UTF8 end) const noexcept { return CharacterFunctions::lengthUpTo (*this, end); } @@ -363,13 +363,13 @@ public: /** Copies a source string to this pointer, advancing this pointer as it goes. */ template - void writeAll (const CharPointer& src) noexcept + void writeAll (const CharPointer src) noexcept { CharacterFunctions::copyAll (*this, src); } /** Copies a source string to this pointer, advancing this pointer as it goes. */ - void writeAll (const CharPointer_UTF8& src) noexcept + void writeAll (const CharPointer_UTF8 src) noexcept { const CharType* s = src.data; @@ -385,7 +385,7 @@ public: to the destination buffer before stopping. */ template - size_t writeWithDestByteLimit (const CharPointer& src, const size_t maxDestBytes) noexcept + size_t writeWithDestByteLimit (const CharPointer src, const size_t maxDestBytes) noexcept { return CharacterFunctions::copyWithDestByteLimit (*this, src, maxDestBytes); } @@ -395,34 +395,34 @@ public: written to the destination buffer before stopping (including the terminating null). */ template - void writeWithCharLimit (const CharPointer& src, const int maxChars) noexcept + void writeWithCharLimit (const CharPointer src, const int maxChars) noexcept { CharacterFunctions::copyWithCharLimit (*this, src, maxChars); } /** Compares this string with another one. */ template - int compare (const CharPointer& other) const noexcept + int compare (const CharPointer other) const noexcept { return CharacterFunctions::compare (*this, other); } /** Compares this string with another one, up to a specified number of characters. */ template - int compareUpTo (const CharPointer& other, const int maxChars) const noexcept + int compareUpTo (const CharPointer other, const int maxChars) const noexcept { return CharacterFunctions::compareUpTo (*this, other, maxChars); } /** Compares this string with another one. */ template - int compareIgnoreCase (const CharPointer& other) const noexcept + int compareIgnoreCase (const CharPointer other) const noexcept { return CharacterFunctions::compareIgnoreCase (*this, other); } /** Compares this string with another one. */ - int compareIgnoreCase (const CharPointer_UTF8& other) const noexcept + int compareIgnoreCase (const CharPointer_UTF8 other) const noexcept { #if JUCE_WINDOWS return stricmp (data, other.data); @@ -433,14 +433,14 @@ public: /** Compares this string with another one, up to a specified number of characters. */ template - int compareIgnoreCaseUpTo (const CharPointer& other, const int maxChars) const noexcept + int compareIgnoreCaseUpTo (const CharPointer other, const int maxChars) const noexcept { return CharacterFunctions::compareIgnoreCaseUpTo (*this, other, maxChars); } /** Returns the character index of a substring, or -1 if it isn't found. */ template - int indexOf (const CharPointer& stringToFind) const noexcept + int indexOf (const CharPointer stringToFind) const noexcept { return CharacterFunctions::indexOf (*this, stringToFind); } @@ -542,7 +542,7 @@ public: } /** Atomically swaps this pointer for a new value, returning the previous value. */ - CharPointer_UTF8 atomicSwap (const CharPointer_UTF8& newValue) + CharPointer_UTF8 atomicSwap (const CharPointer_UTF8 newValue) { return CharPointer_UTF8 (reinterpret_cast &> (data).exchange (newValue.data)); } diff --git a/modules/juce_core/text/juce_CharacterFunctions.h b/modules/juce_core/text/juce_CharacterFunctions.h index 1653528984..a1a3ba5422 100644 --- a/modules/juce_core/text/juce_CharacterFunctions.h +++ b/modules/juce_core/text/juce_CharacterFunctions.h @@ -255,7 +255,7 @@ public: //============================================================================== /** Parses a character string, to read an integer value. */ template - static IntType getIntValue (const CharPointerType& text) noexcept + static IntType getIntValue (const CharPointerType text) noexcept { IntType v = 0; CharPointerType s (text.findEndOfWhitespace()); @@ -294,7 +294,7 @@ public: /** Counts the number of characters in a given string, stopping if the count exceeds a specified end-pointer. */ template - static size_t lengthUpTo (CharPointerType start, const CharPointerType& end) noexcept + static size_t lengthUpTo (CharPointerType start, const CharPointerType end) noexcept { size_t len = 0; @@ -437,7 +437,7 @@ public: Returns -1 if the substring is not found. */ template - static int indexOf (CharPointerType1 textToSearch, const CharPointerType2& substringToLookFor) noexcept + static int indexOf (CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept { int index = 0; const int substringLength = (int) substringToLookFor.length(); @@ -459,7 +459,7 @@ public: null terminator. */ template - static CharPointerType1 find (CharPointerType1 textToSearch, const CharPointerType2& substringToLookFor) noexcept + static CharPointerType1 find (CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept { const int substringLength = (int) substringToLookFor.length(); @@ -475,7 +475,7 @@ public: Returns -1 if the substring is not found. */ template - static int indexOfIgnoreCase (CharPointerType1 haystack, const CharPointerType2& needle) noexcept + static int indexOfIgnoreCase (CharPointerType1 haystack, const CharPointerType2 needle) noexcept { int index = 0; const int needleLength = (int) needle.length(); diff --git a/modules/juce_core/text/juce_Identifier.cpp b/modules/juce_core/text/juce_Identifier.cpp index 050a137426..0e106de269 100644 --- a/modules/juce_core/text/juce_Identifier.cpp +++ b/modules/juce_core/text/juce_Identifier.cpp @@ -39,7 +39,7 @@ Identifier::Identifier (const Identifier& other) noexcept { } -Identifier& Identifier::operator= (const Identifier& other) noexcept +Identifier& Identifier::operator= (const Identifier other) noexcept { name = other.name; return *this; diff --git a/modules/juce_core/text/juce_Identifier.h b/modules/juce_core/text/juce_Identifier.h index 7decd5291d..519c71a6f3 100644 --- a/modules/juce_core/text/juce_Identifier.h +++ b/modules/juce_core/text/juce_Identifier.h @@ -61,16 +61,16 @@ public: Identifier (const Identifier& other) noexcept; /** Creates a copy of another identifier. */ - Identifier& operator= (const Identifier& other) noexcept; + Identifier& operator= (const Identifier other) noexcept; /** Destructor */ ~Identifier(); /** Compares two identifiers. This is a very fast operation. */ - inline bool operator== (const Identifier& other) const noexcept { return name == other.name; } + inline bool operator== (const Identifier other) const noexcept { return name == other.name; } /** Compares two identifiers. This is a very fast operation. */ - inline bool operator!= (const Identifier& other) const noexcept { return name != other.name; } + inline bool operator!= (const Identifier other) const noexcept { return name != other.name; } /** Returns this identifier as a string. */ String toString() const { return name; } diff --git a/modules/juce_core/text/juce_String.cpp b/modules/juce_core/text/juce_String.cpp index 58434414b8..18f6dfdac4 100644 --- a/modules/juce_core/text/juce_String.cpp +++ b/modules/juce_core/text/juce_String.cpp @@ -70,7 +70,7 @@ public: } template - static CharPointerType createFromCharPointer (const CharPointer& text) + static CharPointerType createFromCharPointer (const CharPointer text) { if (text.getAddress() == nullptr || text.isEmpty()) return getEmpty(); @@ -87,7 +87,7 @@ public: } template - static CharPointerType createFromCharPointer (const CharPointer& text, size_t maxChars) + static CharPointerType createFromCharPointer (const CharPointer text, size_t maxChars) { if (text.getAddress() == nullptr || text.isEmpty() || maxChars == 0) return getEmpty(); @@ -108,7 +108,7 @@ public: } template - static CharPointerType createFromCharPointer (const CharPointer& start, const CharPointer& end) + static CharPointerType createFromCharPointer (const CharPointer start, const CharPointer end) { if (start.getAddress() == nullptr || start.isEmpty()) return getEmpty(); @@ -128,7 +128,7 @@ public: return dest; } - static CharPointerType createFromCharPointer (const CharPointerType& start, const CharPointerType& end) + static CharPointerType createFromCharPointer (const CharPointerType start, const CharPointerType end) { if (start.getAddress() == nullptr || start.isEmpty()) return getEmpty(); @@ -153,7 +153,7 @@ public: } //============================================================================== - static void retain (const CharPointerType& text) noexcept + static void retain (const CharPointerType text) noexcept { ++(bufferFromText (text)->refCount); } @@ -164,13 +164,13 @@ public: delete[] reinterpret_cast (b); } - static void release (const CharPointerType& text) noexcept + static void release (const CharPointerType text) noexcept { release (bufferFromText (text)); } //============================================================================== - static CharPointerType makeUnique (const CharPointerType& text) + static CharPointerType makeUnique (const CharPointerType text) { StringHolder* const b = bufferFromText (text); @@ -184,7 +184,7 @@ public: return newText; } - static CharPointerType makeUniqueWithByteSize (const CharPointerType& text, size_t numBytes) + static CharPointerType makeUniqueWithByteSize (const CharPointerType text, size_t numBytes) { StringHolder* const b = bufferFromText (text); @@ -198,7 +198,7 @@ public: return newText; } - static size_t getAllocatedNumBytes (const CharPointerType& text) noexcept + static size_t getAllocatedNumBytes (const CharPointerType text) noexcept { return bufferFromText (text)->allocatedNumBytes; } @@ -211,7 +211,7 @@ public: static StringHolder empty; private: - static inline StringHolder* bufferFromText (const CharPointerType& text) noexcept + static inline StringHolder* bufferFromText (const CharPointerType text) noexcept { // (Can't use offsetof() here because of warnings about this not being a POD) return reinterpret_cast (reinterpret_cast (text.getAddress()) @@ -331,19 +331,19 @@ String::String (const char* const t, const size_t maxChars) } String::String (const wchar_t* const t) : text (StringHolder::createFromCharPointer (castToCharPointer_wchar_t (t))) {} -String::String (const CharPointer_UTF8& t) : text (StringHolder::createFromCharPointer (t)) {} -String::String (const CharPointer_UTF16& t) : text (StringHolder::createFromCharPointer (t)) {} -String::String (const CharPointer_UTF32& t) : text (StringHolder::createFromCharPointer (t)) {} -String::String (const CharPointer_ASCII& t) : text (StringHolder::createFromCharPointer (t)) {} - -String::String (const CharPointer_UTF8& t, const size_t maxChars) : text (StringHolder::createFromCharPointer (t, maxChars)) {} -String::String (const CharPointer_UTF16& t, const size_t maxChars) : text (StringHolder::createFromCharPointer (t, maxChars)) {} -String::String (const CharPointer_UTF32& t, const size_t maxChars) : text (StringHolder::createFromCharPointer (t, maxChars)) {} +String::String (const CharPointer_UTF8 t) : text (StringHolder::createFromCharPointer (t)) {} +String::String (const CharPointer_UTF16 t) : text (StringHolder::createFromCharPointer (t)) {} +String::String (const CharPointer_UTF32 t) : text (StringHolder::createFromCharPointer (t)) {} +String::String (const CharPointer_ASCII t) : text (StringHolder::createFromCharPointer (t)) {} + +String::String (const CharPointer_UTF8 t, const size_t maxChars) : text (StringHolder::createFromCharPointer (t, maxChars)) {} +String::String (const CharPointer_UTF16 t, const size_t maxChars) : text (StringHolder::createFromCharPointer (t, maxChars)) {} +String::String (const CharPointer_UTF32 t, const size_t maxChars) : text (StringHolder::createFromCharPointer (t, maxChars)) {} String::String (const wchar_t* const t, size_t maxChars) : text (StringHolder::createFromCharPointer (castToCharPointer_wchar_t (t), maxChars)) {} -String::String (const CharPointer_UTF8& start, const CharPointer_UTF8& end) : text (StringHolder::createFromCharPointer (start, end)) {} -String::String (const CharPointer_UTF16& start, const CharPointer_UTF16& end) : text (StringHolder::createFromCharPointer (start, end)) {} -String::String (const CharPointer_UTF32& start, const CharPointer_UTF32& end) : text (StringHolder::createFromCharPointer (start, end)) {} +String::String (const CharPointer_UTF8 start, const CharPointer_UTF8 end) : text (StringHolder::createFromCharPointer (start, end)) {} +String::String (const CharPointer_UTF16 start, const CharPointer_UTF16 end) : text (StringHolder::createFromCharPointer (start, end)) {} +String::String (const CharPointer_UTF32 start, const CharPointer_UTF32 end) : text (StringHolder::createFromCharPointer (start, end)) {} String::String (const std::string& s) : text (StringHolder::createFromFixedLength (s.data(), s.size())) {} @@ -546,15 +546,15 @@ int64 String::hashCode64() const noexcept JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const String& s2) noexcept { return s1.compare (s2) == 0; } JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const char* const s2) noexcept { return s1.compare (s2) == 0; } JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const wchar_t* const s2) noexcept { return s1.compare (s2) == 0; } -JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF8& s2) noexcept { return s1.getCharPointer().compare (s2) == 0; } -JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF16& s2) noexcept { return s1.getCharPointer().compare (s2) == 0; } -JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF32& s2) noexcept { return s1.getCharPointer().compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF8 s2) noexcept { return s1.getCharPointer().compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF16 s2) noexcept { return s1.getCharPointer().compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF32 s2) noexcept { return s1.getCharPointer().compare (s2) == 0; } JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const String& s2) noexcept { return s1.compare (s2) != 0; } JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const char* const s2) noexcept { return s1.compare (s2) != 0; } JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const wchar_t* const s2) noexcept { return s1.compare (s2) != 0; } -JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF8& s2) noexcept { return s1.getCharPointer().compare (s2) != 0; } -JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF16& s2) noexcept { return s1.getCharPointer().compare (s2) != 0; } -JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF32& s2) noexcept { return s1.getCharPointer().compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF8 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF16 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF32 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; } JUCE_API bool JUCE_CALLTYPE operator> (const String& s1, const String& s2) noexcept { return s1.compare (s2) > 0; } JUCE_API bool JUCE_CALLTYPE operator< (const String& s1, const String& s2) noexcept { return s1.compare (s2) < 0; } JUCE_API bool JUCE_CALLTYPE operator>= (const String& s1, const String& s2) noexcept { return s1.compare (s2) >= 0; } @@ -1020,7 +1020,7 @@ struct WildCardMatcher || (ignoreCase && CharacterFunctions::toLowerCase (wc) == CharacterFunctions::toLowerCase (tc)); } - static bool matchesAnywhere (const CharPointer& wildcard, CharPointer test, const bool ignoreCase) noexcept + static bool matchesAnywhere (const CharPointer wildcard, CharPointer test, const bool ignoreCase) noexcept { for (; ! test.isEmpty(); ++test) if (matches (wildcard, test, ignoreCase)) @@ -2024,7 +2024,7 @@ std::string String::toStdString() const template struct StringCopier { - static size_t copyToBuffer (const CharPointerType_Src& source, typename CharPointerType_Dest::CharType* const buffer, const size_t maxBufferSizeBytes) + static size_t copyToBuffer (const CharPointerType_Src source, typename CharPointerType_Dest::CharType* const buffer, const size_t maxBufferSizeBytes) { jassert (((ssize_t) maxBufferSizeBytes) >= 0); // keep this value positive! diff --git a/modules/juce_core/text/juce_String.h b/modules/juce_core/text/juce_String.h index a7cb85c894..faa9601b6d 100644 --- a/modules/juce_core/text/juce_String.h +++ b/modules/juce_core/text/juce_String.h @@ -120,37 +120,37 @@ public: //============================================================================== /** Creates a string from a UTF-8 character string */ - String (const CharPointer_UTF8& text); + String (const CharPointer_UTF8 text); /** Creates a string from a UTF-8 character string */ - String (const CharPointer_UTF8& text, size_t maxChars); + String (const CharPointer_UTF8 text, size_t maxChars); /** Creates a string from a UTF-8 character string */ - String (const CharPointer_UTF8& start, const CharPointer_UTF8& end); + String (const CharPointer_UTF8 start, const CharPointer_UTF8 end); //============================================================================== /** Creates a string from a UTF-16 character string */ - String (const CharPointer_UTF16& text); + String (const CharPointer_UTF16 text); /** Creates a string from a UTF-16 character string */ - String (const CharPointer_UTF16& text, size_t maxChars); + String (const CharPointer_UTF16 text, size_t maxChars); /** Creates a string from a UTF-16 character string */ - String (const CharPointer_UTF16& start, const CharPointer_UTF16& end); + String (const CharPointer_UTF16 start, const CharPointer_UTF16 end); //============================================================================== /** Creates a string from a UTF-32 character string */ - String (const CharPointer_UTF32& text); + String (const CharPointer_UTF32 text); /** Creates a string from a UTF-32 character string */ - String (const CharPointer_UTF32& text, size_t maxChars); + String (const CharPointer_UTF32 text, size_t maxChars); /** Creates a string from a UTF-32 character string */ - String (const CharPointer_UTF32& start, const CharPointer_UTF32& end); + String (const CharPointer_UTF32 start, const CharPointer_UTF32 end); //============================================================================== /** Creates a string from an ASCII character string */ - String (const CharPointer_ASCII& text); + String (const CharPointer_ASCII text); /** Creates a string from a UTF-8 encoded std::string. */ String (const std::string&); @@ -242,7 +242,7 @@ public: @param maxCharsToTake the maximum number of characters to take from the string passed in */ template - void appendCharPointer (const CharPointer& textToAppend, size_t maxCharsToTake) + void appendCharPointer (const CharPointer textToAppend, size_t maxCharsToTake) { if (textToAppend.getAddress() != nullptr) { @@ -267,7 +267,7 @@ public: /** Appends a string to the end of this one. */ template - void appendCharPointer (const CharPointer& textToAppend) + void appendCharPointer (const CharPointer textToAppend) { if (textToAppend.getAddress() != nullptr) { @@ -1037,7 +1037,7 @@ public: that is returned must not be stored anywhere, as it can be deleted whenever the string changes. */ - inline const CharPointerType& getCharPointer() const noexcept { return text; } + inline CharPointerType getCharPointer() const noexcept { return text; } /** Returns a pointer to a UTF-8 version of this string. @@ -1296,11 +1296,11 @@ JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const char* strin /** Case-sensitive comparison of two strings. */ JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const wchar_t* string2) noexcept; /** Case-sensitive comparison of two strings. */ -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF8& string2) noexcept; +JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF8 string2) noexcept; /** Case-sensitive comparison of two strings. */ -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF16& string2) noexcept; +JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF16 string2) noexcept; /** Case-sensitive comparison of two strings. */ -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF32& string2) noexcept; +JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF32 string2) noexcept; /** Case-sensitive comparison of two strings. */ JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) noexcept; /** Case-sensitive comparison of two strings. */ @@ -1308,11 +1308,11 @@ JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const char* strin /** Case-sensitive comparison of two strings. */ JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const wchar_t* string2) noexcept; /** Case-sensitive comparison of two strings. */ -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF8& string2) noexcept; +JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF8 string2) noexcept; /** Case-sensitive comparison of two strings. */ -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF16& string2) noexcept; +JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF16 string2) noexcept; /** Case-sensitive comparison of two strings. */ -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF32& string2) noexcept; +JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF32 string2) noexcept; /** Case-sensitive comparison of two strings. */ JUCE_API bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) noexcept; /** Case-sensitive comparison of two strings. */ diff --git a/modules/juce_core/time/juce_RelativeTime.cpp b/modules/juce_core/time/juce_RelativeTime.cpp index 4f6db36bc5..0199017aaa 100644 --- a/modules/juce_core/time/juce_RelativeTime.cpp +++ b/modules/juce_core/time/juce_RelativeTime.cpp @@ -45,20 +45,20 @@ double RelativeTime::inWeeks() const noexcept { return seconds / (60.0 * 6 //============================================================================== RelativeTime& RelativeTime::operator= (const RelativeTime& other) noexcept { seconds = other.seconds; return *this; } -const RelativeTime& RelativeTime::operator+= (const RelativeTime& t) noexcept { seconds += t.seconds; return *this; } -const RelativeTime& RelativeTime::operator-= (const RelativeTime& t) noexcept { seconds -= t.seconds; return *this; } -const RelativeTime& RelativeTime::operator+= (const double secs) noexcept { seconds += secs; return *this; } -const RelativeTime& RelativeTime::operator-= (const double secs) noexcept { seconds -= secs; return *this; } - -RelativeTime operator+ (const RelativeTime& t1, const RelativeTime& t2) noexcept { RelativeTime t (t1); return t += t2; } -RelativeTime operator- (const RelativeTime& t1, const RelativeTime& t2) noexcept { RelativeTime t (t1); return t -= t2; } - -bool operator== (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() == t2.inSeconds(); } -bool operator!= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() != t2.inSeconds(); } -bool operator> (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() > t2.inSeconds(); } -bool operator< (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() < t2.inSeconds(); } -bool operator>= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() >= t2.inSeconds(); } -bool operator<= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() <= t2.inSeconds(); } +RelativeTime RelativeTime::operator+= (RelativeTime t) noexcept { seconds += t.seconds; return *this; } +RelativeTime RelativeTime::operator-= (RelativeTime t) noexcept { seconds -= t.seconds; return *this; } +RelativeTime RelativeTime::operator+= (const double secs) noexcept { seconds += secs; return *this; } +RelativeTime RelativeTime::operator-= (const double secs) noexcept { seconds -= secs; return *this; } + +RelativeTime operator+ (RelativeTime t1, RelativeTime t2) noexcept { return t1 += t2; } +RelativeTime operator- (RelativeTime t1, RelativeTime t2) noexcept { return t1 -= t2; } + +bool operator== (RelativeTime t1, RelativeTime t2) noexcept { return t1.inSeconds() == t2.inSeconds(); } +bool operator!= (RelativeTime t1, RelativeTime t2) noexcept { return t1.inSeconds() != t2.inSeconds(); } +bool operator> (RelativeTime t1, RelativeTime t2) noexcept { return t1.inSeconds() > t2.inSeconds(); } +bool operator< (RelativeTime t1, RelativeTime t2) noexcept { return t1.inSeconds() < t2.inSeconds(); } +bool operator>= (RelativeTime t1, RelativeTime t2) noexcept { return t1.inSeconds() >= t2.inSeconds(); } +bool operator<= (RelativeTime t1, RelativeTime t2) noexcept { return t1.inSeconds() <= t2.inSeconds(); } //============================================================================== static void translateTimeField (String& result, int n, const char* singular, const char* plural) diff --git a/modules/juce_core/time/juce_RelativeTime.h b/modules/juce_core/time/juce_RelativeTime.h index 1e16ba1c1a..cfce0ab27d 100644 --- a/modules/juce_core/time/juce_RelativeTime.h +++ b/modules/juce_core/time/juce_RelativeTime.h @@ -139,14 +139,14 @@ public: //============================================================================== /** Adds another RelativeTime to this one. */ - const RelativeTime& operator+= (const RelativeTime& timeToAdd) noexcept; + RelativeTime operator+= (RelativeTime timeToAdd) noexcept; /** Subtracts another RelativeTime from this one. */ - const RelativeTime& operator-= (const RelativeTime& timeToSubtract) noexcept; + RelativeTime operator-= (RelativeTime timeToSubtract) noexcept; /** Adds a number of seconds to this time. */ - const RelativeTime& operator+= (double secondsToAdd) noexcept; + RelativeTime operator+= (double secondsToAdd) noexcept; /** Subtracts a number of seconds from this time. */ - const RelativeTime& operator-= (double secondsToSubtract) noexcept; + RelativeTime operator-= (double secondsToSubtract) noexcept; private: //============================================================================== @@ -155,23 +155,23 @@ private: //============================================================================== /** Compares two RelativeTimes. */ -bool operator== (const RelativeTime& t1, const RelativeTime& t2) noexcept; +bool operator== (RelativeTime t1, RelativeTime t2) noexcept; /** Compares two RelativeTimes. */ -bool operator!= (const RelativeTime& t1, const RelativeTime& t2) noexcept; +bool operator!= (RelativeTime t1, RelativeTime t2) noexcept; /** Compares two RelativeTimes. */ -bool operator> (const RelativeTime& t1, const RelativeTime& t2) noexcept; +bool operator> (RelativeTime t1, RelativeTime t2) noexcept; /** Compares two RelativeTimes. */ -bool operator< (const RelativeTime& t1, const RelativeTime& t2) noexcept; +bool operator< (RelativeTime t1, RelativeTime t2) noexcept; /** Compares two RelativeTimes. */ -bool operator>= (const RelativeTime& t1, const RelativeTime& t2) noexcept; +bool operator>= (RelativeTime t1, RelativeTime t2) noexcept; /** Compares two RelativeTimes. */ -bool operator<= (const RelativeTime& t1, const RelativeTime& t2) noexcept; +bool operator<= (RelativeTime t1, RelativeTime t2) noexcept; //============================================================================== /** Adds two RelativeTimes together. */ -RelativeTime operator+ (const RelativeTime& t1, const RelativeTime& t2) noexcept; +RelativeTime operator+ (RelativeTime t1, RelativeTime t2) noexcept; /** Subtracts two RelativeTimes. */ -RelativeTime operator- (const RelativeTime& t1, const RelativeTime& t2) noexcept; +RelativeTime operator- (RelativeTime t1, RelativeTime t2) noexcept; diff --git a/modules/juce_core/time/juce_Time.cpp b/modules/juce_core/time/juce_Time.cpp index 420e1d13b2..a3e2a48d34 100644 --- a/modules/juce_core/time/juce_Time.cpp +++ b/modules/juce_core/time/juce_Time.cpp @@ -427,17 +427,17 @@ String Time::getWeekdayName (int day, const bool threeLetterVersion) } //============================================================================== -Time& Time::operator+= (const RelativeTime& delta) { millisSinceEpoch += delta.inMilliseconds(); return *this; } -Time& Time::operator-= (const RelativeTime& delta) { millisSinceEpoch -= delta.inMilliseconds(); return *this; } - -Time operator+ (const Time& time, const RelativeTime& delta) { Time t (time); return t += delta; } -Time operator- (const Time& time, const RelativeTime& delta) { Time t (time); return t -= delta; } -Time operator+ (const RelativeTime& delta, const Time& time) { Time t (time); return t += delta; } -const RelativeTime operator- (const Time& time1, const Time& time2) { return RelativeTime::milliseconds (time1.toMilliseconds() - time2.toMilliseconds()); } - -bool operator== (const Time& time1, const Time& time2) { return time1.toMilliseconds() == time2.toMilliseconds(); } -bool operator!= (const Time& time1, const Time& time2) { return time1.toMilliseconds() != time2.toMilliseconds(); } -bool operator< (const Time& time1, const Time& time2) { return time1.toMilliseconds() < time2.toMilliseconds(); } -bool operator> (const Time& time1, const Time& time2) { return time1.toMilliseconds() > time2.toMilliseconds(); } -bool operator<= (const Time& time1, const Time& time2) { return time1.toMilliseconds() <= time2.toMilliseconds(); } -bool operator>= (const Time& time1, const Time& time2) { return time1.toMilliseconds() >= time2.toMilliseconds(); } +Time& Time::operator+= (RelativeTime delta) { millisSinceEpoch += delta.inMilliseconds(); return *this; } +Time& Time::operator-= (RelativeTime delta) { millisSinceEpoch -= delta.inMilliseconds(); return *this; } + +Time operator+ (Time time, RelativeTime delta) { Time t (time); return t += delta; } +Time operator- (Time time, RelativeTime delta) { Time t (time); return t -= delta; } +Time operator+ (RelativeTime delta, Time time) { Time t (time); return t += delta; } +const RelativeTime operator- (Time time1, Time time2) { return RelativeTime::milliseconds (time1.toMilliseconds() - time2.toMilliseconds()); } + +bool operator== (Time time1, Time time2) { return time1.toMilliseconds() == time2.toMilliseconds(); } +bool operator!= (Time time1, Time time2) { return time1.toMilliseconds() != time2.toMilliseconds(); } +bool operator< (Time time1, Time time2) { return time1.toMilliseconds() < time2.toMilliseconds(); } +bool operator> (Time time1, Time time2) { return time1.toMilliseconds() > time2.toMilliseconds(); } +bool operator<= (Time time1, Time time2) { return time1.toMilliseconds() <= time2.toMilliseconds(); } +bool operator>= (Time time1, Time time2) { return time1.toMilliseconds() >= time2.toMilliseconds(); } diff --git a/modules/juce_core/time/juce_Time.h b/modules/juce_core/time/juce_Time.h index a56c421b09..043d2bbb40 100644 --- a/modules/juce_core/time/juce_Time.h +++ b/modules/juce_core/time/juce_Time.h @@ -252,9 +252,9 @@ public: //============================================================================== /** Adds a RelativeTime to this time. */ - Time& operator+= (const RelativeTime& delta); + Time& operator+= (RelativeTime delta); /** Subtracts a RelativeTime from this time. */ - Time& operator-= (const RelativeTime& delta); + Time& operator-= (RelativeTime delta); //============================================================================== /** Tries to set the computer's clock. @@ -377,27 +377,27 @@ private: //============================================================================== /** Adds a RelativeTime to a Time. */ -JUCE_API Time operator+ (const Time& time, const RelativeTime& delta); +JUCE_API Time operator+ (Time time, RelativeTime delta); /** Adds a RelativeTime to a Time. */ -JUCE_API Time operator+ (const RelativeTime& delta, const Time& time); +JUCE_API Time operator+ (RelativeTime delta, Time time); /** Subtracts a RelativeTime from a Time. */ -JUCE_API Time operator- (const Time& time, const RelativeTime& delta); +JUCE_API Time operator- (Time time, RelativeTime delta); /** Returns the relative time difference between two times. */ -JUCE_API const RelativeTime operator- (const Time& time1, const Time& time2); +JUCE_API const RelativeTime operator- (Time time1, Time time2); /** Compares two Time objects. */ -JUCE_API bool operator== (const Time& time1, const Time& time2); +JUCE_API bool operator== (Time time1, Time time2); /** Compares two Time objects. */ -JUCE_API bool operator!= (const Time& time1, const Time& time2); +JUCE_API bool operator!= (Time time1, Time time2); /** Compares two Time objects. */ -JUCE_API bool operator< (const Time& time1, const Time& time2); +JUCE_API bool operator< (Time time1, Time time2); /** Compares two Time objects. */ -JUCE_API bool operator<= (const Time& time1, const Time& time2); +JUCE_API bool operator<= (Time time1, Time time2); /** Compares two Time objects. */ -JUCE_API bool operator> (const Time& time1, const Time& time2); +JUCE_API bool operator> (Time time1, Time time2); /** Compares two Time objects. */ -JUCE_API bool operator>= (const Time& time1, const Time& time2); +JUCE_API bool operator>= (Time time1, Time time2); #endif // __JUCE_TIME_JUCEHEADER__ diff --git a/modules/juce_cryptography/hashing/juce_MD5.cpp b/modules/juce_cryptography/hashing/juce_MD5.cpp index c291036dad..3aae4ccf2d 100644 --- a/modules/juce_cryptography/hashing/juce_MD5.cpp +++ b/modules/juce_cryptography/hashing/juce_MD5.cpp @@ -216,7 +216,7 @@ MD5::MD5 (const void* data, const size_t numBytes) noexcept processData (data, numBytes); } -MD5::MD5 (const CharPointer_UTF8& utf8) noexcept +MD5::MD5 (CharPointer_UTF8 utf8) noexcept { jassert (utf8.getAddress() != nullptr); processData (utf8.getAddress(), utf8.sizeInBytes() - 1); diff --git a/modules/juce_cryptography/hashing/juce_MD5.h b/modules/juce_cryptography/hashing/juce_MD5.h index 5428529637..d4d69950d8 100644 --- a/modules/juce_cryptography/hashing/juce_MD5.h +++ b/modules/juce_cryptography/hashing/juce_MD5.h @@ -72,7 +72,7 @@ public: @code MD5 checksum (myString.toUTF8()); @endcode */ - explicit MD5 (const CharPointer_UTF8& utf8Text) noexcept; + explicit MD5 (CharPointer_UTF8 utf8Text) noexcept; /** Destructor. */ ~MD5() noexcept; diff --git a/modules/juce_cryptography/hashing/juce_SHA256.cpp b/modules/juce_cryptography/hashing/juce_SHA256.cpp index d75f7db6f1..d0086b974a 100644 --- a/modules/juce_cryptography/hashing/juce_SHA256.cpp +++ b/modules/juce_cryptography/hashing/juce_SHA256.cpp @@ -206,7 +206,7 @@ SHA256::SHA256 (const File& file) } } -SHA256::SHA256 (const CharPointer_UTF8& utf8) noexcept +SHA256::SHA256 (CharPointer_UTF8 utf8) noexcept { jassert (utf8.getAddress() != nullptr); process (utf8.getAddress(), utf8.sizeInBytes() - 1); diff --git a/modules/juce_cryptography/hashing/juce_SHA256.h b/modules/juce_cryptography/hashing/juce_SHA256.h index c868d9d6a6..88cdbb9eb6 100644 --- a/modules/juce_cryptography/hashing/juce_SHA256.h +++ b/modules/juce_cryptography/hashing/juce_SHA256.h @@ -82,7 +82,7 @@ public: @code SHA256 checksum (myString.toUTF8()); @endcode */ - explicit SHA256 (const CharPointer_UTF8& utf8Text) noexcept; + explicit SHA256 (CharPointer_UTF8 utf8Text) noexcept; //============================================================================== /** Returns the hash as a 32-byte block of data. */ diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index 433505d88a..f1321987ab 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -28,7 +28,7 @@ class ValueTree::SharedObject : public ReferenceCountedObject public: typedef ReferenceCountedObjectPtr Ptr; - explicit SharedObject (const Identifier& t) noexcept + explicit SharedObject (const Identifier t) noexcept : type (t), parent (nullptr) { } @@ -58,14 +58,14 @@ public: } } - void sendPropertyChangeMessage (ValueTree& tree, const Identifier& property) + void sendPropertyChangeMessage (ValueTree& tree, const Identifier property) { for (int i = valueTreesWithListeners.size(); --i >= 0;) if (ValueTree* const v = valueTreesWithListeners[i]) v->listeners.call (&ValueTree::Listener::valueTreePropertyChanged, tree, property); } - void sendPropertyChangeMessage (const Identifier& property) + void sendPropertyChangeMessage (const Identifier property) { ValueTree tree (this); @@ -131,17 +131,17 @@ public: v->listeners.call (&ValueTree::Listener::valueTreeParentChanged, tree); } - const var& getProperty (const Identifier& name) const noexcept + const var& getProperty (const Identifier name) const noexcept { return properties [name]; } - var getProperty (const Identifier& name, const var& defaultReturnValue) const + var getProperty (const Identifier name, const var& defaultReturnValue) const { return properties.getWithDefault (name, defaultReturnValue); } - void setProperty (const Identifier& name, const var& newValue, UndoManager* const undoManager) + void setProperty (const Identifier name, const var& newValue, UndoManager* const undoManager) { if (undoManager == nullptr) { @@ -162,12 +162,12 @@ public: } } - bool hasProperty (const Identifier& name) const noexcept + bool hasProperty (const Identifier name) const noexcept { return properties.contains (name); } - void removeProperty (const Identifier& name, UndoManager* const undoManager) + void removeProperty (const Identifier name, UndoManager* const undoManager) { if (undoManager == nullptr) { @@ -210,7 +210,7 @@ public: setProperty (source.properties.getName(i), source.properties.getValueAt(i), undoManager); } - ValueTree getChildWithName (const Identifier& typeToMatch) const + ValueTree getChildWithName (const Identifier typeToMatch) const { for (int i = 0; i < children.size(); ++i) { @@ -222,7 +222,7 @@ public: return ValueTree::invalid; } - ValueTree getOrCreateChildWithName (const Identifier& typeToMatch, UndoManager* undoManager) + ValueTree getOrCreateChildWithName (const Identifier typeToMatch, UndoManager* undoManager) { for (int i = 0; i < children.size(); ++i) { @@ -237,7 +237,7 @@ public: } - ValueTree getChildWithProperty (const Identifier& propertyName, const var& propertyValue) const + ValueTree getChildWithProperty (const Identifier propertyName, const var& propertyValue) const { for (int i = 0; i < children.size(); ++i) { @@ -444,7 +444,7 @@ public: class SetPropertyAction : public UndoableAction { public: - SetPropertyAction (SharedObject* const target_, const Identifier& name_, + SetPropertyAction (SharedObject* const target_, const Identifier name_, const var& newValue_, const var& oldValue_, const bool isAddingNewProperty_, const bool isDeletingProperty_) : target (target_), name (name_), newValue (newValue_), oldValue (oldValue_), @@ -616,7 +616,7 @@ ValueTree::ValueTree() noexcept const ValueTree ValueTree::invalid; -ValueTree::ValueTree (const Identifier& type_) +ValueTree::ValueTree (const Identifier type_) : object (new ValueTree::SharedObject (type_)) { jassert (type_.toString().isNotEmpty()); // All objects should be given a sensible type name! @@ -684,7 +684,7 @@ ValueTree ValueTree::createCopy() const return ValueTree (createCopyIfNotNull (object.get())); } -bool ValueTree::hasType (const Identifier& typeName) const +bool ValueTree::hasType (const Identifier typeName) const { return object != nullptr && object->type == typeName; } @@ -709,23 +709,23 @@ ValueTree ValueTree::getSibling (const int delta) const return ValueTree (object->parent->children.getObjectPointer (index)); } -const var& ValueTree::operator[] (const Identifier& name) const +const var& ValueTree::operator[] (const Identifier name) const { return object == nullptr ? var::null : object->getProperty (name); } -const var& ValueTree::getProperty (const Identifier& name) const +const var& ValueTree::getProperty (const Identifier name) const { return object == nullptr ? var::null : object->getProperty (name); } -var ValueTree::getProperty (const Identifier& name, const var& defaultReturnValue) const +var ValueTree::getProperty (const Identifier name, const var& defaultReturnValue) const { return object == nullptr ? defaultReturnValue : object->getProperty (name, defaultReturnValue); } -ValueTree& ValueTree::setProperty (const Identifier& name, const var& newValue, +ValueTree& ValueTree::setProperty (const Identifier name, const var& newValue, UndoManager* const undoManager) { jassert (name.toString().isNotEmpty()); // Must have a valid property name! @@ -737,12 +737,12 @@ ValueTree& ValueTree::setProperty (const Identifier& name, const var& newValue, return *this; } -bool ValueTree::hasProperty (const Identifier& name) const +bool ValueTree::hasProperty (const Identifier name) const { return object != nullptr && object->hasProperty (name); } -void ValueTree::removeProperty (const Identifier& name, UndoManager* const undoManager) +void ValueTree::removeProperty (const Identifier name, UndoManager* const undoManager) { if (object != nullptr) object->removeProperty (name, undoManager); @@ -780,7 +780,7 @@ class ValueTreePropertyValueSource : public Value::ValueSource, private ValueTree::Listener { public: - ValueTreePropertyValueSource (const ValueTree& vt, const Identifier& prop, UndoManager* um) + ValueTreePropertyValueSource (const ValueTree& vt, const Identifier prop, UndoManager* um) : tree (vt), property (prop), undoManager (um) { tree.addListener (this); @@ -800,21 +800,21 @@ private: UndoManager* const undoManager; void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged, - const Identifier& changedProperty) + const Identifier& changedProperty) override { if (tree == treeWhosePropertyHasChanged && property == changedProperty) sendChangeMessage (false); } - void valueTreeChildAdded (ValueTree&, ValueTree&) {} - void valueTreeChildRemoved (ValueTree&, ValueTree&) {} - void valueTreeChildOrderChanged (ValueTree&) {} - void valueTreeParentChanged (ValueTree&) {} + void valueTreeChildAdded (ValueTree&, ValueTree&) override {} + void valueTreeChildRemoved (ValueTree&, ValueTree&) override {} + void valueTreeChildOrderChanged (ValueTree&) override {} + void valueTreeParentChanged (ValueTree&) override {} JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ValueTreePropertyValueSource) }; -Value ValueTree::getPropertyAsValue (const Identifier& name, UndoManager* const undoManager) +Value ValueTree::getPropertyAsValue (const Identifier name, UndoManager* const undoManager) { return Value (new ValueTreePropertyValueSource (*this, name, undoManager)); } @@ -831,17 +831,17 @@ ValueTree ValueTree::getChild (int index) const : static_cast (nullptr)); } -ValueTree ValueTree::getChildWithName (const Identifier& type) const +ValueTree ValueTree::getChildWithName (const Identifier type) const { return object != nullptr ? object->getChildWithName (type) : ValueTree::invalid; } -ValueTree ValueTree::getOrCreateChildWithName (const Identifier& type, UndoManager* undoManager) +ValueTree ValueTree::getOrCreateChildWithName (const Identifier type, UndoManager* undoManager) { return object != nullptr ? object->getOrCreateChildWithName (type, undoManager) : ValueTree::invalid; } -ValueTree ValueTree::getChildWithProperty (const Identifier& propertyName, const var& propertyValue) const +ValueTree ValueTree::getChildWithProperty (const Identifier propertyName, const var& propertyValue) const { return object != nullptr ? object->getChildWithProperty (propertyName, propertyValue) : ValueTree::invalid; } @@ -923,7 +923,7 @@ void ValueTree::removeListener (Listener* listener) object->valueTreesWithListeners.removeValue (this); } -void ValueTree::sendPropertyChangeMessage (const Identifier& property) +void ValueTree::sendPropertyChangeMessage (const Identifier property) { if (object != nullptr) object->sendPropertyChangeMessage (property); diff --git a/modules/juce_data_structures/values/juce_ValueTree.h b/modules/juce_data_structures/values/juce_ValueTree.h index 5a88030604..60044b66e8 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.h +++ b/modules/juce_data_structures/values/juce_ValueTree.h @@ -83,7 +83,7 @@ public: Like an XmlElement, each ValueTree node has a type, which you can access with getType() and hasType(). */ - explicit ValueTree (const Identifier& type); + explicit ValueTree (const Identifier type); /** Creates a reference to another ValueTree. */ ValueTree (const ValueTree& other); @@ -138,7 +138,7 @@ public: /** Returns true if the node has this type. The comparison is case-sensitive. */ - bool hasType (const Identifier& typeName) const; + bool hasType (const Identifier typeName) const; //============================================================================== /** Returns the value of a named property. @@ -146,21 +146,21 @@ public: You can also use operator[] to get a property. @see var, setProperty, hasProperty */ - const var& getProperty (const Identifier& name) const; + const var& getProperty (const Identifier name) const; /** Returns the value of a named property, or a user-specified default if the property doesn't exist. If no such property has been set, this will return the value of defaultReturnValue. You can also use operator[] and getProperty to get a property. @see var, getProperty, setProperty, hasProperty */ - var getProperty (const Identifier& name, const var& defaultReturnValue) const; + var getProperty (const Identifier name, const var& defaultReturnValue) const; /** Returns the value of a named property. If no such property has been set, this will return a void variant. This is the same as calling getProperty(). @see getProperty */ - const var& operator[] (const Identifier& name) const; + const var& operator[] (const Identifier name) const; /** Changes a named property of the node. The name identifier must not be an empty string. @@ -169,16 +169,16 @@ public: @see var, getProperty, removeProperty @returns a reference to the value tree, so that you can daisy-chain calls to this method. */ - ValueTree& setProperty (const Identifier& name, const var& newValue, UndoManager* undoManager); + ValueTree& setProperty (const Identifier name, const var& newValue, UndoManager* undoManager); /** Returns true if the node contains a named property. */ - bool hasProperty (const Identifier& name) const; + bool hasProperty (const Identifier name) const; /** Removes a property from the node. If the undoManager parameter is non-null, its UndoManager::perform() method will be used, so that this change can be undone. */ - void removeProperty (const Identifier& name, UndoManager* undoManager); + void removeProperty (const Identifier name, UndoManager* undoManager); /** Removes all properties from the node. If the undoManager parameter is non-null, its UndoManager::perform() method will be used, @@ -202,7 +202,7 @@ public: it needs to change the value. Attaching a Value::Listener to the value object will provide callbacks whenever the property changes. */ - Value getPropertyAsValue (const Identifier& name, UndoManager* undoManager); + Value getPropertyAsValue (const Identifier name, UndoManager* undoManager); /** Overwrites all the properties in this tree with the properties of the source tree. Any properties that already exist will be updated; and new ones will be added, and @@ -227,7 +227,7 @@ public: whether a node is valid). @see getOrCreateChildWithName */ - ValueTree getChildWithName (const Identifier& type) const; + ValueTree getChildWithName (const Identifier type) const; /** Returns the first child node with the speficied type name, creating and adding a child with this name if there wasn't already one there. @@ -236,7 +236,7 @@ public: the method on is itself invalid. @see getChildWithName */ - ValueTree getOrCreateChildWithName (const Identifier& type, UndoManager* undoManager); + ValueTree getOrCreateChildWithName (const Identifier type, UndoManager* undoManager); /** Looks for the first child node that has the speficied property value. @@ -246,7 +246,7 @@ public: If no such node is found, it'll return an invalid node. (See isValid() to find out whether a node is valid). */ - ValueTree getChildWithProperty (const Identifier& propertyName, const var& propertyValue) const; + ValueTree getChildWithProperty (const Identifier propertyName, const var& propertyValue) const; /** Adds a child to this node. @@ -452,7 +452,7 @@ public: /** Causes a property-change callback to be triggered for the specified property, calling any listeners that are registered. */ - void sendPropertyChangeMessage (const Identifier& property); + void sendPropertyChangeMessage (const Identifier property); //============================================================================== /** This method uses a comparator object to sort the tree's children into order. diff --git a/modules/juce_graphics/colour/juce_Colour.cpp b/modules/juce_graphics/colour/juce_Colour.cpp index f2fc71b132..794f39214b 100644 --- a/modules/juce_graphics/colour/juce_Colour.cpp +++ b/modules/juce_graphics/colour/juce_Colour.cpp @@ -32,7 +32,7 @@ namespace ColourHelpers // This is an adjusted brightness value, based on the way the human // eye responds to different colour channels.. - static float getPerceivedBrightness (const Colour& c) noexcept + static float getPerceivedBrightness (Colour c) noexcept { const float r = c.getFloatRed(); const float g = c.getFloatGreen(); @@ -46,7 +46,7 @@ namespace ColourHelpers //============================================================================== struct HSB { - HSB (const Colour& col) noexcept + HSB (Colour col) noexcept { const int r = col.getRed(); const int g = col.getGreen(); @@ -92,7 +92,7 @@ namespace ColourHelpers brightness = hi / 255.0f; } - Colour toColour (const Colour& original) const noexcept + Colour toColour (Colour original) const noexcept { return Colour (hue, saturation, brightness, original.getAlpha()); } @@ -124,7 +124,7 @@ namespace ColourHelpers //============================================================================== struct YIQ { - YIQ (const Colour& c) noexcept + YIQ (Colour c) noexcept { const float r = c.getFloatRed(); const float g = c.getFloatGreen(); @@ -275,7 +275,7 @@ Colour Colour::withMultipliedAlpha (const float alphaMultiplier) const noexcept } //============================================================================== -Colour Colour::overlaidWith (const Colour& src) const noexcept +Colour Colour::overlaidWith (Colour src) const noexcept { const int destAlpha = getAlpha(); @@ -296,7 +296,7 @@ Colour Colour::overlaidWith (const Colour& src) const noexcept (uint8) resA); } -Colour Colour::interpolatedWith (const Colour& other, float proportionOfOther) const noexcept +Colour Colour::interpolatedWith (Colour other, float proportionOfOther) const noexcept { if (proportionOfOther <= 0) return *this; @@ -393,7 +393,7 @@ Colour Colour::contrasting (const float amount) const noexcept : Colours::white).withAlpha (amount)); } -Colour Colour::contrasting (const Colour& target, float minContrast) const noexcept +Colour Colour::contrasting (Colour target, float minContrast) const noexcept { const ColourHelpers::YIQ bg (*this); ColourHelpers::YIQ fg (target); @@ -408,8 +408,8 @@ Colour Colour::contrasting (const Colour& target, float minContrast) const noexc return fg.toColour(); } -Colour Colour::contrasting (const Colour& colour1, - const Colour& colour2) noexcept +Colour Colour::contrasting (Colour colour1, + Colour colour2) noexcept { const float b1 = ColourHelpers::getPerceivedBrightness (colour1); const float b2 = ColourHelpers::getPerceivedBrightness (colour2); diff --git a/modules/juce_graphics/colour/juce_Colour.h b/modules/juce_graphics/colour/juce_Colour.h index ce28a6ab17..fcda79cd07 100644 --- a/modules/juce_graphics/colour/juce_Colour.h +++ b/modules/juce_graphics/colour/juce_Colour.h @@ -231,14 +231,14 @@ public: If the foreground colour is semi-transparent, it is blended onto this colour accordingly. */ - Colour overlaidWith (const Colour& foregroundColour) const noexcept; + Colour overlaidWith (Colour foregroundColour) const noexcept; /** Returns a colour that lies somewhere between this one and another. If amountOfOther is zero, the result is 100% this colour, if amountOfOther is 1.0, the result is 100% of the other colour. */ - Colour interpolatedWith (const Colour& other, float proportionOfOther) const noexcept; + Colour interpolatedWith (Colour other, float proportionOfOther) const noexcept; //============================================================================== /** Returns the colour's hue component. @@ -331,14 +331,14 @@ public: nudged up or down so that it differs from the luminosity of this colour by at least the amount specified by minLuminosityDiff. */ - Colour contrasting (const Colour& targetColour, float minLuminosityDiff) const noexcept; + Colour contrasting (Colour targetColour, float minLuminosityDiff) const noexcept; /** Returns a colour that contrasts against two colours. Looks for a colour that contrasts with both of the colours passed-in. Handy for things like choosing a highlight colour in text editors, etc. */ - static Colour contrasting (const Colour& colour1, - const Colour& colour2) noexcept; + static Colour contrasting (Colour colour1, + Colour colour2) noexcept; //============================================================================== /** Returns an opaque shade of grey. diff --git a/modules/juce_graphics/colour/juce_ColourGradient.cpp b/modules/juce_graphics/colour/juce_ColourGradient.cpp index 9a2ba6945d..3ced696cdc 100644 --- a/modules/juce_graphics/colour/juce_ColourGradient.cpp +++ b/modules/juce_graphics/colour/juce_ColourGradient.cpp @@ -33,8 +33,8 @@ ColourGradient::ColourGradient() noexcept #endif } -ColourGradient::ColourGradient (const Colour& colour1, const float x1_, const float y1_, - const Colour& colour2, const float x2_, const float y2_, +ColourGradient::ColourGradient (Colour colour1, const float x1_, const float y1_, + Colour colour2, const float x2_, const float y2_, const bool isRadial_) : point1 (x1_, y1_), point2 (x2_, y2_), @@ -66,7 +66,7 @@ void ColourGradient::clearColours() colours.clear(); } -int ColourGradient::addColour (const double proportionAlongGradient, const Colour& colour) +int ColourGradient::addColour (const double proportionAlongGradient, Colour colour) { // must be within the two end-points jassert (proportionAlongGradient >= 0 && proportionAlongGradient <= 1.0); @@ -119,7 +119,7 @@ Colour ColourGradient::getColour (const int index) const noexcept return Colour(); } -void ColourGradient::setColour (int index, const Colour& newColour) noexcept +void ColourGradient::setColour (int index, Colour newColour) noexcept { if (isPositiveAndBelow (index, colours.size())) colours.getReference (index).colour = newColour; diff --git a/modules/juce_graphics/colour/juce_ColourGradient.h b/modules/juce_graphics/colour/juce_ColourGradient.h index 59c5033b7b..33361314d5 100644 --- a/modules/juce_graphics/colour/juce_ColourGradient.h +++ b/modules/juce_graphics/colour/juce_ColourGradient.h @@ -57,8 +57,8 @@ public: @see ColourGradient */ - ColourGradient (const Colour& colour1, float x1, float y1, - const Colour& colour2, float x2, float y2, + ColourGradient (Colour colour1, float x1, float y1, + Colour colour2, float x2, float y2, bool isRadial); /** Creates an uninitialised gradient. @@ -91,7 +91,7 @@ public: @returns the index at which the new point was added */ int addColour (double proportionAlongGradient, - const Colour& colour); + Colour colour); /** Removes one of the colours from the gradient. */ void removeColour (int index); @@ -117,7 +117,7 @@ public: /** Changes the colour at a given index. The index is from 0 to getNumColours() - 1. */ - void setColour (int index, const Colour& newColour) noexcept; + void setColour (int index, Colour newColour) noexcept; /** Returns the an interpolated colour at any position along the gradient. @param position the position along the gradient, between 0 and 1 @@ -165,7 +165,7 @@ private: { ColourPoint() noexcept {} - ColourPoint (const double pos, const Colour& col) noexcept + ColourPoint (const double pos, Colour col) noexcept : position (pos), colour (col) {} diff --git a/modules/juce_graphics/colour/juce_Colours.cpp b/modules/juce_graphics/colour/juce_Colours.cpp index 65d4c36d8b..fa52227186 100644 --- a/modules/juce_graphics/colour/juce_Colours.cpp +++ b/modules/juce_graphics/colour/juce_Colours.cpp @@ -166,7 +166,7 @@ const Colour Colours::yellowgreen (0xff9acd32); //============================================================================== Colour Colours::findColourForName (const String& colourName, - const Colour& defaultColour) + Colour defaultColour) { static const uint32 presets[] = { diff --git a/modules/juce_graphics/colour/juce_Colours.h b/modules/juce_graphics/colour/juce_Colours.h index 9871516c8b..1b57fbecdb 100644 --- a/modules/juce_graphics/colour/juce_Colours.h +++ b/modules/juce_graphics/colour/juce_Colours.h @@ -96,7 +96,7 @@ public: colour passed in as the defaultColour parameter is returned. */ static JUCE_API Colour findColourForName (const String& colourName, - const Colour& defaultColour); + Colour defaultColour); private: //============================================================================== diff --git a/modules/juce_graphics/colour/juce_FillType.cpp b/modules/juce_graphics/colour/juce_FillType.cpp index 9e2806ca6e..1289aec117 100644 --- a/modules/juce_graphics/colour/juce_FillType.cpp +++ b/modules/juce_graphics/colour/juce_FillType.cpp @@ -28,8 +28,8 @@ FillType::FillType() noexcept { } -FillType::FillType (const Colour& colour_) noexcept - : colour (colour_) +FillType::FillType (Colour c) noexcept + : colour (c) { } @@ -102,7 +102,7 @@ bool FillType::operator!= (const FillType& other) const return ! operator== (other); } -void FillType::setColour (const Colour& newColour) noexcept +void FillType::setColour (Colour newColour) noexcept { gradient = nullptr; image = Image::null; diff --git a/modules/juce_graphics/colour/juce_FillType.h b/modules/juce_graphics/colour/juce_FillType.h index 1a59ad19d0..e95b1aa9f7 100644 --- a/modules/juce_graphics/colour/juce_FillType.h +++ b/modules/juce_graphics/colour/juce_FillType.h @@ -49,7 +49,7 @@ public: /** Creates a fill type of a solid colour. @see setColour */ - FillType (const Colour& colour) noexcept; + FillType (Colour colour) noexcept; /** Creates a gradient fill type. @see setGradient @@ -88,7 +88,7 @@ public: /** Turns this object into a solid colour fill. If the object was an image or gradient, those fields will no longer be valid. */ - void setColour (const Colour& newColour) noexcept; + void setColour (Colour newColour) noexcept; /** Turns this object into a gradient fill. */ void setGradient (const ColourGradient& newGradient); diff --git a/modules/juce_graphics/colour/juce_PixelFormats.h b/modules/juce_graphics/colour/juce_PixelFormats.h index 5dffef611c..4e8c854d9f 100644 --- a/modules/juce_graphics/colour/juce_PixelFormats.h +++ b/modules/juce_graphics/colour/juce_PixelFormats.h @@ -112,7 +112,7 @@ public: This takes into account the opacity of the pixel being overlaid, and blends it accordingly. */ - forcedinline void blend (const PixelRGB& src) noexcept; + forcedinline void blend (const PixelRGB src) noexcept; /** Blends another pixel onto this one, applying an extra multiplier to its opacity. @@ -358,7 +358,7 @@ public: b = (uint8) sargb; } - forcedinline void blend (const PixelRGB& src) noexcept + forcedinline void blend (const PixelRGB src) noexcept { set (src); } @@ -467,7 +467,7 @@ private: #endif ; -forcedinline void PixelARGB::blend (const PixelRGB& src) noexcept +forcedinline void PixelARGB::blend (const PixelRGB src) noexcept { set (src); } diff --git a/modules/juce_graphics/contexts/juce_GraphicsContext.cpp b/modules/juce_graphics/contexts/juce_GraphicsContext.cpp index 9ff39ad3c4..2bfc7dd007 100644 --- a/modules/juce_graphics/contexts/juce_GraphicsContext.cpp +++ b/modules/juce_graphics/contexts/juce_GraphicsContext.cpp @@ -174,7 +174,7 @@ void Graphics::endTransparencyLayer() } //============================================================================== -void Graphics::setColour (const Colour& newColour) +void Graphics::setColour (Colour newColour) { saveStateIfPending(); context.setFill (newColour); @@ -369,7 +369,7 @@ void Graphics::fillAll() const fillRect (context.getClipBounds()); } -void Graphics::fillAll (const Colour& colourToUse) const +void Graphics::fillAll (Colour colourToUse) const { if (! colourToUse.isTransparent()) { @@ -503,7 +503,7 @@ void Graphics::drawArrow (const Line& line, const float lineThickness, co void Graphics::fillCheckerBoard (const Rectangle& area, const int checkWidth, const int checkHeight, - const Colour& colour1, const Colour& colour2) const + Colour colour1, Colour colour2) const { jassert (checkWidth > 0 && checkHeight > 0); // can't be zero or less! diff --git a/modules/juce_graphics/contexts/juce_GraphicsContext.h b/modules/juce_graphics/contexts/juce_GraphicsContext.h index 2c0cf59b66..c638eda367 100644 --- a/modules/juce_graphics/contexts/juce_GraphicsContext.h +++ b/modules/juce_graphics/contexts/juce_GraphicsContext.h @@ -81,7 +81,7 @@ public: @see setOpacity */ - void setColour (const Colour& newColour); + void setColour (Colour newColour); /** Changes the opacity to use with the current colour. @@ -251,7 +251,7 @@ public: //============================================================================== /** Fills the context's entire clip region with the current colour or brush. - (See also the fillAll (const Colour&) method which is a quick way of filling + (See also the fillAll (Colour) method which is a quick way of filling it with a given colour). */ void fillAll() const; @@ -261,7 +261,7 @@ public: This leaves the context's current colour and brush unchanged, it just uses the specified colour temporarily. */ - void fillAll (const Colour& colourToUse) const; + void fillAll (Colour colourToUse) const; //============================================================================== /** Fills a rectangle with the current colour or brush. @@ -301,7 +301,7 @@ public: */ void fillCheckerBoard (const Rectangle& area, int checkWidth, int checkHeight, - const Colour& colour1, const Colour& colour2) const; + Colour colour1, Colour colour2) const; /** Draws four lines to form a rectangular outline, using the current colour or brush. diff --git a/modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp b/modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp index 346b83d382..1b8c2eeb75 100644 --- a/modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp +++ b/modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp @@ -28,7 +28,7 @@ LowLevelGraphicsSoftwareRenderer::LowLevelGraphicsSoftwareRenderer (const Image& { } -LowLevelGraphicsSoftwareRenderer::LowLevelGraphicsSoftwareRenderer (const Image& image, const Point& origin, +LowLevelGraphicsSoftwareRenderer::LowLevelGraphicsSoftwareRenderer (const Image& image, Point origin, const RectangleList& initialClip) : savedState (new RenderingHelpers::SoftwareRendererSavedState (image, initialClip, origin.x, origin.y)) { diff --git a/modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h b/modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h index e9770402ce..e4c49ca856 100644 --- a/modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h +++ b/modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h @@ -42,7 +42,7 @@ class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsCon public: //============================================================================== LowLevelGraphicsSoftwareRenderer (const Image& imageToRenderOnto); - LowLevelGraphicsSoftwareRenderer (const Image& imageToRenderOnto, const Point& origin, + LowLevelGraphicsSoftwareRenderer (const Image& imageToRenderOnto, Point origin, const RectangleList& initialClip); ~LowLevelGraphicsSoftwareRenderer(); diff --git a/modules/juce_graphics/effects/juce_DropShadowEffect.cpp b/modules/juce_graphics/effects/juce_DropShadowEffect.cpp index b3904494c4..5fd6f19d5b 100644 --- a/modules/juce_graphics/effects/juce_DropShadowEffect.cpp +++ b/modules/juce_graphics/effects/juce_DropShadowEffect.cpp @@ -69,7 +69,7 @@ DropShadow::DropShadow() noexcept { } -DropShadow::DropShadow (const Colour& shadowColour, const int r, const Point& o) noexcept +DropShadow::DropShadow (Colour shadowColour, const int r, Point o) noexcept : colour (shadowColour), radius (r), offset (o) { jassert (radius > 0); diff --git a/modules/juce_graphics/effects/juce_DropShadowEffect.h b/modules/juce_graphics/effects/juce_DropShadowEffect.h index 8e3996e592..965d60f7c5 100644 --- a/modules/juce_graphics/effects/juce_DropShadowEffect.h +++ b/modules/juce_graphics/effects/juce_DropShadowEffect.h @@ -39,7 +39,7 @@ struct JUCE_API DropShadow DropShadow() noexcept; /** Creates a drop-shadow object with the given parameters. */ - DropShadow (const Colour& shadowColour, int radius, const Point& offset) noexcept; + DropShadow (Colour shadowColour, int radius, Point offset) noexcept; /** Renders a drop-shadow based on the alpha-channel of the given image. */ void drawForImage (Graphics& g, const Image& srcImage) const; diff --git a/modules/juce_graphics/effects/juce_GlowEffect.cpp b/modules/juce_graphics/effects/juce_GlowEffect.cpp index e8d6478419..cdda9b12e2 100644 --- a/modules/juce_graphics/effects/juce_GlowEffect.cpp +++ b/modules/juce_graphics/effects/juce_GlowEffect.cpp @@ -34,7 +34,7 @@ GlowEffect::~GlowEffect() } void GlowEffect::setGlowProperties (const float newRadius, - const Colour& newColour) + Colour newColour) { radius = newRadius; colour = newColour; diff --git a/modules/juce_graphics/effects/juce_GlowEffect.h b/modules/juce_graphics/effects/juce_GlowEffect.h index e6540e4622..ae50bf501b 100644 --- a/modules/juce_graphics/effects/juce_GlowEffect.h +++ b/modules/juce_graphics/effects/juce_GlowEffect.h @@ -58,7 +58,7 @@ public: opacity). */ void setGlowProperties (float newRadius, - const Colour& newColour); + Colour newColour); //============================================================================== diff --git a/modules/juce_graphics/fonts/juce_AttributedString.cpp b/modules/juce_graphics/fonts/juce_AttributedString.cpp index 4dfb91fde9..d1b979b5b1 100644 --- a/modules/juce_graphics/fonts/juce_AttributedString.cpp +++ b/modules/juce_graphics/fonts/juce_AttributedString.cpp @@ -23,12 +23,12 @@ ============================================================================== */ -AttributedString::Attribute::Attribute (const Range& range_, const Colour& colour_) +AttributedString::Attribute::Attribute (Range range_, Colour colour_) : range (range_), colour (new Colour (colour_)) { } -AttributedString::Attribute::Attribute (const Range& range_, const Font& font_) +AttributedString::Attribute::Attribute (Range range_, const Font& font_) : range (range_), font (new Font (font_)) { } @@ -137,7 +137,7 @@ void AttributedString::append (const String& textToAppend, const Font& font) setFont (Range (oldLength, oldLength + newLength), font); } -void AttributedString::append (const String& textToAppend, const Colour& colour) +void AttributedString::append (const String& textToAppend, Colour colour) { const int oldLength = text.length(); const int newLength = textToAppend.length(); @@ -146,7 +146,7 @@ void AttributedString::append (const String& textToAppend, const Colour& colour) setColour (Range (oldLength, oldLength + newLength), colour); } -void AttributedString::append (const String& textToAppend, const Font& font, const Colour& colour) +void AttributedString::append (const String& textToAppend, const Font& font, Colour colour) { const int oldLength = text.length(); const int newLength = textToAppend.length(); @@ -191,12 +191,12 @@ void AttributedString::setLineSpacing (const float newLineSpacing) noexcept lineSpacing = newLineSpacing; } -void AttributedString::setColour (const Range& range, const Colour& colour) +void AttributedString::setColour (Range range, Colour colour) { attributes.add (new Attribute (range, colour)); } -void AttributedString::setColour (const Colour& colour) +void AttributedString::setColour (Colour colour) { for (int i = attributes.size(); --i >= 0;) if (attributes.getUnchecked(i)->getColour() != nullptr) @@ -205,7 +205,7 @@ void AttributedString::setColour (const Colour& colour) setColour (Range (0, text.length()), colour); } -void AttributedString::setFont (const Range& range, const Font& font) +void AttributedString::setFont (Range range, const Font& font) { attributes.add (new Attribute (range, font)); } diff --git a/modules/juce_graphics/fonts/juce_AttributedString.h b/modules/juce_graphics/fonts/juce_AttributedString.h index 0a21dbe000..3ae6562df1 100644 --- a/modules/juce_graphics/fonts/juce_AttributedString.h +++ b/modules/juce_graphics/fonts/juce_AttributedString.h @@ -71,9 +71,9 @@ public: /** Appends some text, with a specified font, and the default colour (black). */ void append (const String& textToAppend, const Font& font); /** Appends some text, with a specified colour, and the default font. */ - void append (const String& textToAppend, const Colour& colour); + void append (const String& textToAppend, Colour colour); /** Appends some text, with a specified font and colour. */ - void append (const String& textToAppend, const Font& font, const Colour& colour); + void append (const String& textToAppend, const Font& font, Colour colour); /** Appends another AttributedString to this one. Note that this will only append the text, fonts, and colours - it won't copy any @@ -154,12 +154,12 @@ public: /** Creates an attribute that changes the colour for a range of characters. @see AttributedString::setColour() */ - Attribute (const Range& range, const Colour& colour); + Attribute (Range range, Colour colour); /** Creates an attribute that changes the font for a range of characters. @see AttributedString::setFont() */ - Attribute (const Range& range, const Font& font); + Attribute (Range range, const Font& font); Attribute (const Attribute&); ~Attribute(); @@ -194,13 +194,13 @@ public: //============================================================================== /** Adds a colour attribute for the specified range. */ - void setColour (const Range& range, const Colour& colour); + void setColour (Range range, Colour colour); /** Removes all existing colour attributes, and applies this colour to the whole string. */ - void setColour (const Colour& colour); + void setColour (Colour colour); /** Adds a font attribute for the specified range. */ - void setFont (const Range& range, const Font& font); + void setFont (Range range, const Font& font); /** Removes all existing font attributes, and applies this font to the whole string. */ void setFont (const Font& font); diff --git a/modules/juce_graphics/fonts/juce_TextLayout.cpp b/modules/juce_graphics/fonts/juce_TextLayout.cpp index aa4b28254c..09041f8ebe 100644 --- a/modules/juce_graphics/fonts/juce_TextLayout.cpp +++ b/modules/juce_graphics/fonts/juce_TextLayout.cpp @@ -23,7 +23,7 @@ ============================================================================== */ -TextLayout::Glyph::Glyph (const int glyphCode_, const Point& anchor_, float width_) noexcept +TextLayout::Glyph::Glyph (const int glyphCode_, Point anchor_, float width_) noexcept : glyphCode (glyphCode_), anchor (anchor_), width (width_) { } @@ -49,7 +49,7 @@ TextLayout::Run::Run() noexcept { } -TextLayout::Run::Run (const Range& range, const int numGlyphsToPreallocate) +TextLayout::Run::Run (Range range, const int numGlyphsToPreallocate) : colour (0xff000000), stringRange (range) { glyphs.ensureStorageAllocated (numGlyphsToPreallocate); @@ -71,7 +71,7 @@ TextLayout::Line::Line() noexcept { } -TextLayout::Line::Line (const Range& stringRange_, const Point& lineOrigin_, +TextLayout::Line::Line (Range stringRange_, Point lineOrigin_, const float ascent_, const float descent_, const float leading_, const int numRunsToPreallocate) : stringRange (stringRange_), lineOrigin (lineOrigin_), @@ -251,7 +251,7 @@ namespace TextLayoutHelpers struct RunAttribute { - RunAttribute (const FontAndColour& fc, const Range& r) noexcept + RunAttribute (const FontAndColour& fc, const Range r) noexcept : fontAndColour (fc), range (r) {} @@ -415,7 +415,7 @@ namespace TextLayoutHelpers return CharacterFunctions::isWhitespace (c) ? 2 : 1; } - void appendText (const AttributedString& text, const Range& stringRange, + void appendText (const AttributedString& text, const Range stringRange, const Font& font, const Colour& colour) { const String stringText (text.getText().substring (stringRange.getStart(), stringRange.getEnd())); diff --git a/modules/juce_graphics/fonts/juce_TextLayout.h b/modules/juce_graphics/fonts/juce_TextLayout.h index a611be0984..d9dd629312 100644 --- a/modules/juce_graphics/fonts/juce_TextLayout.h +++ b/modules/juce_graphics/fonts/juce_TextLayout.h @@ -82,7 +82,7 @@ public: class JUCE_API Glyph { public: - Glyph (int glyphCode, const Point& anchor, float width) noexcept; + Glyph (int glyphCode, Point anchor, float width) noexcept; Glyph (const Glyph&) noexcept; Glyph& operator= (const Glyph&) noexcept; ~Glyph() noexcept; @@ -108,7 +108,7 @@ public: public: Run() noexcept; Run (const Run&); - Run (const Range& stringRange, int numGlyphsToPreallocate); + Run (Range stringRange, int numGlyphsToPreallocate); ~Run() noexcept; Font font; /**< The run's font. */ @@ -128,7 +128,7 @@ public: public: Line() noexcept; Line (const Line&); - Line (const Range& stringRange, const Point& lineOrigin, + Line (Range stringRange, Point lineOrigin, float ascent, float descent, float leading, int numRunsToPreallocate); ~Line() noexcept; diff --git a/modules/juce_graphics/geometry/juce_Path.cpp b/modules/juce_graphics/geometry/juce_Path.cpp index a04108464f..e6a5850ef8 100644 --- a/modules/juce_graphics/geometry/juce_Path.cpp +++ b/modules/juce_graphics/geometry/juce_Path.cpp @@ -271,7 +271,7 @@ void Path::startNewSubPath (const float x, const float y) data.elements [numElements++] = y; } -void Path::startNewSubPath (const Point& start) +void Path::startNewSubPath (const Point start) { startNewSubPath (start.x, start.y); } @@ -292,7 +292,7 @@ void Path::lineTo (const float x, const float y) bounds.extend (x, y); } -void Path::lineTo (const Point& end) +void Path::lineTo (const Point end) { lineTo (end.x, end.y); } @@ -317,8 +317,8 @@ void Path::quadraticTo (const float x1, const float y1, bounds.extend (x1, y1, x2, y2); } -void Path::quadraticTo (const Point& controlPoint, - const Point& endPoint) +void Path::quadraticTo (const Point controlPoint, + const Point endPoint) { quadraticTo (controlPoint.x, controlPoint.y, endPoint.x, endPoint.y); @@ -349,9 +349,9 @@ void Path::cubicTo (const float x1, const float y1, bounds.extend (x3, y3); } -void Path::cubicTo (const Point& controlPoint1, - const Point& controlPoint2, - const Point& endPoint) +void Path::cubicTo (const Point controlPoint1, + const Point controlPoint2, + const Point endPoint) { cubicTo (controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, @@ -676,7 +676,7 @@ void Path::addArrow (const Line& line, float lineThickness, closeSubPath(); } -void Path::addPolygon (const Point& centre, const int numberOfSides, +void Path::addPolygon (const Point centre, const int numberOfSides, const float radius, const float startAngle) { jassert (numberOfSides > 1); // this would be silly. @@ -700,7 +700,7 @@ void Path::addPolygon (const Point& centre, const int numberOfSides, } } -void Path::addStar (const Point& centre, const int numberOfPoints, +void Path::addStar (const Point centre, const int numberOfPoints, const float innerRadius, const float outerRadius, const float startAngle) { jassert (numberOfPoints > 1); // this would be silly. @@ -728,7 +728,7 @@ void Path::addStar (const Point& centre, const int numberOfPoints, void Path::addBubble (const Rectangle& bodyArea, const Rectangle& maximumArea, - const Point& arrowTip, + const Point arrowTip, const float cornerSize, const float arrowBaseWidth) { @@ -1023,7 +1023,7 @@ bool Path::contains (const float x, const float y, const float tolerance) const : ((negativeCrossings + positiveCrossings) & 1) != 0; } -bool Path::contains (const Point& point, const float tolerance) const +bool Path::contains (const Point point, const float tolerance) const { return contains (point.x, point.y, tolerance); } @@ -1100,7 +1100,7 @@ Point Path::getPointAlongPath (float distanceFromStart, const AffineTrans return Point (i.x2, i.y2); } -float Path::getNearestPoint (const Point& targetPoint, Point& pointOnPath, +float Path::getNearestPoint (const Point targetPoint, Point& pointOnPath, const AffineTransform& transform) const { PathFlatteningIterator i (*this, transform); diff --git a/modules/juce_graphics/geometry/juce_Path.h b/modules/juce_graphics/geometry/juce_Path.h index 8df5cbd38e..163071a415 100644 --- a/modules/juce_graphics/geometry/juce_Path.h +++ b/modules/juce_graphics/geometry/juce_Path.h @@ -134,7 +134,7 @@ public: @see closeSubPath, setUsingNonZeroWinding */ - bool contains (const Point& point, + bool contains (const Point point, float tolerance = 1.0f) const; /** Checks whether a line crosses the path. @@ -181,7 +181,7 @@ public: This sets pointOnPath to the nearest point, and returns the distance of this point from the start of the path. */ - float getNearestPoint (const Point& targetPoint, + float getNearestPoint (const Point targetPoint, Point& pointOnPath, const AffineTransform& transform = AffineTransform::identity) const; @@ -213,7 +213,7 @@ public: @see lineTo, quadraticTo, cubicTo, closeSubPath */ - void startNewSubPath (const Point& start); + void startNewSubPath (const Point start); /** Closes a the current sub-path with a line back to its start-point. @@ -249,7 +249,7 @@ public: @see startNewSubPath, quadraticTo, cubicTo, closeSubPath */ - void lineTo (const Point& end); + void lineTo (const Point end); /** Adds a quadratic bezier curve from the shape's last position to a new position. @@ -274,8 +274,8 @@ public: @see startNewSubPath, lineTo, cubicTo, closeSubPath */ - void quadraticTo (const Point& controlPoint, - const Point& endPoint); + void quadraticTo (const Point controlPoint, + const Point endPoint); /** Adds a cubic bezier curve from the shape's last position to a new position. @@ -302,9 +302,9 @@ public: @see startNewSubPath, lineTo, quadraticTo, closeSubPath */ - void cubicTo (const Point& controlPoint1, - const Point& controlPoint2, - const Point& endPoint); + void cubicTo (const Point controlPoint1, + const Point controlPoint2, + const Point endPoint); /** Returns the last point that was added to the path by one of the drawing methods. */ @@ -512,7 +512,7 @@ public: /** Adds a polygon shape to the path. @see addStar */ - void addPolygon (const Point& centre, + void addPolygon (const Point centre, int numberOfSides, float radius, float startAngle = 0.0f); @@ -520,7 +520,7 @@ public: /** Adds a star shape to the path. @see addPolygon */ - void addStar (const Point& centre, + void addStar (const Point centre, int numberOfPoints, float innerRadius, float outerRadius, @@ -538,7 +538,7 @@ public: */ void addBubble (const Rectangle& bodyArea, const Rectangle& maximumArea, - const Point& arrowTipPosition, + const Point arrowTipPosition, const float cornerSize, const float arrowBaseWidth); diff --git a/modules/juce_graphics/geometry/juce_Point.h b/modules/juce_graphics/geometry/juce_Point.h index 0b3fa52d18..d230135bcf 100644 --- a/modules/juce_graphics/geometry/juce_Point.h +++ b/modules/juce_graphics/geometry/juce_Point.h @@ -59,8 +59,8 @@ public: /** Copies this point from another one. */ Point& operator= (const Point& other) noexcept { x = other.x; y = other.y; return *this; } - inline bool operator== (const Point& other) const noexcept { return x == other.x && y == other.y; } - inline bool operator!= (const Point& other) const noexcept { return x != other.x || y != other.y; } + inline bool operator== (Point other) const noexcept { return x == other.x && y == other.y; } + inline bool operator!= (Point other) const noexcept { return x != other.x || y != other.y; } /** Returns true if the point is (0, 0). */ bool isOrigin() const noexcept { return x == ValueType() && y == ValueType(); } @@ -93,16 +93,16 @@ public: Point translated (const ValueType xDelta, const ValueType yDelta) const noexcept { return Point (x + xDelta, y + yDelta); } /** Adds two points together. */ - Point operator+ (const Point& other) const noexcept { return Point (x + other.x, y + other.y); } + Point operator+ (Point other) const noexcept { return Point (x + other.x, y + other.y); } /** Adds another point's co-ordinates to this one. */ - Point& operator+= (const Point& other) noexcept { x += other.x; y += other.y; return *this; } + Point& operator+= (Point other) noexcept { x += other.x; y += other.y; return *this; } /** Subtracts one points from another. */ - Point operator- (const Point& other) const noexcept { return Point (x - other.x, y - other.y); } + Point operator- (Point other) const noexcept { return Point (x - other.x, y - other.y); } /** Subtracts another point's co-ordinates to this one. */ - Point& operator-= (const Point& other) noexcept { x -= other.x; y -= other.y; return *this; } + Point& operator-= (Point other) noexcept { x -= other.x; y -= other.y; return *this; } /** Returns a point whose coordinates are multiplied by a given value. */ Point operator* (const ValueType multiplier) const noexcept { return Point (x * multiplier, y * multiplier); } @@ -123,7 +123,7 @@ public: ValueType getDistanceFromOrigin() const noexcept { return juce_hypot (x, y); } /** Returns the straight-line distance between this point and another one. */ - ValueType getDistanceFrom (const Point& other) const noexcept { return juce_hypot (x - other.x, y - other.y); } + ValueType getDistanceFrom (Point other) const noexcept { return juce_hypot (x - other.x, y - other.y); } /** This type will be double if the Point's type is double, otherwise it will be float. */ typedef typename TypeHelpers::SmallestFloatType::type FloatType; @@ -133,7 +133,7 @@ public: The return value is the number of radians clockwise from the 12 o'clock direction, where this point is the centre and the other point is on the circumference. */ - FloatType getAngleToPoint (const Point& other) const noexcept + FloatType getAngleToPoint (Point other) const noexcept { return static_cast (std::atan2 (other.x - x, y - other.y)); } /** Taking this point to be the centre of a circle, this returns a point on its circumference. @@ -165,7 +165,7 @@ public: transform.mat10 * x + transform.mat11 * y + transform.mat12); } /** Returns the dot-product of two points (x1 * x2 + y1 * y2). */ - FloatType getDotProduct (const Point& other) const noexcept { return x * other.x + y * other.y; } + FloatType getDotProduct (Point other) const noexcept { return x * other.x + y * other.y; } /** Casts this point to a Point object. */ Point toInt() const noexcept { return Point (static_cast (x), static_cast (y)); } diff --git a/modules/juce_graphics/images/juce_Image.cpp b/modules/juce_graphics/images/juce_Image.cpp index 8d7bba1e7c..dc52f1e33b 100644 --- a/modules/juce_graphics/images/juce_Image.cpp +++ b/modules/juce_graphics/images/juce_Image.cpp @@ -392,7 +392,7 @@ Colour Image::BitmapData::getPixelColour (const int x, const int y) const noexce return Colour(); } -void Image::BitmapData::setPixelColour (const int x, const int y, const Colour& colour) const noexcept +void Image::BitmapData::setPixelColour (const int x, const int y, Colour colour) const noexcept { jassert (isPositiveAndBelow (x, width) && isPositiveAndBelow (y, height)); @@ -409,7 +409,7 @@ void Image::BitmapData::setPixelColour (const int x, const int y, const Colour& } //============================================================================== -void Image::clear (const Rectangle& area, const Colour& colourToClearTo) +void Image::clear (const Rectangle& area, Colour colourToClearTo) { const ScopedPointer g (image->createLowLevelContext()); g->setFill (colourToClearTo); @@ -428,7 +428,7 @@ Colour Image::getPixelAt (const int x, const int y) const return Colour(); } -void Image::setPixelAt (const int x, const int y, const Colour& colour) +void Image::setPixelAt (const int x, const int y, Colour colour) { if (isPositiveAndBelow (x, getWidth()) && isPositiveAndBelow (y, getHeight())) { diff --git a/modules/juce_graphics/images/juce_Image.h b/modules/juce_graphics/images/juce_Image.h index 82afa25b0c..f444bdfd07 100644 --- a/modules/juce_graphics/images/juce_Image.h +++ b/modules/juce_graphics/images/juce_Image.h @@ -188,7 +188,7 @@ public: This won't do any alpha-blending - it just sets all pixels in the image to the given colour (which may be non-opaque if the image has an alpha channel). */ - void clear (const Rectangle& area, const Colour& colourToClearTo = Colour (0x00000000)); + void clear (const Rectangle& area, Colour colourToClearTo = Colour (0x00000000)); /** Returns a rescaled version of this image. @@ -262,7 +262,7 @@ public: @see getPixelAt, Image::BitmapData::setPixelColour */ - void setPixelAt (int x, int y, const Colour& colour); + void setPixelAt (int x, int y, Colour colour); /** Changes the opacity of a pixel. @@ -344,7 +344,7 @@ public: For performance reasons, this won't do any bounds-checking on the coordinates, so it's the caller's repsonsibility to make sure they're within the image's size. */ - void setPixelColour (int x, int y, const Colour& colour) const noexcept; + void setPixelColour (int x, int y, Colour colour) const noexcept; /** Returns the size of the bitmap. */ Rectangle getBounds() const noexcept { return Rectangle (width, height); } diff --git a/modules/juce_graphics/native/juce_RenderingHelpers.h b/modules/juce_graphics/native/juce_RenderingHelpers.h index 5d591076fa..4da6b2fa6c 100644 --- a/modules/juce_graphics/native/juce_RenderingHelpers.h +++ b/modules/juce_graphics/native/juce_RenderingHelpers.h @@ -581,7 +581,7 @@ namespace EdgeTableFillers class SolidColour { public: - SolidColour (const Image::BitmapData& image, const PixelARGB& colour) + SolidColour (const Image::BitmapData& image, const PixelARGB colour) : destData (image), sourceColour (colour) { if (sizeof (PixelType) == 3 && destData.pixelStride == sizeof (PixelType)) @@ -651,12 +651,12 @@ namespace EdgeTableFillers return addBytesToPointer (linePixels, x * destData.pixelStride); } - inline void blendLine (PixelType* dest, const PixelARGB& colour, int width) const noexcept + inline void blendLine (PixelType* dest, const PixelARGB colour, int width) const noexcept { JUCE_PERFORM_PIXEL_OP_LOOP (blend (colour)) } - forcedinline void replaceLine (PixelRGB* dest, const PixelARGB& colour, int width) const noexcept + forcedinline void replaceLine (PixelRGB* dest, const PixelARGB colour, int width) const noexcept { if (destData.pixelStride == sizeof (*dest)) { @@ -701,7 +701,7 @@ namespace EdgeTableFillers } } - forcedinline void replaceLine (PixelAlpha* dest, const PixelARGB& colour, int width) const noexcept + forcedinline void replaceLine (PixelAlpha* dest, const PixelARGB colour, int width) const noexcept { if (destData.pixelStride == sizeof (*dest)) memset (dest, colour.getAlpha(), (size_t) width); @@ -709,7 +709,7 @@ namespace EdgeTableFillers JUCE_PERFORM_PIXEL_OP_LOOP (setAlpha (colour.getAlpha())) } - forcedinline void replaceLine (PixelARGB* dest, const PixelARGB& colour, int width) const noexcept + forcedinline void replaceLine (PixelARGB* dest, const PixelARGB colour, int width) const noexcept { JUCE_PERFORM_PIXEL_OP_LOOP (set (colour)) } @@ -1497,7 +1497,7 @@ namespace EdgeTableFillers } template - void renderSolidFill (Iterator& iter, const Image::BitmapData& destData, const PixelARGB& fillColour, const bool replaceContents, DestPixelType*) + void renderSolidFill (Iterator& iter, const Image::BitmapData& destData, const PixelARGB fillColour, const bool replaceContents, DestPixelType*) { if (replaceContents) { @@ -1556,14 +1556,14 @@ namespace ClipRegions virtual Ptr clipToPath (const Path&, const AffineTransform&) = 0; virtual Ptr clipToEdgeTable (const EdgeTable& et) = 0; virtual Ptr clipToImageAlpha (const Image&, const AffineTransform&, const bool betterQuality) = 0; - virtual void translate (const Point& delta) = 0; + virtual void translate (Point delta) = 0; virtual bool clipRegionIntersects (const Rectangle&) const = 0; virtual Rectangle getClipBounds() const = 0; - virtual void fillRectWithColour (Image::BitmapData& destData, const Rectangle&, const PixelARGB& colour, bool replaceContents) const = 0; - virtual void fillRectWithColour (Image::BitmapData& destData, const Rectangle&, const PixelARGB& colour) const = 0; - virtual void fillAllWithColour (Image::BitmapData& destData, const PixelARGB& colour, bool replaceContents) const = 0; + virtual void fillRectWithColour (Image::BitmapData& destData, const Rectangle&, const PixelARGB colour, bool replaceContents) const = 0; + virtual void fillRectWithColour (Image::BitmapData& destData, const Rectangle&, const PixelARGB colour) const = 0; + virtual void fillAllWithColour (Image::BitmapData& destData, const PixelARGB colour, bool replaceContents) const = 0; virtual void fillAllWithGradient (Image::BitmapData& destData, ColourGradient&, const AffineTransform&, bool isIdentity) const = 0; virtual void renderImageTransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const int alpha, const AffineTransform&, bool betterQuality, bool tiledFill) const = 0; virtual void renderImageUntransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const int alpha, int x, int y, bool tiledFill) const = 0; @@ -1664,7 +1664,7 @@ namespace ClipRegions return edgeTable.isEmpty() ? nullptr : this; } - void translate (const Point& delta) + void translate (Point delta) { edgeTable.translate ((float) delta.x, delta.y); } @@ -1679,7 +1679,7 @@ namespace ClipRegions return edgeTable.getMaximumBounds(); } - void fillRectWithColour (Image::BitmapData& destData, const Rectangle& area, const PixelARGB& colour, bool replaceContents) const + void fillRectWithColour (Image::BitmapData& destData, const Rectangle& area, const PixelARGB colour, bool replaceContents) const { const Rectangle totalClip (edgeTable.getMaximumBounds()); const Rectangle clipped (totalClip.getIntersection (area)); @@ -1692,7 +1692,7 @@ namespace ClipRegions } } - void fillRectWithColour (Image::BitmapData& destData, const Rectangle& area, const PixelARGB& colour) const + void fillRectWithColour (Image::BitmapData& destData, const Rectangle& area, const PixelARGB colour) const { const Rectangle totalClip (edgeTable.getMaximumBounds().toFloat()); const Rectangle clipped (totalClip.getIntersection (area)); @@ -1705,7 +1705,7 @@ namespace ClipRegions } } - void fillAllWithColour (Image::BitmapData& destData, const PixelARGB& colour, bool replaceContents) const + void fillAllWithColour (Image::BitmapData& destData, const PixelARGB colour, bool replaceContents) const { switch (destData.pixelFormat) { @@ -1805,7 +1805,7 @@ namespace ClipRegions return toEdgeTable()->clipToImageAlpha (image, transform, betterQuality); } - void translate (const Point& delta) + void translate (Point delta) { clip.offsetAll (delta.x, delta.y); } @@ -1813,7 +1813,7 @@ namespace ClipRegions bool clipRegionIntersects (const Rectangle& r) const { return clip.intersects (r); } Rectangle getClipBounds() const { return clip.getBounds(); } - void fillRectWithColour (Image::BitmapData& destData, const Rectangle& area, const PixelARGB& colour, bool replaceContents) const + void fillRectWithColour (Image::BitmapData& destData, const Rectangle& area, const PixelARGB colour, bool replaceContents) const { SubRectangleIterator iter (clip, area); @@ -1825,7 +1825,7 @@ namespace ClipRegions } } - void fillRectWithColour (Image::BitmapData& destData, const Rectangle& area, const PixelARGB& colour) const + void fillRectWithColour (Image::BitmapData& destData, const Rectangle& area, const PixelARGB colour) const { SubRectangleIteratorFloat iter (clip, area); @@ -1837,7 +1837,7 @@ namespace ClipRegions } } - void fillAllWithColour (Image::BitmapData& destData, const PixelARGB& colour, bool replaceContents) const + void fillAllWithColour (Image::BitmapData& destData, const PixelARGB colour, bool replaceContents) const { switch (destData.pixelFormat) { diff --git a/modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp b/modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp index 3d9a1e8c1f..0dda08a128 100644 --- a/modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp +++ b/modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp @@ -629,8 +629,8 @@ public: { radialGradient = 0; - const Point& p1 = fillType.gradient->point1; - const Point& p2 = fillType.gradient->point2; + const Point p1 = fillType.gradient->point1; + const Point p2 = fillType.gradient->point2; float r = p1.getDistanceFrom (p2); D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES props = @@ -645,8 +645,8 @@ public: { linearGradient = 0; - const Point& p1 = fillType.gradient->point1; - const Point& p2 = fillType.gradient->point2; + const Point p1 = fillType.gradient->point1; + const Point p2 = fillType.gradient->point2; D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES props = D2D1::LinearGradientBrushProperties (D2D1::Point2F (p1.x, p1.y), diff --git a/modules/juce_gui_basics/buttons/juce_ArrowButton.cpp b/modules/juce_gui_basics/buttons/juce_ArrowButton.cpp index 0d2f87b908..e42898bdc0 100644 --- a/modules/juce_gui_basics/buttons/juce_ArrowButton.cpp +++ b/modules/juce_gui_basics/buttons/juce_ArrowButton.cpp @@ -23,7 +23,7 @@ ============================================================================== */ -ArrowButton::ArrowButton (const String& name, float arrowDirectionInRadians, const Colour& arrowColour) +ArrowButton::ArrowButton (const String& name, float arrowDirectionInRadians, Colour arrowColour) : Button (name), colour (arrowColour) { path.addTriangle (0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.5f); diff --git a/modules/juce_gui_basics/buttons/juce_ArrowButton.h b/modules/juce_gui_basics/buttons/juce_ArrowButton.h index b5f6e22278..c1fbca0eec 100644 --- a/modules/juce_gui_basics/buttons/juce_ArrowButton.h +++ b/modules/juce_gui_basics/buttons/juce_ArrowButton.h @@ -48,7 +48,7 @@ public: */ ArrowButton (const String& buttonName, float arrowDirection, - const Colour& arrowColour); + Colour arrowColour); /** Destructor. */ ~ArrowButton(); diff --git a/modules/juce_gui_basics/buttons/juce_ImageButton.cpp b/modules/juce_gui_basics/buttons/juce_ImageButton.cpp index bda145e8ac..e7c9b0b591 100644 --- a/modules/juce_gui_basics/buttons/juce_ImageButton.cpp +++ b/modules/juce_gui_basics/buttons/juce_ImageButton.cpp @@ -40,13 +40,13 @@ void ImageButton::setImages (const bool resizeButtonNowToFitThisImage, const bool preserveImageProportions, const Image& normalImage_, const float imageOpacityWhenNormal, - const Colour& overlayColourWhenNormal, + Colour overlayColourWhenNormal, const Image& overImage_, const float imageOpacityWhenOver, - const Colour& overlayColourWhenOver, + Colour overlayColourWhenOver, const Image& downImage_, const float imageOpacityWhenDown, - const Colour& overlayColourWhenDown, + Colour overlayColourWhenDown, const float hitTestAlphaThreshold) { normalImage = normalImage_; diff --git a/modules/juce_gui_basics/buttons/juce_ImageButton.h b/modules/juce_gui_basics/buttons/juce_ImageButton.h index 55ddc515b0..9ab30e13bb 100644 --- a/modules/juce_gui_basics/buttons/juce_ImageButton.h +++ b/modules/juce_gui_basics/buttons/juce_ImageButton.h @@ -101,13 +101,13 @@ public: bool preserveImageProportions, const Image& normalImage, float imageOpacityWhenNormal, - const Colour& overlayColourWhenNormal, + Colour overlayColourWhenNormal, const Image& overImage, float imageOpacityWhenOver, - const Colour& overlayColourWhenOver, + Colour overlayColourWhenOver, const Image& downImage, float imageOpacityWhenDown, - const Colour& overlayColourWhenDown, + Colour overlayColourWhenDown, float hitTestAlphaThreshold = 0.0f); /** Returns the currently set 'normal' image. */ diff --git a/modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.cpp b/modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.cpp index 93751b4cf6..37328d7c98 100644 --- a/modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.cpp +++ b/modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.cpp @@ -56,7 +56,7 @@ void ApplicationCommandInfo::setTicked (const bool b) noexcept flags &= ~isTicked; } -void ApplicationCommandInfo::addDefaultKeypress (const int keyCode, const ModifierKeys& modifiers) noexcept +void ApplicationCommandInfo::addDefaultKeypress (const int keyCode, ModifierKeys modifiers) noexcept { defaultKeypresses.add (KeyPress (keyCode, modifiers, 0)); } diff --git a/modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.h b/modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.h index c1bac5ccad..6d5e929db9 100644 --- a/modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.h +++ b/modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.h @@ -82,7 +82,7 @@ struct JUCE_API ApplicationCommandInfo @endcode */ void addDefaultKeypress (int keyCode, - const ModifierKeys& modifiers) noexcept; + ModifierKeys modifiers) noexcept; //============================================================================== /** The command's unique ID number. diff --git a/modules/juce_gui_basics/components/juce_Component.cpp b/modules/juce_gui_basics/components/juce_Component.cpp index 55a23e8fbc..7b49f6a336 100644 --- a/modules/juce_gui_basics/components/juce_Component.cpp +++ b/modules/juce_gui_basics/components/juce_Component.cpp @@ -194,14 +194,14 @@ struct Component::ComponentHelpers } //============================================================================== - static inline bool hitTest (Component& comp, const Point& localPoint) + static inline bool hitTest (Component& comp, Point localPoint) { return isPositiveAndBelow (localPoint.x, comp.getWidth()) && isPositiveAndBelow (localPoint.y, comp.getHeight()) && comp.hitTest (localPoint.x, localPoint.y); } - static Point convertFromParentSpace (const Component& comp, const Point& pointInParentSpace) + static Point convertFromParentSpace (const Component& comp, Point pointInParentSpace) { if (comp.affineTransform == nullptr) return pointInParentSpace - comp.getPosition(); @@ -217,7 +217,7 @@ struct Component::ComponentHelpers return areaInParentSpace.toFloat().transformed (comp.affineTransform->inverted()).getSmallestIntegerContainer() - comp.getPosition(); } - static Point convertToParentSpace (const Component& comp, const Point& pointInLocalSpace) + static Point convertToParentSpace (const Component& comp, Point pointInLocalSpace) { if (comp.affineTransform == nullptr) return pointInLocalSpace + comp.getPosition(); @@ -295,7 +295,7 @@ struct Component::ComponentHelpers return r; } - static bool clipObscuredRegions (const Component& comp, Graphics& g, const Rectangle& clipRect, const Point& delta) + static bool clipObscuredRegions (const Component& comp, Graphics& g, const Rectangle& clipRect, Point delta) { bool nothingChanged = true; @@ -328,7 +328,7 @@ struct Component::ComponentHelpers } static void subtractObscuredRegions (const Component& comp, RectangleList& result, - const Point& delta, const Rectangle& clipRect, + Point delta, const Rectangle& clipRect, const Component* const compToAvoid) { for (int i = comp.childComponentList.size(); --i >= 0;) @@ -966,7 +966,7 @@ Rectangle Component::getParentMonitorArea() const return Desktop::getInstance().getDisplays().getDisplayContaining (getScreenBounds().getCentre()).userArea; } -Point Component::getLocalPoint (const Component* source, const Point& point) const +Point Component::getLocalPoint (const Component* source, Point point) const { return ComponentHelpers::convertCoordinate (this, source, point); } @@ -976,7 +976,7 @@ Rectangle Component::getLocalArea (const Component* source, const Rectangle return ComponentHelpers::convertCoordinate (this, source, area); } -Point Component::localPointToGlobal (const Point& point) const +Point Component::localPointToGlobal (Point point) const { return ComponentHelpers::convertCoordinate (nullptr, this, point); } @@ -987,17 +987,17 @@ Rectangle Component::localAreaToGlobal (const Rectangle& area) const } // Deprecated methods... -Point Component::relativePositionToGlobal (const Point& relativePosition) const +Point Component::relativePositionToGlobal (Point relativePosition) const { return localPointToGlobal (relativePosition); } -Point Component::globalPositionToRelative (const Point& screenPosition) const +Point Component::globalPositionToRelative (Point screenPosition) const { return getLocalPoint (nullptr, screenPosition); } -Point Component::relativePositionToOtherComponent (const Component* const targetComponent, const Point& positionRelativeToThis) const +Point Component::relativePositionToOtherComponent (const Component* const targetComponent, Point positionRelativeToThis) const { return targetComponent == nullptr ? localPointToGlobal (positionRelativeToThis) : targetComponent->getLocalPoint (this, positionRelativeToThis); @@ -1104,7 +1104,7 @@ void Component::setTopLeftPosition (const int x, const int y) setBounds (x, y, getWidth(), getHeight()); } -void Component::setTopLeftPosition (const Point& pos) +void Component::setTopLeftPosition (Point pos) { setBounds (pos.x, pos.y, getWidth(), getHeight()); } @@ -1287,7 +1287,7 @@ void Component::getInterceptsMouseClicks (bool& allowsClicksOnThisComponent, allowsClicksOnChildComponents = flags.allowChildMouseClicksFlag; } -bool Component::contains (const Point& point) +bool Component::contains (Point point) { if (ComponentHelpers::hitTest (*this, point)) { @@ -1302,7 +1302,7 @@ bool Component::contains (const Point& point) return false; } -bool Component::reallyContains (const Point& point, const bool returnTrueIfWithinAChild) +bool Component::reallyContains (Point point, const bool returnTrueIfWithinAChild) { if (! contains (point)) return false; @@ -1313,7 +1313,7 @@ bool Component::reallyContains (const Point& point, const bool returnTrueIf return (compAtPosition == this) || (returnTrueIfWithinAChild && isParentOf (compAtPosition)); } -Component* Component::getComponentAt (const Point& position) +Component* Component::getComponentAt (Point position) { if (flags.visibleFlag && ComponentHelpers::hitTest (*this, position)) { @@ -2046,7 +2046,7 @@ void Component::removeColour (const int colourId) colourChanged(); } -void Component::setColour (const int colourId, const Colour& colour) +void Component::setColour (const int colourId, Colour colour) { if (properties.set (ComponentHelpers::getColourPropertyId (colourId), (int) colour.getARGB())) colourChanged(); @@ -2245,7 +2245,7 @@ void Component::removeMouseListener (MouseListener* const listenerToRemove) } //============================================================================== -void Component::internalMouseEnter (MouseInputSource& source, const Point& relativePos, const Time& time) +void Component::internalMouseEnter (MouseInputSource& source, Point relativePos, Time time) { if (isCurrentlyBlockedByAnotherModalComponent()) { @@ -2271,7 +2271,7 @@ void Component::internalMouseEnter (MouseInputSource& source, const Point& MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseEnter, me); } -void Component::internalMouseExit (MouseInputSource& source, const Point& relativePos, const Time& time) +void Component::internalMouseExit (MouseInputSource& source, Point relativePos, Time time) { if (flags.repaintOnMouseActivityFlag) repaint(); @@ -2291,7 +2291,7 @@ void Component::internalMouseExit (MouseInputSource& source, const Point& r MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseExit, me); } -void Component::internalMouseDown (MouseInputSource& source, const Point& relativePos, const Time& time) +void Component::internalMouseDown (MouseInputSource& source, Point relativePos, Time time) { Desktop& desktop = Desktop::getInstance(); BailOutChecker checker (this); @@ -2355,8 +2355,8 @@ void Component::internalMouseDown (MouseInputSource& source, const Point& r MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDown, me); } -void Component::internalMouseUp (MouseInputSource& source, const Point& relativePos, - const Time& time, const ModifierKeys& oldModifiers) +void Component::internalMouseUp (MouseInputSource& source, Point relativePos, + Time time, const ModifierKeys oldModifiers) { if (flags.mouseDownWasBlocked && isCurrentlyBlockedByAnotherModalComponent()) return; @@ -2398,7 +2398,7 @@ void Component::internalMouseUp (MouseInputSource& source, const Point& rel } } -void Component::internalMouseDrag (MouseInputSource& source, const Point& relativePos, const Time& time) +void Component::internalMouseDrag (MouseInputSource& source, Point relativePos, Time time) { if (! isCurrentlyBlockedByAnotherModalComponent()) { @@ -2421,7 +2421,7 @@ void Component::internalMouseDrag (MouseInputSource& source, const Point& r } } -void Component::internalMouseMove (MouseInputSource& source, const Point& relativePos, const Time& time) +void Component::internalMouseMove (MouseInputSource& source, Point relativePos, Time time) { Desktop& desktop = Desktop::getInstance(); @@ -2447,8 +2447,8 @@ void Component::internalMouseMove (MouseInputSource& source, const Point& r } } -void Component::internalMouseWheel (MouseInputSource& source, const Point& relativePos, - const Time& time, const MouseWheelDetails& wheel) +void Component::internalMouseWheel (MouseInputSource& source, Point relativePos, + Time time, const MouseWheelDetails& wheel) { Desktop& desktop = Desktop::getInstance(); BailOutChecker checker (this); @@ -2475,8 +2475,8 @@ void Component::internalMouseWheel (MouseInputSource& source, const Point& } } -void Component::internalMagnifyGesture (MouseInputSource& source, const Point& relativePos, - const Time& time, float amount) +void Component::internalMagnifyGesture (MouseInputSource& source, Point relativePos, + Time time, float amount) { if (! isCurrentlyBlockedByAnotherModalComponent()) { diff --git a/modules/juce_gui_basics/components/juce_Component.h b/modules/juce_gui_basics/components/juce_Component.h index cdfddb36cf..843662dbb3 100644 --- a/modules/juce_gui_basics/components/juce_Component.h +++ b/modules/juce_gui_basics/components/juce_Component.h @@ -288,7 +288,7 @@ public: int getRight() const noexcept { return bounds.getRight(); } /** Returns the component's top-left position as a Point. */ - const Point& getPosition() const noexcept { return bounds.getPosition(); } + Point getPosition() const noexcept { return bounds.getPosition(); } /** Returns the y coordinate of the bottom edge of this component. This is a distance in pixels from the top edge of the component's parent. @@ -361,7 +361,7 @@ public: screen coordinate. */ Point getLocalPoint (const Component* sourceComponent, - const Point& pointRelativeToSourceComponent) const; + Point pointRelativeToSourceComponent) const; /** Converts a rectangle to be relative to this component's coordinate space. @@ -379,7 +379,7 @@ public: /** Converts a point relative to this component's top-left into a screen coordinate. @see getLocalPoint, localAreaToGlobal */ - Point localPointToGlobal (const Point& localPoint) const; + Point localPointToGlobal (Point localPoint) const; /** Converts a rectangle from this component's coordinate space to a screen coordinate. @@ -419,7 +419,7 @@ public: @see setBounds, ComponentListener::componentMovedOrResized */ - void setTopLeftPosition (const Point& newTopLeftPosition); + void setTopLeftPosition (Point newTopLeftPosition); /** Moves the component to a new position. @@ -897,7 +897,7 @@ public: which might be in the way - for that, see reallyContains() @see hitTest, reallyContains, getComponentAt */ - bool contains (const Point& localPoint); + bool contains (Point localPoint); /** Returns true if a given point lies in this component, taking any overlapping siblings into account. @@ -907,7 +907,7 @@ public: this determines whether that is counted as a hit. @see contains, getComponentAt */ - bool reallyContains (const Point& localPoint, bool returnTrueIfWithinAChild); + bool reallyContains (Point localPoint, bool returnTrueIfWithinAChild); /** Returns the component at a certain point within this one. @@ -930,7 +930,7 @@ public: instead call getComponentAt on the top-level parent of this component. @see hitTest, contains, reallyContains */ - Component* getComponentAt (const Point& position); + Component* getComponentAt (Point position); //============================================================================== /** Marks the whole component as needing to be redrawn. @@ -2043,7 +2043,7 @@ public: @see findColour, isColourSpecified, colourChanged, LookAndFeel::findColour, LookAndFeel::setColour */ - void setColour (int colourId, const Colour& colour); + void setColour (int colourId, Colour newColour); /** If a colour has been set with setColour(), this will remove it. This allows you to make a colour revert to its default state. @@ -2217,9 +2217,9 @@ public: //============================================================================== #ifndef DOXYGEN // These methods are deprecated - use localPointToGlobal, getLocalPoint, getLocalPoint, etc instead. - JUCE_DEPRECATED (Point relativePositionToGlobal (const Point&) const); - JUCE_DEPRECATED (Point globalPositionToRelative (const Point&) const); - JUCE_DEPRECATED (Point relativePositionToOtherComponent (const Component*, const Point&) const); + JUCE_DEPRECATED (Point relativePositionToGlobal (Point) const); + JUCE_DEPRECATED (Point globalPositionToRelative (Point) const); + JUCE_DEPRECATED (Point relativePositionToOtherComponent (const Component*, Point) const); #endif private: @@ -2287,14 +2287,14 @@ private: uint8 componentTransparency; //============================================================================== - void internalMouseEnter (MouseInputSource&, const Point&, const Time&); - void internalMouseExit (MouseInputSource&, const Point&, const Time&); - void internalMouseDown (MouseInputSource&, const Point&, const Time&); - void internalMouseUp (MouseInputSource&, const Point&, const Time&, const ModifierKeys& oldModifiers); - void internalMouseDrag (MouseInputSource&, const Point&, const Time&); - void internalMouseMove (MouseInputSource&, const Point&, const Time&); - void internalMouseWheel (MouseInputSource&, const Point&, const Time&, const MouseWheelDetails&); - void internalMagnifyGesture (MouseInputSource&, const Point&, const Time&, float); + void internalMouseEnter (MouseInputSource&, Point, Time); + void internalMouseExit (MouseInputSource&, Point, Time); + void internalMouseDown (MouseInputSource&, Point, Time); + void internalMouseUp (MouseInputSource&, Point, Time, const ModifierKeys oldModifiers); + void internalMouseDrag (MouseInputSource&, Point, Time); + void internalMouseMove (MouseInputSource&, Point, Time); + void internalMouseWheel (MouseInputSource&, Point, Time, const MouseWheelDetails&); + void internalMagnifyGesture (MouseInputSource&, Point, Time, float); void internalBroughtToFront(); void internalFocusGain (const FocusChangeType, const WeakReference&); void internalFocusGain (const FocusChangeType); @@ -2336,7 +2336,7 @@ private: virtual void filesDropped (const StringArray&, int, int) {} // This is included here to cause an error if you use or overload it - it has been deprecated in - // favour of contains (const Point&) + // favour of contains (Point) void contains (int, int); #endif diff --git a/modules/juce_gui_basics/components/juce_Desktop.cpp b/modules/juce_gui_basics/components/juce_Desktop.cpp index 602f94334e..974cebb00f 100644 --- a/modules/juce_gui_basics/components/juce_Desktop.cpp +++ b/modules/juce_gui_basics/components/juce_Desktop.cpp @@ -64,7 +64,7 @@ Component* Desktop::getComponent (const int index) const noexcept return desktopComponents [index]; } -Component* Desktop::findComponentAt (const Point& screenPosition) const +Component* Desktop::findComponentAt (Point screenPosition) const { for (int i = desktopComponents.size(); --i >= 0;) { @@ -328,7 +328,7 @@ const Desktop::Displays::Display& Desktop::Displays::getMainDisplay() const noex return displays.getReference(0); } -const Desktop::Displays::Display& Desktop::Displays::getDisplayContaining (const Point& position) const noexcept +const Desktop::Displays::Display& Desktop::Displays::getDisplayContaining (Point position) const noexcept { const Display* best = &displays.getReference(0); double bestDistance = 1.0e10; diff --git a/modules/juce_gui_basics/components/juce_Desktop.h b/modules/juce_gui_basics/components/juce_Desktop.h index 22503e3c7e..0aa7d75867 100644 --- a/modules/juce_gui_basics/components/juce_Desktop.h +++ b/modules/juce_gui_basics/components/juce_Desktop.h @@ -80,7 +80,7 @@ public: /** Makes the mouse pointer jump to a given location. The co-ordinates are relative to the top-left of the main monitor. */ - static void setMousePosition (const Point& newPosition); + static void setMousePosition (Point newPosition); /** Returns the last position at which a mouse button was pressed. @@ -203,7 +203,7 @@ public: Returns nullptr if the co-ordinates are inside a non-Juce window. */ - Component* findComponentAt (const Point& screenPosition) const; + Component* findComponentAt (Point screenPosition) const; /** The Desktop object has a ComponentAnimator instance which can be used for performing your animations. @@ -343,7 +343,7 @@ public: /** Returns the display which contains a particular point. If the point lies outside all the displays, the nearest one will be returned. */ - const Display& getDisplayContaining (const Point& position) const noexcept; + const Display& getDisplayContaining (Point position) const noexcept; /** Returns a RectangleList made up of all the displays. */ RectangleList getRectangleList (bool userAreasOnly) const; diff --git a/modules/juce_gui_basics/drawables/juce_Drawable.cpp b/modules/juce_gui_basics/drawables/juce_Drawable.cpp index 6520b5eeca..774f7a31b3 100644 --- a/modules/juce_gui_basics/drawables/juce_Drawable.cpp +++ b/modules/juce_gui_basics/drawables/juce_Drawable.cpp @@ -109,7 +109,7 @@ void Drawable::setBoundsToEnclose (const Rectangle& area) } //============================================================================== -void Drawable::setOriginWithOriginalSize (const Point& originWithinParent) +void Drawable::setOriginWithOriginalSize (Point originWithinParent) { setTransform (AffineTransform::translation (originWithinParent.x, originWithinParent.y)); } diff --git a/modules/juce_gui_basics/drawables/juce_Drawable.h b/modules/juce_gui_basics/drawables/juce_Drawable.h index e6de08775a..2ab4b7881c 100644 --- a/modules/juce_gui_basics/drawables/juce_Drawable.h +++ b/modules/juce_gui_basics/drawables/juce_Drawable.h @@ -113,7 +113,7 @@ public: /** Resets any transformations on this drawable, and positions its origin within its parent component. */ - void setOriginWithOriginalSize (const Point& originWithinParent); + void setOriginWithOriginalSize (Point originWithinParent); /** Sets a transform for this drawable that will position it within the specified area of its parent component. diff --git a/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp b/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp index d3005220c9..cab9619d45 100644 --- a/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp +++ b/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp @@ -403,7 +403,7 @@ namespace DrawablePathHelpers } } -float DrawablePath::ValueTreeWrapper::Element::findProportionAlongLine (const Point& targetPoint, Expression::Scope* scope) const +float DrawablePath::ValueTreeWrapper::Element::findProportionAlongLine (Point targetPoint, Expression::Scope* scope) const { using namespace DrawablePathHelpers; const Identifier pointType (state.getType()); @@ -460,7 +460,7 @@ float DrawablePath::ValueTreeWrapper::Element::findProportionAlongLine (const Po return bestProp; } -ValueTree DrawablePath::ValueTreeWrapper::Element::insertPoint (const Point& targetPoint, Expression::Scope* scope, UndoManager* undoManager) +ValueTree DrawablePath::ValueTreeWrapper::Element::insertPoint (Point targetPoint, Expression::Scope* scope, UndoManager* undoManager) { ValueTree newTree; const Identifier pointType (state.getType()); diff --git a/modules/juce_gui_basics/drawables/juce_DrawablePath.h b/modules/juce_gui_basics/drawables/juce_DrawablePath.h index 391c31c96d..a2a35ca655 100644 --- a/modules/juce_gui_basics/drawables/juce_DrawablePath.h +++ b/modules/juce_gui_basics/drawables/juce_DrawablePath.h @@ -112,9 +112,9 @@ public: void convertToLine (UndoManager*); void convertToCubic (Expression::Scope*, UndoManager*); void convertToPathBreak (UndoManager* undoManager); - ValueTree insertPoint (const Point& targetPoint, Expression::Scope*, UndoManager*); + ValueTree insertPoint (Point targetPoint, Expression::Scope*, UndoManager*); void removePoint (UndoManager* undoManager); - float findProportionAlongLine (const Point& targetPoint, Expression::Scope*) const; + float findProportionAlongLine (Point targetPoint, Expression::Scope*) const; static const Identifier mode, startSubPathElement, closeSubPathElement, lineToElement, quadraticToElement, cubicToElement; diff --git a/modules/juce_gui_basics/drawables/juce_DrawableText.cpp b/modules/juce_gui_basics/drawables/juce_DrawableText.cpp index e2b3ee173d..dfb3221159 100644 --- a/modules/juce_gui_basics/drawables/juce_DrawableText.cpp +++ b/modules/juce_gui_basics/drawables/juce_DrawableText.cpp @@ -59,7 +59,7 @@ void DrawableText::setText (const String& newText) } } -void DrawableText::setColour (const Colour& newColour) +void DrawableText::setColour (Colour newColour) { if (colour != newColour) { @@ -233,7 +233,7 @@ Colour DrawableText::ValueTreeWrapper::getColour() const return Colour::fromString (state [colour].toString()); } -void DrawableText::ValueTreeWrapper::setColour (const Colour& newColour, UndoManager* undoManager) +void DrawableText::ValueTreeWrapper::setColour (Colour newColour, UndoManager* undoManager) { state.setProperty (colour, newColour.toString(), undoManager); } diff --git a/modules/juce_gui_basics/drawables/juce_DrawableText.h b/modules/juce_gui_basics/drawables/juce_DrawableText.h index 440ada9284..79773ac686 100644 --- a/modules/juce_gui_basics/drawables/juce_DrawableText.h +++ b/modules/juce_gui_basics/drawables/juce_DrawableText.h @@ -55,10 +55,10 @@ public: const String& getText() const noexcept { return text;} /** Sets the colour of the text. */ - void setColour (const Colour& newColour); + void setColour (Colour newColour); /** Returns the current text colour. */ - const Colour& getColour() const noexcept { return colour; } + Colour getColour() const noexcept { return colour; } /** Sets the font to use. Note that the font height and horizontal scale are set as RelativeCoordinates using @@ -115,7 +115,7 @@ public: Value getTextValue (UndoManager* undoManager); Colour getColour() const; - void setColour (const Colour& newColour, UndoManager* undoManager); + void setColour (Colour newColour, UndoManager* undoManager); Justification getJustification() const; void setJustification (const Justification& newJustification, UndoManager* undoManager); diff --git a/modules/juce_gui_basics/drawables/juce_SVGParser.cpp b/modules/juce_gui_basics/drawables/juce_SVGParser.cpp index 3d6ffbfa5d..6cb139c08b 100644 --- a/modules/juce_gui_basics/drawables/juce_SVGParser.cpp +++ b/modules/juce_gui_basics/drawables/juce_SVGParser.cpp @@ -714,7 +714,7 @@ private: const String& fill, const String& fillOpacity, const String& overallOpacity, - const Colour& defaultColour) const + const Colour defaultColour) const { float opacity = 1.0f; @@ -1045,7 +1045,7 @@ private: } //============================================================================== - static Colour parseColour (const String& s, int& index, const Colour& defaultColour) + static Colour parseColour (const String& s, int& index, const Colour defaultColour) { if (s [index] == '#') { @@ -1071,9 +1071,10 @@ private: (uint8) ((hex [2] << 4) + hex [3]), (uint8) ((hex [4] << 4) + hex [5])); } - else if (s [index] == 'r' - && s [index + 1] == 'g' - && s [index + 2] == 'b') + + if (s [index] == 'r' + && s [index + 1] == 'g' + && s [index + 2] == 'b') { const int openBracket = s.indexOfChar (index, '('); const int closeBracket = s.indexOfChar (openBracket, ')'); diff --git a/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp b/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp index 28d3b31649..7cd0256b7a 100644 --- a/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp @@ -232,8 +232,8 @@ int DirectoryContentsList::compareElements (const DirectoryContentsList::FileInf bool DirectoryContentsList::addFile (const File& file, const bool isDir, const int64 fileSize, - const Time& modTime, - const Time& creationTime, + const Time modTime, + const Time creationTime, const bool isReadOnly) { if (fileFilter == nullptr diff --git a/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.h b/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.h index 9866bcd216..dac0b2cb84 100644 --- a/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.h +++ b/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.h @@ -206,8 +206,8 @@ private: void changed(); bool checkNextFile (bool& hasChanged); bool addFile (const File& file, bool isDir, - const int64 fileSize, const Time& modTime, - const Time& creationTime, bool isReadOnly); + const int64 fileSize, const Time modTime, + const Time creationTime, bool isReadOnly); void setTypeFlags (int newFlags); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DirectoryContentsList) diff --git a/modules/juce_gui_basics/keyboard/juce_KeyPress.cpp b/modules/juce_gui_basics/keyboard/juce_KeyPress.cpp index b918da235c..a3441b9339 100644 --- a/modules/juce_gui_basics/keyboard/juce_KeyPress.cpp +++ b/modules/juce_gui_basics/keyboard/juce_KeyPress.cpp @@ -30,7 +30,7 @@ KeyPress::KeyPress() noexcept } KeyPress::KeyPress (const int keyCode_, - const ModifierKeys& mods_, + ModifierKeys mods_, const juce_wchar textCharacter_) noexcept : keyCode (keyCode_), mods (mods_), diff --git a/modules/juce_gui_basics/keyboard/juce_KeyPress.h b/modules/juce_gui_basics/keyboard/juce_KeyPress.h index 532fe9f00a..1011b98768 100644 --- a/modules/juce_gui_basics/keyboard/juce_KeyPress.h +++ b/modules/juce_gui_basics/keyboard/juce_KeyPress.h @@ -67,7 +67,7 @@ public: @see getKeyCode, isKeyCode, getModifiers */ KeyPress (int keyCode, - const ModifierKeys& modifiers, + ModifierKeys modifiers, juce_wchar textCharacter) noexcept; /** Creates a keypress with a keyCode but no modifiers or text character. */ diff --git a/modules/juce_gui_basics/keyboard/juce_ModifierKeys.cpp b/modules/juce_gui_basics/keyboard/juce_ModifierKeys.cpp index 476a6fde10..3c5a5f0e4b 100644 --- a/modules/juce_gui_basics/keyboard/juce_ModifierKeys.cpp +++ b/modules/juce_gui_basics/keyboard/juce_ModifierKeys.cpp @@ -38,7 +38,7 @@ ModifierKeys::ModifierKeys (const ModifierKeys& other) noexcept { } -ModifierKeys& ModifierKeys::operator= (const ModifierKeys& other) noexcept +ModifierKeys& ModifierKeys::operator= (const ModifierKeys other) noexcept { flags = other.flags; return *this; diff --git a/modules/juce_gui_basics/keyboard/juce_ModifierKeys.h b/modules/juce_gui_basics/keyboard/juce_ModifierKeys.h index 23cc8831ae..854ee30749 100644 --- a/modules/juce_gui_basics/keyboard/juce_ModifierKeys.h +++ b/modules/juce_gui_basics/keyboard/juce_ModifierKeys.h @@ -55,7 +55,7 @@ public: ModifierKeys (const ModifierKeys& other) noexcept; /** Copies this object from another one. */ - ModifierKeys& operator= (const ModifierKeys& other) noexcept; + ModifierKeys& operator= (const ModifierKeys other) noexcept; //============================================================================== /** Checks whether the 'command' key flag is set (or 'ctrl' on Windows/Linux). @@ -167,8 +167,8 @@ public: /** Returns a copy of only the non-mouse flags */ ModifierKeys withoutMouseButtons() const noexcept { return ModifierKeys (flags & ~allMouseButtonModifiers); } - bool operator== (const ModifierKeys& other) const noexcept { return flags == other.flags; } - bool operator!= (const ModifierKeys& other) const noexcept { return flags != other.flags; } + bool operator== (const ModifierKeys other) const noexcept { return flags == other.flags; } + bool operator!= (const ModifierKeys other) const noexcept { return flags != other.flags; } //============================================================================== /** Returns the raw flags for direct testing. */ diff --git a/modules/juce_gui_basics/layout/juce_ResizableBorderComponent.cpp b/modules/juce_gui_basics/layout/juce_ResizableBorderComponent.cpp index 3755ed7a15..9ffd15d5ad 100644 --- a/modules/juce_gui_basics/layout/juce_ResizableBorderComponent.cpp +++ b/modules/juce_gui_basics/layout/juce_ResizableBorderComponent.cpp @@ -46,7 +46,7 @@ bool ResizableBorderComponent::Zone::operator!= (const ResizableBorderComponent: ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositionOnBorder (const Rectangle& totalSize, const BorderSize& border, - const Point& position) + Point position) { int z = 0; diff --git a/modules/juce_gui_basics/layout/juce_ResizableBorderComponent.h b/modules/juce_gui_basics/layout/juce_ResizableBorderComponent.h index c1e6627de5..4da584dff3 100644 --- a/modules/juce_gui_basics/layout/juce_ResizableBorderComponent.h +++ b/modules/juce_gui_basics/layout/juce_ResizableBorderComponent.h @@ -121,7 +121,7 @@ public: */ static Zone fromPositionOnBorder (const Rectangle& totalSize, const BorderSize& border, - const Point& position); + Point position); /** Returns an appropriate mouse-cursor for this resize zone. */ MouseCursor getMouseCursor() const noexcept; diff --git a/modules/juce_gui_basics/layout/juce_ScrollBar.cpp b/modules/juce_gui_basics/layout/juce_ScrollBar.cpp index 49d90bc982..b3727ca245 100644 --- a/modules/juce_gui_basics/layout/juce_ScrollBar.cpp +++ b/modules/juce_gui_basics/layout/juce_ScrollBar.cpp @@ -79,7 +79,7 @@ ScrollBar::~ScrollBar() } //============================================================================== -void ScrollBar::setRangeLimits (const Range& newRangeLimit, NotificationType notification) +void ScrollBar::setRangeLimits (Range newRangeLimit, NotificationType notification) { if (totalRange != newRangeLimit) { @@ -95,7 +95,7 @@ void ScrollBar::setRangeLimits (const double newMinimum, const double newMaximum setRangeLimits (Range (newMinimum, newMaximum), notification); } -bool ScrollBar::setCurrentRange (const Range& newRange, +bool ScrollBar::setCurrentRange (Range newRange, const NotificationType notification) { const Range constrainedRange (totalRange.constrainRange (newRange)); diff --git a/modules/juce_gui_basics/layout/juce_ScrollBar.h b/modules/juce_gui_basics/layout/juce_ScrollBar.h index 8c3fab1b3b..1f8cdb0cbb 100644 --- a/modules/juce_gui_basics/layout/juce_ScrollBar.h +++ b/modules/juce_gui_basics/layout/juce_ScrollBar.h @@ -99,7 +99,7 @@ public: @see setCurrentRange */ - void setRangeLimits (const Range& newRangeLimit, + void setRangeLimits (Range newRangeLimit, NotificationType notification = sendNotificationAsync); /** Sets the minimum and maximum values that the bar will move between. @@ -145,7 +145,7 @@ public: @returns true if the range was changed, or false if nothing was changed. @see getCurrentRange. setCurrentRangeStart */ - bool setCurrentRange (const Range& newRange, + bool setCurrentRange (Range newRange, NotificationType notification = sendNotificationAsync); /** Changes the position of the scrollbar's 'thumb'. diff --git a/modules/juce_gui_basics/layout/juce_Viewport.cpp b/modules/juce_gui_basics/layout/juce_Viewport.cpp index 889f558fb9..73a7d8015d 100644 --- a/modules/juce_gui_basics/layout/juce_Viewport.cpp +++ b/modules/juce_gui_basics/layout/juce_Viewport.cpp @@ -98,7 +98,7 @@ void Viewport::setViewedComponent (Component* const newViewedComponent, const bo int Viewport::getMaximumVisibleWidth() const { return contentHolder.getWidth(); } int Viewport::getMaximumVisibleHeight() const { return contentHolder.getHeight(); } -Point Viewport::viewportPosToCompPos (const Point& pos) const +Point Viewport::viewportPosToCompPos (Point pos) const { jassert (contentComp != nullptr); return Point (jmax (jmin (0, contentHolder.getWidth() - contentComp->getWidth()), jmin (0, -(pos.x))), @@ -110,7 +110,7 @@ void Viewport::setViewPosition (const int xPixelsOffset, const int yPixelsOffset setViewPosition (Point (xPixelsOffset, yPixelsOffset)); } -void Viewport::setViewPosition (const Point& newPosition) +void Viewport::setViewPosition (Point newPosition) { if (contentComp != nullptr) contentComp->setTopLeftPosition (viewportPosToCompPos (newPosition)); diff --git a/modules/juce_gui_basics/layout/juce_Viewport.h b/modules/juce_gui_basics/layout/juce_Viewport.h index 424079df4d..2aa2cbf4c2 100644 --- a/modules/juce_gui_basics/layout/juce_Viewport.h +++ b/modules/juce_gui_basics/layout/juce_Viewport.h @@ -106,7 +106,7 @@ public: @see getViewPositionX, getViewPositionY, setViewPositionProportionately */ - void setViewPosition (const Point& newPosition); + void setViewPosition (Point newPosition); /** Changes the view position as a proportion of the distance it can move. @@ -136,7 +136,7 @@ public: /** Returns the position within the child component of the top-left of its visible area. */ - const Point& getViewPosition() const noexcept { return lastVisibleArea.getPosition(); } + Point getViewPosition() const noexcept { return lastVisibleArea.getPosition(); } /** Returns the position within the child component of the top-left of its visible area. @see getViewWidth, setViewPosition @@ -260,7 +260,7 @@ private: Component contentHolder; ScrollBar verticalScrollBar; ScrollBar horizontalScrollBar; - Point viewportPosToCompPos (const Point&) const; + Point viewportPosToCompPos (Point) const; void updateVisibleArea(); void deleteContentComp(); diff --git a/modules/juce_gui_basics/menus/juce_MenuBarComponent.cpp b/modules/juce_gui_basics/menus/juce_MenuBarComponent.cpp index faa044c9dc..910ae24bf6 100644 --- a/modules/juce_gui_basics/menus/juce_MenuBarComponent.cpp +++ b/modules/juce_gui_basics/menus/juce_MenuBarComponent.cpp @@ -110,7 +110,7 @@ void MenuBarComponent::resized() } } -int MenuBarComponent::getItemAt (const Point& p) +int MenuBarComponent::getItemAt (Point p) { for (int i = 0; i < xPositions.size(); ++i) if (p.x >= xPositions[i] && p.x < xPositions[i + 1]) @@ -157,7 +157,7 @@ void MenuBarComponent::setOpenItem (int index) } } -void MenuBarComponent::updateItemUnderMouse (const Point& p) +void MenuBarComponent::updateItemUnderMouse (Point p) { setItemUnderMouse (getItemAt (p)); } diff --git a/modules/juce_gui_basics/menus/juce_MenuBarComponent.h b/modules/juce_gui_basics/menus/juce_MenuBarComponent.h index e40a2aba39..50433a3829 100644 --- a/modules/juce_gui_basics/menus/juce_MenuBarComponent.h +++ b/modules/juce_gui_basics/menus/juce_MenuBarComponent.h @@ -108,10 +108,10 @@ private: Point lastMousePos; int itemUnderMouse, currentPopupIndex, topLevelIndexClicked; - int getItemAt (const Point&); + int getItemAt (Point); void setItemUnderMouse (int index); void setOpenItem (int index); - void updateItemUnderMouse (const Point&); + void updateItemUnderMouse (Point); void timerCallback(); void repaintMenuItem (int index); void menuDismissed (int topLevelIndex, int itemId); diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp index b217e60800..7c6e78f0b8 100644 --- a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp +++ b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp @@ -47,7 +47,7 @@ public: const bool active, const bool ticked, const Image& im, - const Colour& colour, + const Colour colour, const bool useColour, CustomComponent* const custom, const PopupMenu* const sub, @@ -564,7 +564,7 @@ private: && (isOver || (activeSubMenu != nullptr && activeSubMenu->isOverChildren())); } - void updateMouseOverStatus (const Point& globalMousePos) + void updateMouseOverStatus (Point globalMousePos) { isOver = reallyContains (getLocalPoint (nullptr, globalMousePos), true); @@ -930,7 +930,7 @@ private: return false; } - void highlightItemUnderMouse (const Point& globalMousePos, const Point& localMousePos, const uint32 timeNow) + void highlightItemUnderMouse (Point globalMousePos, Point localMousePos, const uint32 timeNow) { if (globalMousePos != lastMousePos || timeNow > lastMouseMoveTime + 350) { @@ -1006,7 +1006,7 @@ private: } } - void checkButtonState (const Point& localMousePos, const uint32 timeNow, + void checkButtonState (Point localMousePos, const uint32 timeNow, const bool wasDown, const bool overScrollArea, const bool isOverAny) { isDown = hasBeenOver @@ -1088,7 +1088,7 @@ private: bool isTopScrollZoneActive() const noexcept { return canScroll() && childYOffset > 0; } bool isBottomScrollZoneActive() const noexcept { return canScroll() && childYOffset < contentHeight - windowPos.getHeight(); } - bool scrollIfNecessary (const Point& localMousePos, const uint32 timeNow) + bool scrollIfNecessary (Point localMousePos, const uint32 timeNow) { if (canScroll() && (isOver || (isDown && isPositiveAndBelow (localMousePos.x, getWidth())))) @@ -1214,7 +1214,7 @@ void PopupMenu::addCommandItem (ApplicationCommandManager* commandManager, void PopupMenu::addColouredItem (const int itemResultID, const String& itemText, - const Colour& itemTextColour, + Colour itemTextColour, const bool isActive, const bool isTicked, const Image& iconToUse) diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.h b/modules/juce_gui_basics/menus/juce_PopupMenu.h index 4458f94445..f9711fa54d 100644 --- a/modules/juce_gui_basics/menus/juce_PopupMenu.h +++ b/modules/juce_gui_basics/menus/juce_PopupMenu.h @@ -146,7 +146,7 @@ public: */ void addColouredItem (int itemResultID, const String& itemText, - const Colour& itemTextColour, + Colour itemTextColour, bool isEnabled = true, bool isTicked = false, const Image& iconToUse = Image::null); diff --git a/modules/juce_gui_basics/misc/juce_BubbleComponent.cpp b/modules/juce_gui_basics/misc/juce_BubbleComponent.cpp index f3a5a44b40..d4f42046fd 100644 --- a/modules/juce_gui_basics/misc/juce_BubbleComponent.cpp +++ b/modules/juce_gui_basics/misc/juce_BubbleComponent.cpp @@ -60,7 +60,7 @@ void BubbleComponent::setPosition (Component* componentToPointTo) setPosition (componentToPointTo->getScreenBounds()); } -void BubbleComponent::setPosition (const Point& pos) +void BubbleComponent::setPosition (Point pos) { setPosition (Rectangle (pos.x, pos.y, 1, 1)); } diff --git a/modules/juce_gui_basics/misc/juce_BubbleComponent.h b/modules/juce_gui_basics/misc/juce_BubbleComponent.h index 8fbb19c372..538bcebc49 100644 --- a/modules/juce_gui_basics/misc/juce_BubbleComponent.h +++ b/modules/juce_gui_basics/misc/juce_BubbleComponent.h @@ -108,7 +108,7 @@ public: on where there's the most space, honouring any restrictions that were set with setAllowedPlacement(). */ - void setPosition (const Point& arrowTipPosition); + void setPosition (Point arrowTipPosition); /** Moves and resizes the bubble to point at a given rectangle. diff --git a/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp b/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp index abc63f026d..ef43a57fb9 100644 --- a/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp +++ b/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp @@ -37,7 +37,7 @@ public: Component* const sourceComponent, Component* const mouseDragSource_, DragAndDropContainer& owner_, - const Point& imageOffset_) + Point imageOffset_) : sourceDetails (desc, sourceComponent, Point()), image (im), owner (owner_), @@ -121,7 +121,7 @@ public: updateLocation (true, e.getScreenPosition()); } - void updateLocation (const bool canDoExternalDrag, const Point& screenPos) + void updateLocation (const bool canDoExternalDrag, Point screenPos) { DragAndDropTarget::SourceDetails details (sourceDetails); @@ -187,7 +187,7 @@ private: return dynamic_cast (currentlyOverComp.get()); } - DragAndDropTarget* findTarget (const Point& screenPos, Point& relativePos, + DragAndDropTarget* findTarget (Point screenPos, Point& relativePos, Component*& resultComponent) const { Component* hit = getParentComponent(); @@ -220,7 +220,7 @@ private: return nullptr; } - void setNewScreenPos (const Point& screenPos) + void setNewScreenPos (Point screenPos) { Point newPos (screenPos - imageOffset); @@ -253,7 +253,7 @@ private: bool canMoveFiles; }; - void checkForExternalDrag (DragAndDropTarget::SourceDetails& details, const Point& screenPos) + void checkForExternalDrag (DragAndDropTarget::SourceDetails& details, Point screenPos) { if (! hasCheckedForExternalDrag) { @@ -435,7 +435,7 @@ bool DragAndDropContainer::shouldDropFilesWhenDraggedExternally (const DragAndDr } //============================================================================== -DragAndDropTarget::SourceDetails::SourceDetails (const var& desc, Component* comp, const Point& pos) noexcept +DragAndDropTarget::SourceDetails::SourceDetails (const var& desc, Component* comp, Point pos) noexcept : description (desc), sourceComponent (comp), localPosition (pos) diff --git a/modules/juce_gui_basics/mouse/juce_DragAndDropTarget.h b/modules/juce_gui_basics/mouse/juce_DragAndDropTarget.h index ee70cf0a4a..d6c532b28e 100644 --- a/modules/juce_gui_basics/mouse/juce_DragAndDropTarget.h +++ b/modules/juce_gui_basics/mouse/juce_DragAndDropTarget.h @@ -59,7 +59,7 @@ public: /** Creates a SourceDetails object from its various settings. */ SourceDetails (const var& description, Component* sourceComponent, - const Point& localPosition) noexcept; + Point localPosition) noexcept; /** A descriptor for the drag - this is set DragAndDropContainer::startDragging(). */ var description; diff --git a/modules/juce_gui_basics/mouse/juce_MouseCursor.cpp b/modules/juce_gui_basics/mouse/juce_MouseCursor.cpp index 89664b0072..eccda3976b 100644 --- a/modules/juce_gui_basics/mouse/juce_MouseCursor.cpp +++ b/modules/juce_gui_basics/mouse/juce_MouseCursor.cpp @@ -29,7 +29,7 @@ struct CustomMouseCursorInfo : image (im), hotspot (hsX, hsY), scaleFactor (1.0f) {} - CustomMouseCursorInfo (const Image& im, const Point& hs, float scale) noexcept + CustomMouseCursorInfo (const Image& im, Point hs, float scale) noexcept : image (im), hotspot (hs), scaleFactor (scale) {} @@ -54,7 +54,7 @@ public: { } - SharedCursorHandle (const Image& image, const Point& hotSpot, const float scaleFactor) + SharedCursorHandle (const Image& image, Point hotSpot, const float scaleFactor) : handle (CustomMouseCursorInfo (image, hotSpot, scaleFactor).create()), refCount (1), standardType (MouseCursor::NormalCursor), diff --git a/modules/juce_gui_basics/mouse/juce_MouseEvent.cpp b/modules/juce_gui_basics/mouse/juce_MouseEvent.cpp index dfd0a63ecc..2c0c7d2714 100644 --- a/modules/juce_gui_basics/mouse/juce_MouseEvent.cpp +++ b/modules/juce_gui_basics/mouse/juce_MouseEvent.cpp @@ -24,13 +24,13 @@ */ MouseEvent::MouseEvent (MouseInputSource& inputSource, - const Point& position, - const ModifierKeys& modKeys, + Point position, + ModifierKeys modKeys, Component* const eventComp, Component* const originator, - const Time& time, - const Point& downPos, - const Time& downTime, + Time time, + Point downPos, + Time downTime, const int numClicks, const bool mouseWasDragged) noexcept : x (position.x), @@ -62,7 +62,7 @@ MouseEvent MouseEvent::getEventRelativeTo (Component* const otherComponent) cons mouseDownTime, numberOfClicks, wasMovedSinceMouseDown != 0); } -MouseEvent MouseEvent::withNewPosition (const Point& newPosition) const noexcept +MouseEvent MouseEvent::withNewPosition (Point newPosition) const noexcept { return MouseEvent (source, newPosition, mods, eventComponent, originalComponent, eventTime, mouseDownPos, mouseDownTime, diff --git a/modules/juce_gui_basics/mouse/juce_MouseEvent.h b/modules/juce_gui_basics/mouse/juce_MouseEvent.h index d66e56a503..50d3aed2a9 100644 --- a/modules/juce_gui_basics/mouse/juce_MouseEvent.h +++ b/modules/juce_gui_basics/mouse/juce_MouseEvent.h @@ -62,13 +62,13 @@ public: @param mouseWasDragged whether the mouse has been dragged significantly since the previous mouse-down */ MouseEvent (MouseInputSource& source, - const Point& position, - const ModifierKeys& modifiers, + Point position, + ModifierKeys modifiers, Component* eventComponent, Component* originator, - const Time& eventTime, - const Point& mouseDownPos, - const Time& mouseDownTime, + Time eventTime, + Point mouseDownPos, + Time mouseDownTime, int numberOfClicks, bool mouseWasDragged) noexcept; @@ -290,7 +290,7 @@ public: All other members of the event object are the same, but the x and y are replaced with these new values. */ - MouseEvent withNewPosition (const Point& newPosition) const noexcept; + MouseEvent withNewPosition (Point newPosition) const noexcept; //============================================================================== /** Changes the application-wide setting for the double-click time limit. diff --git a/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp b/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp index 49e74379e2..b3d4046796 100644 --- a/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp +++ b/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp @@ -58,7 +58,7 @@ public: return lastPeer; } - Component* findComponentAt (const Point& screenPos) + Component* findComponentAt (Point screenPos) { if (ComponentPeer* const peer = getPeer()) { @@ -90,49 +90,49 @@ public: #define JUCE_MOUSE_EVENT_DBG(desc) #endif - void sendMouseEnter (Component* const comp, const Point& screenPos, const Time& time) + void sendMouseEnter (Component* const comp, Point screenPos, Time time) { JUCE_MOUSE_EVENT_DBG ("enter") comp->internalMouseEnter (source, comp->getLocalPoint (nullptr, screenPos), time); } - void sendMouseExit (Component* const comp, const Point& screenPos, const Time& time) + void sendMouseExit (Component* const comp, Point screenPos, Time time) { JUCE_MOUSE_EVENT_DBG ("exit") comp->internalMouseExit (source, comp->getLocalPoint (nullptr, screenPos), time); } - void sendMouseMove (Component* const comp, const Point& screenPos, const Time& time) + void sendMouseMove (Component* const comp, Point screenPos, Time time) { JUCE_MOUSE_EVENT_DBG ("move") comp->internalMouseMove (source, comp->getLocalPoint (nullptr, screenPos), time); } - void sendMouseDown (Component* const comp, const Point& screenPos, const Time& time) + void sendMouseDown (Component* const comp, Point screenPos, Time time) { JUCE_MOUSE_EVENT_DBG ("down") comp->internalMouseDown (source, comp->getLocalPoint (nullptr, screenPos), time); } - void sendMouseDrag (Component* const comp, const Point& screenPos, const Time& time) + void sendMouseDrag (Component* const comp, Point screenPos, Time time) { JUCE_MOUSE_EVENT_DBG ("drag") comp->internalMouseDrag (source, comp->getLocalPoint (nullptr, screenPos), time); } - void sendMouseUp (Component* const comp, const Point& screenPos, const Time& time, const ModifierKeys& oldMods) + void sendMouseUp (Component* const comp, Point screenPos, Time time, const ModifierKeys oldMods) { JUCE_MOUSE_EVENT_DBG ("up") comp->internalMouseUp (source, comp->getLocalPoint (nullptr, screenPos), time, oldMods); } - void sendMouseWheel (Component* const comp, const Point& screenPos, const Time& time, const MouseWheelDetails& wheel) + void sendMouseWheel (Component* const comp, Point screenPos, Time time, const MouseWheelDetails& wheel) { JUCE_MOUSE_EVENT_DBG ("wheel") comp->internalMouseWheel (source, comp->getLocalPoint (nullptr, screenPos), time, wheel); } - void sendMagnifyGesture (Component* const comp, const Point& screenPos, const Time& time, const float amount) + void sendMagnifyGesture (Component* const comp, Point screenPos, Time time, const float amount) { JUCE_MOUSE_EVENT_DBG ("magnify") comp->internalMagnifyGesture (source, comp->getLocalPoint (nullptr, screenPos), time, amount); @@ -140,7 +140,7 @@ public: //============================================================================== // (returns true if the button change caused a modal event loop) - bool setButtons (const Point& screenPos, const Time& time, const ModifierKeys& newButtonState) + bool setButtons (Point screenPos, Time time, const ModifierKeys newButtonState) { if (buttonState == newButtonState) return false; @@ -190,7 +190,7 @@ public: return lastCounter != mouseEventCounter; } - void setComponentUnderMouse (Component* const newComponent, const Point& screenPos, const Time& time) + void setComponentUnderMouse (Component* const newComponent, Point screenPos, Time time) { Component* current = getComponentUnderMouse(); @@ -223,7 +223,7 @@ public: } } - void setPeer (ComponentPeer* const newPeer, const Point& screenPos, const Time& time) + void setPeer (ComponentPeer* const newPeer, Point screenPos, Time time) { ModifierKeys::updateCurrentModifiers(); @@ -235,7 +235,7 @@ public: } } - void setScreenPos (const Point& newScreenPos, const Time& time, const bool forceUpdate) + void setScreenPos (Point newScreenPos, Time time, const bool forceUpdate) { if (! isDragging()) setComponentUnderMouse (findComponentAt (newScreenPos), newScreenPos, time); @@ -266,7 +266,7 @@ public: } //============================================================================== - void handleEvent (ComponentPeer* const newPeer, const Point& positionWithinPeer, const Time& time, const ModifierKeys& newMods) + void handleEvent (ComponentPeer* const newPeer, Point positionWithinPeer, Time time, const ModifierKeys newMods) { jassert (newPeer != nullptr); lastTime = time; @@ -293,8 +293,8 @@ public: } } - Component* getTargetForGesture (ComponentPeer* const peer, const Point& positionWithinPeer, - const Time& time, Point& screenPos) + Component* getTargetForGesture (ComponentPeer* const peer, Point positionWithinPeer, + Time time, Point& screenPos) { jassert (peer != nullptr); lastTime = time; @@ -308,8 +308,8 @@ public: return isDragging() ? nullptr : getComponentUnderMouse(); } - void handleWheel (ComponentPeer* const peer, const Point& positionWithinPeer, - const Time& time, const MouseWheelDetails& wheel) + void handleWheel (ComponentPeer* const peer, Point positionWithinPeer, + Time time, const MouseWheelDetails& wheel) { Desktop::getInstance().incrementMouseWheelCounter(); @@ -318,8 +318,8 @@ public: sendMouseWheel (current, screenPos, time, wheel); } - void handleMagnifyGesture (ComponentPeer* const peer, const Point& positionWithinPeer, - const Time& time, const float scaleFactor) + void handleMagnifyGesture (ComponentPeer* const peer, Point positionWithinPeer, + Time time, const float scaleFactor) { Point screenPos; if (Component* current = getTargetForGesture (peer, positionWithinPeer, time, screenPos)) @@ -327,8 +327,8 @@ public: } //============================================================================== - const Time& getLastMouseDownTime() const noexcept { return mouseDowns[0].time; } - const Point& getLastMouseDownPosition() const noexcept { return mouseDowns[0].position; } + Time getLastMouseDownTime() const noexcept { return mouseDowns[0].time; } + Point getLastMouseDownPosition() const noexcept { return mouseDowns[0].position; } int getNumberOfMultipleClicks() const noexcept { @@ -480,8 +480,8 @@ private: Time lastTime; bool mouseMovedSignificantlySincePressed; - void registerMouseDown (const Point& screenPos, const Time& time, - Component& component, const ModifierKeys& modifiers) noexcept + void registerMouseDown (Point screenPos, Time time, + Component& component, const ModifierKeys modifiers) noexcept { for (int i = numElementsInArray (mouseDowns); --i > 0;) mouseDowns[i] = mouseDowns[i - 1]; @@ -498,7 +498,7 @@ private: mouseMovedSignificantlySincePressed = false; } - void registerMouseDrag (const Point& screenPos) noexcept + void registerMouseDrag (Point screenPos) noexcept { mouseMovedSignificantlySincePressed = mouseMovedSignificantlySincePressed || mouseDowns[0].position.getDistanceFrom (screenPos) >= 4; @@ -537,19 +537,19 @@ void MouseInputSource::hideCursor() { pimpl- void MouseInputSource::revealCursor() { pimpl->revealCursor (false); } void MouseInputSource::forceMouseCursorUpdate() { pimpl->revealCursor (true); } -void MouseInputSource::handleEvent (ComponentPeer* peer, const Point& positionWithinPeer, - const int64 time, const ModifierKeys& mods) +void MouseInputSource::handleEvent (ComponentPeer* peer, Point positionWithinPeer, + const int64 time, const ModifierKeys mods) { pimpl->handleEvent (peer, positionWithinPeer, Time (time), mods.withOnlyMouseButtons()); } -void MouseInputSource::handleWheel (ComponentPeer* const peer, const Point& positionWithinPeer, +void MouseInputSource::handleWheel (ComponentPeer* const peer, Point positionWithinPeer, const int64 time, const MouseWheelDetails& wheel) { pimpl->handleWheel (peer, positionWithinPeer, Time (time), wheel); } -void MouseInputSource::handleMagnifyGesture (ComponentPeer* const peer, const Point& positionWithinPeer, +void MouseInputSource::handleMagnifyGesture (ComponentPeer* const peer, Point positionWithinPeer, const int64 time, const float scaleFactor) { pimpl->handleMagnifyGesture (peer, positionWithinPeer, Time (time), scaleFactor); diff --git a/modules/juce_gui_basics/mouse/juce_MouseInputSource.h b/modules/juce_gui_basics/mouse/juce_MouseInputSource.h index 29c36812b8..7ec5db2f6f 100644 --- a/modules/juce_gui_basics/mouse/juce_MouseInputSource.h +++ b/modules/juce_gui_basics/mouse/juce_MouseInputSource.h @@ -166,11 +166,11 @@ public: //============================================================================== /** @internal */ - void handleEvent (ComponentPeer*, const Point&, int64 time, const ModifierKeys&); + void handleEvent (ComponentPeer*, Point, int64 time, const ModifierKeys); /** @internal */ - void handleWheel (ComponentPeer*, const Point&, int64 time, const MouseWheelDetails&); + void handleWheel (ComponentPeer*, Point, int64 time, const MouseWheelDetails&); /** @internal */ - void handleMagnifyGesture (ComponentPeer*, const Point&, int64 time, float scaleFactor); + void handleMagnifyGesture (ComponentPeer*, Point, int64 time, float scaleFactor); private: //============================================================================== diff --git a/modules/juce_gui_basics/mouse/juce_SelectedItemSet.h b/modules/juce_gui_basics/mouse/juce_SelectedItemSet.h index e169bbe6bd..f2f6951e71 100644 --- a/modules/juce_gui_basics/mouse/juce_SelectedItemSet.h +++ b/modules/juce_gui_basics/mouse/juce_SelectedItemSet.h @@ -148,7 +148,7 @@ public: @see selectOnly, addToSelection, addToSelectionOnMouseDown, addToSelectionOnMouseUp */ void addToSelectionBasedOnModifiers (ParameterType item, - const ModifierKeys& modifiers) + ModifierKeys modifiers) { if (modifiers.isShiftDown()) { @@ -185,7 +185,7 @@ public: @see addToSelectionOnMouseUp, addToSelectionBasedOnModifiers */ bool addToSelectionOnMouseDown (ParameterType item, - const ModifierKeys& modifiers) + ModifierKeys modifiers) { if (isSelected (item)) return ! modifiers.isPopupMenu(); @@ -209,7 +209,7 @@ public: should have made during the matching mouseDown event */ void addToSelectionOnMouseUp (ParameterType item, - const ModifierKeys& modifiers, + ModifierKeys modifiers, const bool wasItemDragged, const bool resultOfMouseDownSelectMethod) { diff --git a/modules/juce_gui_basics/native/juce_android_Windowing.cpp b/modules/juce_gui_basics/native/juce_android_Windowing.cpp index 7932c2d400..5762a95ff4 100644 --- a/modules/juce_gui_basics/native/juce_android_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_android_Windowing.cpp @@ -590,7 +590,7 @@ Point MouseInputSource::getCurrentMousePosition() return AndroidComponentPeer::lastMousePos; } -void Desktop::setMousePosition (const Point& newPosition) +void Desktop::setMousePosition (Point newPosition) { // not needed } diff --git a/modules/juce_gui_basics/native/juce_ios_Windowing.mm b/modules/juce_gui_basics/native/juce_ios_Windowing.mm index 6e567ba82a..15e6976f6d 100644 --- a/modules/juce_gui_basics/native/juce_ios_Windowing.mm +++ b/modules/juce_gui_basics/native/juce_ios_Windowing.mm @@ -294,7 +294,7 @@ Point MouseInputSource::getCurrentMousePosition() return juce_lastMousePos; } -void Desktop::setMousePosition (const Point&) +void Desktop::setMousePosition (Point) { } diff --git a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp index fa1ff2cd18..075c664d8a 100644 --- a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp @@ -3115,7 +3115,7 @@ Point MouseInputSource::getCurrentMousePosition() return Point (x, y); } -void Desktop::setMousePosition (const Point& newPosition) +void Desktop::setMousePosition (Point newPosition) { ScopedXLock xlock; Window root = RootWindow (display, DefaultScreen (display)); diff --git a/modules/juce_gui_basics/native/juce_mac_MainMenu.mm b/modules/juce_gui_basics/native/juce_mac_MainMenu.mm index 95b5497f02..3c54572e16 100644 --- a/modules/juce_gui_basics/native/juce_mac_MainMenu.mm +++ b/modules/juce_gui_basics/native/juce_mac_MainMenu.mm @@ -423,7 +423,7 @@ private: [menu release]; } - static unsigned int juceModsToNSMods (const ModifierKeys& mods) + static unsigned int juceModsToNSMods (const ModifierKeys mods) { unsigned int m = 0; if (mods.isShiftDown()) m |= NSShiftKeyMask; diff --git a/modules/juce_gui_basics/native/juce_mac_Windowing.mm b/modules/juce_gui_basics/native/juce_mac_Windowing.mm index 54c015fe86..49cae4454e 100644 --- a/modules/juce_gui_basics/native/juce_mac_Windowing.mm +++ b/modules/juce_gui_basics/native/juce_mac_Windowing.mm @@ -218,7 +218,7 @@ Point MouseInputSource::getCurrentMousePosition() } } -void Desktop::setMousePosition (const Point& newPosition) +void Desktop::setMousePosition (Point newPosition) { // this rubbish needs to be done around the warp call, to avoid causing a // bizarre glitch.. diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index 00cb430432..d22262be7b 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -1555,7 +1555,7 @@ private: } //============================================================================== - void doMouseEvent (const Point& position) + void doMouseEvent (Point position) { handleMouseEvent (0, position, currentModifiers, getMouseEventTime()); } @@ -1613,7 +1613,7 @@ private: && (flags & 0x80) != 0; // (bit 7 = 0 for pen events, 1 for touch) } - void doMouseMove (const Point& position) + void doMouseMove (Point position) { if (! isCurrentEventFromTouchScreen()) { @@ -1652,7 +1652,7 @@ private: } } - void doMouseDown (const Point& position, const WPARAM wParam) + void doMouseDown (Point position, const WPARAM wParam) { if (! isCurrentEventFromTouchScreen()) { @@ -1668,7 +1668,7 @@ private: } } - void doMouseUp (const Point& position, const WPARAM wParam) + void doMouseUp (Point position, const WPARAM wParam) { if (! isCurrentEventFromTouchScreen()) { @@ -3025,7 +3025,7 @@ Point MouseInputSource::getCurrentMousePosition() return Point (mousePos.x, mousePos.y); } -void Desktop::setMousePosition (const Point& newPosition) +void Desktop::setMousePosition (Point newPosition) { SetCursorPos (newPosition.x, newPosition.y); } diff --git a/modules/juce_gui_basics/positioning/juce_RelativeParallelogram.cpp b/modules/juce_gui_basics/positioning/juce_RelativeParallelogram.cpp index 52e5550d62..ea7ed6ae9f 100644 --- a/modules/juce_gui_basics/positioning/juce_RelativeParallelogram.cpp +++ b/modules/juce_gui_basics/positioning/juce_RelativeParallelogram.cpp @@ -111,7 +111,7 @@ bool RelativeParallelogram::operator!= (const RelativeParallelogram& other) cons return ! operator== (other); } -const Point RelativeParallelogram::getInternalCoordForPoint (const Point* const corners, Point target) noexcept +Point RelativeParallelogram::getInternalCoordForPoint (const Point* const corners, Point target) noexcept { const Point tr (corners[1] - corners[0]); const Point bl (corners[2] - corners[0]); @@ -121,14 +121,14 @@ const Point RelativeParallelogram::getInternalCoordForPoint (const Point< Line (Point(), bl).getIntersection (Line (target, target - tr)).getDistanceFromOrigin()); } -const Point RelativeParallelogram::getPointForInternalCoord (const Point* const corners, const Point& point) noexcept +Point RelativeParallelogram::getPointForInternalCoord (const Point* const corners, const Point point) noexcept { return corners[0] + Line (Point(), corners[1] - corners[0]).getPointAlongLine (point.x) + Line (Point(), corners[2] - corners[0]).getPointAlongLine (point.y); } -const Rectangle RelativeParallelogram::getBoundingBox (const Point* const p) noexcept +Rectangle RelativeParallelogram::getBoundingBox (const Point* const p) noexcept { const Point points[] = { p[0], p[1], p[2], p[1] + (p[2] - p[0]) }; return Rectangle::findAreaContainingPoints (points, 4); diff --git a/modules/juce_gui_basics/positioning/juce_RelativeParallelogram.h b/modules/juce_gui_basics/positioning/juce_RelativeParallelogram.h index aa544e27f6..3a1ef71b5f 100644 --- a/modules/juce_gui_basics/positioning/juce_RelativeParallelogram.h +++ b/modules/juce_gui_basics/positioning/juce_RelativeParallelogram.h @@ -56,9 +56,9 @@ public: bool operator== (const RelativeParallelogram& other) const noexcept; bool operator!= (const RelativeParallelogram& other) const noexcept; - static const Point getInternalCoordForPoint (const Point* parallelogramCorners, Point point) noexcept; - static const Point getPointForInternalCoord (const Point* parallelogramCorners, const Point& internalPoint) noexcept; - static const Rectangle getBoundingBox (const Point* parallelogramCorners) noexcept; + static Point getInternalCoordForPoint (const Point* parallelogramCorners, Point point) noexcept; + static Point getPointForInternalCoord (const Point* parallelogramCorners, Point internalPoint) noexcept; + static Rectangle getBoundingBox (const Point* parallelogramCorners) noexcept; //============================================================================== RelativePoint topLeft, topRight, bottomLeft; diff --git a/modules/juce_gui_basics/positioning/juce_RelativePoint.cpp b/modules/juce_gui_basics/positioning/juce_RelativePoint.cpp index b2e0f55520..86debb574b 100644 --- a/modules/juce_gui_basics/positioning/juce_RelativePoint.cpp +++ b/modules/juce_gui_basics/positioning/juce_RelativePoint.cpp @@ -39,7 +39,7 @@ RelativePoint::RelativePoint() { } -RelativePoint::RelativePoint (const Point& absolutePoint) +RelativePoint::RelativePoint (Point absolutePoint) : x (absolutePoint.x), y (absolutePoint.y) { } @@ -72,13 +72,13 @@ bool RelativePoint::operator!= (const RelativePoint& other) const noexcept return ! operator== (other); } -const Point RelativePoint::resolve (const Expression::Scope* scope) const +Point RelativePoint::resolve (const Expression::Scope* scope) const { return Point ((float) x.resolve (scope), (float) y.resolve (scope)); } -void RelativePoint::moveToAbsolute (const Point& newPos, const Expression::Scope* scope) +void RelativePoint::moveToAbsolute (Point newPos, const Expression::Scope* scope) { x.moveToAbsolute (newPos.x, scope); y.moveToAbsolute (newPos.y, scope); diff --git a/modules/juce_gui_basics/positioning/juce_RelativePoint.h b/modules/juce_gui_basics/positioning/juce_RelativePoint.h index 9928ae5f7a..6954765550 100644 --- a/modules/juce_gui_basics/positioning/juce_RelativePoint.h +++ b/modules/juce_gui_basics/positioning/juce_RelativePoint.h @@ -42,7 +42,7 @@ public: RelativePoint(); /** Creates an absolute point, relative to the origin. */ - RelativePoint (const Point& absolutePoint); + RelativePoint (Point absolutePoint); /** Creates an absolute point, relative to the origin. */ RelativePoint (float absoluteX, float absoluteY); @@ -65,7 +65,7 @@ public: You'll need to provide a suitable Expression::Scope for looking up any coordinates that may be needed to calculate the result. */ - const Point resolve (const Expression::Scope* evaluationContext) const; + Point resolve (const Expression::Scope* evaluationContext) const; /** Changes the values of this point's coordinates to make it resolve to the specified position. @@ -73,7 +73,7 @@ public: or relative positions to whatever values are necessary to make the resultant position match the position that is provided. */ - void moveToAbsolute (const Point& newPos, const Expression::Scope* evaluationContext); + void moveToAbsolute (Point newPos, const Expression::Scope* evaluationContext); /** Returns a string which represents this point. This returns a comma-separated pair of coordinates. For details of the string syntax used by the diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.cpp b/modules/juce_gui_basics/widgets/juce_ListBox.cpp index f38b9c9f1b..62cec6a401 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ListBox.cpp @@ -590,7 +590,7 @@ void ListBox::deselectAllRows() } void ListBox::selectRowsBasedOnModifierKeys (const int row, - const ModifierKeys& mods, + ModifierKeys mods, const bool isMouseUpEvent) { if (multipleSelection && mods.isCommandDown()) diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.h b/modules/juce_gui_basics/widgets/juce_ListBox.h index 92c38c3faf..0964e98b53 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.h +++ b/modules/juce_gui_basics/widgets/juce_ListBox.h @@ -333,7 +333,7 @@ public: @see selectRow */ void selectRowsBasedOnModifierKeys (int rowThatWasClickedOn, - const ModifierKeys& modifiers, + ModifierKeys modifiers, bool isMouseUpEvent); //============================================================================== diff --git a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp index 7b8b6fb8c2..5b14206c01 100644 --- a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp +++ b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp @@ -61,7 +61,7 @@ struct TextAtom class TextEditor::UniformTextSection { public: - UniformTextSection (const String& text, const Font& f, const Colour& col, const juce_wchar passwordChar) + UniformTextSection (const String& text, const Font& f, const Colour col, const juce_wchar passwordChar) : font (f), colour (col) { initialiseAtoms (text, passwordChar); @@ -175,7 +175,7 @@ public: mo << atoms.getUnchecked(i)->atomText; } - void appendSubstring (MemoryOutputStream& mo, const Range& range) const + void appendSubstring (MemoryOutputStream& mo, const Range range) const { int index = 0; for (int i = 0; i < atoms.size(); ++i) @@ -557,7 +557,7 @@ public: } } - void drawSelection (Graphics& g, const Range& selected) const + void drawSelection (Graphics& g, const Range selected) const { const int startX = roundToInt (indexToX (selected.getStart())); const int endX = roundToInt (indexToX (selected.getEnd())); @@ -568,7 +568,7 @@ public: g.fillRect (startX, y, endX - startX, nextY - y); } - void drawUnderline (Graphics& g, const Range& underline, const Colour& colour) const + void drawUnderline (Graphics& g, const Range underline, const Colour colour) const { const int startX = roundToInt (indexToX (underline.getStart())); const int endX = roundToInt (indexToX (underline.getEnd())); @@ -580,8 +580,8 @@ public: } void drawSelectedText (Graphics& g, - const Range& selected, - const Colour& selectedTextColour) const + const Range selected, + const Colour selectedTextColour) const { if (passwordCharacter != 0 || ! atom->isWhitespace()) { @@ -728,7 +728,7 @@ public: const String& newText, const int insertPos, const Font& newFont, - const Colour& newColour, + const Colour newColour, const int oldCaret, const int newCaret) : owner (ed), @@ -1282,7 +1282,7 @@ void TextEditor::timerCallbackInt() newTransaction(); } -void TextEditor::repaintText (const Range& range) +void TextEditor::repaintText (const Range range) { if (! range.isEmpty()) { @@ -1654,7 +1654,7 @@ void TextEditor::drawContent (Graphics& g) for (int j = underlinedSections.size(); --j >= 0;) { - const Range& underlinedSection = underlinedSections.getReference (j); + const Range underlinedSection = underlinedSections.getReference (j); Iterator i2 (sections, wordWrapWidth, passwordCharacter); @@ -2183,7 +2183,7 @@ void TextEditor::clearInternal (UndoManager* const um) void TextEditor::insert (const String& text, const int insertIndex, const Font& font, - const Colour& colour, + const Colour colour, UndoManager* const um, const int caretPositionToMoveTo) { @@ -2280,7 +2280,7 @@ void TextEditor::reinsert (const int insertIndex, valueTextNeedsUpdating = true; } -void TextEditor::remove (const Range& range, +void TextEditor::remove (Range range, UndoManager* const um, const int caretPositionToMoveTo) { diff --git a/modules/juce_gui_basics/widgets/juce_TextEditor.h b/modules/juce_gui_basics/widgets/juce_TextEditor.h index 096db1804f..8b01546be0 100644 --- a/modules/juce_gui_basics/widgets/juce_TextEditor.h +++ b/modules/juce_gui_basics/widgets/juce_TextEditor.h @@ -406,16 +406,16 @@ public: The rectangle returned is relative to the component's top-left corner. @see scrollEditorToPositionCaret */ - Rectangle getCaretRectangle(); + Rectangle getCaretRectangle() override; /** Selects a section of the text. */ - void setHighlightedRegion (const Range& newSelection); + void setHighlightedRegion (const Range& newSelection) override; /** Returns the range of characters that are selected. If nothing is selected, this will return an empty range. @see setHighlightedRegion */ - Range getHighlightedRegion() const { return selection; } + Range getHighlightedRegion() const override { return selection; } /** Returns the section of text that is currently selected. */ String getHighlightedText() const; @@ -699,9 +699,9 @@ private: void coalesceSimilarSections(); void splitSection (int sectionIndex, int charToSplitAt); void clearInternal (UndoManager*); - void insert (const String&, int insertIndex, const Font&, const Colour&, UndoManager*, int newCaretPos); + void insert (const String&, int insertIndex, const Font&, const Colour, UndoManager*, int newCaretPos); void reinsert (int insertIndex, const Array &); - void remove (const Range& range, UndoManager*, int caretPositionToMoveTo); + void remove (Range range, UndoManager*, int caretPositionToMoveTo); void getCharPosition (int index, float& x, float& y, float& lineHeight) const; void updateCaretPosition(); void updateValueFromText(); @@ -716,7 +716,7 @@ private: void updateTextHolderSize(); float getWordWrapWidth() const; void timerCallbackInt(); - void repaintText (const Range&); + void repaintText (Range); void scrollByLines (int deltaLines); bool undoOrRedo (bool shouldUndo); UndoManager* getUndoManager() noexcept; diff --git a/modules/juce_gui_basics/widgets/juce_TreeView.cpp b/modules/juce_gui_basics/widgets/juce_TreeView.cpp index 5aaf52ad2d..0b90c2c7be 100644 --- a/modules/juce_gui_basics/widgets/juce_TreeView.cpp +++ b/modules/juce_gui_basics/widgets/juce_TreeView.cpp @@ -279,7 +279,7 @@ private: TreeViewItem* buttonUnderMouse; bool isDragging, needSelectionOnMouseUp; - void selectBasedOnModifiers (TreeViewItem* const item, const ModifierKeys& modifiers) + void selectBasedOnModifiers (TreeViewItem* const item, const ModifierKeys modifiers) { TreeViewItem* firstSelected = nullptr; diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp index 272c5e8042..8ff1a1f276 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp @@ -99,21 +99,21 @@ MouseInputSource* ComponentPeer::getOrCreateMouseInputSource (int touchIndex) } } -void ComponentPeer::handleMouseEvent (const int touchIndex, const Point& positionWithinPeer, - const ModifierKeys& newMods, const int64 time) +void ComponentPeer::handleMouseEvent (const int touchIndex, const Point positionWithinPeer, + const ModifierKeys newMods, const int64 time) { if (MouseInputSource* mouse = getOrCreateMouseInputSource (touchIndex)) mouse->handleEvent (this, positionWithinPeer, time, newMods); } -void ComponentPeer::handleMouseWheel (const int touchIndex, const Point& positionWithinPeer, +void ComponentPeer::handleMouseWheel (const int touchIndex, const Point positionWithinPeer, const int64 time, const MouseWheelDetails& wheel) { if (MouseInputSource* mouse = getOrCreateMouseInputSource (touchIndex)) mouse->handleWheel (this, positionWithinPeer, time, wheel); } -void ComponentPeer::handleMagnifyGesture (const int touchIndex, const Point& positionWithinPeer, +void ComponentPeer::handleMagnifyGesture (const int touchIndex, const Point positionWithinPeer, const int64 time, const float scaleFactor) { if (MouseInputSource* mouse = getOrCreateMouseInputSource (touchIndex)) diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.h b/modules/juce_gui_basics/windows/juce_ComponentPeer.h index 773349d7a5..7c27089d1e 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.h +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.h @@ -296,9 +296,9 @@ public: virtual void setAlpha (float newAlpha) = 0; //============================================================================== - void handleMouseEvent (int touchIndex, const Point& positionWithinPeer, const ModifierKeys& newMods, int64 time); - void handleMouseWheel (int touchIndex, const Point& positionWithinPeer, int64 time, const MouseWheelDetails&); - void handleMagnifyGesture (int touchIndex, const Point& positionWithinPeer, int64 time, float scaleFactor); + void handleMouseEvent (int touchIndex, const Point positionWithinPeer, const ModifierKeys newMods, int64 time); + void handleMouseWheel (int touchIndex, const Point positionWithinPeer, int64 time, const MouseWheelDetails&); + void handleMagnifyGesture (int touchIndex, const Point positionWithinPeer, int64 time, float scaleFactor); void handleUserClosingWindow(); diff --git a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp index b37c646f0a..054b2d111c 100644 --- a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp +++ b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp @@ -85,7 +85,7 @@ public: const float leftClip, const float rightClip, const float x, const int y, const int baselineOffset, const int lineH, const float characterWidth, - const Colour& highlightColour) const + const Colour highlightColour) const { if (highlightColumnStart < highlightColumnEnd) { @@ -710,7 +710,7 @@ void CodeEditorComponent::scrollBy (int deltaLines) scrollToLine (firstLineOnScreen + deltaLines); } -void CodeEditorComponent::scrollToKeepLinesOnScreen (const Range& rangeToShow) +void CodeEditorComponent::scrollToKeepLinesOnScreen (Range rangeToShow) { if (rangeToShow.getStart() < firstLineOnScreen) scrollBy (rangeToShow.getStart() - firstLineOnScreen); @@ -1484,7 +1484,7 @@ void CodeEditorComponent::setFont (const Font& newFont) resized(); } -void CodeEditorComponent::ColourScheme::set (const String& name, const Colour& colour) +void CodeEditorComponent::ColourScheme::set (const String& name, const Colour colour) { for (int i = 0; i < types.size(); ++i) { diff --git a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.h b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.h index 774aa36dfb..6834acdaa8 100644 --- a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.h +++ b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.h @@ -143,7 +143,7 @@ public: void scrollBy (int deltaLines); void scrollToColumn (int newFirstColumnOnScreen); void scrollToKeepCaretOnScreen(); - void scrollToKeepLinesOnScreen (const Range& linesToShow); + void scrollToKeepLinesOnScreen (Range linesToShow); void insertTextAtCaret (const String& textToInsert); void insertTabAtCaret(); @@ -152,10 +152,10 @@ public: void unindentSelection(); //============================================================================== - Range getHighlightedRegion() const; + Range getHighlightedRegion() const override; bool isHighlightActive() const noexcept; - void setHighlightedRegion (const Range& newRange); - String getTextInRange (const Range& range) const; + void setHighlightedRegion (const Range& newRange) override; + String getTextInRange (const Range& range) const override; //============================================================================== /** Can be used to save and restore the editor's caret position, selection state, etc. */ @@ -216,7 +216,7 @@ public: Array types; - void set (const String& name, const Colour& colour); + void set (const String& name, const Colour colour); }; /** Changes the syntax highlighting scheme. diff --git a/modules/juce_gui_extra/misc/juce_ColourSelector.cpp b/modules/juce_gui_extra/misc/juce_ColourSelector.cpp index c44a02fe8b..cbc3ee1090 100644 --- a/modules/juce_gui_extra/misc/juce_ColourSelector.cpp +++ b/modules/juce_gui_extra/misc/juce_ColourSelector.cpp @@ -351,7 +351,7 @@ Colour ColourSelector::getCurrentColour() const return ((flags & showAlphaChannel) != 0) ? colour : colour.withAlpha ((uint8) 0xff); } -void ColourSelector::setCurrentColour (const Colour& c) +void ColourSelector::setCurrentColour (Colour c) { if (c != colour) { diff --git a/modules/juce_gui_extra/misc/juce_ColourSelector.h b/modules/juce_gui_extra/misc/juce_ColourSelector.h index 289e082e25..f3ed139b1a 100644 --- a/modules/juce_gui_extra/misc/juce_ColourSelector.h +++ b/modules/juce_gui_extra/misc/juce_ColourSelector.h @@ -82,7 +82,7 @@ public: /** Changes the colour that is currently being shown. */ - void setCurrentColour (const Colour& newColour); + void setCurrentColour (Colour newColour); //============================================================================== /** Tells the selector how many preset colour swatches you want to have on the component. diff --git a/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp b/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp index 84316b1271..755a88791a 100644 --- a/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp +++ b/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp @@ -424,8 +424,8 @@ KeyMappingEditorComponent::~KeyMappingEditorComponent() } //============================================================================== -void KeyMappingEditorComponent::setColours (const Colour& mainBackground, - const Colour& textColour) +void KeyMappingEditorComponent::setColours (Colour mainBackground, + Colour textColour) { setColour (backgroundColourId, mainBackground); setColour (textColourId, textColour); diff --git a/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.h b/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.h index a6f98636c9..edeaffe839 100644 --- a/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.h +++ b/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.h @@ -57,8 +57,8 @@ public: @param mainBackground colour to use for most of the background @param textColour colour to use for the text */ - void setColours (const Colour& mainBackground, - const Colour& textColour); + void setColours (Colour mainBackground, + Colour textColour); /** Returns the KeyPressMappingSet that this component is acting upon. */ KeyPressMappingSet& getMappings() const noexcept { return mappings; } diff --git a/modules/juce_opengl/opengl/juce_Draggable3DOrientation.h b/modules/juce_opengl/opengl/juce_Draggable3DOrientation.h index da74e05913..bc56ffca1f 100644 --- a/modules/juce_opengl/opengl/juce_Draggable3DOrientation.h +++ b/modules/juce_opengl/opengl/juce_Draggable3DOrientation.h @@ -116,7 +116,7 @@ private: QuaternionType quaternion; Point lastMouse; - Point mousePosToProportion (const Point& mousePos) const noexcept + Point mousePosToProportion (const Point mousePos) const noexcept { const int scale = (jmin (area.getWidth(), area.getHeight()) / 2); @@ -128,7 +128,7 @@ private: (area.getCentreY() - mousePos.y) / scale); } - VectorType projectOnSphere (const Point& pos) const noexcept + VectorType projectOnSphere (const Point pos) const noexcept { const GLfloat radiusSquared = radius * radius; const GLfloat xySquared = pos.x * pos.x + pos.y * pos.y; diff --git a/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.cpp b/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.cpp index 9b60f72ed3..36364c122a 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.cpp @@ -293,7 +293,7 @@ void OpenGLFrameBuffer::releaseAsRenderingTarget() pimpl->context.extensions.glBindFramebuffer (GL_FRAMEBUFFER, 0); } -void OpenGLFrameBuffer::clear (const Colour& colour) +void OpenGLFrameBuffer::clear (Colour colour) { if (makeCurrentRenderingTarget()) { @@ -367,7 +367,7 @@ void OpenGLFrameBuffer::draw2D (float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, - const Colour& colour) const + Colour colour) const { if (pimpl != nullptr) { @@ -381,7 +381,7 @@ void OpenGLFrameBuffer::draw3D (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, - const Colour& colour) const + Colour colour) const { if (pimpl != nullptr) { diff --git a/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.h b/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.h index 958f9f6595..9bc1789d17 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.h +++ b/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.h @@ -102,7 +102,7 @@ public: static GLuint getCurrentFrameBufferTarget(); /** Clears the framebuffer with the specified colour. */ - void clear (const Colour& colour); + void clear (Colour colour); /** Selects the framebuffer as the current target, and clears it to transparent. */ void makeCurrentAndClear(); @@ -113,14 +113,14 @@ public: float x2, float y2, float x3, float y3, float x4, float y4, - const Colour& colour) const; + Colour colour) const; /** Draws this framebuffer onto the current context, with the specified corner positions. */ void draw3D (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, - const Colour& colour) const; + Colour colour) const; /** Draws the framebuffer at a given position. */ void drawAt (float x1, float y1) const; diff --git a/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp index 9f5130e1c5..c991007823 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp @@ -32,7 +32,7 @@ struct Target : context (c), frameBufferID (frameBufferID_), bounds (width, height) {} - Target (OpenGLContext& c, OpenGLFrameBuffer& fb, const Point& origin) noexcept + Target (OpenGLContext& c, OpenGLFrameBuffer& fb, Point origin) noexcept : context (c), frameBufferID (fb.getFrameBufferID()), bounds (origin.x, origin.y, fb.getWidth(), fb.getHeight()) { @@ -298,7 +298,7 @@ public: matrix (program, "matrix") {} - void setMatrix (const Point& p1, const Point& p2, const Point& p3) + void setMatrix (const Point p1, const Point p2, const Point p3) { const AffineTransform t (AffineTransform::fromTargetPoints (p1.x, p1.y, 0.0f, 0.0f, p2.x, p2.y, 1.0f, 0.0f, @@ -665,8 +665,8 @@ struct StateHelpers template struct EdgeTableRenderer { - EdgeTableRenderer (QuadQueueType& quadQueue_, const PixelARGB& colour_) noexcept - : quadQueue (quadQueue_), colour (colour_) + EdgeTableRenderer (QuadQueueType& q, const PixelARGB c) noexcept + : quadQueue (q), colour (c) {} void setEdgeTableYPos (const int y) noexcept @@ -709,8 +709,8 @@ struct StateHelpers template struct FloatRectangleRenderer { - FloatRectangleRenderer (QuadQueueType& quadQueue_, const PixelARGB& colour_) noexcept - : quadQueue (quadQueue_), colour (colour_) + FloatRectangleRenderer (QuadQueueType& q, const PixelARGB c) noexcept + : quadQueue (q), colour (c) {} void operator() (const int x, const int y, const int w, const int h, const int alpha) noexcept @@ -946,7 +946,7 @@ struct StateHelpers JUCE_CHECK_OPENGL_ERROR } - void add (const int x, const int y, const int w, const int h, const PixelARGB& colour) noexcept + void add (const int x, const int y, const int w, const int h, const PixelARGB colour) noexcept { jassert (w > 0 && h > 0); @@ -968,24 +968,24 @@ struct StateHelpers draw(); } - void add (const Rectangle& r, const PixelARGB& colour) noexcept + void add (const Rectangle& r, const PixelARGB colour) noexcept { add (r.getX(), r.getY(), r.getWidth(), r.getHeight(), colour); } - void add (const Rectangle& r, const PixelARGB& colour) noexcept + void add (const Rectangle& r, const PixelARGB colour) noexcept { FloatRectangleRenderer frr (*this, colour); RenderingHelpers::FloatRectangleRasterisingInfo (r).iterate (frr); } - void add (const RectangleList& list, const PixelARGB& colour) noexcept + void add (const RectangleList& list, const PixelARGB colour) noexcept { for (const Rectangle* i = list.begin(), * const e = list.end(); i != e; ++i) add (*i, colour); } - void add (const RectangleList& list, const Rectangle& clip, const PixelARGB& colour) noexcept + void add (const RectangleList& list, const Rectangle& clip, const PixelARGB colour) noexcept { for (const Rectangle* i = list.begin(), * const e = list.end(); i != e; ++i) { @@ -996,7 +996,7 @@ struct StateHelpers } } - void add (const EdgeTable& et, const PixelARGB& colour) + void add (const EdgeTable& et, const PixelARGB colour) { EdgeTableRenderer etr (*this, colour); et.iterate (etr); diff --git a/modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp b/modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp index f6b1e706e4..be53b164b7 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp @@ -64,7 +64,7 @@ bool OpenGLHelpers::isExtensionSupported (const char* const extensionName) return false; } -void OpenGLHelpers::clear (const Colour& colour) +void OpenGLHelpers::clear (Colour colour) { glClearColor (colour.getFloatRed(), colour.getFloatGreen(), colour.getFloatBlue(), colour.getFloatAlpha()); @@ -73,7 +73,7 @@ void OpenGLHelpers::clear (const Colour& colour) } #if JUCE_USE_OPENGL_FIXED_FUNCTION -void OpenGLHelpers::setColour (const Colour& colour) +void OpenGLHelpers::setColour (Colour colour) { glColor4f (colour.getFloatRed(), colour.getFloatGreen(), colour.getFloatBlue(), colour.getFloatAlpha()); @@ -143,7 +143,7 @@ void OpenGLHelpers::drawQuad2D (float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, - const Colour& colour) + Colour colour) { const GLfloat vertices[] = { x1, y1, x2, y2, x4, y4, x3, y3 }; const GLfloat textureCoords[] = { 0, 0, 1.0f, 0, 0, 1.0f, 1.0f, 1.0f }; @@ -166,7 +166,7 @@ void OpenGLHelpers::drawQuad3D (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, - const Colour& colour) + Colour colour) { const GLfloat vertices[] = { x1, y1, z1, x2, y2, z2, x4, y4, z4, x3, y3, z3 }; const GLfloat textureCoords[] = { 0, 0, 1.0f, 0, 0, 1.0f, 1.0f, 1.0f }; @@ -233,7 +233,7 @@ void OpenGLHelpers::fillRectWithTexture (const Rectangle& rect, GLuint text drawTextureQuad (textureID, rect); } -void OpenGLHelpers::fillRectWithColour (const Rectangle& rect, const Colour& colour) +void OpenGLHelpers::fillRectWithColour (const Rectangle& rect, Colour colour) { glEnableClientState (GL_VERTEX_ARRAY); glDisableClientState (GL_TEXTURE_COORD_ARRAY); diff --git a/modules/juce_opengl/opengl/juce_OpenGLHelpers.h b/modules/juce_opengl/opengl/juce_OpenGLHelpers.h index 1605c5703e..a4b9b5e4df 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLHelpers.h +++ b/modules/juce_opengl/opengl/juce_OpenGLHelpers.h @@ -44,7 +44,7 @@ public: static bool isContextActive(); /** Clears the current context using the given colour. */ - static void clear (const Colour& colour); + static void clear (Colour colour); static void enableScissorTest (const Rectangle& clip); @@ -56,7 +56,7 @@ public: #if JUCE_USE_OPENGL_FIXED_FUNCTION /** Sets the current colour using a JUCE colour. */ - static void setColour (const Colour& colour); + static void setColour (Colour colour); /** Gives the current context an orthoganal rendering mode for 2D drawing into the given size. */ static void prepareFor2D (int width, int height); @@ -76,14 +76,14 @@ public: float x2, float y2, float x3, float y3, float x4, float y4, - const Colour& colour); + Colour colour); /** Draws a 3D quad with the specified corner points. */ static void drawQuad3D (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, - const Colour& colour); + Colour colour); static void drawTriangleStrip (const GLfloat* const vertices, const GLfloat* const textureCoords, const int numVertices) noexcept; static void drawTriangleStrip (const GLfloat* const vertices, const GLfloat* const textureCoords, @@ -95,7 +95,7 @@ public: /** Fills a rectangle with the specified colour. */ static void fillRectWithColour (const Rectangle& rect, - const Colour& colour); + Colour colour); static void fillRect (const Rectangle& rect); #endif diff --git a/modules/juce_opengl/opengl/juce_OpenGLTexture.cpp b/modules/juce_opengl/opengl/juce_OpenGLTexture.cpp index 9cca33a054..219c8116f9 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLTexture.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLTexture.cpp @@ -174,7 +174,7 @@ void OpenGLTexture::draw2D (float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, - const Colour& colour) const + Colour colour) const { bind(); OpenGLHelpers::drawQuad2D (x1, y1, x2, y2, x3, y3, x4, y4, colour); @@ -185,7 +185,7 @@ void OpenGLTexture::draw3D (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, - const Colour& colour) const + Colour colour) const { bind(); OpenGLHelpers::drawQuad3D (x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4, colour); diff --git a/modules/juce_opengl/opengl/juce_OpenGLTexture.h b/modules/juce_opengl/opengl/juce_OpenGLTexture.h index bd59cccc77..c1ff9f5062 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLTexture.h +++ b/modules/juce_opengl/opengl/juce_OpenGLTexture.h @@ -84,14 +84,14 @@ public: float x2, float y2, float x3, float y3, float x4, float y4, - const Colour& colour) const; + Colour colour) const; /** Draws this texture into the current context, with the specified corner positions. */ void draw3D (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, - const Colour& colour) const; + Colour colour) const; #endif /** Returns the GL texture ID number. */