Browse Source

Changed some pass-by-references to pass-by-value to improve compiler optimisation.

tags/2021-05-28
jules 12 years ago
parent
commit
c7506df13f
100 changed files with 608 additions and 607 deletions
  1. +2
    -2
      extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.cpp
  2. +2
    -2
      extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.h
  3. +1
    -1
      extras/Introjucer/Source/ComponentEditor/paintelements/jucer_PaintElementPath.cpp
  4. +41
    -41
      modules/juce_audio_basics/buffers/juce_AudioDataConverters.h
  5. +1
    -1
      modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp
  6. +1
    -1
      modules/juce_audio_formats/codecs/juce_WavAudioFormat.h
  7. +1
    -1
      modules/juce_audio_formats/format/juce_AudioFormatReader.cpp
  8. +3
    -3
      modules/juce_audio_formats/format/juce_MemoryMappedAudioFormatReader.h
  9. +1
    -1
      modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp
  10. +3
    -3
      modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp
  11. +3
    -3
      modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h
  12. +9
    -9
      modules/juce_core/containers/juce_NamedValueSet.cpp
  13. +9
    -9
      modules/juce_core/containers/juce_NamedValueSet.h
  14. +5
    -5
      modules/juce_core/containers/juce_SparseSet.h
  15. +9
    -9
      modules/juce_core/containers/juce_Variant.cpp
  16. +9
    -9
      modules/juce_core/containers/juce_Variant.h
  17. +6
    -6
      modules/juce_core/files/juce_File.cpp
  18. +3
    -3
      modules/juce_core/files/juce_File.h
  19. +10
    -10
      modules/juce_core/maths/juce_Range.h
  20. +24
    -24
      modules/juce_core/text/juce_CharPointer_ASCII.h
  21. +24
    -24
      modules/juce_core/text/juce_CharPointer_UTF16.h
  22. +23
    -23
      modules/juce_core/text/juce_CharPointer_UTF32.h
  23. +21
    -21
      modules/juce_core/text/juce_CharPointer_UTF8.h
  24. +5
    -5
      modules/juce_core/text/juce_CharacterFunctions.h
  25. +1
    -1
      modules/juce_core/text/juce_Identifier.cpp
  26. +3
    -3
      modules/juce_core/text/juce_Identifier.h
  27. +29
    -29
      modules/juce_core/text/juce_String.cpp
  28. +19
    -19
      modules/juce_core/text/juce_String.h
  29. +14
    -14
      modules/juce_core/time/juce_RelativeTime.cpp
  30. +12
    -12
      modules/juce_core/time/juce_RelativeTime.h
  31. +14
    -14
      modules/juce_core/time/juce_Time.cpp
  32. +12
    -12
      modules/juce_core/time/juce_Time.h
  33. +1
    -1
      modules/juce_cryptography/hashing/juce_MD5.cpp
  34. +1
    -1
      modules/juce_cryptography/hashing/juce_MD5.h
  35. +1
    -1
      modules/juce_cryptography/hashing/juce_SHA256.cpp
  36. +1
    -1
      modules/juce_cryptography/hashing/juce_SHA256.h
  37. +31
    -31
      modules/juce_data_structures/values/juce_ValueTree.cpp
  38. +13
    -13
      modules/juce_data_structures/values/juce_ValueTree.h
  39. +9
    -9
      modules/juce_graphics/colour/juce_Colour.cpp
  40. +5
    -5
      modules/juce_graphics/colour/juce_Colour.h
  41. +4
    -4
      modules/juce_graphics/colour/juce_ColourGradient.cpp
  42. +5
    -5
      modules/juce_graphics/colour/juce_ColourGradient.h
  43. +1
    -1
      modules/juce_graphics/colour/juce_Colours.cpp
  44. +1
    -1
      modules/juce_graphics/colour/juce_Colours.h
  45. +3
    -3
      modules/juce_graphics/colour/juce_FillType.cpp
  46. +2
    -2
      modules/juce_graphics/colour/juce_FillType.h
  47. +3
    -3
      modules/juce_graphics/colour/juce_PixelFormats.h
  48. +3
    -3
      modules/juce_graphics/contexts/juce_GraphicsContext.cpp
  49. +4
    -4
      modules/juce_graphics/contexts/juce_GraphicsContext.h
  50. +1
    -1
      modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp
  51. +1
    -1
      modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h
  52. +1
    -1
      modules/juce_graphics/effects/juce_DropShadowEffect.cpp
  53. +1
    -1
      modules/juce_graphics/effects/juce_DropShadowEffect.h
  54. +1
    -1
      modules/juce_graphics/effects/juce_GlowEffect.cpp
  55. +1
    -1
      modules/juce_graphics/effects/juce_GlowEffect.h
  56. +7
    -7
      modules/juce_graphics/fonts/juce_AttributedString.cpp
  57. +7
    -7
      modules/juce_graphics/fonts/juce_AttributedString.h
  58. +5
    -5
      modules/juce_graphics/fonts/juce_TextLayout.cpp
  59. +3
    -3
      modules/juce_graphics/fonts/juce_TextLayout.h
  60. +12
    -12
      modules/juce_graphics/geometry/juce_Path.cpp
  61. +12
    -12
      modules/juce_graphics/geometry/juce_Path.h
  62. +9
    -9
      modules/juce_graphics/geometry/juce_Point.h
  63. +3
    -3
      modules/juce_graphics/images/juce_Image.cpp
  64. +3
    -3
      modules/juce_graphics/images/juce_Image.h
  65. +18
    -18
      modules/juce_graphics/native/juce_RenderingHelpers.h
  66. +4
    -4
      modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp
  67. +1
    -1
      modules/juce_gui_basics/buttons/juce_ArrowButton.cpp
  68. +1
    -1
      modules/juce_gui_basics/buttons/juce_ArrowButton.h
  69. +3
    -3
      modules/juce_gui_basics/buttons/juce_ImageButton.cpp
  70. +3
    -3
      modules/juce_gui_basics/buttons/juce_ImageButton.h
  71. +1
    -1
      modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.cpp
  72. +1
    -1
      modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.h
  73. +26
    -26
      modules/juce_gui_basics/components/juce_Component.cpp
  74. +20
    -20
      modules/juce_gui_basics/components/juce_Component.h
  75. +2
    -2
      modules/juce_gui_basics/components/juce_Desktop.cpp
  76. +3
    -3
      modules/juce_gui_basics/components/juce_Desktop.h
  77. +1
    -1
      modules/juce_gui_basics/drawables/juce_Drawable.cpp
  78. +1
    -1
      modules/juce_gui_basics/drawables/juce_Drawable.h
  79. +2
    -2
      modules/juce_gui_basics/drawables/juce_DrawablePath.cpp
  80. +2
    -2
      modules/juce_gui_basics/drawables/juce_DrawablePath.h
  81. +2
    -2
      modules/juce_gui_basics/drawables/juce_DrawableText.cpp
  82. +3
    -3
      modules/juce_gui_basics/drawables/juce_DrawableText.h
  83. +6
    -5
      modules/juce_gui_basics/drawables/juce_SVGParser.cpp
  84. +2
    -2
      modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp
  85. +2
    -2
      modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.h
  86. +1
    -1
      modules/juce_gui_basics/keyboard/juce_KeyPress.cpp
  87. +1
    -1
      modules/juce_gui_basics/keyboard/juce_KeyPress.h
  88. +1
    -1
      modules/juce_gui_basics/keyboard/juce_ModifierKeys.cpp
  89. +3
    -3
      modules/juce_gui_basics/keyboard/juce_ModifierKeys.h
  90. +1
    -1
      modules/juce_gui_basics/layout/juce_ResizableBorderComponent.cpp
  91. +1
    -1
      modules/juce_gui_basics/layout/juce_ResizableBorderComponent.h
  92. +2
    -2
      modules/juce_gui_basics/layout/juce_ScrollBar.cpp
  93. +2
    -2
      modules/juce_gui_basics/layout/juce_ScrollBar.h
  94. +2
    -2
      modules/juce_gui_basics/layout/juce_Viewport.cpp
  95. +3
    -3
      modules/juce_gui_basics/layout/juce_Viewport.h
  96. +2
    -2
      modules/juce_gui_basics/menus/juce_MenuBarComponent.cpp
  97. +2
    -2
      modules/juce_gui_basics/menus/juce_MenuBarComponent.h
  98. +6
    -6
      modules/juce_gui_basics/menus/juce_PopupMenu.cpp
  99. +1
    -1
      modules/juce_gui_basics/menus/juce_PopupMenu.h
  100. +1
    -1
      modules/juce_gui_basics/misc/juce_BubbleComponent.cpp

+ 2
- 2
extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.cpp View File

@@ -155,7 +155,7 @@ void SourceCodeEditor::setEditor (CodeEditorComponent* newEditor)
editor->getDocument().addListener (this); editor->getDocument().addListener (this);
} }
void SourceCodeEditor::scrollToKeepRangeOnScreen (const Range<int>& range)
void SourceCodeEditor::scrollToKeepRangeOnScreen (Range<int> range)
{ {
const int space = jmin (10, editor->getNumLinesOnScreen() / 3); const int space = jmin (10, editor->getNumLinesOnScreen() / 3);
const CodeDocument::Position start (editor->getDocument(), range.getStart()); const CodeDocument::Position start (editor->getDocument(), range.getStart());
@@ -164,7 +164,7 @@ void SourceCodeEditor::scrollToKeepRangeOnScreen (const Range<int>& range)
editor->scrollToKeepLinesOnScreen (Range<int> (start.getLineNumber() - space, end.getLineNumber() + space)); editor->scrollToKeepLinesOnScreen (Range<int> (start.getLineNumber() - space, end.getLineNumber() + space));
} }
void SourceCodeEditor::highlight (const Range<int>& range, bool cursorAtStart)
void SourceCodeEditor::highlight (Range<int> range, bool cursorAtStart)
{ {
scrollToKeepRangeOnScreen (range); scrollToKeepRangeOnScreen (range);


+ 2
- 2
extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.h View File

@@ -146,8 +146,8 @@ public:
void createEditor (CodeDocument& codeDocument); void createEditor (CodeDocument& codeDocument);
void setEditor (CodeEditorComponent*); void setEditor (CodeEditorComponent*);
void scrollToKeepRangeOnScreen (const Range<int>& range);
void highlight (const Range<int>& range, bool cursorAtStart);
void scrollToKeepRangeOnScreen (Range<int> range);
void highlight (Range<int> range, bool cursorAtStart);
ScopedPointer<CodeEditorComponent> editor; ScopedPointer<CodeEditorComponent> editor;


+ 1
- 1
extras/Introjucer/Source/ComponentEditor/paintelements/jucer_PaintElementPath.cpp View File

@@ -231,7 +231,7 @@ void PaintElementPath::rescalePoint (RelativePositionedRectangle& pos, int dx, i
} }
//============================================================================== //==============================================================================
static void drawArrow (Graphics& g, const Point<float>& p1, const Point<float>& p2)
static void drawArrow (Graphics& g, const Point<float> p1, const Point<float> p2)
{ {
g.drawArrow (Line<float> (p1.x, p1.y, (p1.x + p2.x) * 0.5f, (p1.y + p2.y) * 0.5f), 1.0f, 8.0f, 10.0f); g.drawArrow (Line<float> (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); g.drawLine (p1.x + (p2.x - p1.x) * 0.49f, p1.y + (p2.y - p1.y) * 0.49f, p2.x, p2.y);


+ 41
- 41
modules/juce_audio_basics/buffers/juce_AudioDataConverters.h View File

@@ -71,22 +71,22 @@ public:
class BigEndian class BigEndian
{ {
public: public:
template <class SampleFormatType> static inline float getAsFloat (SampleFormatType& s) noexcept { return s.getAsFloatBE(); }
template <class SampleFormatType> static inline void setAsFloat (SampleFormatType& s, float newValue) noexcept { s.setAsFloatBE (newValue); }
template <class SampleFormatType> static inline int32 getAsInt32 (SampleFormatType& s) noexcept { return s.getAsInt32BE(); }
template <class SampleFormatType> static inline void setAsInt32 (SampleFormatType& s, int32 newValue) noexcept { s.setAsInt32BE (newValue); }
template <class SourceType, class DestType> static inline void copyFrom (DestType& dest, SourceType& source) noexcept { dest.copyFromBE (source); }
template <class SampleFormatType> static inline float getAsFloat (SampleFormatType s) noexcept { return s.getAsFloatBE(); }
template <class SampleFormatType> static inline void setAsFloat (SampleFormatType s, float newValue) noexcept { s.setAsFloatBE (newValue); }
template <class SampleFormatType> static inline int32 getAsInt32 (SampleFormatType s) noexcept { return s.getAsInt32BE(); }
template <class SampleFormatType> static inline void setAsInt32 (SampleFormatType s, int32 newValue) noexcept { s.setAsInt32BE (newValue); }
template <class SourceType, class DestType> static inline void copyFrom (DestType dest, SourceType source) noexcept { dest.copyFromBE (source); }
enum { isBigEndian = 1 }; enum { isBigEndian = 1 };
}; };
class LittleEndian class LittleEndian
{ {
public: public:
template <class SampleFormatType> static inline float getAsFloat (SampleFormatType& s) noexcept { return s.getAsFloatLE(); }
template <class SampleFormatType> static inline void setAsFloat (SampleFormatType& s, float newValue) noexcept { s.setAsFloatLE (newValue); }
template <class SampleFormatType> static inline int32 getAsInt32 (SampleFormatType& s) noexcept { return s.getAsInt32LE(); }
template <class SampleFormatType> static inline void setAsInt32 (SampleFormatType& s, int32 newValue) noexcept { s.setAsInt32LE (newValue); }
template <class SourceType, class DestType> static inline void copyFrom (DestType& dest, SourceType& source) noexcept { dest.copyFromLE (source); }
template <class SampleFormatType> static inline float getAsFloat (SampleFormatType s) noexcept { return s.getAsFloatLE(); }
template <class SampleFormatType> static inline void setAsFloat (SampleFormatType s, float newValue) noexcept { s.setAsFloatLE (newValue); }
template <class SampleFormatType> static inline int32 getAsInt32 (SampleFormatType s) noexcept { return s.getAsInt32LE(); }
template <class SampleFormatType> static inline void setAsInt32 (SampleFormatType s, int32 newValue) noexcept { s.setAsInt32LE (newValue); }
template <class SourceType, class DestType> static inline void copyFrom (DestType dest, SourceType source) noexcept { dest.copyFromLE (source); }
enum { isBigEndian = 0 }; enum { isBigEndian = 0 };
}; };
@@ -114,9 +114,9 @@ public:
inline void setAsInt32BE (int newValue) noexcept { setAsInt32LE (newValue); } inline void setAsInt32BE (int newValue) noexcept { setAsInt32LE (newValue); }
inline void clear() noexcept { *data = 0; } inline void clear() noexcept { *data = 0; }
inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;} inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) noexcept { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) noexcept { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int8& source) noexcept { *data = *source.data; }
template <class SourceType> inline void copyFromLE (SourceType source) noexcept { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType source) noexcept { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int8 source) noexcept { *data = *source.data; }
int8* data; int8* data;
enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 }; 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 setAsInt32BE (int newValue) noexcept { setAsInt32LE (newValue); }
inline void clear() noexcept { *data = 128; } inline void clear() noexcept { *data = 128; }
inline void clearMultiple (int num) noexcept { memset (data, 128, (size_t) num) ;} inline void clearMultiple (int num) noexcept { memset (data, 128, (size_t) num) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) noexcept { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) noexcept { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (UInt8& source) noexcept { *data = *source.data; }
template <class SourceType> inline void copyFromLE (SourceType source) noexcept { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType source) noexcept { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (UInt8 source) noexcept { *data = *source.data; }
uint8* data; uint8* data;
enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 }; 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 setAsInt32BE (int32 newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint16) (newValue >> 16)); }
inline void clear() noexcept { *data = 0; } inline void clear() noexcept { *data = 0; }
inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;} inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) noexcept { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) noexcept { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int16& source) noexcept { *data = *source.data; }
template <class SourceType> inline void copyFromLE (SourceType source) noexcept { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType source) noexcept { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int16 source) noexcept { *data = *source.data; }
uint16* data; uint16* data;
enum { bytesPerSample = 2, maxValue = 0x7fff, resolution = (1 << 16), isFloat = 0 }; 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 setAsInt32BE (int32 newValue) noexcept { ByteOrder::bigEndian24BitToChars (newValue >> 8, data); }
inline void clear() noexcept { data[0] = 0; data[1] = 0; data[2] = 0; } 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)) ;} inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) noexcept { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> 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 <class SourceType> inline void copyFromLE (SourceType source) noexcept { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> 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; char* data;
enum { bytesPerSample = 3, maxValue = 0x7fffff, resolution = (1 << 8), isFloat = 0 }; 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 setAsInt32BE (int32 newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) newValue); }
inline void clear() noexcept { *data = 0; } inline void clear() noexcept { *data = 0; }
inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;} inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) noexcept { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) noexcept { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int32& source) noexcept { *data = *source.data; }
template <class SourceType> inline void copyFromLE (SourceType source) noexcept { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType source) noexcept { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int32 source) noexcept { *data = *source.data; }
uint32* data; uint32* data;
enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = 1, isFloat = 0 }; 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 setAsInt32BE (int32 newValue) noexcept { setAsFloatBE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
inline void clear() noexcept { *data = 0; } inline void clear() noexcept { *data = 0; }
inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;} inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) noexcept { setAsFloatLE (source.getAsFloat()); }
template <class SourceType> inline void copyFromBE (SourceType& source) noexcept { setAsFloatBE (source.getAsFloat()); }
inline void copyFromSameType (Float32& source) noexcept { *data = *source.data; }
template <class SourceType> inline void copyFromLE (SourceType source) noexcept { setAsFloatLE (source.getAsFloat()); }
template <class SourceType> inline void copyFromBE (SourceType source) noexcept { setAsFloatBE (source.getAsFloat()); }
inline void copyFromSameType (Float32 source) noexcept { *data = *source.data; }
float* data; float* data;
enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = (1 << 8), isFloat = 1 }; enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = (1 << 8), isFloat = 1 };
@@ -262,10 +262,10 @@ public:
inline NonInterleaved (const NonInterleaved&) noexcept {} inline NonInterleaved (const NonInterleaved&) noexcept {}
inline NonInterleaved (const int) noexcept {} inline NonInterleaved (const int) noexcept {}
inline void copyFrom (const NonInterleaved&) noexcept {} inline void copyFrom (const NonInterleaved&) noexcept {}
template <class SampleFormatType> inline void advanceData (SampleFormatType& s) noexcept { s.advance(); }
template <class SampleFormatType> inline void advanceDataBy (SampleFormatType& s, int numSamples) noexcept { s.skip (numSamples); }
template <class SampleFormatType> inline void clear (SampleFormatType& s, int numSamples) noexcept { s.clearMultiple (numSamples); }
template <class SampleFormatType> inline static int getNumBytesBetweenSamples (const SampleFormatType&) noexcept { return SampleFormatType::bytesPerSample; }
template <class SampleFormatType> inline void advanceData (SampleFormatType s) noexcept { s.advance(); }
template <class SampleFormatType> inline void advanceDataBy (SampleFormatType s, int numSamples) noexcept { s.skip (numSamples); }
template <class SampleFormatType> inline void clear (SampleFormatType s, int numSamples) noexcept { s.clearMultiple (numSamples); }
template <class SampleFormatType> inline static int getNumBytesBetweenSamples (const SampleFormatType) noexcept { return SampleFormatType::bytesPerSample; }
enum { isInterleavedType = 0, numInterleavedChannels = 1 }; enum { isInterleavedType = 0, numInterleavedChannels = 1 };
}; };
@@ -276,11 +276,11 @@ public:
inline Interleaved() noexcept : numInterleavedChannels (1) {} inline Interleaved() noexcept : numInterleavedChannels (1) {}
inline Interleaved (const Interleaved& other) noexcept : numInterleavedChannels (other.numInterleavedChannels) {} inline Interleaved (const Interleaved& other) noexcept : numInterleavedChannels (other.numInterleavedChannels) {}
inline Interleaved (const int numInterleavedChans) noexcept : numInterleavedChannels (numInterleavedChans) {} inline Interleaved (const int numInterleavedChans) noexcept : numInterleavedChannels (numInterleavedChans) {}
inline void copyFrom (const Interleaved& other) noexcept { numInterleavedChannels = other.numInterleavedChannels; }
template <class SampleFormatType> inline void advanceData (SampleFormatType& s) noexcept { s.skip (numInterleavedChannels); }
template <class SampleFormatType> inline void advanceDataBy (SampleFormatType& s, int numSamples) noexcept { s.skip (numInterleavedChannels * numSamples); }
template <class SampleFormatType> inline void clear (SampleFormatType& s, int numSamples) noexcept { while (--numSamples >= 0) { s.clear(); s.skip (numInterleavedChannels); } }
template <class SampleFormatType> inline int getNumBytesBetweenSamples (const SampleFormatType&) const noexcept { return numInterleavedChannels * SampleFormatType::bytesPerSample; }
inline void copyFrom (const Interleaved other) noexcept { numInterleavedChannels = other.numInterleavedChannels; }
template <class SampleFormatType> inline void advanceData (SampleFormatType s) noexcept { s.skip (numInterleavedChannels); }
template <class SampleFormatType> inline void advanceDataBy (SampleFormatType s, int numSamples) noexcept { s.skip (numInterleavedChannels * numSamples); }
template <class SampleFormatType> inline void clear (SampleFormatType s, int numSamples) noexcept { while (--numSamples >= 0) { s.clear(); s.skip (numInterleavedChannels); } }
template <class SampleFormatType> inline int getNumBytesBetweenSamples (const SampleFormatType) const noexcept { return numInterleavedChannels * SampleFormatType::bytesPerSample; }
int numInterleavedChannels; int numInterleavedChannels;
enum { isInterleavedType = 1 }; enum { isInterleavedType = 1 };
}; };
@@ -362,7 +362,7 @@ public:
{ {
} }
Pointer& operator= (const Pointer& other) noexcept
Pointer operator= (const Pointer other) noexcept
{ {
InterleavingType::operator= (other); InterleavingType::operator= (other);
data = other.data; data = other.data;
@@ -407,13 +407,13 @@ public:
} }
/** Moves the pointer along to the next sample. */ /** 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. */ /** 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. */ /** 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. /** Writes a stream of samples into this pointer from another pointer.
This will copy the specified number of samples, converting between formats appropriately. This will copy the specified number of samples, converting between formats appropriately.


+ 1
- 1
modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp View File

@@ -38,7 +38,7 @@ const char* const WavAudioFormat::bwavCodingHistory = "bwav coding history";
StringPairArray WavAudioFormat::createBWAVMetadata (const String& description, StringPairArray WavAudioFormat::createBWAVMetadata (const String& description,
const String& originator, const String& originator,
const String& originatorRef, const String& originatorRef,
const Time& date,
const Time date,
const int64 timeReferenceSamples, const int64 timeReferenceSamples,
const String& codingHistory) const String& codingHistory)
{ {


+ 1
- 1
modules/juce_audio_formats/codecs/juce_WavAudioFormat.h View File

@@ -106,7 +106,7 @@ public:
static StringPairArray createBWAVMetadata (const String& description, static StringPairArray createBWAVMetadata (const String& description,
const String& originator, const String& originator,
const String& originatorRef, const String& originatorRef,
const Time& dateAndTime,
const Time dateAndTime,
const int64 timeReferenceSamples, const int64 timeReferenceSamples,
const String& codingHistory); const String& codingHistory);


+ 1
- 1
modules/juce_audio_formats/format/juce_AudioFormatReader.cpp View File

@@ -395,7 +395,7 @@ bool MemoryMappedAudioFormatReader::mapEntireFile()
return mapSectionOfFile (Range<int64> (0, lengthInSamples)); return mapSectionOfFile (Range<int64> (0, lengthInSamples));
} }
bool MemoryMappedAudioFormatReader::mapSectionOfFile (const Range<int64>& samplesToMap)
bool MemoryMappedAudioFormatReader::mapSectionOfFile (Range<int64> samplesToMap)
{ {
if (map == nullptr || samplesToMap != mappedSection) if (map == nullptr || samplesToMap != mappedSection)
{ {


+ 3
- 3
modules/juce_audio_formats/format/juce_MemoryMappedAudioFormatReader.h View File

@@ -62,16 +62,16 @@ public:
bool mapEntireFile(); bool mapEntireFile();
/** Attempts to map a section of the file into memory. */ /** Attempts to map a section of the file into memory. */
bool mapSectionOfFile (const Range<int64>& samplesToMap);
bool mapSectionOfFile (Range<int64> samplesToMap);
/** Returns the sample range that's currently memory-mapped and available for reading. */ /** Returns the sample range that's currently memory-mapped and available for reading. */
const Range<int64>& getMappedSection() const noexcept { return mappedSection; }
Range<int64> getMappedSection() const noexcept { return mappedSection; }
/** Touches the memory for the given sample, to force it to be loaded into active memory. */ /** Touches the memory for the given sample, to force it to be loaded into active memory. */
void touchSample (int64 sample) const noexcept; void touchSample (int64 sample) const noexcept;
/** Returns the number of bytes currently being mapped */ /** 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: protected:
File file; File file;


+ 1
- 1
modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp View File

@@ -89,7 +89,7 @@ namespace
return Time(); 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(); return t1 != t2 || t1 == Time();
} }


+ 3
- 3
modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp View File

@@ -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::whiteNotes[] = { 0, 2, 4, 5, 7, 9, 11 };
const uint8 MidiKeyboardComponent::blackNotes[] = { 1, 3, 6, 8, 10 }; const uint8 MidiKeyboardComponent::blackNotes[] = { 1, 3, 6, 8, 10 };
int MidiKeyboardComponent::xyToNote (const Point<int>& pos, float& mousePositionVelocity)
int MidiKeyboardComponent::xyToNote (Point<int> pos, float& mousePositionVelocity)
{ {
if (! reallyContains (pos, false)) if (! reallyContains (pos, false))
return -1; return -1;
@@ -286,7 +286,7 @@ int MidiKeyboardComponent::xyToNote (const Point<int>& pos, float& mousePosition
return remappedXYToNote (p + Point<int> (xOffset, 0), mousePositionVelocity); return remappedXYToNote (p + Point<int> (xOffset, 0), mousePositionVelocity);
} }
int MidiKeyboardComponent::remappedXYToNote (const Point<int>& pos, float& mousePositionVelocity) const
int MidiKeyboardComponent::remappedXYToNote (Point<int> pos, float& mousePositionVelocity) const
{ {
if (pos.getY() < blackNoteLength) if (pos.getY() < blackNoteLength)
{ {
@@ -692,7 +692,7 @@ void MidiKeyboardComponent::updateNoteUnderMouse (const MouseEvent& e, bool isDo
updateNoteUnderMouse (e.getPosition(), isDown, e.source.getIndex()); updateNoteUnderMouse (e.getPosition(), isDown, e.source.getIndex());
} }
void MidiKeyboardComponent::updateNoteUnderMouse (const Point<int>& pos, bool isDown, int fingerNum)
void MidiKeyboardComponent::updateNoteUnderMouse (Point<int> pos, bool isDown, int fingerNum)
{ {
float mousePositionVelocity = 0.0f; float mousePositionVelocity = 0.0f;
const int newNote = xyToNote (pos, mousePositionVelocity); const int newNote = xyToNote (pos, mousePositionVelocity);


+ 3
- 3
modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h View File

@@ -398,10 +398,10 @@ private:
static const uint8 blackNotes[]; static const uint8 blackNotes[];
void getKeyPos (int midiNoteNumber, int& x, int& w) const; void getKeyPos (int midiNoteNumber, int& x, int& w) const;
int xyToNote (const Point<int>&, float& mousePositionVelocity);
int remappedXYToNote (const Point<int>&, float& mousePositionVelocity) const;
int xyToNote (Point<int>, float& mousePositionVelocity);
int remappedXYToNote (Point<int>, float& mousePositionVelocity) const;
void resetAnyKeysInUse(); void resetAnyKeysInUse();
void updateNoteUnderMouse (const Point<int>&, bool isDown, int fingerNum);
void updateNoteUnderMouse (Point<int>, bool isDown, int fingerNum);
void updateNoteUnderMouse (const MouseEvent&, bool isDown); void updateNoteUnderMouse (const MouseEvent&, bool isDown);
void repaintNote (const int midiNoteNumber); void repaintNote (const int midiNoteNumber);
void setLowestVisibleKeyFloat (float noteNumber); void setLowestVisibleKeyFloat (float noteNumber);


+ 9
- 9
modules/juce_core/containers/juce_NamedValueSet.cpp View File

@@ -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) : 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 <var&&> (v)) : name (n), value (static_cast <var&&> (v))
{ {
} }
@@ -138,7 +138,7 @@ int NamedValueSet::size() const noexcept
return values.size(); 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) for (NamedValue* i = values; i != nullptr; i = i->nextListItem)
if (i->name == name) if (i->name == name)
@@ -147,7 +147,7 @@ const var& NamedValueSet::operator[] (const Identifier& name) const
return var::null; 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)) if (const var* const v = getVarPointer (name))
return *v; return *v;
@@ -155,7 +155,7 @@ var NamedValueSet::getWithDefault (const Identifier& name, const var& defaultRet
return defaultReturnValue; 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) for (NamedValue* i = values; i != nullptr; i = i->nextListItem)
if (i->name == name) if (i->name == name)
@@ -165,7 +165,7 @@ var* NamedValueSet::getVarPointer (const Identifier& name) const noexcept
} }
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
bool NamedValueSet::set (const Identifier& name, var&& newValue)
bool NamedValueSet::set (const Identifier name, var&& newValue)
{ {
LinkedListPointer<NamedValue>* i = &values; LinkedListPointer<NamedValue>* i = &values;
@@ -190,7 +190,7 @@ bool NamedValueSet::set (const Identifier& name, var&& newValue)
} }
#endif #endif
bool NamedValueSet::set (const Identifier& name, const var& newValue)
bool NamedValueSet::set (const Identifier name, const var& newValue)
{ {
LinkedListPointer<NamedValue>* i = &values; LinkedListPointer<NamedValue>* i = &values;
@@ -214,12 +214,12 @@ bool NamedValueSet::set (const Identifier& name, const var& newValue)
return true; return true;
} }
bool NamedValueSet::contains (const Identifier& name) const
bool NamedValueSet::contains (const Identifier name) const
{ {
return getVarPointer (name) != nullptr; return getVarPointer (name) != nullptr;
} }
bool NamedValueSet::remove (const Identifier& name)
bool NamedValueSet::remove (const Identifier name)
{ {
LinkedListPointer<NamedValue>* i = &values; LinkedListPointer<NamedValue>* i = &values;


+ 9
- 9
modules/juce_core/containers/juce_NamedValueSet.h View File

@@ -71,35 +71,35 @@ public:
If the name isn't found, this will return a void variant. If the name isn't found, this will return a void variant.
@see getProperty @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 /** Tries to return the named value, but if no such value is found, this will
instead return the supplied default value. 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. /** Changes or adds a named value.
@returns true if a value was changed or added; false if the @returns true if a value was changed or added; false if the
value was already set the the value passed-in. 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 #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
/** Changes or adds a named value. /** Changes or adds a named value.
@returns true if a value was changed or added; false if the @returns true if a value was changed or added; false if the
value was already set the the value passed-in. value was already set the the value passed-in.
*/ */
bool set (const Identifier& name, var&& newValue);
bool set (const Identifier name, var&& newValue);
#endif #endif
/** Returns true if the set contains an item with the specified name. */ /** 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. /** Removes a value from the set.
@returns true if a value was removed; false if there was no value @returns true if a value was removed; false if there was no value
with the name that was given. 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. /** Returns the name of the value at a given index.
The index must be between 0 and size() - 1. 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 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(). 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. */ /** Sets properties to the values of all of an XML element's attributes. */
@@ -139,11 +139,11 @@ private:
public: public:
NamedValue() noexcept; NamedValue() noexcept;
NamedValue (const NamedValue&); NamedValue (const NamedValue&);
NamedValue (const Identifier& name, const var& value);
NamedValue (const Identifier name, const var& value);
NamedValue& operator= (const NamedValue&); NamedValue& operator= (const NamedValue&);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
NamedValue (NamedValue&&) noexcept; NamedValue (NamedValue&&) noexcept;
NamedValue (const Identifier& name, var&& value);
NamedValue (const Identifier name, var&& value);
NamedValue& operator= (NamedValue&&) noexcept; NamedValue& operator= (NamedValue&&) noexcept;
#endif #endif
bool operator== (const NamedValue& other) const noexcept; bool operator== (const NamedValue& other) const noexcept;


+ 5
- 5
modules/juce_core/containers/juce_SparseSet.h View File

@@ -162,7 +162,7 @@ public:
/** Adds a range of contiguous values to the set. /** Adds a range of contiguous values to the set.
e.g. addRange (Range \<int\> (10, 14)) will add (10, 11, 12, 13) to the set. e.g. addRange (Range \<int\> (10, 14)) will add (10, 11, 12, 13) to the set.
*/ */
void addRange (const Range<Type>& range)
void addRange (const Range<Type> range)
{ {
jassert (range.getLength() >= 0); jassert (range.getLength() >= 0);
if (range.getLength() > 0) if (range.getLength() > 0)
@@ -179,7 +179,7 @@ public:
/** Removes a range of values from the set. /** Removes a range of values from the set.
e.g. removeRange (Range\<int\> (10, 14)) will remove (10, 11, 12, 13) from the set. e.g. removeRange (Range\<int\> (10, 14)) will remove (10, 11, 12, 13) from the set.
*/ */
void removeRange (const Range<Type>& rangeToRemove)
void removeRange (const Range<Type> rangeToRemove)
{ {
jassert (rangeToRemove.getLength() >= 0); jassert (rangeToRemove.getLength() >= 0);
@@ -216,7 +216,7 @@ public:
} }
/** Does an XOR of the values in a given range. */ /** Does an XOR of the values in a given range. */
void invertRange (const Range<Type>& range)
void invertRange (const Range<Type> range)
{ {
SparseSet newItems; SparseSet newItems;
newItems.addRange (range); newItems.addRange (range);
@@ -231,7 +231,7 @@ public:
} }
/** Checks whether any part of a given range overlaps any part of this set. */ /** Checks whether any part of a given range overlaps any part of this set. */
bool overlapsRange (const Range<Type>& range)
bool overlapsRange (const Range<Type> range)
{ {
if (range.getLength() > 0) if (range.getLength() > 0)
{ {
@@ -249,7 +249,7 @@ public:
} }
/** Checks whether the whole of a given range is contained within this one. */ /** Checks whether the whole of a given range is contained within this one. */
bool containsRange (const Range<Type>& range)
bool containsRange (const Range<Type> range)
{ {
if (range.getLength() > 0) if (range.getLength() > 0)
{ {


+ 9
- 9
modules/juce_core/containers/juce_Variant.cpp View File

@@ -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()) if (DynamicObject* const o = getDynamicObject())
return o->getProperty (propertyName); return o->getProperty (propertyName);
@@ -508,7 +508,7 @@ var var::operator[] (const char* const propertyName) const
return operator[] (Identifier (propertyName)); 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()) if (DynamicObject* const o = getDynamicObject())
return o->getProperties().getWithDefault (propertyName, defaultReturnValue); return o->getProperties().getWithDefault (propertyName, defaultReturnValue);
@@ -516,7 +516,7 @@ var var::getProperty (const Identifier& propertyName, const var& defaultReturnVa
return defaultReturnValue; 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()) if (DynamicObject* const o = getDynamicObject())
return o->invokeMethod (method, arguments, numArguments); return o->invokeMethod (method, arguments, numArguments);
@@ -534,35 +534,35 @@ var var::invokeMethod (DynamicObject* const target, const var* const arguments,
return var::null; return var::null;
} }
var var::call (const Identifier& method) const
var var::call (const Identifier method) const
{ {
return invoke (method, nullptr, 0); 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); 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 }; var args[] = { arg1, arg2 };
return invoke (method, args, 2); 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 }; var args[] = { arg1, arg2, arg3 };
return invoke (method, args, 3); 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 }; var args[] = { arg1, arg2, arg3, arg4 };
return invoke (method, args, 4); 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 }; var args[] = { arg1, arg2, arg3, arg4, arg5 };
return invoke (method, args, 5); return invoke (method, args, 5);


+ 9
- 9
modules/juce_core/containers/juce_Variant.h View File

@@ -220,27 +220,27 @@ public:
//============================================================================== //==============================================================================
/** If this variant is an object, this returns one of its properties. */ /** 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. */ /** If this variant is an object, this returns one of its properties. */
var operator[] (const char* propertyName) const; var operator[] (const char* propertyName) const;
/** If this variant is an object, this returns one of its properties, or a default /** If this variant is an object, this returns one of its properties, or a default
fallback value if the property is not set. */ 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. */ /** 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. */ /** 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. */ /** 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. */ /** 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. */ /** 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. */ /** 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. */ /** 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. /** Writes a binary representation of this value to a stream.


+ 6
- 6
modules/juce_core/files/juce_File.cpp View File

@@ -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 bool File::loadFileAsData (MemoryBlock& destBlock) const


+ 3
- 3
modules/juce_core/files/juce_File.h View File

@@ -392,7 +392,7 @@ public:
@returns true if it manages to change the file's time. @returns true if it manages to change the file's time.
@see getLastModificationTime, setLastAccessTime, setCreationTime @see getLastModificationTime, setLastAccessTime, setCreationTime
*/ */
bool setLastModificationTime (const Time& newTime) const;
bool setLastModificationTime (Time newTime) const;
/** Changes the last-access time for this file. /** Changes the last-access time for this file.
@@ -400,7 +400,7 @@ public:
@returns true if it manages to change the file's time. @returns true if it manages to change the file's time.
@see getLastAccessTime, setLastModificationTime, setCreationTime @see getLastAccessTime, setLastModificationTime, setCreationTime
*/ */
bool setLastAccessTime (const Time& newTime) const;
bool setLastAccessTime (Time newTime) const;
/** Changes the creation date for this file. /** Changes the creation date for this file.
@@ -408,7 +408,7 @@ public:
@returns true if it manages to change the file's time. @returns true if it manages to change the file's time.
@see getCreationTime, setLastModificationTime, setLastAccessTime @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. /** If possible, this will try to create a version string for the given file.


+ 10
- 10
modules/juce_core/maths/juce_Range.h View File

@@ -58,7 +58,7 @@ public:
} }
/** Copies another range object. */ /** Copies another range object. */
Range& operator= (const Range& other) noexcept
Range& operator= (Range other) noexcept
{ {
start = other.start; start = other.start;
end = other.end; end = other.end;
@@ -167,7 +167,7 @@ public:
//============================================================================== //==============================================================================
/** Adds an amount to the start and end of the range. */ /** 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; start += amountToAdd;
end += amountToAdd; end += amountToAdd;
@@ -175,7 +175,7 @@ public:
} }
/** Subtracts an amount from the start and end of the range. */ /** 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; start -= amountToSubtract;
end -= amountToSubtract; end -= amountToSubtract;
@@ -197,8 +197,8 @@ public:
return Range (start - amountToSubtract, end - amountToSubtract); 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. */ /** 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. */ /** 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; return start <= other.start && end >= other.end;
} }
/** Returns true if the given range intersects this one. */ /** 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; return other.start < end && start < other.end;
} }
/** Returns the range that is the intersection of the two ranges, or an empty range /** 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. */ 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), return Range (jmax (start, other.start),
jmin (end, other.end)); jmin (end, other.end));
} }
/** Returns the smallest range that contains both this one and the other one. */ /** 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), return Range (jmin (start, other.start),
jmax (end, other.end)); jmax (end, other.end));
@@ -250,7 +250,7 @@ public:
will be the new range, shifted forwards or backwards so that it doesn't extend will be the new range, shifted forwards or backwards so that it doesn't extend
beyond this one, but keeping its original length. 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(); const ValueType otherLen = rangeToConstrain.getLength();
return getLength() <= otherLen return getLength() <= otherLen


+ 24
- 24
modules/juce_core/text/juce_CharPointer_ASCII.h View File

@@ -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; data = other.data;
return *this; return *this;
} }
inline CharPointer_ASCII& operator= (const CharType* text) noexcept
inline CharPointer_ASCII operator= (const CharType* text) noexcept
{ {
data = const_cast <CharType*> (text); data = const_cast <CharType*> (text);
return *this; return *this;
} }
/** This is a pointer comparison, it doesn't compare the actual text. */ /** 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. */ /** Returns the address that this pointer is pointing to. */
inline CharType* getAddress() const noexcept { return data; } inline CharType* getAddress() const noexcept { return data; }
@@ -84,14 +84,14 @@ public:
inline juce_wchar operator*() const noexcept { return (juce_wchar) (uint8) *data; } inline juce_wchar operator*() const noexcept { return (juce_wchar) (uint8) *data; }
/** Moves this pointer along to the next character in the string. */ /** Moves this pointer along to the next character in the string. */
inline CharPointer_ASCII& operator++() noexcept
inline CharPointer_ASCII operator++() noexcept
{ {
++data; ++data;
return *this; return *this;
} }
/** Moves this pointer to the previous character in the string. */ /** Moves this pointer to the previous character in the string. */
inline CharPointer_ASCII& operator--() noexcept
inline CharPointer_ASCII operator--() noexcept
{ {
--data; --data;
return *this; 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. */ /** 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); return CharacterFunctions::lengthUpTo (*this, end);
} }
@@ -194,7 +194,7 @@ public:
The value returned does NOT include the terminating null character. The value returned does NOT include the terminating null character.
*/ */
template <class CharPointer> template <class CharPointer>
static size_t getBytesRequiredFor (const CharPointer& text) noexcept
static size_t getBytesRequiredFor (const CharPointer text) noexcept
{ {
return text.length(); return text.length();
} }
@@ -207,13 +207,13 @@ public:
/** Copies a source string to this pointer, advancing this pointer as it goes. */ /** Copies a source string to this pointer, advancing this pointer as it goes. */
template <typename CharPointer> template <typename CharPointer>
void writeAll (const CharPointer& src) noexcept
void writeAll (const CharPointer src) noexcept
{ {
CharacterFunctions::copyAll (*this, src); CharacterFunctions::copyAll (*this, src);
} }
/** Copies a source string to this pointer, advancing this pointer as it goes. */ /** 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); strcpy (data, src.data);
} }
@@ -223,7 +223,7 @@ public:
to the destination buffer before stopping. to the destination buffer before stopping.
*/ */
template <typename CharPointer> template <typename CharPointer>
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); return CharacterFunctions::copyWithDestByteLimit (*this, src, maxDestBytes);
} }
@@ -233,45 +233,45 @@ public:
written to the destination buffer before stopping (including the terminating null). written to the destination buffer before stopping (including the terminating null).
*/ */
template <typename CharPointer> template <typename CharPointer>
void writeWithCharLimit (const CharPointer& src, const int maxChars) noexcept
void writeWithCharLimit (const CharPointer src, const int maxChars) noexcept
{ {
CharacterFunctions::copyWithCharLimit (*this, src, maxChars); CharacterFunctions::copyWithCharLimit (*this, src, maxChars);
} }
/** Compares this string with another one. */ /** Compares this string with another one. */
template <typename CharPointer> template <typename CharPointer>
int compare (const CharPointer& other) const noexcept
int compare (const CharPointer other) const noexcept
{ {
return CharacterFunctions::compare (*this, other); return CharacterFunctions::compare (*this, other);
} }
/** Compares this string with another one. */ /** 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); return strcmp (data, other.data);
} }
/** Compares this string with another one, up to a specified number of characters. */ /** Compares this string with another one, up to a specified number of characters. */
template <typename CharPointer> template <typename CharPointer>
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); return CharacterFunctions::compareUpTo (*this, other, maxChars);
} }
/** Compares this string with another one, up to a specified number of characters. */ /** 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); return strncmp (data, other.data, (size_t) maxChars);
} }
/** Compares this string with another one. */ /** Compares this string with another one. */
template <typename CharPointer> template <typename CharPointer>
int compareIgnoreCase (const CharPointer& other) const
int compareIgnoreCase (const CharPointer other) const
{ {
return CharacterFunctions::compareIgnoreCase (*this, other); return CharacterFunctions::compareIgnoreCase (*this, other);
} }
int compareIgnoreCase (const CharPointer_ASCII& other) const
int compareIgnoreCase (const CharPointer_ASCII other) const
{ {
#if JUCE_WINDOWS #if JUCE_WINDOWS
return stricmp (data, other.data); return stricmp (data, other.data);
@@ -282,14 +282,14 @@ public:
/** Compares this string with another one, up to a specified number of characters. */ /** Compares this string with another one, up to a specified number of characters. */
template <typename CharPointer> template <typename CharPointer>
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); return CharacterFunctions::compareIgnoreCaseUpTo (*this, other, maxChars);
} }
/** Returns the character index of a substring, or -1 if it isn't found. */ /** Returns the character index of a substring, or -1 if it isn't found. */
template <typename CharPointer> template <typename CharPointer>
int indexOf (const CharPointer& stringToFind) const noexcept
int indexOf (const CharPointer stringToFind) const noexcept
{ {
return CharacterFunctions::indexOf (*this, stringToFind); return CharacterFunctions::indexOf (*this, stringToFind);
} }


+ 24
- 24
modules/juce_core/text/juce_CharPointer_UTF16.h View File

@@ -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; data = other.data;
return *this; return *this;
} }
inline CharPointer_UTF16& operator= (const CharType* text) noexcept
inline CharPointer_UTF16 operator= (const CharType* text) noexcept
{ {
data = const_cast <CharType*> (text); data = const_cast <CharType*> (text);
return *this; return *this;
} }
/** This is a pointer comparison, it doesn't compare the actual text. */ /** 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. */ /** Returns the address that this pointer is pointing to. */
inline CharType* getAddress() const noexcept { return data; } inline CharType* getAddress() const noexcept { return data; }
@@ -93,7 +93,7 @@ public:
} }
/** Moves this pointer along to the next character in the string. */ /** Moves this pointer along to the next character in the string. */
CharPointer_UTF16& operator++() noexcept
CharPointer_UTF16 operator++() noexcept
{ {
const juce_wchar n = *data++; const juce_wchar n = *data++;
@@ -104,7 +104,7 @@ public:
} }
/** Moves this pointer back to the previous character in the string. */ /** Moves this pointer back to the previous character in the string. */
CharPointer_UTF16& operator--() noexcept
CharPointer_UTF16 operator--() noexcept
{ {
const juce_wchar n = *--data; 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. */ /** 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); return CharacterFunctions::lengthUpTo (*this, end);
} }
@@ -281,13 +281,13 @@ public:
/** Copies a source string to this pointer, advancing this pointer as it goes. */ /** Copies a source string to this pointer, advancing this pointer as it goes. */
template <typename CharPointer> template <typename CharPointer>
void writeAll (const CharPointer& src) noexcept
void writeAll (const CharPointer src) noexcept
{ {
CharacterFunctions::copyAll (*this, src); CharacterFunctions::copyAll (*this, src);
} }
/** Copies a source string to this pointer, advancing this pointer as it goes. */ /** 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; const CharType* s = src.data;
@@ -303,7 +303,7 @@ public:
to the destination buffer before stopping. to the destination buffer before stopping.
*/ */
template <typename CharPointer> template <typename CharPointer>
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); return CharacterFunctions::copyWithDestByteLimit (*this, src, maxDestBytes);
} }
@@ -313,51 +313,51 @@ public:
written to the destination buffer before stopping (including the terminating null). written to the destination buffer before stopping (including the terminating null).
*/ */
template <typename CharPointer> template <typename CharPointer>
void writeWithCharLimit (const CharPointer& src, const int maxChars) noexcept
void writeWithCharLimit (const CharPointer src, const int maxChars) noexcept
{ {
CharacterFunctions::copyWithCharLimit (*this, src, maxChars); CharacterFunctions::copyWithCharLimit (*this, src, maxChars);
} }
/** Compares this string with another one. */ /** Compares this string with another one. */
template <typename CharPointer> template <typename CharPointer>
int compare (const CharPointer& other) const noexcept
int compare (const CharPointer other) const noexcept
{ {
return CharacterFunctions::compare (*this, other); return CharacterFunctions::compare (*this, other);
} }
/** Compares this string with another one, up to a specified number of characters. */ /** Compares this string with another one, up to a specified number of characters. */
template <typename CharPointer> template <typename CharPointer>
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); return CharacterFunctions::compareUpTo (*this, other, maxChars);
} }
/** Compares this string with another one. */ /** Compares this string with another one. */
template <typename CharPointer> template <typename CharPointer>
int compareIgnoreCase (const CharPointer& other) const noexcept
int compareIgnoreCase (const CharPointer other) const noexcept
{ {
return CharacterFunctions::compareIgnoreCase (*this, other); return CharacterFunctions::compareIgnoreCase (*this, other);
} }
/** Compares this string with another one, up to a specified number of characters. */ /** Compares this string with another one, up to a specified number of characters. */
template <typename CharPointer> template <typename CharPointer>
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); return CharacterFunctions::compareIgnoreCaseUpTo (*this, other, maxChars);
} }
#if JUCE_WINDOWS && ! DOXYGEN #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); 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); 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()); const CharType* const t = wcsstr (data, stringToFind.getAddress());
return t == nullptr ? -1 : (int) (t - data); 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. */ /** Returns the character index of a substring, or -1 if it isn't found. */
template <typename CharPointer> template <typename CharPointer>
int indexOf (const CharPointer& stringToFind) const noexcept
int indexOf (const CharPointer stringToFind) const noexcept
{ {
return CharacterFunctions::indexOf (*this, stringToFind); return CharacterFunctions::indexOf (*this, stringToFind);
} }
@@ -466,7 +466,7 @@ public:
} }
/** Atomically swaps this pointer for a new value, returning the previous value. */ /** 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 <Atomic<CharType*>&> (data).exchange (newValue.data)); return CharPointer_UTF16 (reinterpret_cast <Atomic<CharType*>&> (data).exchange (newValue.data));
} }


+ 23
- 23
modules/juce_core/text/juce_CharPointer_UTF32.h View File

@@ -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; data = other.data;
return *this; return *this;
} }
inline CharPointer_UTF32& operator= (const CharType* text) noexcept
inline CharPointer_UTF32 operator= (const CharType* text) noexcept
{ {
data = const_cast <CharType*> (text); data = const_cast <CharType*> (text);
return *this; return *this;
} }
/** This is a pointer comparison, it doesn't compare the actual text. */ /** 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. */ /** Returns the address that this pointer is pointing to. */
inline CharType* getAddress() const noexcept { return data; } inline CharType* getAddress() const noexcept { return data; }
@@ -81,14 +81,14 @@ public:
inline juce_wchar operator*() const noexcept { return *data; } inline juce_wchar operator*() const noexcept { return *data; }
/** Moves this pointer along to the next character in the string. */ /** Moves this pointer along to the next character in the string. */
inline CharPointer_UTF32& operator++() noexcept
inline CharPointer_UTF32 operator++() noexcept
{ {
++data; ++data;
return *this; return *this;
} }
/** Moves this pointer to the previous character in the string. */ /** Moves this pointer to the previous character in the string. */
inline CharPointer_UTF32& operator--() noexcept
inline CharPointer_UTF32 operator--() noexcept
{ {
--data; --data;
return *this; 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. */ /** 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); return CharacterFunctions::lengthUpTo (*this, end);
} }
@@ -198,7 +198,7 @@ public:
The value returned does NOT include the terminating null character. The value returned does NOT include the terminating null character.
*/ */
template <class CharPointer> template <class CharPointer>
static size_t getBytesRequiredFor (const CharPointer& text) noexcept
static size_t getBytesRequiredFor (const CharPointer text) noexcept
{ {
return sizeof (CharType) * text.length(); return sizeof (CharType) * text.length();
} }
@@ -211,13 +211,13 @@ public:
/** Copies a source string to this pointer, advancing this pointer as it goes. */ /** Copies a source string to this pointer, advancing this pointer as it goes. */
template <typename CharPointer> template <typename CharPointer>
void writeAll (const CharPointer& src) noexcept
void writeAll (const CharPointer src) noexcept
{ {
CharacterFunctions::copyAll (*this, src); CharacterFunctions::copyAll (*this, src);
} }
/** Copies a source string to this pointer, advancing this pointer as it goes. */ /** 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; const CharType* s = src.data;
@@ -233,7 +233,7 @@ public:
to the destination buffer before stopping. to the destination buffer before stopping.
*/ */
template <typename CharPointer> template <typename CharPointer>
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); return CharacterFunctions::copyWithDestByteLimit (*this, src, maxDestBytes);
} }
@@ -243,21 +243,21 @@ public:
written to the destination buffer before stopping (including the terminating null). written to the destination buffer before stopping (including the terminating null).
*/ */
template <typename CharPointer> template <typename CharPointer>
void writeWithCharLimit (const CharPointer& src, const int maxChars) noexcept
void writeWithCharLimit (const CharPointer src, const int maxChars) noexcept
{ {
CharacterFunctions::copyWithCharLimit (*this, src, maxChars); CharacterFunctions::copyWithCharLimit (*this, src, maxChars);
} }
/** Compares this string with another one. */ /** Compares this string with another one. */
template <typename CharPointer> template <typename CharPointer>
int compare (const CharPointer& other) const noexcept
int compare (const CharPointer other) const noexcept
{ {
return CharacterFunctions::compare (*this, other); return CharacterFunctions::compare (*this, other);
} }
#if JUCE_NATIVE_WCHAR_IS_UTF32 && ! JUCE_ANDROID #if JUCE_NATIVE_WCHAR_IS_UTF32 && ! JUCE_ANDROID
/** Compares this string with another one. */ /** 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); return wcscmp (data, other.data);
} }
@@ -265,28 +265,28 @@ public:
/** Compares this string with another one, up to a specified number of characters. */ /** Compares this string with another one, up to a specified number of characters. */
template <typename CharPointer> template <typename CharPointer>
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); return CharacterFunctions::compareUpTo (*this, other, maxChars);
} }
/** Compares this string with another one. */ /** Compares this string with another one. */
template <typename CharPointer> template <typename CharPointer>
int compareIgnoreCase (const CharPointer& other) const
int compareIgnoreCase (const CharPointer other) const
{ {
return CharacterFunctions::compareIgnoreCase (*this, other); return CharacterFunctions::compareIgnoreCase (*this, other);
} }
/** Compares this string with another one, up to a specified number of characters. */ /** Compares this string with another one, up to a specified number of characters. */
template <typename CharPointer> template <typename CharPointer>
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); return CharacterFunctions::compareIgnoreCaseUpTo (*this, other, maxChars);
} }
/** Returns the character index of a substring, or -1 if it isn't found. */ /** Returns the character index of a substring, or -1 if it isn't found. */
template <typename CharPointer> template <typename CharPointer>
int indexOf (const CharPointer& stringToFind) const noexcept
int indexOf (const CharPointer stringToFind) const noexcept
{ {
return CharacterFunctions::indexOf (*this, stringToFind); return CharacterFunctions::indexOf (*this, stringToFind);
} }
@@ -362,7 +362,7 @@ public:
} }
/** Atomically swaps this pointer for a new value, returning the previous value. */ /** 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 <Atomic<CharType*>&> (data).exchange (newValue.data)); return CharPointer_UTF32 (reinterpret_cast <Atomic<CharType*>&> (data).exchange (newValue.data));
} }


+ 21
- 21
modules/juce_core/text/juce_CharPointer_UTF8.h View File

@@ -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; data = other.data;
return *this; return *this;
} }
inline CharPointer_UTF8& operator= (const CharType* text) noexcept
inline CharPointer_UTF8 operator= (const CharType* text) noexcept
{ {
data = const_cast <CharType*> (text); data = const_cast <CharType*> (text);
return *this; return *this;
} }
/** This is a pointer comparison, it doesn't compare the actual text. */ /** 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. */ /** Returns the address that this pointer is pointing to. */
inline CharType* getAddress() const noexcept { return data; } inline CharType* getAddress() const noexcept { return data; }
@@ -132,7 +132,7 @@ public:
} }
/** Moves this pointer back to the previous character in the string. */ /** Moves this pointer back to the previous character in the string. */
CharPointer_UTF8& operator--() noexcept
CharPointer_UTF8 operator--() noexcept
{ {
int count = 0; 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. */ /** 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); return CharacterFunctions::lengthUpTo (*this, end);
} }
@@ -363,13 +363,13 @@ public:
/** Copies a source string to this pointer, advancing this pointer as it goes. */ /** Copies a source string to this pointer, advancing this pointer as it goes. */
template <typename CharPointer> template <typename CharPointer>
void writeAll (const CharPointer& src) noexcept
void writeAll (const CharPointer src) noexcept
{ {
CharacterFunctions::copyAll (*this, src); CharacterFunctions::copyAll (*this, src);
} }
/** Copies a source string to this pointer, advancing this pointer as it goes. */ /** 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; const CharType* s = src.data;
@@ -385,7 +385,7 @@ public:
to the destination buffer before stopping. to the destination buffer before stopping.
*/ */
template <typename CharPointer> template <typename CharPointer>
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); return CharacterFunctions::copyWithDestByteLimit (*this, src, maxDestBytes);
} }
@@ -395,34 +395,34 @@ public:
written to the destination buffer before stopping (including the terminating null). written to the destination buffer before stopping (including the terminating null).
*/ */
template <typename CharPointer> template <typename CharPointer>
void writeWithCharLimit (const CharPointer& src, const int maxChars) noexcept
void writeWithCharLimit (const CharPointer src, const int maxChars) noexcept
{ {
CharacterFunctions::copyWithCharLimit (*this, src, maxChars); CharacterFunctions::copyWithCharLimit (*this, src, maxChars);
} }
/** Compares this string with another one. */ /** Compares this string with another one. */
template <typename CharPointer> template <typename CharPointer>
int compare (const CharPointer& other) const noexcept
int compare (const CharPointer other) const noexcept
{ {
return CharacterFunctions::compare (*this, other); return CharacterFunctions::compare (*this, other);
} }
/** Compares this string with another one, up to a specified number of characters. */ /** Compares this string with another one, up to a specified number of characters. */
template <typename CharPointer> template <typename CharPointer>
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); return CharacterFunctions::compareUpTo (*this, other, maxChars);
} }
/** Compares this string with another one. */ /** Compares this string with another one. */
template <typename CharPointer> template <typename CharPointer>
int compareIgnoreCase (const CharPointer& other) const noexcept
int compareIgnoreCase (const CharPointer other) const noexcept
{ {
return CharacterFunctions::compareIgnoreCase (*this, other); return CharacterFunctions::compareIgnoreCase (*this, other);
} }
/** Compares this string with another one. */ /** 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 #if JUCE_WINDOWS
return stricmp (data, other.data); return stricmp (data, other.data);
@@ -433,14 +433,14 @@ public:
/** Compares this string with another one, up to a specified number of characters. */ /** Compares this string with another one, up to a specified number of characters. */
template <typename CharPointer> template <typename CharPointer>
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); return CharacterFunctions::compareIgnoreCaseUpTo (*this, other, maxChars);
} }
/** Returns the character index of a substring, or -1 if it isn't found. */ /** Returns the character index of a substring, or -1 if it isn't found. */
template <typename CharPointer> template <typename CharPointer>
int indexOf (const CharPointer& stringToFind) const noexcept
int indexOf (const CharPointer stringToFind) const noexcept
{ {
return CharacterFunctions::indexOf (*this, stringToFind); return CharacterFunctions::indexOf (*this, stringToFind);
} }
@@ -542,7 +542,7 @@ public:
} }
/** Atomically swaps this pointer for a new value, returning the previous value. */ /** 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 <Atomic<CharType*>&> (data).exchange (newValue.data)); return CharPointer_UTF8 (reinterpret_cast <Atomic<CharType*>&> (data).exchange (newValue.data));
} }


+ 5
- 5
modules/juce_core/text/juce_CharacterFunctions.h View File

@@ -255,7 +255,7 @@ public:
//============================================================================== //==============================================================================
/** Parses a character string, to read an integer value. */ /** Parses a character string, to read an integer value. */
template <typename IntType, typename CharPointerType> template <typename IntType, typename CharPointerType>
static IntType getIntValue (const CharPointerType& text) noexcept
static IntType getIntValue (const CharPointerType text) noexcept
{ {
IntType v = 0; IntType v = 0;
CharPointerType s (text.findEndOfWhitespace()); CharPointerType s (text.findEndOfWhitespace());
@@ -294,7 +294,7 @@ public:
/** Counts the number of characters in a given string, stopping if the count exceeds /** Counts the number of characters in a given string, stopping if the count exceeds
a specified end-pointer. */ a specified end-pointer. */
template <typename CharPointerType> template <typename CharPointerType>
static size_t lengthUpTo (CharPointerType start, const CharPointerType& end) noexcept
static size_t lengthUpTo (CharPointerType start, const CharPointerType end) noexcept
{ {
size_t len = 0; size_t len = 0;
@@ -437,7 +437,7 @@ public:
Returns -1 if the substring is not found. Returns -1 if the substring is not found.
*/ */
template <typename CharPointerType1, typename CharPointerType2> template <typename CharPointerType1, typename CharPointerType2>
static int indexOf (CharPointerType1 textToSearch, const CharPointerType2& substringToLookFor) noexcept
static int indexOf (CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept
{ {
int index = 0; int index = 0;
const int substringLength = (int) substringToLookFor.length(); const int substringLength = (int) substringToLookFor.length();
@@ -459,7 +459,7 @@ public:
null terminator. null terminator.
*/ */
template <typename CharPointerType1, typename CharPointerType2> template <typename CharPointerType1, typename CharPointerType2>
static CharPointerType1 find (CharPointerType1 textToSearch, const CharPointerType2& substringToLookFor) noexcept
static CharPointerType1 find (CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept
{ {
const int substringLength = (int) substringToLookFor.length(); const int substringLength = (int) substringToLookFor.length();
@@ -475,7 +475,7 @@ public:
Returns -1 if the substring is not found. Returns -1 if the substring is not found.
*/ */
template <typename CharPointerType1, typename CharPointerType2> template <typename CharPointerType1, typename CharPointerType2>
static int indexOfIgnoreCase (CharPointerType1 haystack, const CharPointerType2& needle) noexcept
static int indexOfIgnoreCase (CharPointerType1 haystack, const CharPointerType2 needle) noexcept
{ {
int index = 0; int index = 0;
const int needleLength = (int) needle.length(); const int needleLength = (int) needle.length();


+ 1
- 1
modules/juce_core/text/juce_Identifier.cpp View File

@@ -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; name = other.name;
return *this; return *this;


+ 3
- 3
modules/juce_core/text/juce_Identifier.h View File

@@ -61,16 +61,16 @@ public:
Identifier (const Identifier& other) noexcept; Identifier (const Identifier& other) noexcept;
/** Creates a copy of another identifier. */ /** Creates a copy of another identifier. */
Identifier& operator= (const Identifier& other) noexcept;
Identifier& operator= (const Identifier other) noexcept;
/** Destructor */ /** Destructor */
~Identifier(); ~Identifier();
/** Compares two identifiers. This is a very fast operation. */ /** 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. */ /** 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. */ /** Returns this identifier as a string. */
String toString() const { return name; } String toString() const { return name; }


+ 29
- 29
modules/juce_core/text/juce_String.cpp View File

@@ -70,7 +70,7 @@ public:
} }
template <class CharPointer> template <class CharPointer>
static CharPointerType createFromCharPointer (const CharPointer& text)
static CharPointerType createFromCharPointer (const CharPointer text)
{ {
if (text.getAddress() == nullptr || text.isEmpty()) if (text.getAddress() == nullptr || text.isEmpty())
return getEmpty(); return getEmpty();
@@ -87,7 +87,7 @@ public:
} }
template <class CharPointer> template <class CharPointer>
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) if (text.getAddress() == nullptr || text.isEmpty() || maxChars == 0)
return getEmpty(); return getEmpty();
@@ -108,7 +108,7 @@ public:
} }
template <class CharPointer> template <class CharPointer>
static CharPointerType createFromCharPointer (const CharPointer& start, const CharPointer& end)
static CharPointerType createFromCharPointer (const CharPointer start, const CharPointer end)
{ {
if (start.getAddress() == nullptr || start.isEmpty()) if (start.getAddress() == nullptr || start.isEmpty())
return getEmpty(); return getEmpty();
@@ -128,7 +128,7 @@ public:
return dest; 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()) if (start.getAddress() == nullptr || start.isEmpty())
return getEmpty(); return getEmpty();
@@ -153,7 +153,7 @@ public:
} }
//============================================================================== //==============================================================================
static void retain (const CharPointerType& text) noexcept
static void retain (const CharPointerType text) noexcept
{ {
++(bufferFromText (text)->refCount); ++(bufferFromText (text)->refCount);
} }
@@ -164,13 +164,13 @@ public:
delete[] reinterpret_cast <char*> (b); delete[] reinterpret_cast <char*> (b);
} }
static void release (const CharPointerType& text) noexcept
static void release (const CharPointerType text) noexcept
{ {
release (bufferFromText (text)); release (bufferFromText (text));
} }
//============================================================================== //==============================================================================
static CharPointerType makeUnique (const CharPointerType& text)
static CharPointerType makeUnique (const CharPointerType text)
{ {
StringHolder* const b = bufferFromText (text); StringHolder* const b = bufferFromText (text);
@@ -184,7 +184,7 @@ public:
return newText; 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); StringHolder* const b = bufferFromText (text);
@@ -198,7 +198,7 @@ public:
return newText; return newText;
} }
static size_t getAllocatedNumBytes (const CharPointerType& text) noexcept
static size_t getAllocatedNumBytes (const CharPointerType text) noexcept
{ {
return bufferFromText (text)->allocatedNumBytes; return bufferFromText (text)->allocatedNumBytes;
} }
@@ -211,7 +211,7 @@ public:
static StringHolder empty; static StringHolder empty;
private: 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) // (Can't use offsetof() here because of warnings about this not being a POD)
return reinterpret_cast <StringHolder*> (reinterpret_cast <char*> (text.getAddress()) return reinterpret_cast <StringHolder*> (reinterpret_cast <char*> (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 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 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())) {} 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 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 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 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 char* const 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 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; } 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)); || (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) for (; ! test.isEmpty(); ++test)
if (matches (wildcard, test, ignoreCase)) if (matches (wildcard, test, ignoreCase))
@@ -2024,7 +2024,7 @@ std::string String::toStdString() const
template <class CharPointerType_Src, class CharPointerType_Dest> template <class CharPointerType_Src, class CharPointerType_Dest>
struct StringCopier 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! jassert (((ssize_t) maxBufferSizeBytes) >= 0); // keep this value positive!


+ 19
- 19
modules/juce_core/text/juce_String.h View File

@@ -120,37 +120,37 @@ public:
//============================================================================== //==============================================================================
/** Creates a string from a UTF-8 character string */ /** 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 */ /** 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 */ /** 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 */ /** 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 */ /** 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 */ /** 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 */ /** 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 */ /** 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 */ /** 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 */ /** 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. */ /** Creates a string from a UTF-8 encoded std::string. */
String (const 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 @param maxCharsToTake the maximum number of characters to take from the string passed in
*/ */
template <class CharPointer> template <class CharPointer>
void appendCharPointer (const CharPointer& textToAppend, size_t maxCharsToTake)
void appendCharPointer (const CharPointer textToAppend, size_t maxCharsToTake)
{ {
if (textToAppend.getAddress() != nullptr) if (textToAppend.getAddress() != nullptr)
{ {
@@ -267,7 +267,7 @@ public:
/** Appends a string to the end of this one. */ /** Appends a string to the end of this one. */
template <class CharPointer> template <class CharPointer>
void appendCharPointer (const CharPointer& textToAppend)
void appendCharPointer (const CharPointer textToAppend)
{ {
if (textToAppend.getAddress() != nullptr) if (textToAppend.getAddress() != nullptr)
{ {
@@ -1037,7 +1037,7 @@ public:
that is returned must not be stored anywhere, as it can be deleted whenever the that is returned must not be stored anywhere, as it can be deleted whenever the
string changes. 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. /** 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. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const wchar_t* string2) noexcept; JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const wchar_t* string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** 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. */ /** 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. */ /** 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. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) noexcept; JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** 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. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const wchar_t* string2) noexcept; JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const wchar_t* string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** 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. */ /** 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. */ /** 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. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) noexcept; JUCE_API bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */


+ 14
- 14
modules/juce_core/time/juce_RelativeTime.cpp View File

@@ -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; } 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) static void translateTimeField (String& result, int n, const char* singular, const char* plural)


+ 12
- 12
modules/juce_core/time/juce_RelativeTime.h View File

@@ -139,14 +139,14 @@ public:
//============================================================================== //==============================================================================
/** Adds another RelativeTime to this one. */ /** Adds another RelativeTime to this one. */
const RelativeTime& operator+= (const RelativeTime& timeToAdd) noexcept;
RelativeTime operator+= (RelativeTime timeToAdd) noexcept;
/** Subtracts another RelativeTime from this one. */ /** 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. */ /** 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. */ /** Subtracts a number of seconds from this time. */
const RelativeTime& operator-= (double secondsToSubtract) noexcept;
RelativeTime operator-= (double secondsToSubtract) noexcept;
private: private:
//============================================================================== //==============================================================================
@@ -155,23 +155,23 @@ private:
//============================================================================== //==============================================================================
/** Compares two RelativeTimes. */ /** Compares two RelativeTimes. */
bool operator== (const RelativeTime& t1, const RelativeTime& t2) noexcept;
bool operator== (RelativeTime t1, RelativeTime t2) noexcept;
/** Compares two RelativeTimes. */ /** Compares two RelativeTimes. */
bool operator!= (const RelativeTime& t1, const RelativeTime& t2) noexcept;
bool operator!= (RelativeTime t1, RelativeTime t2) noexcept;
/** Compares two RelativeTimes. */ /** Compares two RelativeTimes. */
bool operator> (const RelativeTime& t1, const RelativeTime& t2) noexcept;
bool operator> (RelativeTime t1, RelativeTime t2) noexcept;
/** Compares two RelativeTimes. */ /** Compares two RelativeTimes. */
bool operator< (const RelativeTime& t1, const RelativeTime& t2) noexcept;
bool operator< (RelativeTime t1, RelativeTime t2) noexcept;
/** Compares two RelativeTimes. */ /** Compares two RelativeTimes. */
bool operator>= (const RelativeTime& t1, const RelativeTime& t2) noexcept;
bool operator>= (RelativeTime t1, RelativeTime t2) noexcept;
/** Compares two RelativeTimes. */ /** Compares two RelativeTimes. */
bool operator<= (const RelativeTime& t1, const RelativeTime& t2) noexcept;
bool operator<= (RelativeTime t1, RelativeTime t2) noexcept;
//============================================================================== //==============================================================================
/** Adds two RelativeTimes together. */ /** Adds two RelativeTimes together. */
RelativeTime operator+ (const RelativeTime& t1, const RelativeTime& t2) noexcept;
RelativeTime operator+ (RelativeTime t1, RelativeTime t2) noexcept;
/** Subtracts two RelativeTimes. */ /** Subtracts two RelativeTimes. */
RelativeTime operator- (const RelativeTime& t1, const RelativeTime& t2) noexcept;
RelativeTime operator- (RelativeTime t1, RelativeTime t2) noexcept;


+ 14
- 14
modules/juce_core/time/juce_Time.cpp View File

@@ -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(); }

+ 12
- 12
modules/juce_core/time/juce_Time.h View File

@@ -252,9 +252,9 @@ public:
//============================================================================== //==============================================================================
/** Adds a RelativeTime to this time. */ /** Adds a RelativeTime to this time. */
Time& operator+= (const RelativeTime& delta);
Time& operator+= (RelativeTime delta);
/** Subtracts a RelativeTime from this time. */ /** Subtracts a RelativeTime from this time. */
Time& operator-= (const RelativeTime& delta);
Time& operator-= (RelativeTime delta);
//============================================================================== //==============================================================================
/** Tries to set the computer's clock. /** Tries to set the computer's clock.
@@ -377,27 +377,27 @@ private:
//============================================================================== //==============================================================================
/** Adds a RelativeTime to a Time. */ /** 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. */ /** 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. */ /** 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. */ /** 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. */ /** 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. */ /** 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. */ /** 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. */ /** 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. */ /** 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. */ /** 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__ #endif // __JUCE_TIME_JUCEHEADER__

+ 1
- 1
modules/juce_cryptography/hashing/juce_MD5.cpp View File

@@ -216,7 +216,7 @@ MD5::MD5 (const void* data, const size_t numBytes) noexcept
processData (data, numBytes); processData (data, numBytes);
} }
MD5::MD5 (const CharPointer_UTF8& utf8) noexcept
MD5::MD5 (CharPointer_UTF8 utf8) noexcept
{ {
jassert (utf8.getAddress() != nullptr); jassert (utf8.getAddress() != nullptr);
processData (utf8.getAddress(), utf8.sizeInBytes() - 1); processData (utf8.getAddress(), utf8.sizeInBytes() - 1);


+ 1
- 1
modules/juce_cryptography/hashing/juce_MD5.h View File

@@ -72,7 +72,7 @@ public:
@code MD5 checksum (myString.toUTF8()); @code MD5 checksum (myString.toUTF8());
@endcode @endcode
*/ */
explicit MD5 (const CharPointer_UTF8& utf8Text) noexcept;
explicit MD5 (CharPointer_UTF8 utf8Text) noexcept;
/** Destructor. */ /** Destructor. */
~MD5() noexcept; ~MD5() noexcept;


+ 1
- 1
modules/juce_cryptography/hashing/juce_SHA256.cpp View File

@@ -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); jassert (utf8.getAddress() != nullptr);
process (utf8.getAddress(), utf8.sizeInBytes() - 1); process (utf8.getAddress(), utf8.sizeInBytes() - 1);


+ 1
- 1
modules/juce_cryptography/hashing/juce_SHA256.h View File

@@ -82,7 +82,7 @@ public:
@code SHA256 checksum (myString.toUTF8()); @code SHA256 checksum (myString.toUTF8());
@endcode @endcode
*/ */
explicit SHA256 (const CharPointer_UTF8& utf8Text) noexcept;
explicit SHA256 (CharPointer_UTF8 utf8Text) noexcept;
//============================================================================== //==============================================================================
/** Returns the hash as a 32-byte block of data. */ /** Returns the hash as a 32-byte block of data. */


+ 31
- 31
modules/juce_data_structures/values/juce_ValueTree.cpp View File

@@ -28,7 +28,7 @@ class ValueTree::SharedObject : public ReferenceCountedObject
public: public:
typedef ReferenceCountedObjectPtr<SharedObject> Ptr; typedef ReferenceCountedObjectPtr<SharedObject> Ptr;
explicit SharedObject (const Identifier& t) noexcept
explicit SharedObject (const Identifier t) noexcept
: type (t), parent (nullptr) : 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;) for (int i = valueTreesWithListeners.size(); --i >= 0;)
if (ValueTree* const v = valueTreesWithListeners[i]) if (ValueTree* const v = valueTreesWithListeners[i])
v->listeners.call (&ValueTree::Listener::valueTreePropertyChanged, tree, property); v->listeners.call (&ValueTree::Listener::valueTreePropertyChanged, tree, property);
} }
void sendPropertyChangeMessage (const Identifier& property)
void sendPropertyChangeMessage (const Identifier property)
{ {
ValueTree tree (this); ValueTree tree (this);
@@ -131,17 +131,17 @@ public:
v->listeners.call (&ValueTree::Listener::valueTreeParentChanged, tree); 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]; 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); 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) 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); return properties.contains (name);
} }
void removeProperty (const Identifier& name, UndoManager* const undoManager)
void removeProperty (const Identifier name, UndoManager* const undoManager)
{ {
if (undoManager == nullptr) if (undoManager == nullptr)
{ {
@@ -210,7 +210,7 @@ public:
setProperty (source.properties.getName(i), source.properties.getValueAt(i), undoManager); 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) for (int i = 0; i < children.size(); ++i)
{ {
@@ -222,7 +222,7 @@ public:
return ValueTree::invalid; 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) 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) for (int i = 0; i < children.size(); ++i)
{ {
@@ -444,7 +444,7 @@ public:
class SetPropertyAction : public UndoableAction class SetPropertyAction : public UndoableAction
{ {
public: public:
SetPropertyAction (SharedObject* const target_, const Identifier& name_,
SetPropertyAction (SharedObject* const target_, const Identifier name_,
const var& newValue_, const var& oldValue_, const var& newValue_, const var& oldValue_,
const bool isAddingNewProperty_, const bool isDeletingProperty_) const bool isAddingNewProperty_, const bool isDeletingProperty_)
: target (target_), name (name_), newValue (newValue_), oldValue (oldValue_), : target (target_), name (name_), newValue (newValue_), oldValue (oldValue_),
@@ -616,7 +616,7 @@ ValueTree::ValueTree() noexcept
const ValueTree ValueTree::invalid; const ValueTree ValueTree::invalid;
ValueTree::ValueTree (const Identifier& type_)
ValueTree::ValueTree (const Identifier type_)
: object (new ValueTree::SharedObject (type_)) : object (new ValueTree::SharedObject (type_))
{ {
jassert (type_.toString().isNotEmpty()); // All objects should be given a sensible type name! 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())); 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; return object != nullptr && object->type == typeName;
} }
@@ -709,23 +709,23 @@ ValueTree ValueTree::getSibling (const int delta) const
return ValueTree (object->parent->children.getObjectPointer (index)); 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); 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); 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 return object == nullptr ? defaultReturnValue
: object->getProperty (name, 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) UndoManager* const undoManager)
{ {
jassert (name.toString().isNotEmpty()); // Must have a valid property name! 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; return *this;
} }
bool ValueTree::hasProperty (const Identifier& name) const
bool ValueTree::hasProperty (const Identifier name) const
{ {
return object != nullptr && object->hasProperty (name); 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) if (object != nullptr)
object->removeProperty (name, undoManager); object->removeProperty (name, undoManager);
@@ -780,7 +780,7 @@ class ValueTreePropertyValueSource : public Value::ValueSource,
private ValueTree::Listener private ValueTree::Listener
{ {
public: 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 (vt), property (prop), undoManager (um)
{ {
tree.addListener (this); tree.addListener (this);
@@ -800,21 +800,21 @@ private:
UndoManager* const undoManager; UndoManager* const undoManager;
void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged, void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
const Identifier& changedProperty)
const Identifier& changedProperty) override
{ {
if (tree == treeWhosePropertyHasChanged && property == changedProperty) if (tree == treeWhosePropertyHasChanged && property == changedProperty)
sendChangeMessage (false); 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) 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)); return Value (new ValueTreePropertyValueSource (*this, name, undoManager));
} }
@@ -831,17 +831,17 @@ ValueTree ValueTree::getChild (int index) const
: static_cast <SharedObject*> (nullptr)); : static_cast <SharedObject*> (nullptr));
} }
ValueTree ValueTree::getChildWithName (const Identifier& type) const
ValueTree ValueTree::getChildWithName (const Identifier type) const
{ {
return object != nullptr ? object->getChildWithName (type) : ValueTree::invalid; 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; 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; return object != nullptr ? object->getChildWithProperty (propertyName, propertyValue) : ValueTree::invalid;
} }
@@ -923,7 +923,7 @@ void ValueTree::removeListener (Listener* listener)
object->valueTreesWithListeners.removeValue (this); object->valueTreesWithListeners.removeValue (this);
} }
void ValueTree::sendPropertyChangeMessage (const Identifier& property)
void ValueTree::sendPropertyChangeMessage (const Identifier property)
{ {
if (object != nullptr) if (object != nullptr)
object->sendPropertyChangeMessage (property); object->sendPropertyChangeMessage (property);


+ 13
- 13
modules/juce_data_structures/values/juce_ValueTree.h View File

@@ -83,7 +83,7 @@ public:
Like an XmlElement, each ValueTree node has a type, which you can access with Like an XmlElement, each ValueTree node has a type, which you can access with
getType() and hasType(). getType() and hasType().
*/ */
explicit ValueTree (const Identifier& type);
explicit ValueTree (const Identifier type);
/** Creates a reference to another ValueTree. */ /** Creates a reference to another ValueTree. */
ValueTree (const ValueTree& other); ValueTree (const ValueTree& other);
@@ -138,7 +138,7 @@ public:
/** Returns true if the node has this type. /** Returns true if the node has this type.
The comparison is case-sensitive. The comparison is case-sensitive.
*/ */
bool hasType (const Identifier& typeName) const;
bool hasType (const Identifier typeName) const;
//============================================================================== //==============================================================================
/** Returns the value of a named property. /** Returns the value of a named property.
@@ -146,21 +146,21 @@ public:
You can also use operator[] to get a property. You can also use operator[] to get a property.
@see var, setProperty, hasProperty @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. /** 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. 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. You can also use operator[] and getProperty to get a property.
@see var, getProperty, setProperty, hasProperty @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. /** 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 If no such property has been set, this will return a void variant. This is the same as
calling getProperty(). calling getProperty().
@see getProperty @see getProperty
*/ */
const var& operator[] (const Identifier& name) const;
const var& operator[] (const Identifier name) const;
/** Changes a named property of the node. /** Changes a named property of the node.
The name identifier must not be an empty string. The name identifier must not be an empty string.
@@ -169,16 +169,16 @@ public:
@see var, getProperty, removeProperty @see var, getProperty, removeProperty
@returns a reference to the value tree, so that you can daisy-chain calls to this method. @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. */ /** 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. /** Removes a property from the node.
If the undoManager parameter is non-null, its UndoManager::perform() method will be used, If the undoManager parameter is non-null, its UndoManager::perform() method will be used,
so that this change can be undone. 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. /** Removes all properties from the node.
If the undoManager parameter is non-null, its UndoManager::perform() method will be used, 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 it needs to change the value. Attaching a Value::Listener to the value object will provide
callbacks whenever the property changes. 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. /** 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 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). whether a node is valid).
@see getOrCreateChildWithName @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 /** 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. a child with this name if there wasn't already one there.
@@ -236,7 +236,7 @@ public:
the method on is itself invalid. the method on is itself invalid.
@see getChildWithName @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. /** 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 If no such node is found, it'll return an invalid node. (See isValid() to find out
whether a node is valid). 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. /** Adds a child to this node.
@@ -452,7 +452,7 @@ public:
/** Causes a property-change callback to be triggered for the specified property, /** Causes a property-change callback to be triggered for the specified property,
calling any listeners that are registered. 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. /** This method uses a comparator object to sort the tree's children into order.


+ 9
- 9
modules/juce_graphics/colour/juce_Colour.cpp View File

@@ -32,7 +32,7 @@ namespace ColourHelpers
// This is an adjusted brightness value, based on the way the human // This is an adjusted brightness value, based on the way the human
// eye responds to different colour channels.. // 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 r = c.getFloatRed();
const float g = c.getFloatGreen(); const float g = c.getFloatGreen();
@@ -46,7 +46,7 @@ namespace ColourHelpers
//============================================================================== //==============================================================================
struct HSB struct HSB
{ {
HSB (const Colour& col) noexcept
HSB (Colour col) noexcept
{ {
const int r = col.getRed(); const int r = col.getRed();
const int g = col.getGreen(); const int g = col.getGreen();
@@ -92,7 +92,7 @@ namespace ColourHelpers
brightness = hi / 255.0f; brightness = hi / 255.0f;
} }
Colour toColour (const Colour& original) const noexcept
Colour toColour (Colour original) const noexcept
{ {
return Colour (hue, saturation, brightness, original.getAlpha()); return Colour (hue, saturation, brightness, original.getAlpha());
} }
@@ -124,7 +124,7 @@ namespace ColourHelpers
//============================================================================== //==============================================================================
struct YIQ struct YIQ
{ {
YIQ (const Colour& c) noexcept
YIQ (Colour c) noexcept
{ {
const float r = c.getFloatRed(); const float r = c.getFloatRed();
const float g = c.getFloatGreen(); 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(); const int destAlpha = getAlpha();
@@ -296,7 +296,7 @@ Colour Colour::overlaidWith (const Colour& src) const noexcept
(uint8) resA); (uint8) resA);
} }
Colour Colour::interpolatedWith (const Colour& other, float proportionOfOther) const noexcept
Colour Colour::interpolatedWith (Colour other, float proportionOfOther) const noexcept
{ {
if (proportionOfOther <= 0) if (proportionOfOther <= 0)
return *this; return *this;
@@ -393,7 +393,7 @@ Colour Colour::contrasting (const float amount) const noexcept
: Colours::white).withAlpha (amount)); : 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); const ColourHelpers::YIQ bg (*this);
ColourHelpers::YIQ fg (target); ColourHelpers::YIQ fg (target);
@@ -408,8 +408,8 @@ Colour Colour::contrasting (const Colour& target, float minContrast) const noexc
return fg.toColour(); 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 b1 = ColourHelpers::getPerceivedBrightness (colour1);
const float b2 = ColourHelpers::getPerceivedBrightness (colour2); const float b2 = ColourHelpers::getPerceivedBrightness (colour2);


+ 5
- 5
modules/juce_graphics/colour/juce_Colour.h View File

@@ -231,14 +231,14 @@ public:
If the foreground colour is semi-transparent, it is blended onto this colour If the foreground colour is semi-transparent, it is blended onto this colour
accordingly. 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. /** Returns a colour that lies somewhere between this one and another.
If amountOfOther is zero, the result is 100% this colour, if amountOfOther If amountOfOther is zero, the result is 100% this colour, if amountOfOther
is 1.0, the result is 100% of the other colour. 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. /** 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 nudged up or down so that it differs from the luminosity of this colour
by at least the amount specified by minLuminosityDiff. 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. /** Returns a colour that contrasts against two colours.
Looks for a colour that contrasts with both of the colours passed-in. 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. 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. /** Returns an opaque shade of grey.


+ 4
- 4
modules/juce_graphics/colour/juce_ColourGradient.cpp View File

@@ -33,8 +33,8 @@ ColourGradient::ColourGradient() noexcept
#endif #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_) const bool isRadial_)
: point1 (x1_, y1_), : point1 (x1_, y1_),
point2 (x2_, y2_), point2 (x2_, y2_),
@@ -66,7 +66,7 @@ void ColourGradient::clearColours()
colours.clear(); 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 // must be within the two end-points
jassert (proportionAlongGradient >= 0 && proportionAlongGradient <= 1.0); jassert (proportionAlongGradient >= 0 && proportionAlongGradient <= 1.0);
@@ -119,7 +119,7 @@ Colour ColourGradient::getColour (const int index) const noexcept
return Colour(); return Colour();
} }
void ColourGradient::setColour (int index, const Colour& newColour) noexcept
void ColourGradient::setColour (int index, Colour newColour) noexcept
{ {
if (isPositiveAndBelow (index, colours.size())) if (isPositiveAndBelow (index, colours.size()))
colours.getReference (index).colour = newColour; colours.getReference (index).colour = newColour;


+ 5
- 5
modules/juce_graphics/colour/juce_ColourGradient.h View File

@@ -57,8 +57,8 @@ public:
@see ColourGradient @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); bool isRadial);
/** Creates an uninitialised gradient. /** Creates an uninitialised gradient.
@@ -91,7 +91,7 @@ public:
@returns the index at which the new point was added @returns the index at which the new point was added
*/ */
int addColour (double proportionAlongGradient, int addColour (double proportionAlongGradient,
const Colour& colour);
Colour colour);
/** Removes one of the colours from the gradient. */ /** Removes one of the colours from the gradient. */
void removeColour (int index); void removeColour (int index);
@@ -117,7 +117,7 @@ public:
/** Changes the colour at a given index. /** Changes the colour at a given index.
The index is from 0 to getNumColours() - 1. 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. /** Returns the an interpolated colour at any position along the gradient.
@param position the position along the gradient, between 0 and 1 @param position the position along the gradient, between 0 and 1
@@ -165,7 +165,7 @@ private:
{ {
ColourPoint() noexcept {} ColourPoint() noexcept {}
ColourPoint (const double pos, const Colour& col) noexcept
ColourPoint (const double pos, Colour col) noexcept
: position (pos), colour (col) : position (pos), colour (col)
{} {}


+ 1
- 1
modules/juce_graphics/colour/juce_Colours.cpp View File

@@ -166,7 +166,7 @@ const Colour Colours::yellowgreen (0xff9acd32);
//============================================================================== //==============================================================================
Colour Colours::findColourForName (const String& colourName, Colour Colours::findColourForName (const String& colourName,
const Colour& defaultColour)
Colour defaultColour)
{ {
static const uint32 presets[] = static const uint32 presets[] =
{ {


+ 1
- 1
modules/juce_graphics/colour/juce_Colours.h View File

@@ -96,7 +96,7 @@ public:
colour passed in as the defaultColour parameter is returned. colour passed in as the defaultColour parameter is returned.
*/ */
static JUCE_API Colour findColourForName (const String& colourName, static JUCE_API Colour findColourForName (const String& colourName,
const Colour& defaultColour);
Colour defaultColour);
private: private:
//============================================================================== //==============================================================================


+ 3
- 3
modules/juce_graphics/colour/juce_FillType.cpp View File

@@ -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); return ! operator== (other);
} }
void FillType::setColour (const Colour& newColour) noexcept
void FillType::setColour (Colour newColour) noexcept
{ {
gradient = nullptr; gradient = nullptr;
image = Image::null; image = Image::null;


+ 2
- 2
modules/juce_graphics/colour/juce_FillType.h View File

@@ -49,7 +49,7 @@ public:
/** Creates a fill type of a solid colour. /** Creates a fill type of a solid colour.
@see setColour @see setColour
*/ */
FillType (const Colour& colour) noexcept;
FillType (Colour colour) noexcept;
/** Creates a gradient fill type. /** Creates a gradient fill type.
@see setGradient @see setGradient
@@ -88,7 +88,7 @@ public:
/** Turns this object into a solid colour fill. /** Turns this object into a solid colour fill.
If the object was an image or gradient, those fields will no longer be valid. */ 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. */ /** Turns this object into a gradient fill. */
void setGradient (const ColourGradient& newGradient); void setGradient (const ColourGradient& newGradient);


+ 3
- 3
modules/juce_graphics/colour/juce_PixelFormats.h View File

@@ -112,7 +112,7 @@ public:
This takes into account the opacity of the pixel being overlaid, and blends This takes into account the opacity of the pixel being overlaid, and blends
it accordingly. 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. /** Blends another pixel onto this one, applying an extra multiplier to its opacity.
@@ -358,7 +358,7 @@ public:
b = (uint8) sargb; b = (uint8) sargb;
} }
forcedinline void blend (const PixelRGB& src) noexcept
forcedinline void blend (const PixelRGB src) noexcept
{ {
set (src); set (src);
} }
@@ -467,7 +467,7 @@ private:
#endif #endif
; ;
forcedinline void PixelARGB::blend (const PixelRGB& src) noexcept
forcedinline void PixelARGB::blend (const PixelRGB src) noexcept
{ {
set (src); set (src);
} }


+ 3
- 3
modules/juce_graphics/contexts/juce_GraphicsContext.cpp View File

@@ -174,7 +174,7 @@ void Graphics::endTransparencyLayer()
} }
//============================================================================== //==============================================================================
void Graphics::setColour (const Colour& newColour)
void Graphics::setColour (Colour newColour)
{ {
saveStateIfPending(); saveStateIfPending();
context.setFill (newColour); context.setFill (newColour);
@@ -369,7 +369,7 @@ void Graphics::fillAll() const
fillRect (context.getClipBounds()); fillRect (context.getClipBounds());
} }
void Graphics::fillAll (const Colour& colourToUse) const
void Graphics::fillAll (Colour colourToUse) const
{ {
if (! colourToUse.isTransparent()) if (! colourToUse.isTransparent())
{ {
@@ -503,7 +503,7 @@ void Graphics::drawArrow (const Line<float>& line, const float lineThickness, co
void Graphics::fillCheckerBoard (const Rectangle<int>& area, void Graphics::fillCheckerBoard (const Rectangle<int>& area,
const int checkWidth, const int checkHeight, 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! jassert (checkWidth > 0 && checkHeight > 0); // can't be zero or less!


+ 4
- 4
modules/juce_graphics/contexts/juce_GraphicsContext.h View File

@@ -81,7 +81,7 @@ public:
@see setOpacity @see setOpacity
*/ */
void setColour (const Colour& newColour);
void setColour (Colour newColour);
/** Changes the opacity to use with the current colour. /** 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. /** 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). it with a given colour).
*/ */
void fillAll() const; void fillAll() const;
@@ -261,7 +261,7 @@ public:
This leaves the context's current colour and brush unchanged, it just This leaves the context's current colour and brush unchanged, it just
uses the specified colour temporarily. 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. /** Fills a rectangle with the current colour or brush.
@@ -301,7 +301,7 @@ public:
*/ */
void fillCheckerBoard (const Rectangle<int>& area, void fillCheckerBoard (const Rectangle<int>& area,
int checkWidth, int checkHeight, 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. /** Draws four lines to form a rectangular outline, using the current colour or brush.


+ 1
- 1
modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp View File

@@ -28,7 +28,7 @@ LowLevelGraphicsSoftwareRenderer::LowLevelGraphicsSoftwareRenderer (const Image&
{ {
} }
LowLevelGraphicsSoftwareRenderer::LowLevelGraphicsSoftwareRenderer (const Image& image, const Point<int>& origin,
LowLevelGraphicsSoftwareRenderer::LowLevelGraphicsSoftwareRenderer (const Image& image, Point<int> origin,
const RectangleList& initialClip) const RectangleList& initialClip)
: savedState (new RenderingHelpers::SoftwareRendererSavedState (image, initialClip, origin.x, origin.y)) : savedState (new RenderingHelpers::SoftwareRendererSavedState (image, initialClip, origin.x, origin.y))
{ {


+ 1
- 1
modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h View File

@@ -42,7 +42,7 @@ class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsCon
public: public:
//============================================================================== //==============================================================================
LowLevelGraphicsSoftwareRenderer (const Image& imageToRenderOnto); LowLevelGraphicsSoftwareRenderer (const Image& imageToRenderOnto);
LowLevelGraphicsSoftwareRenderer (const Image& imageToRenderOnto, const Point<int>& origin,
LowLevelGraphicsSoftwareRenderer (const Image& imageToRenderOnto, Point<int> origin,
const RectangleList& initialClip); const RectangleList& initialClip);
~LowLevelGraphicsSoftwareRenderer(); ~LowLevelGraphicsSoftwareRenderer();


+ 1
- 1
modules/juce_graphics/effects/juce_DropShadowEffect.cpp View File

@@ -69,7 +69,7 @@ DropShadow::DropShadow() noexcept
{ {
} }
DropShadow::DropShadow (const Colour& shadowColour, const int r, const Point<int>& o) noexcept
DropShadow::DropShadow (Colour shadowColour, const int r, Point<int> o) noexcept
: colour (shadowColour), radius (r), offset (o) : colour (shadowColour), radius (r), offset (o)
{ {
jassert (radius > 0); jassert (radius > 0);


+ 1
- 1
modules/juce_graphics/effects/juce_DropShadowEffect.h View File

@@ -39,7 +39,7 @@ struct JUCE_API DropShadow
DropShadow() noexcept; DropShadow() noexcept;
/** Creates a drop-shadow object with the given parameters. */ /** Creates a drop-shadow object with the given parameters. */
DropShadow (const Colour& shadowColour, int radius, const Point<int>& offset) noexcept;
DropShadow (Colour shadowColour, int radius, Point<int> offset) noexcept;
/** Renders a drop-shadow based on the alpha-channel of the given image. */ /** Renders a drop-shadow based on the alpha-channel of the given image. */
void drawForImage (Graphics& g, const Image& srcImage) const; void drawForImage (Graphics& g, const Image& srcImage) const;


+ 1
- 1
modules/juce_graphics/effects/juce_GlowEffect.cpp View File

@@ -34,7 +34,7 @@ GlowEffect::~GlowEffect()
} }
void GlowEffect::setGlowProperties (const float newRadius, void GlowEffect::setGlowProperties (const float newRadius,
const Colour& newColour)
Colour newColour)
{ {
radius = newRadius; radius = newRadius;
colour = newColour; colour = newColour;


+ 1
- 1
modules/juce_graphics/effects/juce_GlowEffect.h View File

@@ -58,7 +58,7 @@ public:
opacity). opacity).
*/ */
void setGlowProperties (float newRadius, void setGlowProperties (float newRadius,
const Colour& newColour);
Colour newColour);
//============================================================================== //==============================================================================


+ 7
- 7
modules/juce_graphics/fonts/juce_AttributedString.cpp View File

@@ -23,12 +23,12 @@
============================================================================== ==============================================================================
*/ */
AttributedString::Attribute::Attribute (const Range<int>& range_, const Colour& colour_)
AttributedString::Attribute::Attribute (Range<int> range_, Colour colour_)
: range (range_), colour (new Colour (colour_)) : range (range_), colour (new Colour (colour_))
{ {
} }
AttributedString::Attribute::Attribute (const Range<int>& range_, const Font& font_)
AttributedString::Attribute::Attribute (Range<int> range_, const Font& font_)
: range (range_), font (new Font (font_)) : range (range_), font (new Font (font_))
{ {
} }
@@ -137,7 +137,7 @@ void AttributedString::append (const String& textToAppend, const Font& font)
setFont (Range<int> (oldLength, oldLength + newLength), font); setFont (Range<int> (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 oldLength = text.length();
const int newLength = textToAppend.length(); const int newLength = textToAppend.length();
@@ -146,7 +146,7 @@ void AttributedString::append (const String& textToAppend, const Colour& colour)
setColour (Range<int> (oldLength, oldLength + newLength), colour); setColour (Range<int> (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 oldLength = text.length();
const int newLength = textToAppend.length(); const int newLength = textToAppend.length();
@@ -191,12 +191,12 @@ void AttributedString::setLineSpacing (const float newLineSpacing) noexcept
lineSpacing = newLineSpacing; lineSpacing = newLineSpacing;
} }
void AttributedString::setColour (const Range<int>& range, const Colour& colour)
void AttributedString::setColour (Range<int> range, Colour colour)
{ {
attributes.add (new Attribute (range, 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;) for (int i = attributes.size(); --i >= 0;)
if (attributes.getUnchecked(i)->getColour() != nullptr) if (attributes.getUnchecked(i)->getColour() != nullptr)
@@ -205,7 +205,7 @@ void AttributedString::setColour (const Colour& colour)
setColour (Range<int> (0, text.length()), colour); setColour (Range<int> (0, text.length()), colour);
} }
void AttributedString::setFont (const Range<int>& range, const Font& font)
void AttributedString::setFont (Range<int> range, const Font& font)
{ {
attributes.add (new Attribute (range, font)); attributes.add (new Attribute (range, font));
} }


+ 7
- 7
modules/juce_graphics/fonts/juce_AttributedString.h View File

@@ -71,9 +71,9 @@ public:
/** Appends some text, with a specified font, and the default colour (black). */ /** Appends some text, with a specified font, and the default colour (black). */
void append (const String& textToAppend, const Font& font); void append (const String& textToAppend, const Font& font);
/** Appends some text, with a specified colour, and the default 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. */ /** 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. /** Appends another AttributedString to this one.
Note that this will only append the text, fonts, and colours - it won't copy any 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. /** Creates an attribute that changes the colour for a range of characters.
@see AttributedString::setColour() @see AttributedString::setColour()
*/ */
Attribute (const Range<int>& range, const Colour& colour);
Attribute (Range<int> range, Colour colour);
/** Creates an attribute that changes the font for a range of characters. /** Creates an attribute that changes the font for a range of characters.
@see AttributedString::setFont() @see AttributedString::setFont()
*/ */
Attribute (const Range<int>& range, const Font& font);
Attribute (Range<int> range, const Font& font);
Attribute (const Attribute&); Attribute (const Attribute&);
~Attribute(); ~Attribute();
@@ -194,13 +194,13 @@ public:
//============================================================================== //==============================================================================
/** Adds a colour attribute for the specified range. */ /** Adds a colour attribute for the specified range. */
void setColour (const Range<int>& range, const Colour& colour);
void setColour (Range<int> range, Colour colour);
/** Removes all existing colour attributes, and applies this colour to the whole string. */ /** 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. */ /** Adds a font attribute for the specified range. */
void setFont (const Range<int>& range, const Font& font);
void setFont (Range<int> range, const Font& font);
/** Removes all existing font attributes, and applies this font to the whole string. */ /** Removes all existing font attributes, and applies this font to the whole string. */
void setFont (const Font& font); void setFont (const Font& font);


+ 5
- 5
modules/juce_graphics/fonts/juce_TextLayout.cpp View File

@@ -23,7 +23,7 @@
============================================================================== ==============================================================================
*/ */
TextLayout::Glyph::Glyph (const int glyphCode_, const Point<float>& anchor_, float width_) noexcept
TextLayout::Glyph::Glyph (const int glyphCode_, Point<float> anchor_, float width_) noexcept
: glyphCode (glyphCode_), anchor (anchor_), width (width_) : glyphCode (glyphCode_), anchor (anchor_), width (width_)
{ {
} }
@@ -49,7 +49,7 @@ TextLayout::Run::Run() noexcept
{ {
} }
TextLayout::Run::Run (const Range<int>& range, const int numGlyphsToPreallocate)
TextLayout::Run::Run (Range<int> range, const int numGlyphsToPreallocate)
: colour (0xff000000), stringRange (range) : colour (0xff000000), stringRange (range)
{ {
glyphs.ensureStorageAllocated (numGlyphsToPreallocate); glyphs.ensureStorageAllocated (numGlyphsToPreallocate);
@@ -71,7 +71,7 @@ TextLayout::Line::Line() noexcept
{ {
} }
TextLayout::Line::Line (const Range<int>& stringRange_, const Point<float>& lineOrigin_,
TextLayout::Line::Line (Range<int> stringRange_, Point<float> lineOrigin_,
const float ascent_, const float descent_, const float leading_, const float ascent_, const float descent_, const float leading_,
const int numRunsToPreallocate) const int numRunsToPreallocate)
: stringRange (stringRange_), lineOrigin (lineOrigin_), : stringRange (stringRange_), lineOrigin (lineOrigin_),
@@ -251,7 +251,7 @@ namespace TextLayoutHelpers
struct RunAttribute struct RunAttribute
{ {
RunAttribute (const FontAndColour& fc, const Range<int>& r) noexcept
RunAttribute (const FontAndColour& fc, const Range<int> r) noexcept
: fontAndColour (fc), range (r) : fontAndColour (fc), range (r)
{} {}
@@ -415,7 +415,7 @@ namespace TextLayoutHelpers
return CharacterFunctions::isWhitespace (c) ? 2 : 1; return CharacterFunctions::isWhitespace (c) ? 2 : 1;
} }
void appendText (const AttributedString& text, const Range<int>& stringRange,
void appendText (const AttributedString& text, const Range<int> stringRange,
const Font& font, const Colour& colour) const Font& font, const Colour& colour)
{ {
const String stringText (text.getText().substring (stringRange.getStart(), stringRange.getEnd())); const String stringText (text.getText().substring (stringRange.getStart(), stringRange.getEnd()));


+ 3
- 3
modules/juce_graphics/fonts/juce_TextLayout.h View File

@@ -82,7 +82,7 @@ public:
class JUCE_API Glyph class JUCE_API Glyph
{ {
public: public:
Glyph (int glyphCode, const Point<float>& anchor, float width) noexcept;
Glyph (int glyphCode, Point<float> anchor, float width) noexcept;
Glyph (const Glyph&) noexcept; Glyph (const Glyph&) noexcept;
Glyph& operator= (const Glyph&) noexcept; Glyph& operator= (const Glyph&) noexcept;
~Glyph() noexcept; ~Glyph() noexcept;
@@ -108,7 +108,7 @@ public:
public: public:
Run() noexcept; Run() noexcept;
Run (const Run&); Run (const Run&);
Run (const Range<int>& stringRange, int numGlyphsToPreallocate);
Run (Range<int> stringRange, int numGlyphsToPreallocate);
~Run() noexcept; ~Run() noexcept;
Font font; /**< The run's font. */ Font font; /**< The run's font. */
@@ -128,7 +128,7 @@ public:
public: public:
Line() noexcept; Line() noexcept;
Line (const Line&); Line (const Line&);
Line (const Range<int>& stringRange, const Point<float>& lineOrigin,
Line (Range<int> stringRange, Point<float> lineOrigin,
float ascent, float descent, float leading, int numRunsToPreallocate); float ascent, float descent, float leading, int numRunsToPreallocate);
~Line() noexcept; ~Line() noexcept;


+ 12
- 12
modules/juce_graphics/geometry/juce_Path.cpp View File

@@ -271,7 +271,7 @@ void Path::startNewSubPath (const float x, const float y)
data.elements [numElements++] = y; data.elements [numElements++] = y;
} }
void Path::startNewSubPath (const Point<float>& start)
void Path::startNewSubPath (const Point<float> start)
{ {
startNewSubPath (start.x, start.y); startNewSubPath (start.x, start.y);
} }
@@ -292,7 +292,7 @@ void Path::lineTo (const float x, const float y)
bounds.extend (x, y); bounds.extend (x, y);
} }
void Path::lineTo (const Point<float>& end)
void Path::lineTo (const Point<float> end)
{ {
lineTo (end.x, end.y); lineTo (end.x, end.y);
} }
@@ -317,8 +317,8 @@ void Path::quadraticTo (const float x1, const float y1,
bounds.extend (x1, y1, x2, y2); bounds.extend (x1, y1, x2, y2);
} }
void Path::quadraticTo (const Point<float>& controlPoint,
const Point<float>& endPoint)
void Path::quadraticTo (const Point<float> controlPoint,
const Point<float> endPoint)
{ {
quadraticTo (controlPoint.x, controlPoint.y, quadraticTo (controlPoint.x, controlPoint.y,
endPoint.x, endPoint.y); endPoint.x, endPoint.y);
@@ -349,9 +349,9 @@ void Path::cubicTo (const float x1, const float y1,
bounds.extend (x3, y3); bounds.extend (x3, y3);
} }
void Path::cubicTo (const Point<float>& controlPoint1,
const Point<float>& controlPoint2,
const Point<float>& endPoint)
void Path::cubicTo (const Point<float> controlPoint1,
const Point<float> controlPoint2,
const Point<float> endPoint)
{ {
cubicTo (controlPoint1.x, controlPoint1.y, cubicTo (controlPoint1.x, controlPoint1.y,
controlPoint2.x, controlPoint2.y, controlPoint2.x, controlPoint2.y,
@@ -676,7 +676,7 @@ void Path::addArrow (const Line<float>& line, float lineThickness,
closeSubPath(); closeSubPath();
} }
void Path::addPolygon (const Point<float>& centre, const int numberOfSides,
void Path::addPolygon (const Point<float> centre, const int numberOfSides,
const float radius, const float startAngle) const float radius, const float startAngle)
{ {
jassert (numberOfSides > 1); // this would be silly. jassert (numberOfSides > 1); // this would be silly.
@@ -700,7 +700,7 @@ void Path::addPolygon (const Point<float>& centre, const int numberOfSides,
} }
} }
void Path::addStar (const Point<float>& centre, const int numberOfPoints,
void Path::addStar (const Point<float> centre, const int numberOfPoints,
const float innerRadius, const float outerRadius, const float startAngle) const float innerRadius, const float outerRadius, const float startAngle)
{ {
jassert (numberOfPoints > 1); // this would be silly. jassert (numberOfPoints > 1); // this would be silly.
@@ -728,7 +728,7 @@ void Path::addStar (const Point<float>& centre, const int numberOfPoints,
void Path::addBubble (const Rectangle<float>& bodyArea, void Path::addBubble (const Rectangle<float>& bodyArea,
const Rectangle<float>& maximumArea, const Rectangle<float>& maximumArea,
const Point<float>& arrowTip,
const Point<float> arrowTip,
const float cornerSize, const float cornerSize,
const float arrowBaseWidth) const float arrowBaseWidth)
{ {
@@ -1023,7 +1023,7 @@ bool Path::contains (const float x, const float y, const float tolerance) const
: ((negativeCrossings + positiveCrossings) & 1) != 0; : ((negativeCrossings + positiveCrossings) & 1) != 0;
} }
bool Path::contains (const Point<float>& point, const float tolerance) const
bool Path::contains (const Point<float> point, const float tolerance) const
{ {
return contains (point.x, point.y, tolerance); return contains (point.x, point.y, tolerance);
} }
@@ -1100,7 +1100,7 @@ Point<float> Path::getPointAlongPath (float distanceFromStart, const AffineTrans
return Point<float> (i.x2, i.y2); return Point<float> (i.x2, i.y2);
} }
float Path::getNearestPoint (const Point<float>& targetPoint, Point<float>& pointOnPath,
float Path::getNearestPoint (const Point<float> targetPoint, Point<float>& pointOnPath,
const AffineTransform& transform) const const AffineTransform& transform) const
{ {
PathFlatteningIterator i (*this, transform); PathFlatteningIterator i (*this, transform);


+ 12
- 12
modules/juce_graphics/geometry/juce_Path.h View File

@@ -134,7 +134,7 @@ public:
@see closeSubPath, setUsingNonZeroWinding @see closeSubPath, setUsingNonZeroWinding
*/ */
bool contains (const Point<float>& point,
bool contains (const Point<float> point,
float tolerance = 1.0f) const; float tolerance = 1.0f) const;
/** Checks whether a line crosses the path. /** 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 This sets pointOnPath to the nearest point, and returns the distance of this point from the start
of the path. of the path.
*/ */
float getNearestPoint (const Point<float>& targetPoint,
float getNearestPoint (const Point<float> targetPoint,
Point<float>& pointOnPath, Point<float>& pointOnPath,
const AffineTransform& transform = AffineTransform::identity) const; const AffineTransform& transform = AffineTransform::identity) const;
@@ -213,7 +213,7 @@ public:
@see lineTo, quadraticTo, cubicTo, closeSubPath @see lineTo, quadraticTo, cubicTo, closeSubPath
*/ */
void startNewSubPath (const Point<float>& start);
void startNewSubPath (const Point<float> start);
/** Closes a the current sub-path with a line back to its start-point. /** Closes a the current sub-path with a line back to its start-point.
@@ -249,7 +249,7 @@ public:
@see startNewSubPath, quadraticTo, cubicTo, closeSubPath @see startNewSubPath, quadraticTo, cubicTo, closeSubPath
*/ */
void lineTo (const Point<float>& end);
void lineTo (const Point<float> end);
/** Adds a quadratic bezier curve from the shape's last position to a new position. /** 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 @see startNewSubPath, lineTo, cubicTo, closeSubPath
*/ */
void quadraticTo (const Point<float>& controlPoint,
const Point<float>& endPoint);
void quadraticTo (const Point<float> controlPoint,
const Point<float> endPoint);
/** Adds a cubic bezier curve from the shape's last position to a new position. /** 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 @see startNewSubPath, lineTo, quadraticTo, closeSubPath
*/ */
void cubicTo (const Point<float>& controlPoint1,
const Point<float>& controlPoint2,
const Point<float>& endPoint);
void cubicTo (const Point<float> controlPoint1,
const Point<float> controlPoint2,
const Point<float> endPoint);
/** Returns the last point that was added to the path by one of the drawing methods. /** 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. /** Adds a polygon shape to the path.
@see addStar @see addStar
*/ */
void addPolygon (const Point<float>& centre,
void addPolygon (const Point<float> centre,
int numberOfSides, int numberOfSides,
float radius, float radius,
float startAngle = 0.0f); float startAngle = 0.0f);
@@ -520,7 +520,7 @@ public:
/** Adds a star shape to the path. /** Adds a star shape to the path.
@see addPolygon @see addPolygon
*/ */
void addStar (const Point<float>& centre,
void addStar (const Point<float> centre,
int numberOfPoints, int numberOfPoints,
float innerRadius, float innerRadius,
float outerRadius, float outerRadius,
@@ -538,7 +538,7 @@ public:
*/ */
void addBubble (const Rectangle<float>& bodyArea, void addBubble (const Rectangle<float>& bodyArea,
const Rectangle<float>& maximumArea, const Rectangle<float>& maximumArea,
const Point<float>& arrowTipPosition,
const Point<float> arrowTipPosition,
const float cornerSize, const float cornerSize,
const float arrowBaseWidth); const float arrowBaseWidth);


+ 9
- 9
modules/juce_graphics/geometry/juce_Point.h View File

@@ -59,8 +59,8 @@ public:
/** Copies this point from another one. */ /** Copies this point from another one. */
Point& operator= (const Point& other) noexcept { x = other.x; y = other.y; return *this; } 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). */ /** Returns true if the point is (0, 0). */
bool isOrigin() const noexcept { return x == ValueType() && y == ValueType(); } 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); } Point translated (const ValueType xDelta, const ValueType yDelta) const noexcept { return Point (x + xDelta, y + yDelta); }
/** Adds two points together. */ /** 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. */ /** 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. */ /** 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. */ /** 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. */ /** Returns a point whose coordinates are multiplied by a given value. */
Point operator* (const ValueType multiplier) const noexcept { return Point (x * multiplier, y * multiplier); } 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); } ValueType getDistanceFromOrigin() const noexcept { return juce_hypot (x, y); }
/** Returns the straight-line distance between this point and another one. */ /** 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. */ /** This type will be double if the Point's type is double, otherwise it will be float. */
typedef typename TypeHelpers::SmallestFloatType<ValueType>::type FloatType; typedef typename TypeHelpers::SmallestFloatType<ValueType>::type FloatType;
@@ -133,7 +133,7 @@ public:
The return value is the number of radians clockwise from the 12 o'clock direction, 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. 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<FloatType> (std::atan2 (other.x - x, y - other.y)); } { return static_cast<FloatType> (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. /** 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); } transform.mat10 * x + transform.mat11 * y + transform.mat12); }
/** Returns the dot-product of two points (x1 * x2 + y1 * y2). */ /** 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<int> object. */ /** Casts this point to a Point<int> object. */
Point<int> toInt() const noexcept { return Point<int> (static_cast <int> (x), static_cast<int> (y)); } Point<int> toInt() const noexcept { return Point<int> (static_cast <int> (x), static_cast<int> (y)); }


+ 3
- 3
modules/juce_graphics/images/juce_Image.cpp View File

@@ -392,7 +392,7 @@ Colour Image::BitmapData::getPixelColour (const int x, const int y) const noexce
return Colour(); 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)); 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<int>& area, const Colour& colourToClearTo)
void Image::clear (const Rectangle<int>& area, Colour colourToClearTo)
{ {
const ScopedPointer<LowLevelGraphicsContext> g (image->createLowLevelContext()); const ScopedPointer<LowLevelGraphicsContext> g (image->createLowLevelContext());
g->setFill (colourToClearTo); g->setFill (colourToClearTo);
@@ -428,7 +428,7 @@ Colour Image::getPixelAt (const int x, const int y) const
return Colour(); 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())) if (isPositiveAndBelow (x, getWidth()) && isPositiveAndBelow (y, getHeight()))
{ {


+ 3
- 3
modules/juce_graphics/images/juce_Image.h View File

@@ -188,7 +188,7 @@ public:
This won't do any alpha-blending - it just sets all pixels in the image to 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). the given colour (which may be non-opaque if the image has an alpha channel).
*/ */
void clear (const Rectangle<int>& area, const Colour& colourToClearTo = Colour (0x00000000));
void clear (const Rectangle<int>& area, Colour colourToClearTo = Colour (0x00000000));
/** Returns a rescaled version of this image. /** Returns a rescaled version of this image.
@@ -262,7 +262,7 @@ public:
@see getPixelAt, Image::BitmapData::setPixelColour @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. /** 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 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. 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. */ /** Returns the size of the bitmap. */
Rectangle<int> getBounds() const noexcept { return Rectangle<int> (width, height); } Rectangle<int> getBounds() const noexcept { return Rectangle<int> (width, height); }


+ 18
- 18
modules/juce_graphics/native/juce_RenderingHelpers.h View File

@@ -581,7 +581,7 @@ namespace EdgeTableFillers
class SolidColour class SolidColour
{ {
public: public:
SolidColour (const Image::BitmapData& image, const PixelARGB& colour)
SolidColour (const Image::BitmapData& image, const PixelARGB colour)
: destData (image), sourceColour (colour) : destData (image), sourceColour (colour)
{ {
if (sizeof (PixelType) == 3 && destData.pixelStride == sizeof (PixelType)) if (sizeof (PixelType) == 3 && destData.pixelStride == sizeof (PixelType))
@@ -651,12 +651,12 @@ namespace EdgeTableFillers
return addBytesToPointer (linePixels, x * destData.pixelStride); 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)) 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)) 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)) if (destData.pixelStride == sizeof (*dest))
memset (dest, colour.getAlpha(), (size_t) width); memset (dest, colour.getAlpha(), (size_t) width);
@@ -709,7 +709,7 @@ namespace EdgeTableFillers
JUCE_PERFORM_PIXEL_OP_LOOP (setAlpha (colour.getAlpha())) 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)) JUCE_PERFORM_PIXEL_OP_LOOP (set (colour))
} }
@@ -1497,7 +1497,7 @@ namespace EdgeTableFillers
} }
template <class Iterator, class DestPixelType> template <class Iterator, class DestPixelType>
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) if (replaceContents)
{ {
@@ -1556,14 +1556,14 @@ namespace ClipRegions
virtual Ptr clipToPath (const Path&, const AffineTransform&) = 0; virtual Ptr clipToPath (const Path&, const AffineTransform&) = 0;
virtual Ptr clipToEdgeTable (const EdgeTable& et) = 0; virtual Ptr clipToEdgeTable (const EdgeTable& et) = 0;
virtual Ptr clipToImageAlpha (const Image&, const AffineTransform&, const bool betterQuality) = 0; virtual Ptr clipToImageAlpha (const Image&, const AffineTransform&, const bool betterQuality) = 0;
virtual void translate (const Point<int>& delta) = 0;
virtual void translate (Point<int> delta) = 0;
virtual bool clipRegionIntersects (const Rectangle<int>&) const = 0; virtual bool clipRegionIntersects (const Rectangle<int>&) const = 0;
virtual Rectangle<int> getClipBounds() const = 0; virtual Rectangle<int> getClipBounds() const = 0;
virtual void fillRectWithColour (Image::BitmapData& destData, const Rectangle<int>&, const PixelARGB& colour, bool replaceContents) const = 0;
virtual void fillRectWithColour (Image::BitmapData& destData, const Rectangle<float>&, 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<int>&, const PixelARGB colour, bool replaceContents) const = 0;
virtual void fillRectWithColour (Image::BitmapData& destData, const Rectangle<float>&, 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 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 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; 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; return edgeTable.isEmpty() ? nullptr : this;
} }
void translate (const Point<int>& delta)
void translate (Point<int> delta)
{ {
edgeTable.translate ((float) delta.x, delta.y); edgeTable.translate ((float) delta.x, delta.y);
} }
@@ -1679,7 +1679,7 @@ namespace ClipRegions
return edgeTable.getMaximumBounds(); return edgeTable.getMaximumBounds();
} }
void fillRectWithColour (Image::BitmapData& destData, const Rectangle<int>& area, const PixelARGB& colour, bool replaceContents) const
void fillRectWithColour (Image::BitmapData& destData, const Rectangle<int>& area, const PixelARGB colour, bool replaceContents) const
{ {
const Rectangle<int> totalClip (edgeTable.getMaximumBounds()); const Rectangle<int> totalClip (edgeTable.getMaximumBounds());
const Rectangle<int> clipped (totalClip.getIntersection (area)); const Rectangle<int> clipped (totalClip.getIntersection (area));
@@ -1692,7 +1692,7 @@ namespace ClipRegions
} }
} }
void fillRectWithColour (Image::BitmapData& destData, const Rectangle<float>& area, const PixelARGB& colour) const
void fillRectWithColour (Image::BitmapData& destData, const Rectangle<float>& area, const PixelARGB colour) const
{ {
const Rectangle<float> totalClip (edgeTable.getMaximumBounds().toFloat()); const Rectangle<float> totalClip (edgeTable.getMaximumBounds().toFloat());
const Rectangle<float> clipped (totalClip.getIntersection (area)); const Rectangle<float> 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) switch (destData.pixelFormat)
{ {
@@ -1805,7 +1805,7 @@ namespace ClipRegions
return toEdgeTable()->clipToImageAlpha (image, transform, betterQuality); return toEdgeTable()->clipToImageAlpha (image, transform, betterQuality);
} }
void translate (const Point<int>& delta)
void translate (Point<int> delta)
{ {
clip.offsetAll (delta.x, delta.y); clip.offsetAll (delta.x, delta.y);
} }
@@ -1813,7 +1813,7 @@ namespace ClipRegions
bool clipRegionIntersects (const Rectangle<int>& r) const { return clip.intersects (r); } bool clipRegionIntersects (const Rectangle<int>& r) const { return clip.intersects (r); }
Rectangle<int> getClipBounds() const { return clip.getBounds(); } Rectangle<int> getClipBounds() const { return clip.getBounds(); }
void fillRectWithColour (Image::BitmapData& destData, const Rectangle<int>& area, const PixelARGB& colour, bool replaceContents) const
void fillRectWithColour (Image::BitmapData& destData, const Rectangle<int>& area, const PixelARGB colour, bool replaceContents) const
{ {
SubRectangleIterator iter (clip, area); SubRectangleIterator iter (clip, area);
@@ -1825,7 +1825,7 @@ namespace ClipRegions
} }
} }
void fillRectWithColour (Image::BitmapData& destData, const Rectangle<float>& area, const PixelARGB& colour) const
void fillRectWithColour (Image::BitmapData& destData, const Rectangle<float>& area, const PixelARGB colour) const
{ {
SubRectangleIteratorFloat iter (clip, area); 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) switch (destData.pixelFormat)
{ {


+ 4
- 4
modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp View File

@@ -629,8 +629,8 @@ public:
{ {
radialGradient = 0; radialGradient = 0;
const Point<float>& p1 = fillType.gradient->point1;
const Point<float>& p2 = fillType.gradient->point2;
const Point<float> p1 = fillType.gradient->point1;
const Point<float> p2 = fillType.gradient->point2;
float r = p1.getDistanceFrom (p2); float r = p1.getDistanceFrom (p2);
D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES props = D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES props =
@@ -645,8 +645,8 @@ public:
{ {
linearGradient = 0; linearGradient = 0;
const Point<float>& p1 = fillType.gradient->point1;
const Point<float>& p2 = fillType.gradient->point2;
const Point<float> p1 = fillType.gradient->point1;
const Point<float> p2 = fillType.gradient->point2;
D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES props = D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES props =
D2D1::LinearGradientBrushProperties (D2D1::Point2F (p1.x, p1.y), D2D1::LinearGradientBrushProperties (D2D1::Point2F (p1.x, p1.y),


+ 1
- 1
modules/juce_gui_basics/buttons/juce_ArrowButton.cpp View File

@@ -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) : Button (name), colour (arrowColour)
{ {
path.addTriangle (0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.5f); path.addTriangle (0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.5f);


+ 1
- 1
modules/juce_gui_basics/buttons/juce_ArrowButton.h View File

@@ -48,7 +48,7 @@ public:
*/ */
ArrowButton (const String& buttonName, ArrowButton (const String& buttonName,
float arrowDirection, float arrowDirection,
const Colour& arrowColour);
Colour arrowColour);
/** Destructor. */ /** Destructor. */
~ArrowButton(); ~ArrowButton();


+ 3
- 3
modules/juce_gui_basics/buttons/juce_ImageButton.cpp View File

@@ -40,13 +40,13 @@ void ImageButton::setImages (const bool resizeButtonNowToFitThisImage,
const bool preserveImageProportions, const bool preserveImageProportions,
const Image& normalImage_, const Image& normalImage_,
const float imageOpacityWhenNormal, const float imageOpacityWhenNormal,
const Colour& overlayColourWhenNormal,
Colour overlayColourWhenNormal,
const Image& overImage_, const Image& overImage_,
const float imageOpacityWhenOver, const float imageOpacityWhenOver,
const Colour& overlayColourWhenOver,
Colour overlayColourWhenOver,
const Image& downImage_, const Image& downImage_,
const float imageOpacityWhenDown, const float imageOpacityWhenDown,
const Colour& overlayColourWhenDown,
Colour overlayColourWhenDown,
const float hitTestAlphaThreshold) const float hitTestAlphaThreshold)
{ {
normalImage = normalImage_; normalImage = normalImage_;


+ 3
- 3
modules/juce_gui_basics/buttons/juce_ImageButton.h View File

@@ -101,13 +101,13 @@ public:
bool preserveImageProportions, bool preserveImageProportions,
const Image& normalImage, const Image& normalImage,
float imageOpacityWhenNormal, float imageOpacityWhenNormal,
const Colour& overlayColourWhenNormal,
Colour overlayColourWhenNormal,
const Image& overImage, const Image& overImage,
float imageOpacityWhenOver, float imageOpacityWhenOver,
const Colour& overlayColourWhenOver,
Colour overlayColourWhenOver,
const Image& downImage, const Image& downImage,
float imageOpacityWhenDown, float imageOpacityWhenDown,
const Colour& overlayColourWhenDown,
Colour overlayColourWhenDown,
float hitTestAlphaThreshold = 0.0f); float hitTestAlphaThreshold = 0.0f);
/** Returns the currently set 'normal' image. */ /** Returns the currently set 'normal' image. */


+ 1
- 1
modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.cpp View File

@@ -56,7 +56,7 @@ void ApplicationCommandInfo::setTicked (const bool b) noexcept
flags &= ~isTicked; 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)); defaultKeypresses.add (KeyPress (keyCode, modifiers, 0));
} }

+ 1
- 1
modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.h View File

@@ -82,7 +82,7 @@ struct JUCE_API ApplicationCommandInfo
@endcode @endcode
*/ */
void addDefaultKeypress (int keyCode, void addDefaultKeypress (int keyCode,
const ModifierKeys& modifiers) noexcept;
ModifierKeys modifiers) noexcept;
//============================================================================== //==============================================================================
/** The command's unique ID number. /** The command's unique ID number.


+ 26
- 26
modules/juce_gui_basics/components/juce_Component.cpp View File

@@ -194,14 +194,14 @@ struct Component::ComponentHelpers
} }
//============================================================================== //==============================================================================
static inline bool hitTest (Component& comp, const Point<int>& localPoint)
static inline bool hitTest (Component& comp, Point<int> localPoint)
{ {
return isPositiveAndBelow (localPoint.x, comp.getWidth()) return isPositiveAndBelow (localPoint.x, comp.getWidth())
&& isPositiveAndBelow (localPoint.y, comp.getHeight()) && isPositiveAndBelow (localPoint.y, comp.getHeight())
&& comp.hitTest (localPoint.x, localPoint.y); && comp.hitTest (localPoint.x, localPoint.y);
} }
static Point<int> convertFromParentSpace (const Component& comp, const Point<int>& pointInParentSpace)
static Point<int> convertFromParentSpace (const Component& comp, Point<int> pointInParentSpace)
{ {
if (comp.affineTransform == nullptr) if (comp.affineTransform == nullptr)
return pointInParentSpace - comp.getPosition(); return pointInParentSpace - comp.getPosition();
@@ -217,7 +217,7 @@ struct Component::ComponentHelpers
return areaInParentSpace.toFloat().transformed (comp.affineTransform->inverted()).getSmallestIntegerContainer() - comp.getPosition(); return areaInParentSpace.toFloat().transformed (comp.affineTransform->inverted()).getSmallestIntegerContainer() - comp.getPosition();
} }
static Point<int> convertToParentSpace (const Component& comp, const Point<int>& pointInLocalSpace)
static Point<int> convertToParentSpace (const Component& comp, Point<int> pointInLocalSpace)
{ {
if (comp.affineTransform == nullptr) if (comp.affineTransform == nullptr)
return pointInLocalSpace + comp.getPosition(); return pointInLocalSpace + comp.getPosition();
@@ -295,7 +295,7 @@ struct Component::ComponentHelpers
return r; return r;
} }
static bool clipObscuredRegions (const Component& comp, Graphics& g, const Rectangle<int>& clipRect, const Point<int>& delta)
static bool clipObscuredRegions (const Component& comp, Graphics& g, const Rectangle<int>& clipRect, Point<int> delta)
{ {
bool nothingChanged = true; bool nothingChanged = true;
@@ -328,7 +328,7 @@ struct Component::ComponentHelpers
} }
static void subtractObscuredRegions (const Component& comp, RectangleList& result, static void subtractObscuredRegions (const Component& comp, RectangleList& result,
const Point<int>& delta, const Rectangle<int>& clipRect,
Point<int> delta, const Rectangle<int>& clipRect,
const Component* const compToAvoid) const Component* const compToAvoid)
{ {
for (int i = comp.childComponentList.size(); --i >= 0;) for (int i = comp.childComponentList.size(); --i >= 0;)
@@ -966,7 +966,7 @@ Rectangle<int> Component::getParentMonitorArea() const
return Desktop::getInstance().getDisplays().getDisplayContaining (getScreenBounds().getCentre()).userArea; return Desktop::getInstance().getDisplays().getDisplayContaining (getScreenBounds().getCentre()).userArea;
} }
Point<int> Component::getLocalPoint (const Component* source, const Point<int>& point) const
Point<int> Component::getLocalPoint (const Component* source, Point<int> point) const
{ {
return ComponentHelpers::convertCoordinate (this, source, point); return ComponentHelpers::convertCoordinate (this, source, point);
} }
@@ -976,7 +976,7 @@ Rectangle<int> Component::getLocalArea (const Component* source, const Rectangle
return ComponentHelpers::convertCoordinate (this, source, area); return ComponentHelpers::convertCoordinate (this, source, area);
} }
Point<int> Component::localPointToGlobal (const Point<int>& point) const
Point<int> Component::localPointToGlobal (Point<int> point) const
{ {
return ComponentHelpers::convertCoordinate (nullptr, this, point); return ComponentHelpers::convertCoordinate (nullptr, this, point);
} }
@@ -987,17 +987,17 @@ Rectangle<int> Component::localAreaToGlobal (const Rectangle<int>& area) const
} }
// Deprecated methods... // Deprecated methods...
Point<int> Component::relativePositionToGlobal (const Point<int>& relativePosition) const
Point<int> Component::relativePositionToGlobal (Point<int> relativePosition) const
{ {
return localPointToGlobal (relativePosition); return localPointToGlobal (relativePosition);
} }
Point<int> Component::globalPositionToRelative (const Point<int>& screenPosition) const
Point<int> Component::globalPositionToRelative (Point<int> screenPosition) const
{ {
return getLocalPoint (nullptr, screenPosition); return getLocalPoint (nullptr, screenPosition);
} }
Point<int> Component::relativePositionToOtherComponent (const Component* const targetComponent, const Point<int>& positionRelativeToThis) const
Point<int> Component::relativePositionToOtherComponent (const Component* const targetComponent, Point<int> positionRelativeToThis) const
{ {
return targetComponent == nullptr ? localPointToGlobal (positionRelativeToThis) return targetComponent == nullptr ? localPointToGlobal (positionRelativeToThis)
: targetComponent->getLocalPoint (this, positionRelativeToThis); : targetComponent->getLocalPoint (this, positionRelativeToThis);
@@ -1104,7 +1104,7 @@ void Component::setTopLeftPosition (const int x, const int y)
setBounds (x, y, getWidth(), getHeight()); setBounds (x, y, getWidth(), getHeight());
} }
void Component::setTopLeftPosition (const Point<int>& pos)
void Component::setTopLeftPosition (Point<int> pos)
{ {
setBounds (pos.x, pos.y, getWidth(), getHeight()); setBounds (pos.x, pos.y, getWidth(), getHeight());
} }
@@ -1287,7 +1287,7 @@ void Component::getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
allowsClicksOnChildComponents = flags.allowChildMouseClicksFlag; allowsClicksOnChildComponents = flags.allowChildMouseClicksFlag;
} }
bool Component::contains (const Point<int>& point)
bool Component::contains (Point<int> point)
{ {
if (ComponentHelpers::hitTest (*this, point)) if (ComponentHelpers::hitTest (*this, point))
{ {
@@ -1302,7 +1302,7 @@ bool Component::contains (const Point<int>& point)
return false; return false;
} }
bool Component::reallyContains (const Point<int>& point, const bool returnTrueIfWithinAChild)
bool Component::reallyContains (Point<int> point, const bool returnTrueIfWithinAChild)
{ {
if (! contains (point)) if (! contains (point))
return false; return false;
@@ -1313,7 +1313,7 @@ bool Component::reallyContains (const Point<int>& point, const bool returnTrueIf
return (compAtPosition == this) || (returnTrueIfWithinAChild && isParentOf (compAtPosition)); return (compAtPosition == this) || (returnTrueIfWithinAChild && isParentOf (compAtPosition));
} }
Component* Component::getComponentAt (const Point<int>& position)
Component* Component::getComponentAt (Point<int> position)
{ {
if (flags.visibleFlag && ComponentHelpers::hitTest (*this, position)) if (flags.visibleFlag && ComponentHelpers::hitTest (*this, position))
{ {
@@ -2046,7 +2046,7 @@ void Component::removeColour (const int colourId)
colourChanged(); 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())) if (properties.set (ComponentHelpers::getColourPropertyId (colourId), (int) colour.getARGB()))
colourChanged(); colourChanged();
@@ -2245,7 +2245,7 @@ void Component::removeMouseListener (MouseListener* const listenerToRemove)
} }
//============================================================================== //==============================================================================
void Component::internalMouseEnter (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
void Component::internalMouseEnter (MouseInputSource& source, Point<int> relativePos, Time time)
{ {
if (isCurrentlyBlockedByAnotherModalComponent()) if (isCurrentlyBlockedByAnotherModalComponent())
{ {
@@ -2271,7 +2271,7 @@ void Component::internalMouseEnter (MouseInputSource& source, const Point<int>&
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseEnter, me); MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseEnter, me);
} }
void Component::internalMouseExit (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
void Component::internalMouseExit (MouseInputSource& source, Point<int> relativePos, Time time)
{ {
if (flags.repaintOnMouseActivityFlag) if (flags.repaintOnMouseActivityFlag)
repaint(); repaint();
@@ -2291,7 +2291,7 @@ void Component::internalMouseExit (MouseInputSource& source, const Point<int>& r
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseExit, me); MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseExit, me);
} }
void Component::internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
void Component::internalMouseDown (MouseInputSource& source, Point<int> relativePos, Time time)
{ {
Desktop& desktop = Desktop::getInstance(); Desktop& desktop = Desktop::getInstance();
BailOutChecker checker (this); BailOutChecker checker (this);
@@ -2355,8 +2355,8 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDown, me); MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDown, me);
} }
void Component::internalMouseUp (MouseInputSource& source, const Point<int>& relativePos,
const Time& time, const ModifierKeys& oldModifiers)
void Component::internalMouseUp (MouseInputSource& source, Point<int> relativePos,
Time time, const ModifierKeys oldModifiers)
{ {
if (flags.mouseDownWasBlocked && isCurrentlyBlockedByAnotherModalComponent()) if (flags.mouseDownWasBlocked && isCurrentlyBlockedByAnotherModalComponent())
return; return;
@@ -2398,7 +2398,7 @@ void Component::internalMouseUp (MouseInputSource& source, const Point<int>& rel
} }
} }
void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
void Component::internalMouseDrag (MouseInputSource& source, Point<int> relativePos, Time time)
{ {
if (! isCurrentlyBlockedByAnotherModalComponent()) if (! isCurrentlyBlockedByAnotherModalComponent())
{ {
@@ -2421,7 +2421,7 @@ void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& r
} }
} }
void Component::internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
void Component::internalMouseMove (MouseInputSource& source, Point<int> relativePos, Time time)
{ {
Desktop& desktop = Desktop::getInstance(); Desktop& desktop = Desktop::getInstance();
@@ -2447,8 +2447,8 @@ void Component::internalMouseMove (MouseInputSource& source, const Point<int>& r
} }
} }
void Component::internalMouseWheel (MouseInputSource& source, const Point<int>& relativePos,
const Time& time, const MouseWheelDetails& wheel)
void Component::internalMouseWheel (MouseInputSource& source, Point<int> relativePos,
Time time, const MouseWheelDetails& wheel)
{ {
Desktop& desktop = Desktop::getInstance(); Desktop& desktop = Desktop::getInstance();
BailOutChecker checker (this); BailOutChecker checker (this);
@@ -2475,8 +2475,8 @@ void Component::internalMouseWheel (MouseInputSource& source, const Point<int>&
} }
} }
void Component::internalMagnifyGesture (MouseInputSource& source, const Point<int>& relativePos,
const Time& time, float amount)
void Component::internalMagnifyGesture (MouseInputSource& source, Point<int> relativePos,
Time time, float amount)
{ {
if (! isCurrentlyBlockedByAnotherModalComponent()) if (! isCurrentlyBlockedByAnotherModalComponent())
{ {


+ 20
- 20
modules/juce_gui_basics/components/juce_Component.h View File

@@ -288,7 +288,7 @@ public:
int getRight() const noexcept { return bounds.getRight(); } int getRight() const noexcept { return bounds.getRight(); }
/** Returns the component's top-left position as a Point. */ /** Returns the component's top-left position as a Point. */
const Point<int>& getPosition() const noexcept { return bounds.getPosition(); }
Point<int> getPosition() const noexcept { return bounds.getPosition(); }
/** Returns the y coordinate of the bottom edge of this component. /** 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. This is a distance in pixels from the top edge of the component's parent.
@@ -361,7 +361,7 @@ public:
screen coordinate. screen coordinate.
*/ */
Point<int> getLocalPoint (const Component* sourceComponent, Point<int> getLocalPoint (const Component* sourceComponent,
const Point<int>& pointRelativeToSourceComponent) const;
Point<int> pointRelativeToSourceComponent) const;
/** Converts a rectangle to be relative to this component's coordinate space. /** 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. /** Converts a point relative to this component's top-left into a screen coordinate.
@see getLocalPoint, localAreaToGlobal @see getLocalPoint, localAreaToGlobal
*/ */
Point<int> localPointToGlobal (const Point<int>& localPoint) const;
Point<int> localPointToGlobal (Point<int> localPoint) const;
/** Converts a rectangle from this component's coordinate space to a screen coordinate. /** Converts a rectangle from this component's coordinate space to a screen coordinate.
@@ -419,7 +419,7 @@ public:
@see setBounds, ComponentListener::componentMovedOrResized @see setBounds, ComponentListener::componentMovedOrResized
*/ */
void setTopLeftPosition (const Point<int>& newTopLeftPosition);
void setTopLeftPosition (Point<int> newTopLeftPosition);
/** Moves the component to a new position. /** Moves the component to a new position.
@@ -897,7 +897,7 @@ public:
which might be in the way - for that, see reallyContains() which might be in the way - for that, see reallyContains()
@see hitTest, reallyContains, getComponentAt @see hitTest, reallyContains, getComponentAt
*/ */
bool contains (const Point<int>& localPoint);
bool contains (Point<int> localPoint);
/** Returns true if a given point lies in this component, taking any overlapping /** Returns true if a given point lies in this component, taking any overlapping
siblings into account. siblings into account.
@@ -907,7 +907,7 @@ public:
this determines whether that is counted as a hit. this determines whether that is counted as a hit.
@see contains, getComponentAt @see contains, getComponentAt
*/ */
bool reallyContains (const Point<int>& localPoint, bool returnTrueIfWithinAChild);
bool reallyContains (Point<int> localPoint, bool returnTrueIfWithinAChild);
/** Returns the component at a certain point within this one. /** 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. instead call getComponentAt on the top-level parent of this component.
@see hitTest, contains, reallyContains @see hitTest, contains, reallyContains
*/ */
Component* getComponentAt (const Point<int>& position);
Component* getComponentAt (Point<int> position);
//============================================================================== //==============================================================================
/** Marks the whole component as needing to be redrawn. /** Marks the whole component as needing to be redrawn.
@@ -2043,7 +2043,7 @@ public:
@see findColour, isColourSpecified, colourChanged, LookAndFeel::findColour, LookAndFeel::setColour @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. /** If a colour has been set with setColour(), this will remove it.
This allows you to make a colour revert to its default state. This allows you to make a colour revert to its default state.
@@ -2217,9 +2217,9 @@ public:
//============================================================================== //==============================================================================
#ifndef DOXYGEN #ifndef DOXYGEN
// These methods are deprecated - use localPointToGlobal, getLocalPoint, getLocalPoint, etc instead. // These methods are deprecated - use localPointToGlobal, getLocalPoint, getLocalPoint, etc instead.
JUCE_DEPRECATED (Point<int> relativePositionToGlobal (const Point<int>&) const);
JUCE_DEPRECATED (Point<int> globalPositionToRelative (const Point<int>&) const);
JUCE_DEPRECATED (Point<int> relativePositionToOtherComponent (const Component*, const Point<int>&) const);
JUCE_DEPRECATED (Point<int> relativePositionToGlobal (Point<int>) const);
JUCE_DEPRECATED (Point<int> globalPositionToRelative (Point<int>) const);
JUCE_DEPRECATED (Point<int> relativePositionToOtherComponent (const Component*, Point<int>) const);
#endif #endif
private: private:
@@ -2287,14 +2287,14 @@ private:
uint8 componentTransparency; uint8 componentTransparency;
//============================================================================== //==============================================================================
void internalMouseEnter (MouseInputSource&, const Point<int>&, const Time&);
void internalMouseExit (MouseInputSource&, const Point<int>&, const Time&);
void internalMouseDown (MouseInputSource&, const Point<int>&, const Time&);
void internalMouseUp (MouseInputSource&, const Point<int>&, const Time&, const ModifierKeys& oldModifiers);
void internalMouseDrag (MouseInputSource&, const Point<int>&, const Time&);
void internalMouseMove (MouseInputSource&, const Point<int>&, const Time&);
void internalMouseWheel (MouseInputSource&, const Point<int>&, const Time&, const MouseWheelDetails&);
void internalMagnifyGesture (MouseInputSource&, const Point<int>&, const Time&, float);
void internalMouseEnter (MouseInputSource&, Point<int>, Time);
void internalMouseExit (MouseInputSource&, Point<int>, Time);
void internalMouseDown (MouseInputSource&, Point<int>, Time);
void internalMouseUp (MouseInputSource&, Point<int>, Time, const ModifierKeys oldModifiers);
void internalMouseDrag (MouseInputSource&, Point<int>, Time);
void internalMouseMove (MouseInputSource&, Point<int>, Time);
void internalMouseWheel (MouseInputSource&, Point<int>, Time, const MouseWheelDetails&);
void internalMagnifyGesture (MouseInputSource&, Point<int>, Time, float);
void internalBroughtToFront(); void internalBroughtToFront();
void internalFocusGain (const FocusChangeType, const WeakReference<Component>&); void internalFocusGain (const FocusChangeType, const WeakReference<Component>&);
void internalFocusGain (const FocusChangeType); void internalFocusGain (const FocusChangeType);
@@ -2336,7 +2336,7 @@ private:
virtual void filesDropped (const StringArray&, int, int) {} 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 // This is included here to cause an error if you use or overload it - it has been deprecated in
// favour of contains (const Point<int>&)
// favour of contains (Point<int>)
void contains (int, int); void contains (int, int);
#endif #endif


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

@@ -64,7 +64,7 @@ Component* Desktop::getComponent (const int index) const noexcept
return desktopComponents [index]; return desktopComponents [index];
} }
Component* Desktop::findComponentAt (const Point<int>& screenPosition) const
Component* Desktop::findComponentAt (Point<int> screenPosition) const
{ {
for (int i = desktopComponents.size(); --i >= 0;) for (int i = desktopComponents.size(); --i >= 0;)
{ {
@@ -328,7 +328,7 @@ const Desktop::Displays::Display& Desktop::Displays::getMainDisplay() const noex
return displays.getReference(0); return displays.getReference(0);
} }
const Desktop::Displays::Display& Desktop::Displays::getDisplayContaining (const Point<int>& position) const noexcept
const Desktop::Displays::Display& Desktop::Displays::getDisplayContaining (Point<int> position) const noexcept
{ {
const Display* best = &displays.getReference(0); const Display* best = &displays.getReference(0);
double bestDistance = 1.0e10; double bestDistance = 1.0e10;


+ 3
- 3
modules/juce_gui_basics/components/juce_Desktop.h View File

@@ -80,7 +80,7 @@ public:
/** Makes the mouse pointer jump to a given location. /** Makes the mouse pointer jump to a given location.
The co-ordinates are relative to the top-left of the main monitor. The co-ordinates are relative to the top-left of the main monitor.
*/ */
static void setMousePosition (const Point<int>& newPosition);
static void setMousePosition (Point<int> newPosition);
/** Returns the last position at which a mouse button was pressed. /** 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. Returns nullptr if the co-ordinates are inside a non-Juce window.
*/ */
Component* findComponentAt (const Point<int>& screenPosition) const;
Component* findComponentAt (Point<int> screenPosition) const;
/** The Desktop object has a ComponentAnimator instance which can be used for performing /** The Desktop object has a ComponentAnimator instance which can be used for performing
your animations. your animations.
@@ -343,7 +343,7 @@ public:
/** Returns the display which contains a particular point. /** Returns the display which contains a particular point.
If the point lies outside all the displays, the nearest one will be returned. If the point lies outside all the displays, the nearest one will be returned.
*/ */
const Display& getDisplayContaining (const Point<int>& position) const noexcept;
const Display& getDisplayContaining (Point<int> position) const noexcept;
/** Returns a RectangleList made up of all the displays. */ /** Returns a RectangleList made up of all the displays. */
RectangleList getRectangleList (bool userAreasOnly) const; RectangleList getRectangleList (bool userAreasOnly) const;


+ 1
- 1
modules/juce_gui_basics/drawables/juce_Drawable.cpp View File

@@ -109,7 +109,7 @@ void Drawable::setBoundsToEnclose (const Rectangle<float>& area)
} }
//============================================================================== //==============================================================================
void Drawable::setOriginWithOriginalSize (const Point<float>& originWithinParent)
void Drawable::setOriginWithOriginalSize (Point<float> originWithinParent)
{ {
setTransform (AffineTransform::translation (originWithinParent.x, originWithinParent.y)); setTransform (AffineTransform::translation (originWithinParent.x, originWithinParent.y));
} }


+ 1
- 1
modules/juce_gui_basics/drawables/juce_Drawable.h View File

@@ -113,7 +113,7 @@ public:
/** Resets any transformations on this drawable, and positions its origin within /** Resets any transformations on this drawable, and positions its origin within
its parent component. its parent component.
*/ */
void setOriginWithOriginalSize (const Point<float>& originWithinParent);
void setOriginWithOriginalSize (Point<float> originWithinParent);
/** Sets a transform for this drawable that will position it within the specified /** Sets a transform for this drawable that will position it within the specified
area of its parent component. area of its parent component.


+ 2
- 2
modules/juce_gui_basics/drawables/juce_DrawablePath.cpp View File

@@ -403,7 +403,7 @@ namespace DrawablePathHelpers
} }
} }
float DrawablePath::ValueTreeWrapper::Element::findProportionAlongLine (const Point<float>& targetPoint, Expression::Scope* scope) const
float DrawablePath::ValueTreeWrapper::Element::findProportionAlongLine (Point<float> targetPoint, Expression::Scope* scope) const
{ {
using namespace DrawablePathHelpers; using namespace DrawablePathHelpers;
const Identifier pointType (state.getType()); const Identifier pointType (state.getType());
@@ -460,7 +460,7 @@ float DrawablePath::ValueTreeWrapper::Element::findProportionAlongLine (const Po
return bestProp; return bestProp;
} }
ValueTree DrawablePath::ValueTreeWrapper::Element::insertPoint (const Point<float>& targetPoint, Expression::Scope* scope, UndoManager* undoManager)
ValueTree DrawablePath::ValueTreeWrapper::Element::insertPoint (Point<float> targetPoint, Expression::Scope* scope, UndoManager* undoManager)
{ {
ValueTree newTree; ValueTree newTree;
const Identifier pointType (state.getType()); const Identifier pointType (state.getType());


+ 2
- 2
modules/juce_gui_basics/drawables/juce_DrawablePath.h View File

@@ -112,9 +112,9 @@ public:
void convertToLine (UndoManager*); void convertToLine (UndoManager*);
void convertToCubic (Expression::Scope*, UndoManager*); void convertToCubic (Expression::Scope*, UndoManager*);
void convertToPathBreak (UndoManager* undoManager); void convertToPathBreak (UndoManager* undoManager);
ValueTree insertPoint (const Point<float>& targetPoint, Expression::Scope*, UndoManager*);
ValueTree insertPoint (Point<float> targetPoint, Expression::Scope*, UndoManager*);
void removePoint (UndoManager* undoManager); void removePoint (UndoManager* undoManager);
float findProportionAlongLine (const Point<float>& targetPoint, Expression::Scope*) const;
float findProportionAlongLine (Point<float> targetPoint, Expression::Scope*) const;
static const Identifier mode, startSubPathElement, closeSubPathElement, static const Identifier mode, startSubPathElement, closeSubPathElement,
lineToElement, quadraticToElement, cubicToElement; lineToElement, quadraticToElement, cubicToElement;


+ 2
- 2
modules/juce_gui_basics/drawables/juce_DrawableText.cpp View File

@@ -59,7 +59,7 @@ void DrawableText::setText (const String& newText)
} }
} }
void DrawableText::setColour (const Colour& newColour)
void DrawableText::setColour (Colour newColour)
{ {
if (colour != newColour) if (colour != newColour)
{ {
@@ -233,7 +233,7 @@ Colour DrawableText::ValueTreeWrapper::getColour() const
return Colour::fromString (state [colour].toString()); 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); state.setProperty (colour, newColour.toString(), undoManager);
} }


+ 3
- 3
modules/juce_gui_basics/drawables/juce_DrawableText.h View File

@@ -55,10 +55,10 @@ public:
const String& getText() const noexcept { return text;} const String& getText() const noexcept { return text;}
/** Sets the colour of the text. */ /** Sets the colour of the text. */
void setColour (const Colour& newColour);
void setColour (Colour newColour);
/** Returns the current text colour. */ /** Returns the current text colour. */
const Colour& getColour() const noexcept { return colour; }
Colour getColour() const noexcept { return colour; }
/** Sets the font to use. /** Sets the font to use.
Note that the font height and horizontal scale are set as RelativeCoordinates using Note that the font height and horizontal scale are set as RelativeCoordinates using
@@ -115,7 +115,7 @@ public:
Value getTextValue (UndoManager* undoManager); Value getTextValue (UndoManager* undoManager);
Colour getColour() const; Colour getColour() const;
void setColour (const Colour& newColour, UndoManager* undoManager);
void setColour (Colour newColour, UndoManager* undoManager);
Justification getJustification() const; Justification getJustification() const;
void setJustification (const Justification& newJustification, UndoManager* undoManager); void setJustification (const Justification& newJustification, UndoManager* undoManager);


+ 6
- 5
modules/juce_gui_basics/drawables/juce_SVGParser.cpp View File

@@ -714,7 +714,7 @@ private:
const String& fill, const String& fill,
const String& fillOpacity, const String& fillOpacity,
const String& overallOpacity, const String& overallOpacity,
const Colour& defaultColour) const
const Colour defaultColour) const
{ {
float opacity = 1.0f; 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] == '#') if (s [index] == '#')
{ {
@@ -1071,9 +1071,10 @@ private:
(uint8) ((hex [2] << 4) + hex [3]), (uint8) ((hex [2] << 4) + hex [3]),
(uint8) ((hex [4] << 4) + hex [5])); (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 openBracket = s.indexOfChar (index, '(');
const int closeBracket = s.indexOfChar (openBracket, ')'); const int closeBracket = s.indexOfChar (openBracket, ')');


+ 2
- 2
modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp View File

@@ -232,8 +232,8 @@ int DirectoryContentsList::compareElements (const DirectoryContentsList::FileInf
bool DirectoryContentsList::addFile (const File& file, bool DirectoryContentsList::addFile (const File& file,
const bool isDir, const bool isDir,
const int64 fileSize, const int64 fileSize,
const Time& modTime,
const Time& creationTime,
const Time modTime,
const Time creationTime,
const bool isReadOnly) const bool isReadOnly)
{ {
if (fileFilter == nullptr if (fileFilter == nullptr


+ 2
- 2
modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.h View File

@@ -206,8 +206,8 @@ private:
void changed(); void changed();
bool checkNextFile (bool& hasChanged); bool checkNextFile (bool& hasChanged);
bool addFile (const File& file, bool isDir, 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); void setTypeFlags (int newFlags);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DirectoryContentsList) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DirectoryContentsList)


+ 1
- 1
modules/juce_gui_basics/keyboard/juce_KeyPress.cpp View File

@@ -30,7 +30,7 @@ KeyPress::KeyPress() noexcept
} }
KeyPress::KeyPress (const int keyCode_, KeyPress::KeyPress (const int keyCode_,
const ModifierKeys& mods_,
ModifierKeys mods_,
const juce_wchar textCharacter_) noexcept const juce_wchar textCharacter_) noexcept
: keyCode (keyCode_), : keyCode (keyCode_),
mods (mods_), mods (mods_),


+ 1
- 1
modules/juce_gui_basics/keyboard/juce_KeyPress.h View File

@@ -67,7 +67,7 @@ public:
@see getKeyCode, isKeyCode, getModifiers @see getKeyCode, isKeyCode, getModifiers
*/ */
KeyPress (int keyCode, KeyPress (int keyCode,
const ModifierKeys& modifiers,
ModifierKeys modifiers,
juce_wchar textCharacter) noexcept; juce_wchar textCharacter) noexcept;
/** Creates a keypress with a keyCode but no modifiers or text character. */ /** Creates a keypress with a keyCode but no modifiers or text character. */


+ 1
- 1
modules/juce_gui_basics/keyboard/juce_ModifierKeys.cpp View File

@@ -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; flags = other.flags;
return *this; return *this;


+ 3
- 3
modules/juce_gui_basics/keyboard/juce_ModifierKeys.h View File

@@ -55,7 +55,7 @@ public:
ModifierKeys (const ModifierKeys& other) noexcept; ModifierKeys (const ModifierKeys& other) noexcept;
/** Copies this object from another one. */ /** 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). /** 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 */ /** Returns a copy of only the non-mouse flags */
ModifierKeys withoutMouseButtons() const noexcept { return ModifierKeys (flags & ~allMouseButtonModifiers); } 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. */ /** Returns the raw flags for direct testing. */


+ 1
- 1
modules/juce_gui_basics/layout/juce_ResizableBorderComponent.cpp View File

@@ -46,7 +46,7 @@ bool ResizableBorderComponent::Zone::operator!= (const ResizableBorderComponent:
ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositionOnBorder (const Rectangle<int>& totalSize, ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositionOnBorder (const Rectangle<int>& totalSize,
const BorderSize<int>& border, const BorderSize<int>& border,
const Point<int>& position)
Point<int> position)
{ {
int z = 0; int z = 0;


+ 1
- 1
modules/juce_gui_basics/layout/juce_ResizableBorderComponent.h View File

@@ -121,7 +121,7 @@ public:
*/ */
static Zone fromPositionOnBorder (const Rectangle<int>& totalSize, static Zone fromPositionOnBorder (const Rectangle<int>& totalSize,
const BorderSize<int>& border, const BorderSize<int>& border,
const Point<int>& position);
Point<int> position);
/** Returns an appropriate mouse-cursor for this resize zone. */ /** Returns an appropriate mouse-cursor for this resize zone. */
MouseCursor getMouseCursor() const noexcept; MouseCursor getMouseCursor() const noexcept;


+ 2
- 2
modules/juce_gui_basics/layout/juce_ScrollBar.cpp View File

@@ -79,7 +79,7 @@ ScrollBar::~ScrollBar()
} }
//============================================================================== //==============================================================================
void ScrollBar::setRangeLimits (const Range<double>& newRangeLimit, NotificationType notification)
void ScrollBar::setRangeLimits (Range<double> newRangeLimit, NotificationType notification)
{ {
if (totalRange != newRangeLimit) if (totalRange != newRangeLimit)
{ {
@@ -95,7 +95,7 @@ void ScrollBar::setRangeLimits (const double newMinimum, const double newMaximum
setRangeLimits (Range<double> (newMinimum, newMaximum), notification); setRangeLimits (Range<double> (newMinimum, newMaximum), notification);
} }
bool ScrollBar::setCurrentRange (const Range<double>& newRange,
bool ScrollBar::setCurrentRange (Range<double> newRange,
const NotificationType notification) const NotificationType notification)
{ {
const Range<double> constrainedRange (totalRange.constrainRange (newRange)); const Range<double> constrainedRange (totalRange.constrainRange (newRange));


+ 2
- 2
modules/juce_gui_basics/layout/juce_ScrollBar.h View File

@@ -99,7 +99,7 @@ public:
@see setCurrentRange @see setCurrentRange
*/ */
void setRangeLimits (const Range<double>& newRangeLimit,
void setRangeLimits (Range<double> newRangeLimit,
NotificationType notification = sendNotificationAsync); NotificationType notification = sendNotificationAsync);
/** Sets the minimum and maximum values that the bar will move between. /** 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. @returns true if the range was changed, or false if nothing was changed.
@see getCurrentRange. setCurrentRangeStart @see getCurrentRange. setCurrentRangeStart
*/ */
bool setCurrentRange (const Range<double>& newRange,
bool setCurrentRange (Range<double> newRange,
NotificationType notification = sendNotificationAsync); NotificationType notification = sendNotificationAsync);
/** Changes the position of the scrollbar's 'thumb'. /** Changes the position of the scrollbar's 'thumb'.


+ 2
- 2
modules/juce_gui_basics/layout/juce_Viewport.cpp View File

@@ -98,7 +98,7 @@ void Viewport::setViewedComponent (Component* const newViewedComponent, const bo
int Viewport::getMaximumVisibleWidth() const { return contentHolder.getWidth(); } int Viewport::getMaximumVisibleWidth() const { return contentHolder.getWidth(); }
int Viewport::getMaximumVisibleHeight() const { return contentHolder.getHeight(); } int Viewport::getMaximumVisibleHeight() const { return contentHolder.getHeight(); }
Point<int> Viewport::viewportPosToCompPos (const Point<int>& pos) const
Point<int> Viewport::viewportPosToCompPos (Point<int> pos) const
{ {
jassert (contentComp != nullptr); jassert (contentComp != nullptr);
return Point<int> (jmax (jmin (0, contentHolder.getWidth() - contentComp->getWidth()), jmin (0, -(pos.x))), return Point<int> (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<int> (xPixelsOffset, yPixelsOffset)); setViewPosition (Point<int> (xPixelsOffset, yPixelsOffset));
} }
void Viewport::setViewPosition (const Point<int>& newPosition)
void Viewport::setViewPosition (Point<int> newPosition)
{ {
if (contentComp != nullptr) if (contentComp != nullptr)
contentComp->setTopLeftPosition (viewportPosToCompPos (newPosition)); contentComp->setTopLeftPosition (viewportPosToCompPos (newPosition));


+ 3
- 3
modules/juce_gui_basics/layout/juce_Viewport.h View File

@@ -106,7 +106,7 @@ public:
@see getViewPositionX, getViewPositionY, setViewPositionProportionately @see getViewPositionX, getViewPositionY, setViewPositionProportionately
*/ */
void setViewPosition (const Point<int>& newPosition);
void setViewPosition (Point<int> newPosition);
/** Changes the view position as a proportion of the distance it can move. /** 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. /** Returns the position within the child component of the top-left of its visible area.
*/ */
const Point<int>& getViewPosition() const noexcept { return lastVisibleArea.getPosition(); }
Point<int> getViewPosition() const noexcept { return lastVisibleArea.getPosition(); }
/** Returns the position within the child component of the top-left of its visible area. /** Returns the position within the child component of the top-left of its visible area.
@see getViewWidth, setViewPosition @see getViewWidth, setViewPosition
@@ -260,7 +260,7 @@ private:
Component contentHolder; Component contentHolder;
ScrollBar verticalScrollBar; ScrollBar verticalScrollBar;
ScrollBar horizontalScrollBar; ScrollBar horizontalScrollBar;
Point<int> viewportPosToCompPos (const Point<int>&) const;
Point<int> viewportPosToCompPos (Point<int>) const;
void updateVisibleArea(); void updateVisibleArea();
void deleteContentComp(); void deleteContentComp();


+ 2
- 2
modules/juce_gui_basics/menus/juce_MenuBarComponent.cpp View File

@@ -110,7 +110,7 @@ void MenuBarComponent::resized()
} }
} }
int MenuBarComponent::getItemAt (const Point<int>& p)
int MenuBarComponent::getItemAt (Point<int> p)
{ {
for (int i = 0; i < xPositions.size(); ++i) for (int i = 0; i < xPositions.size(); ++i)
if (p.x >= xPositions[i] && p.x < xPositions[i + 1]) if (p.x >= xPositions[i] && p.x < xPositions[i + 1])
@@ -157,7 +157,7 @@ void MenuBarComponent::setOpenItem (int index)
} }
} }
void MenuBarComponent::updateItemUnderMouse (const Point<int>& p)
void MenuBarComponent::updateItemUnderMouse (Point<int> p)
{ {
setItemUnderMouse (getItemAt (p)); setItemUnderMouse (getItemAt (p));
} }


+ 2
- 2
modules/juce_gui_basics/menus/juce_MenuBarComponent.h View File

@@ -108,10 +108,10 @@ private:
Point<int> lastMousePos; Point<int> lastMousePos;
int itemUnderMouse, currentPopupIndex, topLevelIndexClicked; int itemUnderMouse, currentPopupIndex, topLevelIndexClicked;
int getItemAt (const Point<int>&);
int getItemAt (Point<int>);
void setItemUnderMouse (int index); void setItemUnderMouse (int index);
void setOpenItem (int index); void setOpenItem (int index);
void updateItemUnderMouse (const Point<int>&);
void updateItemUnderMouse (Point<int>);
void timerCallback(); void timerCallback();
void repaintMenuItem (int index); void repaintMenuItem (int index);
void menuDismissed (int topLevelIndex, int itemId); void menuDismissed (int topLevelIndex, int itemId);


+ 6
- 6
modules/juce_gui_basics/menus/juce_PopupMenu.cpp View File

@@ -47,7 +47,7 @@ public:
const bool active, const bool active,
const bool ticked, const bool ticked,
const Image& im, const Image& im,
const Colour& colour,
const Colour colour,
const bool useColour, const bool useColour,
CustomComponent* const custom, CustomComponent* const custom,
const PopupMenu* const sub, const PopupMenu* const sub,
@@ -564,7 +564,7 @@ private:
&& (isOver || (activeSubMenu != nullptr && activeSubMenu->isOverChildren())); && (isOver || (activeSubMenu != nullptr && activeSubMenu->isOverChildren()));
} }
void updateMouseOverStatus (const Point<int>& globalMousePos)
void updateMouseOverStatus (Point<int> globalMousePos)
{ {
isOver = reallyContains (getLocalPoint (nullptr, globalMousePos), true); isOver = reallyContains (getLocalPoint (nullptr, globalMousePos), true);
@@ -930,7 +930,7 @@ private:
return false; return false;
} }
void highlightItemUnderMouse (const Point<int>& globalMousePos, const Point<int>& localMousePos, const uint32 timeNow)
void highlightItemUnderMouse (Point<int> globalMousePos, Point<int> localMousePos, const uint32 timeNow)
{ {
if (globalMousePos != lastMousePos || timeNow > lastMouseMoveTime + 350) if (globalMousePos != lastMousePos || timeNow > lastMouseMoveTime + 350)
{ {
@@ -1006,7 +1006,7 @@ private:
} }
} }
void checkButtonState (const Point<int>& localMousePos, const uint32 timeNow,
void checkButtonState (Point<int> localMousePos, const uint32 timeNow,
const bool wasDown, const bool overScrollArea, const bool isOverAny) const bool wasDown, const bool overScrollArea, const bool isOverAny)
{ {
isDown = hasBeenOver isDown = hasBeenOver
@@ -1088,7 +1088,7 @@ private:
bool isTopScrollZoneActive() const noexcept { return canScroll() && childYOffset > 0; } bool isTopScrollZoneActive() const noexcept { return canScroll() && childYOffset > 0; }
bool isBottomScrollZoneActive() const noexcept { return canScroll() && childYOffset < contentHeight - windowPos.getHeight(); } bool isBottomScrollZoneActive() const noexcept { return canScroll() && childYOffset < contentHeight - windowPos.getHeight(); }
bool scrollIfNecessary (const Point<int>& localMousePos, const uint32 timeNow)
bool scrollIfNecessary (Point<int> localMousePos, const uint32 timeNow)
{ {
if (canScroll() if (canScroll()
&& (isOver || (isDown && isPositiveAndBelow (localMousePos.x, getWidth())))) && (isOver || (isDown && isPositiveAndBelow (localMousePos.x, getWidth()))))
@@ -1214,7 +1214,7 @@ void PopupMenu::addCommandItem (ApplicationCommandManager* commandManager,
void PopupMenu::addColouredItem (const int itemResultID, void PopupMenu::addColouredItem (const int itemResultID,
const String& itemText, const String& itemText,
const Colour& itemTextColour,
Colour itemTextColour,
const bool isActive, const bool isActive,
const bool isTicked, const bool isTicked,
const Image& iconToUse) const Image& iconToUse)


+ 1
- 1
modules/juce_gui_basics/menus/juce_PopupMenu.h View File

@@ -146,7 +146,7 @@ public:
*/ */
void addColouredItem (int itemResultID, void addColouredItem (int itemResultID,
const String& itemText, const String& itemText,
const Colour& itemTextColour,
Colour itemTextColour,
bool isEnabled = true, bool isEnabled = true,
bool isTicked = false, bool isTicked = false,
const Image& iconToUse = Image::null); const Image& iconToUse = Image::null);


+ 1
- 1
modules/juce_gui_basics/misc/juce_BubbleComponent.cpp View File

@@ -60,7 +60,7 @@ void BubbleComponent::setPosition (Component* componentToPointTo)
setPosition (componentToPointTo->getScreenBounds()); setPosition (componentToPointTo->getScreenBounds());
} }
void BubbleComponent::setPosition (const Point<int>& pos)
void BubbleComponent::setPosition (Point<int> pos)
{ {
setPosition (Rectangle<int> (pos.x, pos.y, 1, 1)); setPosition (Rectangle<int> (pos.x, pos.y, 1, 1));
} }


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save