Browse Source

New class StringRef, to improve performance in function calls that can take either a String or a raw string literal. Modified a few other classes to take advantage of this.

tags/2021-05-28
jules 11 years ago
parent
commit
fecba9c31c
51 changed files with 539 additions and 371 deletions
  1. +4
    -0
      extras/Introjucer/Builds/CodeBlocks/The Introjucer.cbp
  2. +2
    -0
      extras/Introjucer/Builds/MacOSX/The Introjucer.xcodeproj/project.pbxproj
  3. +1
    -0
      extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj
  4. +1
    -0
      extras/Introjucer/Builds/VisualStudio2008/The Introjucer.vcproj
  5. +1
    -0
      extras/Introjucer/Builds/VisualStudio2010/The Introjucer.vcxproj
  6. +3
    -0
      extras/Introjucer/Builds/VisualStudio2010/The Introjucer.vcxproj.filters
  7. +1
    -0
      extras/Introjucer/Builds/VisualStudio2012/The Introjucer.vcxproj
  8. +3
    -0
      extras/Introjucer/Builds/VisualStudio2012/The Introjucer.vcxproj.filters
  9. +1
    -1
      extras/Introjucer/Source/Project/jucer_Module.cpp
  10. +4
    -0
      extras/JuceDemo/Builds/CodeBlocks/Juce Demo.cbp
  11. +10
    -8
      extras/JuceDemo/Builds/MacOSX/Juce Demo.xcodeproj/project.pbxproj
  12. +1
    -0
      extras/JuceDemo/Builds/VisualStudio2005/Juce Demo.vcproj
  13. +1
    -0
      extras/JuceDemo/Builds/VisualStudio2008/Juce Demo.vcproj
  14. +1
    -0
      extras/JuceDemo/Builds/VisualStudio2010/Juce Demo.vcxproj
  15. +3
    -0
      extras/JuceDemo/Builds/VisualStudio2010/Juce Demo.vcxproj.filters
  16. +1
    -0
      extras/JuceDemo/Builds/VisualStudio2012/Juce Demo.vcxproj
  17. +3
    -0
      extras/JuceDemo/Builds/VisualStudio2012/Juce Demo.vcxproj.filters
  18. +2
    -0
      extras/JuceDemo/Builds/iOS/Juce Demo.xcodeproj/project.pbxproj
  19. +6
    -4
      extras/audio plugin demo/Builds/MacOSX/JuceDemoPlugin.xcodeproj/project.pbxproj
  20. +1
    -0
      extras/audio plugin demo/Builds/VisualStudio2005/JuceDemoPlugin.vcproj
  21. +1
    -0
      extras/audio plugin demo/Builds/VisualStudio2008/JuceDemoPlugin.vcproj
  22. +5
    -5
      extras/audio plugin demo/Source/PluginProcessor.cpp
  23. +2
    -0
      extras/audio plugin host/Builds/MacOSX/Plugin Host.xcodeproj/project.pbxproj
  24. +1
    -0
      extras/audio plugin host/Builds/VisualStudio2005/Plugin Host.vcproj
  25. +1
    -0
      extras/audio plugin host/Builds/VisualStudio2008/Plugin Host.vcproj
  26. +2
    -0
      extras/binarybuilder/Builds/MacOSX/BinaryBuilder.xcodeproj/project.pbxproj
  27. +1
    -0
      extras/binarybuilder/Builds/VisualStudio2008/BinaryBuilder.vcproj
  28. +4
    -2
      extras/example projects/Builds/MacOSX/HelloWorld.xcodeproj/project.pbxproj
  29. +1
    -0
      extras/example projects/Builds/VisualStudio2005/HelloWorld.vcproj
  30. +1
    -0
      extras/example projects/Builds/VisualStudio2008/HelloWorld.vcproj
  31. +2
    -0
      extras/example projects/Builds/iOS/HelloWorld.xcodeproj/project.pbxproj
  32. +7
    -11
      modules/juce_core/containers/juce_PropertySet.cpp
  33. +7
    -11
      modules/juce_core/containers/juce_PropertySet.h
  34. +41
    -40
      modules/juce_core/files/juce_File.cpp
  35. +6
    -6
      modules/juce_core/files/juce_File.h
  36. +2
    -0
      modules/juce_core/juce_core.h
  37. +1
    -1
      modules/juce_core/native/juce_win32_Network.cpp
  38. +4
    -1
      modules/juce_core/text/juce_Identifier.h
  39. +5
    -0
      modules/juce_core/text/juce_NewLine.h
  40. +92
    -76
      modules/juce_core/text/juce_String.cpp
  41. +39
    -37
      modules/juce_core/text/juce_String.h
  42. +19
    -22
      modules/juce_core/text/juce_StringArray.cpp
  43. +15
    -16
      modules/juce_core/text/juce_StringArray.h
  44. +3
    -3
      modules/juce_core/text/juce_StringPairArray.cpp
  45. +3
    -9
      modules/juce_core/text/juce_StringPairArray.h
  46. +124
    -0
      modules/juce_core/text/juce_StringRef.h
  47. +66
    -69
      modules/juce_core/xml/juce_XmlElement.cpp
  48. +28
    -43
      modules/juce_core/xml/juce_XmlElement.h
  49. +4
    -4
      modules/juce_graphics/geometry/juce_Rectangle.h
  50. +1
    -1
      modules/juce_gui_basics/components/juce_Component.cpp
  51. +1
    -1
      modules/juce_gui_basics/components/juce_Component.h

+ 4
- 0
extras/Introjucer/Builds/CodeBlocks/The Introjucer.cbp View File

@@ -728,6 +728,10 @@
<Option compile="0"/>
<Option link="0"/>
</Unit>
<Unit filename="../../../../modules/juce_core/text/juce_StringRef.h">
<Option compile="0"/>
<Option link="0"/>
</Unit>
<Unit filename="../../../../modules/juce_core/text/juce_TextDiff.cpp">
<Option compile="0"/>
<Option link="0"/>


+ 2
- 0
extras/Introjucer/Builds/MacOSX/The Introjucer.xcodeproj/project.pbxproj View File

@@ -519,6 +519,7 @@
922DB1DA01DAF63CE86B5E53 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ProjectTreeViewBase.h"; path = "../../Source/Project/jucer_ProjectTreeViewBase.h"; sourceTree = "SOURCE_ROOT"; };
925CC15E1449AED03A1CE4F8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_GraphicsContext.h"; path = "../../../../modules/juce_graphics/contexts/juce_GraphicsContext.h"; sourceTree = "SOURCE_ROOT"; };
92F91DC29B64AD85B1F508BD = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_GenericComponentHandler.h"; path = "../../Source/ComponentEditor/components/jucer_GenericComponentHandler.h"; sourceTree = "SOURCE_ROOT"; };
93260AA1B96F74E928B7B07C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringRef.h"; path = "../../../../modules/juce_core/text/juce_StringRef.h"; sourceTree = "SOURCE_ROOT"; };
939B1B2421964EEF71768BC7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_OutputStream.cpp"; path = "../../../../modules/juce_core/streams/juce_OutputStream.cpp"; sourceTree = "SOURCE_ROOT"; };
93B419190CCE92ACAB1ED25B = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_ColouredElement.cpp"; path = "../../Source/ComponentEditor/paintelements/jucer_ColouredElement.cpp"; sourceTree = "SOURCE_ROOT"; };
93BD6F4BB776E432A4006696 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Identifier.h"; path = "../../../../modules/juce_core/text/juce_Identifier.h"; sourceTree = "SOURCE_ROOT"; };
@@ -1103,6 +1104,7 @@
D9B077E2ECDDA94961E134D7,
9AEC1D0512CFF7E9173BEE4E,
31ACA83BF72B34828ADA1F3F,
93260AA1B96F74E928B7B07C,
0D1C432D74433308E05942AD,
79B3DE19D706135161A727B0 ); name = text; sourceTree = "<group>"; };
F824830BD560E7906A8CD82B = { isa = PBXGroup; children = (


+ 1
- 0
extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj View File

@@ -610,6 +610,7 @@
</FileConfiguration>
</File>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_TextDiff.cpp">
<FileConfiguration Name="Debug|Win32"
ExcludedFromBuild="true">


+ 1
- 0
extras/Introjucer/Builds/VisualStudio2008/The Introjucer.vcproj View File

@@ -610,6 +610,7 @@
</FileConfiguration>
</File>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_TextDiff.cpp">
<FileConfiguration Name="Debug|Win32"
ExcludedFromBuild="true">


+ 1
- 0
extras/Introjucer/Builds/VisualStudio2010/The Introjucer.vcxproj View File

@@ -1137,6 +1137,7 @@
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringArray.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringPairArray.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_TextDiff.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\maths\juce_BigInteger.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\maths\juce_Expression.h"/>


+ 3
- 0
extras/Introjucer/Builds/VisualStudio2010/The Introjucer.vcxproj.filters View File

@@ -1677,6 +1677,9 @@
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringPool.h">
<Filter>Juce Modules\juce_core\text</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringRef.h">
<Filter>Juce Modules\juce_core\text</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_TextDiff.h">
<Filter>Juce Modules\juce_core\text</Filter>
</ClInclude>


+ 1
- 0
extras/Introjucer/Builds/VisualStudio2012/The Introjucer.vcxproj View File

@@ -1143,6 +1143,7 @@
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringArray.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringPairArray.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_TextDiff.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\maths\juce_BigInteger.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\maths\juce_Expression.h"/>


+ 3
- 0
extras/Introjucer/Builds/VisualStudio2012/The Introjucer.vcxproj.filters View File

@@ -1677,6 +1677,9 @@
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringPool.h">
<Filter>Juce Modules\juce_core\text</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringRef.h">
<Filter>Juce Modules\juce_core\text</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_TextDiff.h">
<Filter>Juce Modules\juce_core\text</Filter>
</ClInclude>


+ 1
- 1
extras/Introjucer/Source/Project/jucer_Module.cpp View File

@@ -407,7 +407,7 @@ bool LibraryModule::isVSTPluginHost (const Project& project) const { return get
File LibraryModule::getInclude (const File& folder) const
{
return folder.getChildFile (moduleInfo ["include"]);
return folder.getChildFile (moduleInfo ["include"].toString());
}
RelativePath LibraryModule::getModuleRelativeToProject (ProjectExporter& exporter) const


+ 4
- 0
extras/JuceDemo/Builds/CodeBlocks/Juce Demo.cbp View File

@@ -905,6 +905,10 @@
<Option compile="0"/>
<Option link="0"/>
</Unit>
<Unit filename="../../../../modules/juce_core/text/juce_StringRef.h">
<Option compile="0"/>
<Option link="0"/>
</Unit>
<Unit filename="../../../../modules/juce_core/text/juce_TextDiff.cpp">
<Option compile="0"/>
<Option link="0"/>


+ 10
- 8
extras/JuceDemo/Builds/MacOSX/Juce Demo.xcodeproj/project.pbxproj View File

@@ -75,6 +75,7 @@
0655D6F5C85104403FC367AC = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_AudioPluginFormatManager.cpp"; path = "../../../../modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp"; sourceTree = "SOURCE_ROOT"; };
06574539E17A8703E442F691 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_RelativeRectangle.cpp"; path = "../../../../modules/juce_gui_basics/positioning/juce_RelativeRectangle.cpp"; sourceTree = "SOURCE_ROOT"; };
06D8EAABB6D94D55189361D0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Result.cpp"; path = "../../../../modules/juce_core/misc/juce_Result.cpp"; sourceTree = "SOURCE_ROOT"; };
06E844BBD6A9FBACCFA1D29F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringRef.h"; path = "../../../../modules/juce_core/text/juce_StringRef.h"; sourceTree = "SOURCE_ROOT"; };
06FA4CB9F78A6F953DC83C6B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_TextDiff.h"; path = "../../../../modules/juce_core/text/juce_TextDiff.h"; sourceTree = "SOURCE_ROOT"; };
070230F8B36CFD14E7EEAD71 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_ThreadPool.cpp"; path = "../../../../modules/juce_core/threads/juce_ThreadPool.cpp"; sourceTree = "SOURCE_ROOT"; };
07492D83B5CEED0F975EEF77 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Image.cpp"; path = "../../../../modules/juce_graphics/images/juce_Image.cpp"; sourceTree = "SOURCE_ROOT"; };
@@ -841,7 +842,6 @@
D8081154AA3072D2F2C4B625 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_posix_SharedCode.h"; path = "../../../../modules/juce_core/native/juce_posix_SharedCode.h"; sourceTree = "SOURCE_ROOT"; };
D866C4735BF1EF0CA24FC1FB = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Draggable3DOrientation.h"; path = "../../../../modules/juce_opengl/opengl/juce_Draggable3DOrientation.h"; sourceTree = "SOURCE_ROOT"; };
D8AFC87A918360FFC9D96BE5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Atomic.h"; path = "../../../../modules/juce_core/memory/juce_Atomic.h"; sourceTree = "SOURCE_ROOT"; };
D9282DF6556197822D2BD5D4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PropertySet.cpp"; path = "../../../../modules/juce_core/containers/juce_PropertySet.cpp"; sourceTree = "SOURCE_ROOT"; };
DA0D464BE6E90C3668AD7C73 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_FileChooser.mm"; path = "../../../../modules/juce_gui_basics/native/juce_mac_FileChooser.mm"; sourceTree = "SOURCE_ROOT"; };
DA2FCB30EE2A41085FF93B9B = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_Files.cpp"; path = "../../../../modules/juce_core/native/juce_win32_Files.cpp"; sourceTree = "SOURCE_ROOT"; };
DD40A3E06CA320D95F3924BA = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_StretchableLayoutResizerBar.cpp"; path = "../../../../modules/juce_gui_basics/layout/juce_StretchableLayoutResizerBar.cpp"; sourceTree = "SOURCE_ROOT"; };
@@ -849,34 +849,35 @@
DEA38275A65473112CD34252 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_TreeView.h"; path = "../../../../modules/juce_gui_basics/widgets/juce_TreeView.h"; sourceTree = "SOURCE_ROOT"; };
DEB23C98FEC261260F63B6A4 = { isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
DED6D04CFED991C5924B78F0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_MD5.h"; path = "../../../../modules/juce_cryptography/hashing/juce_MD5.h"; sourceTree = "SOURCE_ROOT"; };
DEE1FC30E2FBB97921616CA9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Font.cpp"; path = "../../../../modules/juce_graphics/fonts/juce_Font.cpp"; sourceTree = "SOURCE_ROOT"; };
DF2D86EEA8031481C1FD08B2 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_FileTreeComponent.cpp"; path = "../../../../modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp"; sourceTree = "SOURCE_ROOT"; };
DF3B7E1BC0AF0C826C47745B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ResizableWindow.h"; path = "../../../../modules/juce_gui_basics/windows/juce_ResizableWindow.h"; sourceTree = "SOURCE_ROOT"; };
DF590CD70352A30FA3BD9835 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_linux_SystemTrayIcon.cpp"; path = "../../../../modules/juce_gui_extra/native/juce_linux_SystemTrayIcon.cpp"; sourceTree = "SOURCE_ROOT"; };
DFEAB699C98B89FF0B85F557 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_DirectWriteTypeLayout.cpp"; path = "../../../../modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp"; sourceTree = "SOURCE_ROOT"; };
DFF6BF0BB64714A494A25E93 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_RSAKey.h"; path = "../../../../modules/juce_cryptography/encryption/juce_RSAKey.h"; sourceTree = "SOURCE_ROOT"; };
E0AE248F52C70AA1DEA1A5A1 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_MidiOutput.h"; path = "../../../../modules/juce_audio_devices/midi_io/juce_MidiOutput.h"; sourceTree = "SOURCE_ROOT"; };
E10CA355E85B468045CDCAC7 = { isa = PBXFileReference; lastKnownFileType = file.nib; name = RecentFilesMenuTemplate.nib; path = RecentFilesMenuTemplate.nib; sourceTree = "SOURCE_ROOT"; };
E249D6583995E0E6D0B3EADF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_AudioSourcePlayer.h"; path = "../../../../modules/juce_audio_devices/sources/juce_AudioSourcePlayer.h"; sourceTree = "SOURCE_ROOT"; };
E2732267CD7C0C3BDB17456A = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_BooleanPropertyComponent.h"; path = "../../../../modules/juce_gui_basics/properties/juce_BooleanPropertyComponent.h"; sourceTree = "SOURCE_ROOT"; };
E34B2BCD14634ED3BC9F5431 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_AudioProcessorGraph.h"; path = "../../../../modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h"; sourceTree = "SOURCE_ROOT"; };
E48615F1F7D8213F6DC24FC9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ThreadPool.h"; path = "../../../../modules/juce_core/threads/juce_ThreadPool.h"; sourceTree = "SOURCE_ROOT"; };
E48E2824CED9933934127522 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_BasicNativeHeaders.h"; path = "../../../../modules/juce_core/native/juce_BasicNativeHeaders.h"; sourceTree = "SOURCE_ROOT"; };
E6448B3F03DD2B41519DF93D = { isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DiscRecording.framework; path = System/Library/Frameworks/DiscRecording.framework; sourceTree = SDKROOT; };
D119A3871626EC2B8EFCB0D4 = { isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JuceDemo.app; sourceTree = "BUILT_PRODUCTS_DIR"; };
D9282DF6556197822D2BD5D4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PropertySet.cpp"; path = "../../../../modules/juce_core/containers/juce_PropertySet.cpp"; sourceTree = "SOURCE_ROOT"; };
D9AB5165697DB60BA305F414 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_android_OpenSL.cpp"; path = "../../../../modules/juce_audio_devices/native/juce_android_OpenSL.cpp"; sourceTree = "SOURCE_ROOT"; };
DB507A1F7BB7489344FF90A9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Range.h"; path = "../../../../modules/juce_core/maths/juce_Range.h"; sourceTree = "SOURCE_ROOT"; };
DCBC77E022F3282E7DC97642 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_HighResolutionTimer.h"; path = "../../../../modules/juce_core/threads/juce_HighResolutionTimer.h"; sourceTree = "SOURCE_ROOT"; };
DDEC339D244553357E234C92 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_DirectSound.cpp"; path = "../../../../modules/juce_audio_devices/native/juce_win32_DirectSound.cpp"; sourceTree = "SOURCE_ROOT"; };
DE80C724F35B1464853FDE9E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_SubregionStream.h"; path = "../../../../modules/juce_core/streams/juce_SubregionStream.h"; sourceTree = "SOURCE_ROOT"; };
DEE1FC30E2FBB97921616CA9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Font.cpp"; path = "../../../../modules/juce_graphics/fonts/juce_Font.cpp"; sourceTree = "SOURCE_ROOT"; };
DF3B7E1BC0AF0C826C47745B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ResizableWindow.h"; path = "../../../../modules/juce_gui_basics/windows/juce_ResizableWindow.h"; sourceTree = "SOURCE_ROOT"; };
DF590CD70352A30FA3BD9835 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_linux_SystemTrayIcon.cpp"; path = "../../../../modules/juce_gui_extra/native/juce_linux_SystemTrayIcon.cpp"; sourceTree = "SOURCE_ROOT"; };
DFEAB699C98B89FF0B85F557 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_DirectWriteTypeLayout.cpp"; path = "../../../../modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp"; sourceTree = "SOURCE_ROOT"; };
E15F577E82B2E12597447472 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ApplicationBase.h"; path = "../../../../modules/juce_events/messages/juce_ApplicationBase.h"; sourceTree = "SOURCE_ROOT"; };
E26E3AC933F70B56B7B83EFA = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_MACAddress.cpp"; path = "../../../../modules/juce_core/network/juce_MACAddress.cpp"; sourceTree = "SOURCE_ROOT"; };
E2732267CD7C0C3BDB17456A = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_BooleanPropertyComponent.h"; path = "../../../../modules/juce_gui_basics/properties/juce_BooleanPropertyComponent.h"; sourceTree = "SOURCE_ROOT"; };
E274BFB25D87D93EDBC23114 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OggVorbisAudioFormat.h"; path = "../../../../modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.h"; sourceTree = "SOURCE_ROOT"; };
E38DE271B32DCC95E52C72DA = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_DrawableButton.h"; path = "../../../../modules/juce_gui_basics/buttons/juce_DrawableButton.h"; sourceTree = "SOURCE_ROOT"; };
E3D24CD61D75922457DB9642 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_Midi.cpp"; path = "../../../../modules/juce_audio_devices/native/juce_win32_Midi.cpp"; sourceTree = "SOURCE_ROOT"; };
E3FC888CC9FAD650C469ACC5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_TextButton.cpp"; path = "../../../../modules/juce_gui_basics/buttons/juce_TextButton.cpp"; sourceTree = "SOURCE_ROOT"; };
E453E312D607E60FAA6D1BF0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_MultiDocumentPanel.cpp"; path = "../../../../modules/juce_gui_basics/layout/juce_MultiDocumentPanel.cpp"; sourceTree = "SOURCE_ROOT"; };
E46977801F19277F4D3B324B = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_OpenGLImage.cpp"; path = "../../../../modules/juce_opengl/opengl/juce_OpenGLImage.cpp"; sourceTree = "SOURCE_ROOT"; };
E48E2824CED9933934127522 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_BasicNativeHeaders.h"; path = "../../../../modules/juce_core/native/juce_BasicNativeHeaders.h"; sourceTree = "SOURCE_ROOT"; };
E48615F1F7D8213F6DC24FC9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ThreadPool.h"; path = "../../../../modules/juce_core/threads/juce_ThreadPool.h"; sourceTree = "SOURCE_ROOT"; };
E5DC4602843749A071B17576 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Slider.h"; path = "../../../../modules/juce_gui_basics/widgets/juce_Slider.h"; sourceTree = "SOURCE_ROOT"; };
E6B13A51A01032961340735D = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_StringPairArray.cpp"; path = "../../../../modules/juce_core/text/juce_StringPairArray.cpp"; sourceTree = "SOURCE_ROOT"; };
E6C582E67DC0C4D0CCA18166 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ShapeButton.h"; path = "../../../../modules/juce_gui_basics/buttons/juce_ShapeButton.h"; sourceTree = "SOURCE_ROOT"; };
@@ -1226,6 +1227,7 @@
89ABB9AFCDB73A409754BE48,
CE882EE8C05AC3A809E41332,
B6ECBC8983C8C13575A3420E,
06E844BBD6A9FBACCFA1D29F,
6A7463E25E5C0C70C01B5054,
06FA4CB9F78A6F953DC83C6B ); name = text; sourceTree = "<group>"; };
9E385EE2C33A34870884808C = { isa = PBXGroup; children = (


+ 1
- 0
extras/JuceDemo/Builds/VisualStudio2005/Juce Demo.vcproj View File

@@ -1240,6 +1240,7 @@
</FileConfiguration>
</File>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_TextDiff.cpp">
<FileConfiguration Name="Debug|Win32"
ExcludedFromBuild="true">


+ 1
- 0
extras/JuceDemo/Builds/VisualStudio2008/Juce Demo.vcproj View File

@@ -1240,6 +1240,7 @@
</FileConfiguration>
</File>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_TextDiff.cpp">
<FileConfiguration Name="Debug|Win32"
ExcludedFromBuild="true">


+ 1
- 0
extras/JuceDemo/Builds/VisualStudio2010/Juce Demo.vcxproj View File

@@ -1332,6 +1332,7 @@
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringArray.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringPairArray.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_TextDiff.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\maths\juce_BigInteger.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\maths\juce_Expression.h"/>


+ 3
- 0
extras/JuceDemo/Builds/VisualStudio2010/Juce Demo.vcxproj.filters View File

@@ -1866,6 +1866,9 @@
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringPool.h">
<Filter>Juce Modules\juce_core\text</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringRef.h">
<Filter>Juce Modules\juce_core\text</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_TextDiff.h">
<Filter>Juce Modules\juce_core\text</Filter>
</ClInclude>


+ 1
- 0
extras/JuceDemo/Builds/VisualStudio2012/Juce Demo.vcxproj View File

@@ -1338,6 +1338,7 @@
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringArray.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringPairArray.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_TextDiff.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\maths\juce_BigInteger.h"/>
<ClInclude Include="..\..\..\..\modules\juce_core\maths\juce_Expression.h"/>


+ 3
- 0
extras/JuceDemo/Builds/VisualStudio2012/Juce Demo.vcxproj.filters View File

@@ -1866,6 +1866,9 @@
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringPool.h">
<Filter>Juce Modules\juce_core\text</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_StringRef.h">
<Filter>Juce Modules\juce_core\text</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_core\text\juce_TextDiff.h">
<Filter>Juce Modules\juce_core\text</Filter>
</ClInclude>


+ 2
- 0
extras/JuceDemo/Builds/iOS/Juce Demo.xcodeproj/project.pbxproj View File

@@ -70,6 +70,7 @@
0655D6F5C85104403FC367AC = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_AudioPluginFormatManager.cpp"; path = "../../../../modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp"; sourceTree = "SOURCE_ROOT"; };
06574539E17A8703E442F691 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_RelativeRectangle.cpp"; path = "../../../../modules/juce_gui_basics/positioning/juce_RelativeRectangle.cpp"; sourceTree = "SOURCE_ROOT"; };
06D8EAABB6D94D55189361D0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Result.cpp"; path = "../../../../modules/juce_core/misc/juce_Result.cpp"; sourceTree = "SOURCE_ROOT"; };
06E844BBD6A9FBACCFA1D29F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringRef.h"; path = "../../../../modules/juce_core/text/juce_StringRef.h"; sourceTree = "SOURCE_ROOT"; };
06FA4CB9F78A6F953DC83C6B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_TextDiff.h"; path = "../../../../modules/juce_core/text/juce_TextDiff.h"; sourceTree = "SOURCE_ROOT"; };
070230F8B36CFD14E7EEAD71 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_ThreadPool.cpp"; path = "../../../../modules/juce_core/threads/juce_ThreadPool.cpp"; sourceTree = "SOURCE_ROOT"; };
07492D83B5CEED0F975EEF77 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Image.cpp"; path = "../../../../modules/juce_graphics/images/juce_Image.cpp"; sourceTree = "SOURCE_ROOT"; };
@@ -1216,6 +1217,7 @@
89ABB9AFCDB73A409754BE48,
CE882EE8C05AC3A809E41332,
B6ECBC8983C8C13575A3420E,
06E844BBD6A9FBACCFA1D29F,
6A7463E25E5C0C70C01B5054,
06FA4CB9F78A6F953DC83C6B ); name = text; sourceTree = "<group>"; };
9E385EE2C33A34870884808C = { isa = PBXGroup; children = (


+ 6
- 4
extras/audio plugin demo/Builds/MacOSX/JuceDemoPlugin.xcodeproj/project.pbxproj View File

@@ -637,10 +637,11 @@
A7A527D783D3B38F455964D4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_InterprocessConnectionServer.h"; path = "../../../../modules/juce_events/interprocess/juce_InterprocessConnectionServer.h"; sourceTree = "SOURCE_ROOT"; };
A7EE73FF3A5962BBF41DC2AB = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Component.h"; path = "../../../../modules/juce_gui_basics/components/juce_Component.h"; sourceTree = "SOURCE_ROOT"; };
A7FD436305E19DF69A7AF446 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_DragAndDrop.cpp"; path = "../../../../modules/juce_gui_basics/native/juce_win32_DragAndDrop.cpp"; sourceTree = "SOURCE_ROOT"; };
A8F3FC233163016FE3B23543 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PathIterator.cpp"; path = "../../../../modules/juce_graphics/geometry/juce_PathIterator.cpp"; sourceTree = "SOURCE_ROOT"; };
A90A45FB8790A91DF1A78BE7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ComponentBuilder.h"; path = "../../../../modules/juce_gui_basics/layout/juce_ComponentBuilder.h"; sourceTree = "SOURCE_ROOT"; };
A90E41C0C52BDF0CC82161C9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_AppleRemote.mm"; path = "../../../../modules/juce_gui_extra/native/juce_mac_AppleRemote.mm"; sourceTree = "SOURCE_ROOT"; };
A9133BF4A4E9DF3268BE0A5F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_HyperlinkButton.cpp"; path = "../../../../modules/juce_gui_basics/buttons/juce_HyperlinkButton.cpp"; sourceTree = "SOURCE_ROOT"; };
A935F7A0CA0C3A7FE2607D0A = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ResamplingAudioSource.h"; path = "../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.h"; sourceTree = "SOURCE_ROOT"; };
A9801DABE20B0BC1A3405EA0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_android_Network.cpp"; path = "../../../../modules/juce_core/native/juce_android_Network.cpp"; sourceTree = "SOURCE_ROOT"; };
A9B46A5FF98D7B9DF8598C12 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_AudioUnitPluginFormat.mm"; path = "../../../../modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm"; sourceTree = "SOURCE_ROOT"; };
A9C466FBA4FCF6484BCF86A2 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_VSTMidiEventList.h"; path = "../../../../modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h"; sourceTree = "SOURCE_ROOT"; };
AA29B047C1A1904618B410D5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StretchableObjectResizer.h"; path = "../../../../modules/juce_gui_basics/layout/juce_StretchableObjectResizer.h"; sourceTree = "SOURCE_ROOT"; };
@@ -660,7 +661,6 @@
B43E810ABF9939F0F6E76318 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_NewLine.h"; path = "../../../../modules/juce_core/text/juce_NewLine.h"; sourceTree = "SOURCE_ROOT"; };
B7F3E4AF0F482E9F6EAF6C41 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_MidiBuffer.h"; path = "../../../../modules/juce_audio_basics/midi/juce_MidiBuffer.h"; sourceTree = "SOURCE_ROOT"; };
BA98346EFD1037285E245CC9 = { isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMIDI.framework; path = System/Library/Frameworks/CoreMIDI.framework; sourceTree = SDKROOT; };
BBECA9EB9DD3C9B6CB04B10A = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Uuid.h"; path = "../../../../modules/juce_core/misc/juce_Uuid.h"; sourceTree = "SOURCE_ROOT"; };
BF9246177C0D98297F4228E1 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_MidiBuffer.cpp"; path = "../../../../modules/juce_audio_basics/midi/juce_MidiBuffer.cpp"; sourceTree = "SOURCE_ROOT"; };
C37123DA8D32C1B6FC09FFF2 = { isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
63F8022F081E22DFFFCAC998 = { isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JuceDemoPlugin.component; sourceTree = "BUILT_PRODUCTS_DIR"; };
@@ -669,8 +669,7 @@
97B6D6C6FABF547674BD0F19 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_AudioFormatReader.h"; path = "../../../../modules/juce_audio_formats/format/juce_AudioFormatReader.h"; sourceTree = "SOURCE_ROOT"; };
A7055681554844E4708E27A0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_FileSearchPath.cpp"; path = "../../../../modules/juce_core/files/juce_FileSearchPath.cpp"; sourceTree = "SOURCE_ROOT"; };
A722B041FD2540D1380C4D02 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_linux_AudioCDReader.cpp"; path = "../../../../modules/juce_audio_devices/native/juce_linux_AudioCDReader.cpp"; sourceTree = "SOURCE_ROOT"; };
A8F3FC233163016FE3B23543 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PathIterator.cpp"; path = "../../../../modules/juce_graphics/geometry/juce_PathIterator.cpp"; sourceTree = "SOURCE_ROOT"; };
A9133BF4A4E9DF3268BE0A5F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_HyperlinkButton.cpp"; path = "../../../../modules/juce_gui_basics/buttons/juce_HyperlinkButton.cpp"; sourceTree = "SOURCE_ROOT"; };
A9801DABE20B0BC1A3405EA0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_android_Network.cpp"; path = "../../../../modules/juce_core/native/juce_android_Network.cpp"; sourceTree = "SOURCE_ROOT"; };
AA012A21BE3049C205D4A44A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_AudioCDReader.cpp"; path = "../../../../modules/juce_audio_devices/native/juce_win32_AudioCDReader.cpp"; sourceTree = "SOURCE_ROOT"; };
AAEC41BFA57E45EBF94ED3C1 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_DrawableImage.cpp"; path = "../../../../modules/juce_gui_basics/drawables/juce_DrawableImage.cpp"; sourceTree = "SOURCE_ROOT"; };
AB10327C69AAE4AACCFC81EB = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_DrawableText.cpp"; path = "../../../../modules/juce_gui_basics/drawables/juce_DrawableText.cpp"; sourceTree = "SOURCE_ROOT"; };
@@ -710,6 +709,7 @@
BB1148DE7477E7B58ABD2B95 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_AudioSubsectionReader.h"; path = "../../../../modules/juce_audio_formats/format/juce_AudioSubsectionReader.h"; sourceTree = "SOURCE_ROOT"; };
BB84A0B296CFBF17FAF145B0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_TemporaryFile.h"; path = "../../../../modules/juce_core/files/juce_TemporaryFile.h"; sourceTree = "SOURCE_ROOT"; };
BBBE74C4A9FA85B5F29FF346 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_ButtonPropertyComponent.cpp"; path = "../../../../modules/juce_gui_basics/properties/juce_ButtonPropertyComponent.cpp"; sourceTree = "SOURCE_ROOT"; };
BBECA9EB9DD3C9B6CB04B10A = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Uuid.h"; path = "../../../../modules/juce_core/misc/juce_Uuid.h"; sourceTree = "SOURCE_ROOT"; };
BBF88983012D33EFEF11EA81 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_Network.cpp"; path = "../../../../modules/juce_core/native/juce_win32_Network.cpp"; sourceTree = "SOURCE_ROOT"; };
BC369095BAEED8707D12F63B = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CAStreamBasicDescription.cpp; path = Extras/CoreAudio/PublicUtility/CAStreamBasicDescription.cpp; sourceTree = "DEVELOPER_DIR"; };
BCB54D2E4C0C3357DACFD29B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_NSViewComponent.h"; path = "../../../../modules/juce_gui_extra/embedding/juce_NSViewComponent.h"; sourceTree = "SOURCE_ROOT"; };
@@ -741,6 +741,7 @@
C4BC9568B31F3E7EC4C3C7E6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_WebBrowserComponent.h"; path = "../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.h"; sourceTree = "SOURCE_ROOT"; };
C4CA0BF69BD074C55F7BD871 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PluginProcessor.h; path = ../../Source/PluginProcessor.h; sourceTree = "SOURCE_ROOT"; };
C4E99D3E7C558C9F14AFBB8E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_PropertyComponent.h"; path = "../../../../modules/juce_gui_basics/properties/juce_PropertyComponent.h"; sourceTree = "SOURCE_ROOT"; };
C507A853557D8CA51377907F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringRef.h"; path = "../../../../modules/juce_core/text/juce_StringRef.h"; sourceTree = "SOURCE_ROOT"; };
C5334A5D1AB867C5C4631D37 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_HyperlinkButton.h"; path = "../../../../modules/juce_gui_basics/buttons/juce_HyperlinkButton.h"; sourceTree = "SOURCE_ROOT"; };
C5ED4BF4E575F3A98F08FADA = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ScopedXLock.h"; path = "../../../../modules/juce_events/native/juce_ScopedXLock.h"; sourceTree = "SOURCE_ROOT"; };
C66971823D34B6CC6C72A0D0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_String.h"; path = "../../../../modules/juce_core/text/juce_String.h"; sourceTree = "SOURCE_ROOT"; };
@@ -1206,6 +1207,7 @@
988CB13161D84307D53770D7,
D39E8327482025C181E2646E,
8E8EF7A3035A5F657E18814C,
C507A853557D8CA51377907F,
4912E679D7789579BDF68CBE,
5BE5D2C8BD79AA4B1D2A24D3 ); name = text; sourceTree = "<group>"; };
41AB523E67C8F9D07AEC9388 = { isa = PBXGroup; children = (


+ 1
- 0
extras/audio plugin demo/Builds/VisualStudio2005/JuceDemoPlugin.vcproj View File

@@ -1192,6 +1192,7 @@
</FileConfiguration>
</File>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_TextDiff.cpp">
<FileConfiguration Name="Debug|Win32"
ExcludedFromBuild="true">


+ 1
- 0
extras/audio plugin demo/Builds/VisualStudio2008/JuceDemoPlugin.vcproj View File

@@ -1192,6 +1192,7 @@
</FileConfiguration>
</File>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_TextDiff.cpp">
<FileConfiguration Name="Debug|Win32"
ExcludedFromBuild="true">


+ 5
- 5
extras/audio plugin demo/Source/PluginProcessor.cpp View File

@@ -41,8 +41,8 @@ public:
return dynamic_cast <SineWaveSound*> (sound) != 0;
}
void startNote (const int midiNoteNumber, const float velocity,
SynthesiserSound* /*sound*/, const int /*currentPitchWheelPosition*/)
void startNote (int midiNoteNumber, float velocity,
SynthesiserSound* /*sound*/, int /*currentPitchWheelPosition*/)
{
currentAngle = 0.0;
level = velocity * 0.15;
@@ -54,7 +54,7 @@ public:
angleDelta = cyclesPerSample * 2.0 * double_Pi;
}
void stopNote (const bool allowTailOff)
void stopNote (bool allowTailOff)
{
if (allowTailOff)
{
@@ -74,12 +74,12 @@ public:
}
}
void pitchWheelMoved (const int /*newValue*/)
void pitchWheelMoved (int /*newValue*/)
{
// can't be bothered implementing this for the demo!
}
void controllerMoved (const int /*controllerNumber*/, const int /*newValue*/)
void controllerMoved (int /*controllerNumber*/, int /*newValue*/)
{
// not interested in controllers in this case.
}


+ 2
- 0
extras/audio plugin host/Builds/MacOSX/Plugin Host.xcodeproj/project.pbxproj View File

@@ -491,6 +491,7 @@
873EBB357BD6D24BF4A933FC = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_FileBrowserComponent.cpp"; path = "../../../../modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp"; sourceTree = "SOURCE_ROOT"; };
87C21E57BEAE3789837E3EE7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_Files.mm"; path = "../../../../modules/juce_core/native/juce_mac_Files.mm"; sourceTree = "SOURCE_ROOT"; };
87E1C69D47EEBB410C736057 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_FileTreeComponent.h"; path = "../../../../modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.h"; sourceTree = "SOURCE_ROOT"; };
882707E7AF3729EE34BC413B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringRef.h"; path = "../../../../modules/juce_core/text/juce_StringRef.h"; sourceTree = "SOURCE_ROOT"; };
883079D96B41550931751AF6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_FileDragAndDropTarget.h"; path = "../../../../modules/juce_gui_basics/mouse/juce_FileDragAndDropTarget.h"; sourceTree = "SOURCE_ROOT"; };
883C3CFCC12E44CB751A1492 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_PropertyPanel.h"; path = "../../../../modules/juce_gui_basics/properties/juce_PropertyPanel.h"; sourceTree = "SOURCE_ROOT"; };
88840B304F3E4CE1F05FCD8C = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Slider.cpp"; path = "../../../../modules/juce_gui_basics/widgets/juce_Slider.cpp"; sourceTree = "SOURCE_ROOT"; };
@@ -1147,6 +1148,7 @@
920F595F97031574B427C153,
62D82C201C4829E3F70EA188,
06C1447B9CBC6813BB7BEA53,
882707E7AF3729EE34BC413B,
A3EE7A9FD5BFE2DF31C04EF0,
6CB5AB2EA383094C2127BBDB ); name = text; sourceTree = "<group>"; };
0DA42F9BE820CD85C34E691D = { isa = PBXGroup; children = (


+ 1
- 0
extras/audio plugin host/Builds/VisualStudio2005/Plugin Host.vcproj View File

@@ -1163,6 +1163,7 @@
</FileConfiguration>
</File>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_TextDiff.cpp">
<FileConfiguration Name="Debug|Win32"
ExcludedFromBuild="true">


+ 1
- 0
extras/audio plugin host/Builds/VisualStudio2008/Plugin Host.vcproj View File

@@ -1163,6 +1163,7 @@
</FileConfiguration>
</File>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_TextDiff.cpp">
<FileConfiguration Name="Debug|Win32"
ExcludedFromBuild="true">


+ 2
- 0
extras/binarybuilder/Builds/MacOSX/BinaryBuilder.xcodeproj/project.pbxproj View File

@@ -104,6 +104,7 @@
8D1215F04E8191D74F58DEBE = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Logger.h"; path = "../../../../modules/juce_core/logging/juce_Logger.h"; sourceTree = "SOURCE_ROOT"; };
8DE69053F730461605C00231 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_Files.mm"; path = "../../../../modules/juce_core/native/juce_mac_Files.mm"; sourceTree = "SOURCE_ROOT"; };
92551BCF8DEA45A929CCF97A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_GZIPCompressorOutputStream.cpp"; path = "../../../../modules/juce_core/zip/juce_GZIPCompressorOutputStream.cpp"; sourceTree = "SOURCE_ROOT"; };
949507E2CFF41C7AAFA2BB1C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringRef.h"; path = "../../../../modules/juce_core/text/juce_StringRef.h"; sourceTree = "SOURCE_ROOT"; };
9666FDE5D872069865B28BC4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_DynamicObject.h"; path = "../../../../modules/juce_core/containers/juce_DynamicObject.h"; sourceTree = "SOURCE_ROOT"; };
979580822F8E084EF20A9A93 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_RelativeTime.h"; path = "../../../../modules/juce_core/time/juce_RelativeTime.h"; sourceTree = "SOURCE_ROOT"; };
990638D213329067AD10546B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringPairArray.h"; path = "../../../../modules/juce_core/text/juce_StringPairArray.h"; sourceTree = "SOURCE_ROOT"; };
@@ -226,6 +227,7 @@
990638D213329067AD10546B,
8708F2DFDF82F27A61EFC9D5,
12D525C1F3C776A69AB0938A,
949507E2CFF41C7AAFA2BB1C,
44E6B4B64DA8BF09F45A4703,
213DF50804C369804C6B6E92 ); name = text; sourceTree = "<group>"; };
8470C95EB732572CA3419423 = { isa = PBXGroup; children = (


+ 1
- 0
extras/binarybuilder/Builds/VisualStudio2008/BinaryBuilder.vcproj View File

@@ -216,6 +216,7 @@
</FileConfiguration>
</File>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_TextDiff.cpp">
<FileConfiguration Name="Debug|Win32"
ExcludedFromBuild="true">


+ 4
- 2
extras/example projects/Builds/MacOSX/HelloWorld.xcodeproj/project.pbxproj View File

@@ -396,6 +396,7 @@
9AF8A6A41A7FFACC570EBCF5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_TopLevelWindow.h"; path = "../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.h"; sourceTree = "SOURCE_ROOT"; };
9B02109FBEEB89243D72FC11 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_WebBrowserComponent.cpp"; path = "../../../../modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp"; sourceTree = "SOURCE_ROOT"; };
9B0ADC4932AEE1AEDBAAB8AE = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_MenuBarModel.cpp"; path = "../../../../modules/juce_gui_basics/menus/juce_MenuBarModel.cpp"; sourceTree = "SOURCE_ROOT"; };
9B5E2905BAEE2A1E7B7657AF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringRef.h"; path = "../../../../modules/juce_core/text/juce_StringRef.h"; sourceTree = "SOURCE_ROOT"; };
9CBEE085CF47C89A93F2783E = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_posix_NamedPipe.cpp"; path = "../../../../modules/juce_core/native/juce_posix_NamedPipe.cpp"; sourceTree = "SOURCE_ROOT"; };
9D0323FECB030B06FBD0F627 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_LookAndFeel.cpp"; path = "../../../../modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp"; sourceTree = "SOURCE_ROOT"; };
9EDBF1BC8604795A1B0774C9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_TextDragAndDropTarget.h"; path = "../../../../modules/juce_gui_basics/mouse/juce_TextDragAndDropTarget.h"; sourceTree = "SOURCE_ROOT"; };
@@ -598,11 +599,11 @@
ED577465CA22A65861192A35 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_TooltipClient.h"; path = "../../../../modules/juce_gui_basics/mouse/juce_TooltipClient.h"; sourceTree = "SOURCE_ROOT"; };
ED872E47438BBE6325FE78F2 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_GlyphArrangement.cpp"; path = "../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"; sourceTree = "SOURCE_ROOT"; };
EE785DBFA288EFA2E7AB2108 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_GIFLoader.cpp"; path = "../../../../modules/juce_graphics/image_formats/juce_GIFLoader.cpp"; sourceTree = "SOURCE_ROOT"; };
EF28BA2B5E24F4749F732230 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OptionalScopedPointer.h"; path = "../../../../modules/juce_core/memory/juce_OptionalScopedPointer.h"; sourceTree = "SOURCE_ROOT"; };
EF3A7A1A871BAB32EA1B46EF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Logger.h"; path = "../../../../modules/juce_core/logging/juce_Logger.h"; sourceTree = "SOURCE_ROOT"; };
EF54929F7151858D8FF8107B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_SystemStats.h"; path = "../../../../modules/juce_core/system/juce_SystemStats.h"; sourceTree = "SOURCE_ROOT"; };
EF932865774E86525CE7FC55 = { isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
EA398D9C544440E06637C134 = { isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = "BUILT_PRODUCTS_DIR"; };
EF28BA2B5E24F4749F732230 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OptionalScopedPointer.h"; path = "../../../../modules/juce_core/memory/juce_OptionalScopedPointer.h"; sourceTree = "SOURCE_ROOT"; };
EF3A7A1A871BAB32EA1B46EF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Logger.h"; path = "../../../../modules/juce_core/logging/juce_Logger.h"; sourceTree = "SOURCE_ROOT"; };
EFE00478AEAFE39D81B0E59D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_CustomTypeface.h"; path = "../../../../modules/juce_graphics/fonts/juce_CustomTypeface.h"; sourceTree = "SOURCE_ROOT"; };
EFE65E031B01332448C2BE5E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_InterprocessConnectionServer.h"; path = "../../../../modules/juce_events/interprocess/juce_InterprocessConnectionServer.h"; sourceTree = "SOURCE_ROOT"; };
F003AC63C800E3F090BF217F = { isa = PBXFileReference; lastKnownFileType = file; name = "juce_module_info"; path = "../../../../modules/juce_core/juce_module_info"; sourceTree = "SOURCE_ROOT"; };
@@ -674,6 +675,7 @@
1D68491BDF0E63AC125D454C,
971270DAD06B91F5B156C362,
DD7DC4C53F386AD914887EDA,
9B5E2905BAEE2A1E7B7657AF,
03BB1C54D9DEDDAB20B854AD,
AD1F1A9815D8660FA0305028 ); name = text; sourceTree = "<group>"; };
C3BF0F36B4C2A20B594B2C17 = { isa = PBXGroup; children = (


+ 1
- 0
extras/example projects/Builds/VisualStudio2005/HelloWorld.vcproj View File

@@ -218,6 +218,7 @@
</FileConfiguration>
</File>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_TextDiff.cpp">
<FileConfiguration Name="Debug|Win32"
ExcludedFromBuild="true">


+ 1
- 0
extras/example projects/Builds/VisualStudio2008/HelloWorld.vcproj View File

@@ -218,6 +218,7 @@
</FileConfiguration>
</File>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringPool.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_StringRef.h"/>
<File RelativePath="..\..\..\..\modules\juce_core\text\juce_TextDiff.cpp">
<FileConfiguration Name="Debug|Win32"
ExcludedFromBuild="true">


+ 2
- 0
extras/example projects/Builds/iOS/HelloWorld.xcodeproj/project.pbxproj View File

@@ -393,6 +393,7 @@
9AF8A6A41A7FFACC570EBCF5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_TopLevelWindow.h"; path = "../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.h"; sourceTree = "SOURCE_ROOT"; };
9B02109FBEEB89243D72FC11 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_WebBrowserComponent.cpp"; path = "../../../../modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp"; sourceTree = "SOURCE_ROOT"; };
9B0ADC4932AEE1AEDBAAB8AE = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_MenuBarModel.cpp"; path = "../../../../modules/juce_gui_basics/menus/juce_MenuBarModel.cpp"; sourceTree = "SOURCE_ROOT"; };
9B5E2905BAEE2A1E7B7657AF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringRef.h"; path = "../../../../modules/juce_core/text/juce_StringRef.h"; sourceTree = "SOURCE_ROOT"; };
9CBEE085CF47C89A93F2783E = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_posix_NamedPipe.cpp"; path = "../../../../modules/juce_core/native/juce_posix_NamedPipe.cpp"; sourceTree = "SOURCE_ROOT"; };
9D0323FECB030B06FBD0F627 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_LookAndFeel.cpp"; path = "../../../../modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp"; sourceTree = "SOURCE_ROOT"; };
9EDBF1BC8604795A1B0774C9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_TextDragAndDropTarget.h"; path = "../../../../modules/juce_gui_basics/mouse/juce_TextDragAndDropTarget.h"; sourceTree = "SOURCE_ROOT"; };
@@ -672,6 +673,7 @@
1D68491BDF0E63AC125D454C,
971270DAD06B91F5B156C362,
DD7DC4C53F386AD914887EDA,
9B5E2905BAEE2A1E7B7657AF,
03BB1C54D9DEDDAB20B854AD,
AD1F1A9815D8660FA0305028 ); name = text; sourceTree = "<group>"; };
C3BF0F36B4C2A20B594B2C17 = { isa = PBXGroup; children = (


+ 7
- 11
modules/juce_core/containers/juce_PropertySet.cpp View File

@@ -65,8 +65,7 @@ void PropertySet::clear()
}
}
String PropertySet::getValue (const String& keyName,
const String& defaultValue) const noexcept
String PropertySet::getValue (StringRef keyName, const String& defaultValue) const noexcept
{
const ScopedLock sl (lock);
@@ -79,8 +78,7 @@ String PropertySet::getValue (const String& keyName,
: defaultValue;
}
int PropertySet::getIntValue (const String& keyName,
const int defaultValue) const noexcept
int PropertySet::getIntValue (StringRef keyName, const int defaultValue) const noexcept
{
const ScopedLock sl (lock);
const int index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
@@ -92,8 +90,7 @@ int PropertySet::getIntValue (const String& keyName,
: defaultValue;
}
double PropertySet::getDoubleValue (const String& keyName,
const double defaultValue) const noexcept
double PropertySet::getDoubleValue (StringRef keyName, const double defaultValue) const noexcept
{
const ScopedLock sl (lock);
const int index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
@@ -105,8 +102,7 @@ double PropertySet::getDoubleValue (const String& keyName,
: defaultValue;
}
bool PropertySet::getBoolValue (const String& keyName,
const bool defaultValue) const noexcept
bool PropertySet::getBoolValue (StringRef keyName, const bool defaultValue) const noexcept
{
const ScopedLock sl (lock);
const int index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
@@ -118,7 +114,7 @@ bool PropertySet::getBoolValue (const String& keyName,
: defaultValue;
}
XmlElement* PropertySet::getXmlValue (const String& keyName) const
XmlElement* PropertySet::getXmlValue (StringRef keyName) const
{
return XmlDocument::parse (getValue (keyName));
}
@@ -142,7 +138,7 @@ void PropertySet::setValue (const String& keyName, const var& v)
}
}
void PropertySet::removeValue (const String& keyName)
void PropertySet::removeValue (StringRef keyName)
{
if (keyName.isNotEmpty())
{
@@ -163,7 +159,7 @@ void PropertySet::setValue (const String& keyName, const XmlElement* const xml)
: var (xml->createDocument (String::empty, true)));
}
bool PropertySet::containsKey (const String& keyName) const noexcept
bool PropertySet::containsKey (StringRef keyName) const noexcept
{
const ScopedLock sl (lock);
return properties.getAllKeys().contains (keyName, ignoreCaseOfKeys);


+ 7
- 11
modules/juce_core/containers/juce_PropertySet.h View File

@@ -69,8 +69,7 @@ public:
@param keyName the name of the property to retrieve
@param defaultReturnValue a value to return if the named property doesn't actually exist
*/
String getValue (const String& keyName,
const String& defaultReturnValue = String::empty) const noexcept;
String getValue (StringRef keyName, const String& defaultReturnValue = String::empty) const noexcept;
/** Returns one of the properties as an integer.
@@ -81,8 +80,7 @@ public:
@param keyName the name of the property to retrieve
@param defaultReturnValue a value to return if the named property doesn't actually exist
*/
int getIntValue (const String& keyName,
const int defaultReturnValue = 0) const noexcept;
int getIntValue (StringRef keyName, int defaultReturnValue = 0) const noexcept;
/** Returns one of the properties as an double.
@@ -93,8 +91,7 @@ public:
@param keyName the name of the property to retrieve
@param defaultReturnValue a value to return if the named property doesn't actually exist
*/
double getDoubleValue (const String& keyName,
const double defaultReturnValue = 0.0) const noexcept;
double getDoubleValue (StringRef keyName, double defaultReturnValue = 0.0) const noexcept;
/** Returns one of the properties as an boolean.
@@ -108,8 +105,7 @@ public:
@param keyName the name of the property to retrieve
@param defaultReturnValue a value to return if the named property doesn't actually exist
*/
bool getBoolValue (const String& keyName,
const bool defaultReturnValue = false) const noexcept;
bool getBoolValue (StringRef keyName, bool defaultReturnValue = false) const noexcept;
/** Returns one of the properties as an XML element.
@@ -122,7 +118,7 @@ public:
@param keyName the name of the property to retrieve
*/
XmlElement* getXmlValue (const String& keyName) const;
XmlElement* getXmlValue (StringRef keyName) const;
//==============================================================================
/** Sets a named property.
@@ -150,10 +146,10 @@ public:
/** Deletes a property.
@param keyName the name of the property to delete. (This mustn't be an empty string)
*/
void removeValue (const String& keyName);
void removeValue (StringRef keyName);
/** Returns true if the properies include the given key. */
bool containsKey (const String& keyName) const noexcept;
bool containsKey (StringRef keyName) const noexcept;
/** Removes all values. */
void clear();


+ 41
- 40
modules/juce_core/files/juce_File.cpp View File

@@ -340,66 +340,67 @@ int File::hashCode() const { return fullPath.hashCode(); }
int64 File::hashCode64() const { return fullPath.hashCode64(); }
//==============================================================================
bool File::isAbsolutePath (const String& path)
bool File::isAbsolutePath (StringRef path)
{
return path.startsWithChar (separator)
return path.text[0] == separator
#if JUCE_WINDOWS
|| (path.isNotEmpty() && path[1] == ':');
|| (path.isNotEmpty() && path.text[1] == ':');
#else
|| path.startsWithChar ('~');
|| path.text[0] == '~';
#endif
}
File File::getChildFile (String relativePath) const
File File::getChildFile (StringRef relativePath) const
{
if (isAbsolutePath (relativePath))
return File (relativePath);
return File (String (relativePath.text));
if (relativePath.text[0] != '.')
return File (addTrailingSeparator (fullPath) + relativePath);
String path (fullPath);
// It's relative, so remove any ../ or ./ bits at the start..
if (relativePath[0] == '.')
#if JUCE_WINDOWS
if (relativePath.text.indexOf ((juce_wchar) '/') >= 0)
return getChildFile (String (relativePath.text).replaceCharacter ('/', '\\'));
#endif
while (relativePath[0] == '.')
{
#if JUCE_WINDOWS
relativePath = relativePath.replaceCharacter ('/', '\\');
#endif
const juce_wchar secondChar = relativePath.text[1];
while (relativePath[0] == '.')
if (secondChar == '.')
{
const juce_wchar secondChar = relativePath[1];
const juce_wchar thirdChar = relativePath.text[2];
if (secondChar == '.')
{
const juce_wchar thirdChar = relativePath[2];
if (thirdChar == 0 || thirdChar == separator)
{
const int lastSlash = path.lastIndexOfChar (separator);
if (lastSlash >= 0)
path = path.substring (0, lastSlash);
relativePath = relativePath.substring (3);
}
else
{
break;
}
}
else if (secondChar == separator)
if (thirdChar == 0 || thirdChar == separator)
{
relativePath = relativePath.substring (2);
const int lastSlash = path.lastIndexOfChar (separator);
if (lastSlash >= 0)
path = path.substring (0, lastSlash);
relativePath = relativePath.text + 3;
}
else
{
break;
}
}
else if (secondChar == separator)
{
relativePath = relativePath.text + 2;
}
else
{
break;
}
}
return File (addTrailingSeparator (path) + relativePath);
}
File File::getSiblingFile (const String& fileName) const
File File::getSiblingFile (StringRef fileName) const
{
return getParentDirectory().getChildFile (fileName);
}
@@ -602,23 +603,23 @@ String File::getFileExtension() const
return String::empty;
}
bool File::hasFileExtension (const String& possibleSuffix) const
bool File::hasFileExtension (StringRef possibleSuffix) const
{
if (possibleSuffix.isEmpty())
return fullPath.lastIndexOfChar ('.') <= fullPath.lastIndexOfChar (separator);
const int semicolon = possibleSuffix.indexOfChar (0, ';');
const int semicolon = possibleSuffix.text.indexOf ((juce_wchar) ';');
if (semicolon >= 0)
{
return hasFileExtension (possibleSuffix.substring (0, semicolon).trimEnd())
|| hasFileExtension (possibleSuffix.substring (semicolon + 1).trimStart());
return hasFileExtension (String (possibleSuffix.text).substring (0, semicolon).trimEnd())
|| hasFileExtension ((possibleSuffix.text + (semicolon + 1)).findEndOfWhitespace());
}
else
{
if (fullPath.endsWithIgnoreCase (possibleSuffix))
{
if (possibleSuffix.startsWithChar ('.'))
if (possibleSuffix.text[0] == '.')
return true;
const int dotPos = fullPath.length() - possibleSuffix.length() - 1;
@@ -631,7 +632,7 @@ bool File::hasFileExtension (const String& possibleSuffix) const
return false;
}
File File::withFileExtension (const String& newExtension) const
File File::withFileExtension (StringRef newExtension) const
{
if (fullPath.isEmpty())
return File::nonexistent;
@@ -642,7 +643,7 @@ File File::withFileExtension (const String& newExtension) const
if (i >= 0)
filePart = filePart.substring (0, i);
if (newExtension.isNotEmpty() && ! newExtension.startsWithChar ('.'))
if (newExtension.isNotEmpty() && newExtension.text[0] != '.')
filePart << '.';
return getSiblingFile (filePart + newExtension);
@@ -874,7 +875,7 @@ String File::getRelativePathFrom (const File& dir) const
}
//==============================================================================
File File::createTempFile (const String& fileNameEnding)
File File::createTempFile (StringRef fileNameEnding)
{
const File tempFile (getSpecialLocation (tempDirectory)
.getChildFile ("temp_" + String::toHexString (Random::getSystemRandom().nextInt()))


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

@@ -203,7 +203,7 @@ public:
@see getFileExtension, withFileExtension, getFileNameWithoutExtension
*/
bool hasFileExtension (const String& extensionToTest) const;
bool hasFileExtension (StringRef extensionToTest) const;
/** Returns a version of this file with a different file extension.
@@ -215,7 +215,7 @@ public:
@see getFileName, getFileExtension, hasFileExtension, getFileNameWithoutExtension
*/
File withFileExtension (const String& newExtension) const;
File withFileExtension (StringRef newExtension) const;
/** Returns the last part of the filename, without its file extension.
@@ -255,7 +255,7 @@ public:
@see getSiblingFile, getParentDirectory, getRelativePathFrom, isAChildOf
*/
File getChildFile (String relativeOrAbsolutePath) const;
File getChildFile (StringRef relativeOrAbsolutePath) const;
/** Returns a file which is in the same directory as this one.
@@ -263,7 +263,7 @@ public:
@see getChildFile, getParentDirectory
*/
File getSiblingFile (const String& siblingFileName) const;
File getSiblingFile (StringRef siblingFileName) const;
//==============================================================================
/** Returns the directory that contains this file or directory.
@@ -852,7 +852,7 @@ public:
This will try to return the name of a non-existent temp file.
To get the temp folder, you can use getSpecialLocation (File::tempDirectory).
*/
static File createTempFile (const String& fileNameEnding);
static File createTempFile (StringRef fileNameEnding);
//==============================================================================
@@ -908,7 +908,7 @@ public:
static bool areFileNamesCaseSensitive();
/** Returns true if the string seems to be a fully-specified absolute path. */
static bool isAbsolutePath (const String& path);
static bool isAbsolutePath (StringRef path);
/** Creates a file that simply contains this string, without doing the sanity-checking
that the normal constructors do.


+ 2
- 0
modules/juce_core/juce_core.h View File

@@ -145,6 +145,7 @@
namespace juce
{
class StringRef;
class MemoryBlock;
class File;
class InputStream;
@@ -179,6 +180,7 @@ extern JUCE_API void JUCE_CALLTYPE logAssertion (const char* file, int line) noe
#endif
#include "text/juce_String.h"
#include "text/juce_StringRef.h"
#include "logging/juce_Logger.h"
#include "memory/juce_LeakedObjectDetector.h"
#include "memory/juce_ContainerDeletePolicy.h"


+ 1
- 1
modules/juce_core/native/juce_win32_Network.cpp View File

@@ -58,7 +58,7 @@ public:
if (HttpQueryInfo (request, HTTP_QUERY_RAW_HEADERS_CRLF, buffer.getData(), &bufferSizeBytes, 0))
{
StringArray headersArray;
headersArray.addLines (reinterpret_cast <const WCHAR*> (buffer.getData()));
headersArray.addLines (String (reinterpret_cast<const WCHAR*> (buffer.getData())));
for (int i = 0; i < headersArray.size(); ++i)
{


+ 4
- 1
modules/juce_core/text/juce_Identifier.h View File

@@ -38,7 +38,7 @@
from a string, so it's much faster to keep a static identifier object to refer
to frequently-used names, rather than constructing them each time you need it.
@see NamedPropertySet, ValueTree
@see NamedValueSet, ValueTree
*/
class JUCE_API Identifier
{
@@ -82,6 +82,9 @@ public:
/** Returns this identifier's raw string pointer. */
const String::CharPointerType getCharPointer() const noexcept { return name; }
/** Returns this identifier as a StringRef. */
operator StringRef() const noexcept { return name.getAddress(); }
/** Returns true if this Identifier is not null */
bool isValid() const noexcept { return name.getAddress() != nullptr; }


+ 5
- 0
modules/juce_core/text/juce_NewLine.h View File

@@ -53,6 +53,11 @@ public:
@see getDefault()
*/
operator String() const { return getDefault(); }
/** Returns the default new-line sequence that the library uses.
@see OutputStream::setNewLineString()
*/
operator StringRef() const noexcept { return getDefault(); }
};
//==============================================================================


+ 92
- 76
modules/juce_core/text/juce_String.cpp View File

@@ -512,11 +512,16 @@ int String::length() const noexcept
return (int) text.length();
}
size_t String::getByteOffsetOfEnd() const noexcept
static size_t findByteOffsetOfEnd (String::CharPointerType text) noexcept
{
return (size_t) (((char*) text.findTerminatingNull().getAddress()) - (char*) text.getAddress());
}
size_t String::getByteOffsetOfEnd() const noexcept
{
return findByteOffsetOfEnd (text);
}
juce_wchar String::operator[] (int index) const noexcept
{
jassert (index == 0 || (index > 0 && index <= (int) text.lengthUpTo ((size_t) index + 1)));
@@ -550,12 +555,14 @@ JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const wchar_t* const s
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, StringRef s2) noexcept { return s1.getCharPointer().compare (s2.text) == 0; }
JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const String& s2) noexcept { return s1.compare (s2) != 0; }
JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const char* const s2) noexcept { return s1.compare (s2) != 0; }
JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const wchar_t* const s2) noexcept { return s1.compare (s2) != 0; }
JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF8 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; }
JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF16 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; }
JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF32 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; }
JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, StringRef s2) noexcept { return s1.getCharPointer().compare (s2.text) != 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; }
@@ -804,7 +811,7 @@ int String::lastIndexOfChar (const juce_wchar character) const noexcept
return last;
}
int String::indexOfAnyOf (const String& charactersToLookFor, const int startIndex, const bool ignoreCase) const noexcept
int String::indexOfAnyOf (StringRef charactersToLookFor, const int startIndex, const bool ignoreCase) const noexcept
{
CharPointerType t (text);
@@ -824,17 +831,17 @@ int String::indexOfAnyOf (const String& charactersToLookFor, const int startInde
return -1;
}
int String::indexOf (const String& other) const noexcept
int String::indexOf (StringRef other) const noexcept
{
return other.isEmpty() ? 0 : text.indexOf (other.text);
}
int String::indexOfIgnoreCase (const String& other) const noexcept
int String::indexOfIgnoreCase (StringRef other) const noexcept
{
return other.isEmpty() ? 0 : CharacterFunctions::indexOfIgnoreCase (text, other.text);
}
int String::indexOf (const int startIndex, const String& other) const noexcept
int String::indexOf (const int startIndex, StringRef other) const noexcept
{
if (other.isEmpty())
return -1;
@@ -855,7 +862,7 @@ int String::indexOf (const int startIndex, const String& other) const noexcept
return found;
}
int String::indexOfIgnoreCase (const int startIndex, const String& other) const noexcept
int String::indexOfIgnoreCase (const int startIndex, StringRef other) const noexcept
{
if (other.isEmpty())
return -1;
@@ -876,7 +883,7 @@ int String::indexOfIgnoreCase (const int startIndex, const String& other) const
return found;
}
int String::lastIndexOf (const String& other) const noexcept
int String::lastIndexOf (StringRef other) const noexcept
{
if (other.isNotEmpty())
{
@@ -901,7 +908,7 @@ int String::lastIndexOf (const String& other) const noexcept
return -1;
}
int String::lastIndexOfIgnoreCase (const String& other) const noexcept
int String::lastIndexOfIgnoreCase (StringRef other) const noexcept
{
if (other.isNotEmpty())
{
@@ -926,7 +933,7 @@ int String::lastIndexOfIgnoreCase (const String& other) const noexcept
return -1;
}
int String::lastIndexOfAnyOf (const String& charactersToLookFor, const bool ignoreCase) const noexcept
int String::lastIndexOfAnyOf (StringRef charactersToLookFor, const bool ignoreCase) const noexcept
{
CharPointerType t (text);
int last = -1;
@@ -938,7 +945,7 @@ int String::lastIndexOfAnyOf (const String& charactersToLookFor, const bool igno
return last;
}
bool String::contains (const String& other) const noexcept
bool String::contains (StringRef other) const noexcept
{
return indexOf (other) >= 0;
}
@@ -948,12 +955,12 @@ bool String::containsChar (const juce_wchar character) const noexcept
return text.indexOf (character) >= 0;
}
bool String::containsIgnoreCase (const String& t) const noexcept
bool String::containsIgnoreCase (StringRef t) const noexcept
{
return indexOfIgnoreCase (t) >= 0;
}
int String::indexOfWholeWord (const String& word) const noexcept
int String::indexOfWholeWord (StringRef word) const noexcept
{
if (word.isNotEmpty())
{
@@ -975,7 +982,7 @@ int String::indexOfWholeWord (const String& word) const noexcept
return -1;
}
int String::indexOfWholeWordIgnoreCase (const String& word) const noexcept
int String::indexOfWholeWordIgnoreCase (StringRef word) const noexcept
{
if (word.isNotEmpty())
{
@@ -997,12 +1004,12 @@ int String::indexOfWholeWordIgnoreCase (const String& word) const noexcept
return -1;
}
bool String::containsWholeWord (const String& wordToLookFor) const noexcept
bool String::containsWholeWord (StringRef wordToLookFor) const noexcept
{
return indexOfWholeWord (wordToLookFor) >= 0;
}
bool String::containsWholeWordIgnoreCase (const String& wordToLookFor) const noexcept
bool String::containsWholeWordIgnoreCase (StringRef wordToLookFor) const noexcept
{
return indexOfWholeWordIgnoreCase (wordToLookFor) >= 0;
}
@@ -1044,18 +1051,18 @@ struct WildCardMatcher
}
};
bool String::matchesWildcard (const String& wildcard, const bool ignoreCase) const noexcept
bool String::matchesWildcard (StringRef wildcard, const bool ignoreCase) const noexcept
{
return WildCardMatcher<CharPointerType>::matches (wildcard.text, text, ignoreCase);
}
//==============================================================================
String String::repeatedString (const String& stringToRepeat, int numberOfTimesToRepeat)
String String::repeatedString (StringRef stringToRepeat, int numberOfTimesToRepeat)
{
if (numberOfTimesToRepeat <= 0)
return empty;
String result (PreallocationBytes (stringToRepeat.getByteOffsetOfEnd() * (size_t) numberOfTimesToRepeat));
String result (PreallocationBytes (findByteOffsetOfEnd (stringToRepeat) * (size_t) numberOfTimesToRepeat));
CharPointerType n (result.text);
while (--numberOfTimesToRepeat >= 0)
@@ -1121,7 +1128,7 @@ String String::paddedRight (const juce_wchar padCharacter, int minimumLength) co
}
//==============================================================================
String String::replaceSection (int index, int numCharsToReplace, const String& stringToInsert) const
String String::replaceSection (int index, int numCharsToReplace, StringRef stringToInsert) const
{
if (index < 0)
{
@@ -1163,10 +1170,10 @@ String String::replaceSection (int index, int numCharsToReplace, const String& s
}
if (insertPoint == text && startOfRemainder.isEmpty())
return stringToInsert;
return stringToInsert.text;
const size_t initialBytes = (size_t) (((char*) insertPoint.getAddress()) - (char*) text.getAddress());
const size_t newStringBytes = stringToInsert.getByteOffsetOfEnd();
const size_t newStringBytes = findByteOffsetOfEnd (stringToInsert);
const size_t remainderBytes = (size_t) (((char*) startOfRemainder.findTerminatingNull().getAddress()) - (char*) startOfRemainder.getAddress());
const size_t newTotalBytes = initialBytes + newStringBytes + remainderBytes;
@@ -1187,7 +1194,7 @@ String String::replaceSection (int index, int numCharsToReplace, const String& s
return result;
}
String String::replace (const String& stringToReplace, const String& stringToInsert, const bool ignoreCase) const
String String::replace (StringRef stringToReplace, StringRef stringToInsert, const bool ignoreCase) const
{
const int stringToReplaceLen = stringToReplace.length();
const int stringToInsertLen = stringToInsert.length();
@@ -1268,7 +1275,7 @@ String String::replaceCharacter (const juce_wchar charToReplace, const juce_wcha
return builder.result;
}
String String::replaceCharacters (const String& charactersToReplace, const String& charactersToInsertInstead) const
String String::replaceCharacters (StringRef charactersToReplace, StringRef charactersToInsertInstead) const
{
StringCreationHelper builder (text);
@@ -1276,7 +1283,7 @@ String String::replaceCharacters (const String& charactersToReplace, const Strin
{
juce_wchar c = builder.source.getAndAdvance();
const int index = charactersToReplace.indexOfChar (c);
const int index = charactersToReplace.text.indexOf (c);
if (index >= 0)
c = charactersToInsertInstead [index];
@@ -1290,12 +1297,12 @@ String String::replaceCharacters (const String& charactersToReplace, const Strin
}
//==============================================================================
bool String::startsWith (const String& other) const noexcept
bool String::startsWith (StringRef other) const noexcept
{
return text.compareUpTo (other.text, other.length()) == 0;
}
bool String::startsWithIgnoreCase (const String& other) const noexcept
bool String::startsWithIgnoreCase (StringRef other) const noexcept
{
return text.compareIgnoreCaseUpTo (other.text, other.length()) == 0;
}
@@ -1318,7 +1325,7 @@ bool String::endsWithChar (const juce_wchar character) const noexcept
return *--t == character;
}
bool String::endsWith (const String& other) const noexcept
bool String::endsWith (StringRef other) const noexcept
{
CharPointerType end (text.findTerminatingNull());
CharPointerType otherEnd (other.text.findTerminatingNull());
@@ -1335,7 +1342,7 @@ bool String::endsWith (const String& other) const noexcept
return otherEnd == other.text;
}
bool String::endsWithIgnoreCase (const String& other) const noexcept
bool String::endsWithIgnoreCase (StringRef other) const noexcept
{
CharPointerType end (text.findTerminatingNull());
CharPointerType otherEnd (other.text.findTerminatingNull());
@@ -1459,7 +1466,7 @@ String String::getLastCharacters (const int numCharacters) const
return String (text + jmax (0, length() - jmax (0, numCharacters)));
}
String String::fromFirstOccurrenceOf (const String& sub,
String String::fromFirstOccurrenceOf (StringRef sub,
const bool includeSubString,
const bool ignoreCase) const
{
@@ -1471,7 +1478,7 @@ String String::fromFirstOccurrenceOf (const String& sub,
return substring (includeSubString ? i : i + sub.length());
}
String String::fromLastOccurrenceOf (const String& sub,
String String::fromLastOccurrenceOf (StringRef sub,
const bool includeSubString,
const bool ignoreCase) const
{
@@ -1483,7 +1490,7 @@ String String::fromLastOccurrenceOf (const String& sub,
return substring (includeSubString ? i : i + sub.length());
}
String String::upToFirstOccurrenceOf (const String& sub,
String String::upToFirstOccurrenceOf (StringRef sub,
const bool includeSubString,
const bool ignoreCase) const
{
@@ -1495,7 +1502,7 @@ String String::upToFirstOccurrenceOf (const String& sub,
return substring (0, includeSubString ? i + sub.length() : i);
}
String String::upToLastOccurrenceOf (const String& sub,
String String::upToLastOccurrenceOf (StringRef sub,
const bool includeSubString,
const bool ignoreCase) const
{
@@ -1607,17 +1614,17 @@ String String::trimEnd() const
return *this;
}
String String::trimCharactersAtStart (const String& charactersToTrim) const
String String::trimCharactersAtStart (StringRef charactersToTrim) const
{
CharPointerType t (text);
while (charactersToTrim.containsChar (*t))
while (charactersToTrim.text.indexOf (*t) >= 0)
++t;
return t == text ? *this : String (t);
}
String String::trimCharactersAtEnd (const String& charactersToTrim) const
String String::trimCharactersAtEnd (StringRef charactersToTrim) const
{
if (isNotEmpty())
{
@@ -1626,7 +1633,7 @@ String String::trimCharactersAtEnd (const String& charactersToTrim) const
while (trimmedEnd > text)
{
if (! charactersToTrim.containsChar (*--trimmedEnd))
if (charactersToTrim.text.indexOf (*--trimmedEnd) < 0)
{
++trimmedEnd;
break;
@@ -1641,7 +1648,7 @@ String String::trimCharactersAtEnd (const String& charactersToTrim) const
}
//==============================================================================
String String::retainCharacters (const String& charactersToRetain) const
String String::retainCharacters (StringRef charactersToRetain) const
{
if (isEmpty())
return empty;
@@ -1652,7 +1659,7 @@ String String::retainCharacters (const String& charactersToRetain) const
{
juce_wchar c = builder.source.getAndAdvance();
if (charactersToRetain.containsChar (c))
if (charactersToRetain.text.indexOf (c) >= 0)
builder.write (c);
if (c == 0)
@@ -1663,7 +1670,7 @@ String String::retainCharacters (const String& charactersToRetain) const
return builder.result;
}
String String::removeCharacters (const String& charactersToRemove) const
String String::removeCharacters (StringRef charactersToRemove) const
{
if (isEmpty())
return empty;
@@ -1674,7 +1681,7 @@ String String::removeCharacters (const String& charactersToRemove) const
{
juce_wchar c = builder.source.getAndAdvance();
if (! charactersToRemove.containsChar (c))
if (charactersToRemove.text.indexOf (c) < 0)
builder.write (c);
if (c == 0)
@@ -1684,13 +1691,13 @@ String String::removeCharacters (const String& charactersToRemove) const
return builder.result;
}
String String::initialSectionContainingOnly (const String& permittedCharacters) const
String String::initialSectionContainingOnly (StringRef permittedCharacters) const
{
CharPointerType t (text);
while (! t.isEmpty())
{
if (! permittedCharacters.containsChar (*t))
if (permittedCharacters.text.indexOf (*t) < 0)
return String (text, t);
++t;
@@ -1699,13 +1706,13 @@ String String::initialSectionContainingOnly (const String& permittedCharacters)
return *this;
}
String String::initialSectionNotContaining (const String& charactersToStopAt) const
String String::initialSectionNotContaining (StringRef charactersToStopAt) const
{
CharPointerType t (text);
while (! t.isEmpty())
{
if (charactersToStopAt.containsChar (*t))
if (charactersToStopAt.text.indexOf (*t) >= 0)
return String (text, t);
++t;
@@ -1714,23 +1721,23 @@ String String::initialSectionNotContaining (const String& charactersToStopAt) co
return *this;
}
bool String::containsOnly (const String& chars) const noexcept
bool String::containsOnly (StringRef chars) const noexcept
{
CharPointerType t (text);
while (! t.isEmpty())
if (! chars.containsChar (t.getAndAdvance()))
if (chars.text.indexOf (t.getAndAdvance()) < 0)
return false;
return true;
}
bool String::containsAnyOf (const String& chars) const noexcept
bool String::containsAnyOf (StringRef chars) const noexcept
{
CharPointerType t (text);
while (! t.isEmpty())
if (chars.containsChar (t.getAndAdvance()))
if (chars.text.indexOf (t.getAndAdvance()) >= 0)
return true;
return false;
@@ -2082,6 +2089,15 @@ String String::fromUTF8 (const char* const buffer, int bufferSizeBytes)
#pragma warning (pop)
#endif
//==============================================================================
StringRef::StringRef (const String::CharPointerType::CharType* stringLiteral) noexcept : text (stringLiteral)
{
jassert (stringLiteral != nullptr); // This must be a valid string literal, not a null pointer!!
}
StringRef::StringRef (String::CharPointerType stringLiteral) noexcept : text (stringLiteral) {}
StringRef::StringRef (const String& string) noexcept : text (string.getCharPointer()) {}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@@ -2192,12 +2208,12 @@ public:
expect (s.substring (0, 100) == s);
expect (s.substring (-1, 100) == s);
expect (s.substring (3) == "345678");
expect (s.indexOf (L"45") == 4);
expect (s.indexOf (String (L"45")) == 4);
expect (String ("444445").indexOf ("45") == 4);
expect (String ("444445").lastIndexOfChar ('4') == 4);
expect (String ("45454545x").lastIndexOf (L"45") == 6);
expect (String ("45454545x").lastIndexOf (String (L"45")) == 6);
expect (String ("45454545x").lastIndexOfAnyOf ("456") == 7);
expect (String ("45454545x").lastIndexOfAnyOf (L"456x") == 8);
expect (String ("45454545x").lastIndexOfAnyOf (String (L"456x")) == 8);
expect (String ("abABaBaBa").lastIndexOfIgnoreCase ("aB") == 6);
expect (s.indexOfChar (L'4') == 4);
expect (s + s == "012345678012345678");
@@ -2254,21 +2270,21 @@ public:
expect (s3.compareIgnoreCase (L"ABCdeFGhiJ") == 0);
expect (s3.containsIgnoreCase (s3.substring (3)));
expect (s3.indexOfAnyOf ("xyzf", 2, true) == 5);
expect (s3.indexOfAnyOf (L"xyzf", 2, false) == -1);
expect (s3.indexOfAnyOf (String (L"xyzf"), 2, false) == -1);
expect (s3.indexOfAnyOf ("xyzF", 2, false) == 5);
expect (s3.containsAnyOf (L"zzzFs"));
expect (s3.containsAnyOf (String (L"zzzFs")));
expect (s3.startsWith ("abcd"));
expect (s3.startsWithIgnoreCase (L"abCD"));
expect (s3.startsWithIgnoreCase (String (L"abCD")));
expect (s3.startsWith (String::empty));
expect (s3.startsWithChar ('a'));
expect (s3.endsWith (String ("HIJ")));
expect (s3.endsWithIgnoreCase (L"Hij"));
expect (s3.endsWithIgnoreCase (String (L"Hij")));
expect (s3.endsWith (String::empty));
expect (s3.endsWithChar (L'J'));
expect (s3.indexOf ("HIJ") == 7);
expect (s3.indexOf (L"HIJK") == -1);
expect (s3.indexOf (String (L"HIJK")) == -1);
expect (s3.indexOfIgnoreCase ("hij") == 7);
expect (s3.indexOfIgnoreCase (L"hijk") == -1);
expect (s3.indexOfIgnoreCase (String (L"hijk")) == -1);
expect (s3.toStdString() == s3.toRawUTF8());
String s4 (s3);
@@ -2285,25 +2301,25 @@ public:
String s5 ("word word2 word3");
expect (s5.containsWholeWord (String ("word2")));
expect (s5.indexOfWholeWord ("word2") == 5);
expect (s5.containsWholeWord (L"word"));
expect (s5.containsWholeWord (String (L"word")));
expect (s5.containsWholeWord ("word3"));
expect (s5.containsWholeWord (s5));
expect (s5.containsWholeWordIgnoreCase (L"Word2"));
expect (s5.containsWholeWordIgnoreCase (String (L"Word2")));
expect (s5.indexOfWholeWordIgnoreCase ("Word2") == 5);
expect (s5.containsWholeWordIgnoreCase (L"Word"));
expect (s5.containsWholeWordIgnoreCase (String (L"Word")));
expect (s5.containsWholeWordIgnoreCase ("Word3"));
expect (! s5.containsWholeWordIgnoreCase (L"Wordx"));
expect (! s5.containsWholeWordIgnoreCase (String (L"Wordx")));
expect (! s5.containsWholeWordIgnoreCase ("xWord2"));
expect (s5.containsNonWhitespaceChars());
expect (s5.containsOnly ("ordw23 "));
expect (! String (" \n\r\t").containsNonWhitespaceChars());
expect (s5.matchesWildcard (L"wor*", false));
expect (s5.matchesWildcard (String (L"wor*"), false));
expect (s5.matchesWildcard ("wOr*", true));
expect (s5.matchesWildcard (L"*word3", true));
expect (s5.matchesWildcard (String (L"*word3"), true));
expect (s5.matchesWildcard ("*word?", true));
expect (s5.matchesWildcard (L"Word*3", true));
expect (! s5.matchesWildcard (L"*34", true));
expect (s5.matchesWildcard (String (L"Word*3"), true));
expect (! s5.matchesWildcard (String (L"*34"), true));
expect (String ("xx**y").matchesWildcard ("*y", true));
expect (String ("xx**y").matchesWildcard ("x*y", true));
expect (String ("xx**y").matchesWildcard ("xx*y", true));
@@ -2315,23 +2331,23 @@ public:
expectEquals (s5.fromFirstOccurrenceOf (String::empty, true, false), s5);
expectEquals (s5.fromFirstOccurrenceOf ("xword2", true, false), s5.substring (100));
expectEquals (s5.fromFirstOccurrenceOf (L"word2", true, false), s5.substring (5));
expectEquals (s5.fromFirstOccurrenceOf (String (L"word2"), true, false), s5.substring (5));
expectEquals (s5.fromFirstOccurrenceOf ("Word2", true, true), s5.substring (5));
expectEquals (s5.fromFirstOccurrenceOf ("word2", false, false), s5.getLastCharacters (6));
expectEquals (s5.fromFirstOccurrenceOf (L"Word2", false, true), s5.getLastCharacters (6));
expectEquals (s5.fromFirstOccurrenceOf ("Word2", false, true), s5.getLastCharacters (6));
expectEquals (s5.fromLastOccurrenceOf (String::empty, true, false), s5);
expectEquals (s5.fromLastOccurrenceOf (L"wordx", true, false), s5);
expectEquals (s5.fromLastOccurrenceOf ("wordx", true, false), s5);
expectEquals (s5.fromLastOccurrenceOf ("word", true, false), s5.getLastCharacters (5));
expectEquals (s5.fromLastOccurrenceOf (L"worD", true, true), s5.getLastCharacters (5));
expectEquals (s5.fromLastOccurrenceOf ("worD", true, true), s5.getLastCharacters (5));
expectEquals (s5.fromLastOccurrenceOf ("word", false, false), s5.getLastCharacters (1));
expectEquals (s5.fromLastOccurrenceOf (L"worD", false, true), s5.getLastCharacters (1));
expectEquals (s5.fromLastOccurrenceOf ("worD", false, true), s5.getLastCharacters (1));
expect (s5.upToFirstOccurrenceOf (String::empty, true, false).isEmpty());
expectEquals (s5.upToFirstOccurrenceOf ("word4", true, false), s5);
expectEquals (s5.upToFirstOccurrenceOf (L"word2", true, false), s5.substring (0, 10));
expectEquals (s5.upToFirstOccurrenceOf ("word2", true, false), s5.substring (0, 10));
expectEquals (s5.upToFirstOccurrenceOf ("Word2", true, true), s5.substring (0, 10));
expectEquals (s5.upToFirstOccurrenceOf (L"word2", false, false), s5.substring (0, 5));
expectEquals (s5.upToFirstOccurrenceOf ("word2", false, false), s5.substring (0, 5));
expectEquals (s5.upToFirstOccurrenceOf ("Word2", false, true), s5.substring (0, 5));
expectEquals (s5.upToLastOccurrenceOf (String::empty, true, false), s5);
@@ -2342,15 +2358,15 @@ public:
expectEquals (s5.upToLastOccurrenceOf ("word", false, false), s5.dropLastCharacters (5));
expectEquals (s5.upToLastOccurrenceOf ("Word", false, true), s5.dropLastCharacters (5));
expectEquals (s5.replace ("word", L"xyz", false), String ("xyz xyz2 xyz3"));
expect (s5.replace (L"Word", "xyz", true) == "xyz xyz2 xyz3");
expectEquals (s5.replace ("word", "xyz", false), String ("xyz xyz2 xyz3"));
expect (s5.replace ("Word", "xyz", true) == "xyz xyz2 xyz3");
expect (s5.dropLastCharacters (1).replace ("Word", String ("xyz"), true) == L"xyz xyz2 xyz");
expect (s5.replace ("Word", "", true) == " 2 3");
expectEquals (s5.replace ("Word2", L"xyz", true), String ("word xyz word3"));
expectEquals (s5.replace ("Word2", "xyz", true), String ("word xyz word3"));
expect (s5.replaceCharacter (L'w', 'x') != s5);
expectEquals (s5.replaceCharacter ('w', L'x').replaceCharacter ('x', 'w'), s5);
expect (s5.replaceCharacters ("wo", "xy") != s5);
expectEquals (s5.replaceCharacters ("wo", "xy").replaceCharacters ("xy", L"wo"), s5);
expectEquals (s5.replaceCharacters ("wo", "xy").replaceCharacters ("xy", "wo"), s5);
expectEquals (s5.retainCharacters ("1wordxya"), String ("wordwordword"));
expect (s5.retainCharacters (String::empty).isEmpty());
expect (s5.removeCharacters ("1wordxya") == " 2 3");


+ 39
- 37
modules/juce_core/text/juce_String.h View File

@@ -340,7 +340,7 @@ public:
If the parameter is an empty string, this will always return true.
Uses a case-sensitive comparison.
*/
bool startsWith (const String& text) const noexcept;
bool startsWith (StringRef text) const noexcept;
/** Tests whether the string begins with a particular character.
If the character is 0, this will always return false.
@@ -352,13 +352,13 @@ public:
If the parameter is an empty string, this will always return true.
Uses a case-insensitive comparison.
*/
bool startsWithIgnoreCase (const String& text) const noexcept;
bool startsWithIgnoreCase (StringRef text) const noexcept;
/** Tests whether the string ends with another string.
If the parameter is an empty string, this will always return true.
Uses a case-sensitive comparison.
*/
bool endsWith (const String& text) const noexcept;
bool endsWith (StringRef text) const noexcept;
/** Tests whether the string ends with a particular character.
If the character is 0, this will always return false.
@@ -370,13 +370,13 @@ public:
If the parameter is an empty string, this will always return true.
Uses a case-insensitive comparison.
*/
bool endsWithIgnoreCase (const String& text) const noexcept;
bool endsWithIgnoreCase (StringRef text) const noexcept;
/** Tests whether the string contains another substring.
If the parameter is an empty string, this will always return true.
Uses a case-sensitive comparison.
*/
bool contains (const String& text) const noexcept;
bool contains (StringRef text) const noexcept;
/** Tests whether the string contains a particular character.
Uses a case-sensitive comparison.
@@ -386,7 +386,7 @@ public:
/** Tests whether the string contains another substring.
Uses a case-insensitive comparison.
*/
bool containsIgnoreCase (const String& text) const noexcept;
bool containsIgnoreCase (StringRef text) const noexcept;
/** Tests whether the string contains another substring as a distinct word.
@@ -394,7 +394,7 @@ public:
non-alphanumeric characters
@see indexOfWholeWord, containsWholeWordIgnoreCase
*/
bool containsWholeWord (const String& wordToLookFor) const noexcept;
bool containsWholeWord (StringRef wordToLookFor) const noexcept;
/** Tests whether the string contains another substring as a distinct word.
@@ -402,7 +402,7 @@ public:
non-alphanumeric characters
@see indexOfWholeWordIgnoreCase, containsWholeWord
*/
bool containsWholeWordIgnoreCase (const String& wordToLookFor) const noexcept;
bool containsWholeWordIgnoreCase (StringRef wordToLookFor) const noexcept;
/** Finds an instance of another substring if it exists as a distinct word.
@@ -411,7 +411,7 @@ public:
found, then it will return -1
@see indexOfWholeWordIgnoreCase, containsWholeWord
*/
int indexOfWholeWord (const String& wordToLookFor) const noexcept;
int indexOfWholeWord (StringRef wordToLookFor) const noexcept;
/** Finds an instance of another substring if it exists as a distinct word.
@@ -420,7 +420,7 @@ public:
found, then it will return -1
@see indexOfWholeWord, containsWholeWordIgnoreCase
*/
int indexOfWholeWordIgnoreCase (const String& wordToLookFor) const noexcept;
int indexOfWholeWordIgnoreCase (StringRef wordToLookFor) const noexcept;
/** Looks for any of a set of characters in the string.
Uses a case-sensitive comparison.
@@ -428,7 +428,7 @@ public:
@returns true if the string contains any of the characters from
the string that is passed in.
*/
bool containsAnyOf (const String& charactersItMightContain) const noexcept;
bool containsAnyOf (StringRef charactersItMightContain) const noexcept;
/** Looks for a set of characters in the string.
Uses a case-sensitive comparison.
@@ -437,7 +437,7 @@ public:
the parameter string. If this string is empty, the return value will
always be true.
*/
bool containsOnly (const String& charactersItMightContain) const noexcept;
bool containsOnly (StringRef charactersItMightContain) const noexcept;
/** Returns true if this string contains any non-whitespace characters.
@@ -455,7 +455,7 @@ public:
This isn't a full-blown regex though! The only wildcard characters supported
are "*" and "?". It's mainly intended for filename pattern matching.
*/
bool matchesWildcard (const String& wildcard, bool ignoreCase) const noexcept;
bool matchesWildcard (StringRef wildcard, bool ignoreCase) const noexcept;
//==============================================================================
// Substring location methods..
@@ -488,7 +488,7 @@ public:
@see indexOfChar, lastIndexOfAnyOf
*/
int indexOfAnyOf (const String& charactersToLookFor,
int indexOfAnyOf (StringRef charactersToLookFor,
int startIndex = 0,
bool ignoreCase = false) const noexcept;
@@ -497,7 +497,7 @@ public:
@returns the index of the first occurrence of this substring, or -1 if it's not found.
If textToLookFor is an empty string, this will always return 0.
*/
int indexOf (const String& textToLookFor) const noexcept;
int indexOf (StringRef textToLookFor) const noexcept;
/** Searches for a substring within this string.
Uses a case-sensitive comparison.
@@ -506,14 +506,14 @@ public:
@returns the index of the first occurrence of this substring, or -1 if it's not found.
If textToLookFor is an empty string, this will always return -1.
*/
int indexOf (int startIndex, const String& textToLookFor) const noexcept;
int indexOf (int startIndex, StringRef textToLookFor) const noexcept;
/** Searches for a substring within this string.
Uses a case-insensitive comparison.
@returns the index of the first occurrence of this substring, or -1 if it's not found.
If textToLookFor is an empty string, this will always return 0.
*/
int indexOfIgnoreCase (const String& textToLookFor) const noexcept;
int indexOfIgnoreCase (StringRef textToLookFor) const noexcept;
/** Searches for a substring within this string.
Uses a case-insensitive comparison.
@@ -522,7 +522,7 @@ public:
@returns the index of the first occurrence of this substring, or -1 if it's not found.
If textToLookFor is an empty string, this will always return -1.
*/
int indexOfIgnoreCase (int startIndex, const String& textToLookFor) const noexcept;
int indexOfIgnoreCase (int startIndex, StringRef textToLookFor) const noexcept;
/** Searches for a character inside this string (working backwards from the end of the string).
Uses a case-sensitive comparison.
@@ -535,14 +535,14 @@ public:
@returns the index of the start of the last occurrence of the substring within this string,
or -1 if it's not found. If textToLookFor is an empty string, this will always return -1.
*/
int lastIndexOf (const String& textToLookFor) const noexcept;
int lastIndexOf (StringRef textToLookFor) const noexcept;
/** Searches for a substring inside this string (working backwards from the end of the string).
Uses a case-insensitive comparison.
@returns the index of the start of the last occurrence of the substring within this string, or -1
if it's not found. If textToLookFor is an empty string, this will always return -1.
*/
int lastIndexOfIgnoreCase (const String& textToLookFor) const noexcept;
int lastIndexOfIgnoreCase (StringRef textToLookFor) const noexcept;
/** Returns the index of the last character in this string that matches one of the
characters passed-in to this method.
@@ -556,7 +556,7 @@ public:
@see lastIndexOf, indexOfAnyOf
*/
int lastIndexOfAnyOf (const String& charactersToLookFor,
int lastIndexOfAnyOf (StringRef charactersToLookFor,
bool ignoreCase = false) const noexcept;
@@ -640,7 +640,7 @@ public:
@see upToFirstOccurrenceOf, fromLastOccurrenceOf
*/
String fromFirstOccurrenceOf (const String& substringToStartFrom,
String fromFirstOccurrenceOf (StringRef substringToStartFrom,
bool includeSubStringInResult,
bool ignoreCase) const;
@@ -652,7 +652,7 @@ public:
@see fromFirstOccurrenceOf, upToLastOccurrenceOf
*/
String fromLastOccurrenceOf (const String& substringToFind,
String fromLastOccurrenceOf (StringRef substringToFind,
bool includeSubStringInResult,
bool ignoreCase) const;
@@ -669,7 +669,7 @@ public:
@see upToLastOccurrenceOf, fromFirstOccurrenceOf
*/
String upToFirstOccurrenceOf (const String& substringToEndWith,
String upToFirstOccurrenceOf (StringRef substringToEndWith,
bool includeSubStringInResult,
bool ignoreCase) const;
@@ -680,7 +680,7 @@ public:
@see upToFirstOccurrenceOf, fromFirstOccurrenceOf
*/
String upToLastOccurrenceOf (const String& substringToFind,
String upToLastOccurrenceOf (StringRef substringToFind,
bool includeSubStringInResult,
bool ignoreCase) const;
@@ -700,7 +700,7 @@ public:
@param charactersToTrim the set of characters to remove.
@see trim, trimStart, trimCharactersAtEnd
*/
String trimCharactersAtStart (const String& charactersToTrim) const;
String trimCharactersAtStart (StringRef charactersToTrim) const;
/** Returns a copy of this string, having removed a specified set of characters from its end.
Characters are removed from the end of the string until it finds one that is not in the
@@ -708,7 +708,7 @@ public:
@param charactersToTrim the set of characters to remove.
@see trim, trimEnd, trimCharactersAtStart
*/
String trimCharactersAtEnd (const String& charactersToTrim) const;
String trimCharactersAtEnd (StringRef charactersToTrim) const;
//==============================================================================
/** Returns an upper-case version of this string. */
@@ -735,7 +735,7 @@ public:
*/
String replaceSection (int startIndex,
int numCharactersToReplace,
const String& stringToInsert) const;
StringRef stringToInsert) const;
/** Replaces all occurrences of a substring with another string.
@@ -744,8 +744,8 @@ public:
Note that this is a const method, and won't alter the string itself.
*/
String replace (const String& stringToReplace,
const String& stringToInsertInstead,
String replace (StringRef stringToReplace,
StringRef stringToInsertInstead,
bool ignoreCase = false) const;
/** Returns a string with all occurrences of a character replaced with a different one. */
@@ -762,8 +762,8 @@ public:
Note that this is a const method, and won't affect the string itself.
*/
String replaceCharacters (const String& charactersToReplace,
const String& charactersToInsertInstead) const;
String replaceCharacters (StringRef charactersToReplace,
StringRef charactersToInsertInstead) const;
/** Returns a version of this string that only retains a fixed set of characters.
@@ -774,7 +774,7 @@ public:
Note that this is a const method, and won't alter the string itself.
*/
String retainCharacters (const String& charactersToRetain) const;
String retainCharacters (StringRef charactersToRetain) const;
/** Returns a version of this string with a set of characters removed.
@@ -785,14 +785,14 @@ public:
Note that this is a const method, and won't alter the string itself.
*/
String removeCharacters (const String& charactersToRemove) const;
String removeCharacters (StringRef charactersToRemove) const;
/** Returns a section from the start of the string that only contains a certain set of characters.
This returns the leftmost section of the string, up to (and not including) the
first character that doesn't appear in the string passed in.
*/
String initialSectionContainingOnly (const String& permittedCharacters) const;
String initialSectionContainingOnly (StringRef permittedCharacters) const;
/** Returns a section from the start of the string that only contains a certain set of characters.
@@ -800,7 +800,7 @@ public:
first character that occurs in the string passed in. (If none of the specified
characters are found in the string, the return value will just be the original string).
*/
String initialSectionNotContaining (const String& charactersToStopAt) const;
String initialSectionNotContaining (StringRef charactersToStopAt) const;
//==============================================================================
/** Checks whether the string might be in quotation marks.
@@ -843,7 +843,7 @@ public:
@param stringToRepeat the string to repeat
@param numberOfTimesToRepeat how many times to repeat it
*/
static String repeatedString (const String& stringToRepeat,
static String repeatedString (StringRef stringToRepeat,
int numberOfTimesToRepeat);
/** Returns a copy of this string with the specified character repeatedly added to its
@@ -1293,6 +1293,7 @@ JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF16 string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF32 string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */
@@ -1305,6 +1306,7 @@ JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF16 string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF32 string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */


+ 19
- 22
modules/juce_core/text/juce_StringArray.cpp View File

@@ -190,7 +190,7 @@ void StringArray::set (const int index, const String& newString)
strings.set (index, newString);
}
bool StringArray::contains (const String& stringToLookFor, const bool ignoreCase) const
bool StringArray::contains (StringRef stringToLookFor, const bool ignoreCase) const
{
if (ignoreCase)
{
@@ -208,7 +208,7 @@ bool StringArray::contains (const String& stringToLookFor, const bool ignoreCase
return false;
}
int StringArray::indexOf (const String& stringToLookFor, const bool ignoreCase, int i) const
int StringArray::indexOf (StringRef stringToLookFor, const bool ignoreCase, int i) const
{
if (i < 0)
i = 0;
@@ -245,8 +245,7 @@ void StringArray::remove (const int index)
strings.remove (index);
}
void StringArray::removeString (const String& stringToRemove,
const bool ignoreCase)
void StringArray::removeString (StringRef stringToRemove, const bool ignoreCase)
{
if (ignoreCase)
{
@@ -325,7 +324,7 @@ void StringArray::move (const int currentIndex, int newIndex) noexcept
//==============================================================================
String StringArray::joinIntoString (const String& separator, int start, int numberToJoin) const
String StringArray::joinIntoString (StringRef separator, int start, int numberToJoin) const
{
const int last = (numberToJoin < 0) ? size()
: jmin (size(), start + numberToJoin);
@@ -339,7 +338,7 @@ String StringArray::joinIntoString (const String& separator, int start, int numb
if (start == last - 1)
return strings.getReference (start);
const size_t separatorBytes = separator.getCharPointer().sizeInBytes() - sizeof (String::CharPointerType::CharType);
const size_t separatorBytes = separator.text.sizeInBytes() - sizeof (String::CharPointerType::CharType);
size_t bytesNeeded = separatorBytes * (size_t) (last - start - 1);
for (int i = start; i < last; ++i)
@@ -358,7 +357,7 @@ String StringArray::joinIntoString (const String& separator, int start, int numb
dest.writeAll (s.getCharPointer());
if (++start < last && separatorBytes > 0)
dest.writeAll (separator.getCharPointer());
dest.writeAll (separator.text);
}
dest.writeNull();
@@ -366,23 +365,22 @@ String StringArray::joinIntoString (const String& separator, int start, int numb
return result;
}
int StringArray::addTokens (const String& text, const bool preserveQuotedStrings)
int StringArray::addTokens (StringRef text, const bool preserveQuotedStrings)
{
return addTokens (text, " \n\r\t", preserveQuotedStrings ? "\"" : "");
}
int StringArray::addTokens (const String& text, const String& breakCharacters, const String& quoteCharacters)
int StringArray::addTokens (StringRef text, StringRef breakCharacters, StringRef quoteCharacters)
{
int num = 0;
String::CharPointerType t (text.getCharPointer());
if (! t.isEmpty())
if (text.isNotEmpty())
{
for (;;)
for (String::CharPointerType t (text.text);;)
{
String::CharPointerType tokenEnd (CharacterFunctions::findEndOfToken (t,
breakCharacters.getCharPointer(),
quoteCharacters.getCharPointer()));
breakCharacters.text,
quoteCharacters.text));
strings.add (String (t, tokenEnd));
++num;
@@ -396,10 +394,10 @@ int StringArray::addTokens (const String& text, const String& breakCharacters, c
return num;
}
int StringArray::addLines (const String& sourceText)
int StringArray::addLines (StringRef sourceText)
{
int numLines = 0;
String::CharPointerType text (sourceText.getCharPointer());
String::CharPointerType text (sourceText.text);
bool finished = text.isEmpty();
while (! finished)
@@ -425,24 +423,23 @@ int StringArray::addLines (const String& sourceText)
return numLines;
}
StringArray StringArray::fromTokens (const String& stringToTokenise,
bool preserveQuotedStrings)
StringArray StringArray::fromTokens (StringRef stringToTokenise, bool preserveQuotedStrings)
{
StringArray s;
s.addTokens (stringToTokenise, preserveQuotedStrings);
return s;
}
StringArray StringArray::fromTokens (const String& stringToTokenise,
const String& breakCharacters,
const String& quoteCharacters)
StringArray StringArray::fromTokens (StringRef stringToTokenise,
StringRef breakCharacters,
StringRef quoteCharacters)
{
StringArray s;
s.addTokens (stringToTokenise, breakCharacters, quoteCharacters);
return s;
}
StringArray StringArray::fromLines (const String& stringToBreakUp)
StringArray StringArray::fromLines (StringRef stringToBreakUp)
{
StringArray s;
s.addLines (stringToBreakUp);


+ 15
- 16
modules/juce_core/text/juce_StringArray.h View File

@@ -153,7 +153,7 @@ public:
@returns true if the string is found inside the array
*/
bool contains (const String& stringToLookFor,
bool contains (StringRef stringToLookFor,
bool ignoreCase = false) const;
/** Searches for a string in the array.
@@ -166,7 +166,7 @@ public:
@returns the index of the first occurrence of the string in this array,
or -1 if it isn't found.
*/
int indexOf (const String& stringToLookFor,
int indexOf (StringRef stringToLookFor,
bool ignoreCase = false,
int startIndex = 0) const;
@@ -214,8 +214,7 @@ public:
@returns the number of tokens added
@see fromTokens
*/
int addTokens (const String& stringToTokenise,
bool preserveQuotedStrings);
int addTokens (StringRef stringToTokenise, bool preserveQuotedStrings);
/** Breaks up a string into tokens and adds them to this array.
@@ -231,9 +230,9 @@ public:
@returns the number of tokens added
@see fromTokens
*/
int addTokens (const String& stringToTokenise,
const String& breakCharacters,
const String& quoteCharacters);
int addTokens (StringRef stringToTokenise,
StringRef breakCharacters,
StringRef quoteCharacters);
/** Breaks up a string into lines and adds them to this array.
@@ -241,7 +240,7 @@ public:
to the array. Line-break characters are omitted from the strings that are added to
the array.
*/
int addLines (const String& stringToBreakUp);
int addLines (StringRef stringToBreakUp);
/** Returns an array containing the tokens in a given string.
@@ -249,7 +248,7 @@ public:
token delimiters, and return these tokens as an array.
@see addTokens
*/
static StringArray fromTokens (const String& stringToTokenise,
static StringArray fromTokens (StringRef stringToTokenise,
bool preserveQuotedStrings);
/** Returns an array containing the tokens in a given string.
@@ -265,9 +264,9 @@ public:
between quotes is not broken up into tokens.
@see addTokens
*/
static StringArray fromTokens (const String& stringToTokenise,
const String& breakCharacters,
const String& quoteCharacters);
static StringArray fromTokens (StringRef stringToTokenise,
StringRef breakCharacters,
StringRef quoteCharacters);
/** Returns an array containing the lines in a given string.
@@ -275,7 +274,7 @@ public:
array containing these lines. Line-break characters are omitted from the strings that
are added to the array.
*/
static StringArray fromLines (const String& stringToBreakUp);
static StringArray fromLines (StringRef stringToBreakUp);
//==============================================================================
/** Removes all elements from the array. */
@@ -295,7 +294,7 @@ public:
This will remove the first occurrence of the given string from the array. The
comparison may be case-insensitive depending on the ignoreCase parameter.
*/
void removeString (const String& stringToRemove,
void removeString (StringRef stringToRemove,
bool ignoreCase = false);
/** Removes a range of elements from the array.
@@ -379,7 +378,7 @@ public:
@param numberOfElements how many elements to join together. If this is less
than zero, all available elements will be used.
*/
String joinIntoString (const String& separatorString,
String joinIntoString (StringRef separatorString,
int startIndex = 0,
int numberOfElements = -1) const;
@@ -410,7 +409,7 @@ public:
private:
//==============================================================================
Array <String> strings;
Array<String> strings;
JUCE_LEAK_DETECTOR (StringArray)
};


+ 3
- 3
modules/juce_core/text/juce_StringPairArray.cpp View File

@@ -63,12 +63,12 @@ bool StringPairArray::operator!= (const StringPairArray& other) const
return ! operator== (other);
}
const String& StringPairArray::operator[] (const String& key) const
const String& StringPairArray::operator[] (StringRef key) const
{
return values [keys.indexOf (key, ignoreCase)];
}
String StringPairArray::getValue (const String& key, const String& defaultReturnValue) const
String StringPairArray::getValue (StringRef key, const String& defaultReturnValue) const
{
const int i = keys.indexOf (key, ignoreCase);
@@ -105,7 +105,7 @@ void StringPairArray::clear()
values.clear();
}
void StringPairArray::remove (const String& key)
void StringPairArray::remove (StringRef key)
{
remove (keys.indexOf (key, ignoreCase));
}


+ 3
- 9
modules/juce_core/text/juce_StringPairArray.h View File

@@ -77,15 +77,13 @@ public:
@see getValue
*/
const String& operator[] (const String& key) const;
const String& operator[] (StringRef key) const;
/** Finds the value corresponding to a key string.
If no such key is found, this will just return the value provided as a default.
@see operator[]
*/
String getValue (const String& key, const String& defaultReturnValue) const;
String getValue (StringRef, const String& defaultReturnValue) const;
/** Returns a list of all keys in the array. */
@@ -100,14 +98,12 @@ public:
//==============================================================================
/** Adds or amends a key/value pair.
If a value already exists with this key, its value will be overwritten,
otherwise the key/value pair will be added to the array.
*/
void set (const String& key, const String& value);
/** Adds the items from another array to this one.
This is equivalent to using set() to add each of the pairs from the other array.
*/
void addArray (const StringPairArray& other);
@@ -117,13 +113,11 @@ public:
void clear();
/** Removes a string from the array based on its key.
If the key isn't found, nothing will happen.
*/
void remove (const String& key);
void remove (StringRef key);
/** Removes a string from the array based on its index.
If the index is out-of-range, no action will be taken.
*/
void remove (int index);


+ 124
- 0
modules/juce_core/text/juce_StringRef.h View File

@@ -0,0 +1,124 @@
/*
==============================================================================
This file is part of the juce_core module of the JUCE library.
Copyright (c) 2013 - Raw Material Software Ltd.
Permission to use, copy, modify, and/or distribute this software for any purpose with
or without fee is hereby granted, provided that the above copyright notice and this
permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
------------------------------------------------------------------------------
NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
All other JUCE modules are covered by a dual GPL/commercial license, so if you are
using any other modules, be sure to check that you also comply with their license.
For more details, visit www.juce.com
==============================================================================
*/
#ifndef JUCE_STRINGREF_H_INCLUDED
#define JUCE_STRINGREF_H_INCLUDED
//==============================================================================
/**
A simple class for holding temporary references to a string literal or String.
Unlike a real String object, the StringRef does not allocate any memory or
take ownership of the strings you give to it - it simply holds a reference to
a string that has been allocated elsewhere.
The main purpose of the class is to be used instead of a const String& as the type
of function arguments where the caller may pass either a string literal or a String
object. This means that when the called uses a string literal, there's no need
for an temporary String object to be allocated, and this cuts down overheads
substantially.
Because the class is simply a wrapper around a pointer, you should always pass
it by value, not by reference.
@code
void myStringFunction1 (const String&);
void myStringFunction2 (StringRef);
myStringFunction1 ("abc"); // Implicitly allocates a temporary String object.
myStringFunction2 ("abc"); // Much faster, as no local allocations are needed.
@endcode
For examples of it in use, see the XmlElement or StringArray classes.
Bear in mind that there are still many cases where it's better to use an argument
which is a const String&. For example if the function stores the string or needs
to internally create a String from the argument, then it's better for the original
argument to already be a String.
@see String
*/
class JUCE_API StringRef
{
public:
/** Creates a StringRef from a raw string literal.
The StringRef object does NOT take ownership or copy this data, so you must
ensure that the data does not change during the lifetime of the StringRef.
Note that this pointer not be null!
*/
StringRef (const String::CharPointerType::CharType* stringLiteral) noexcept;
/** Creates a StringRef from a raw char pointer.
The StringRef object does NOT take ownership or copy this data, so you must
ensure that the data does not change during the lifetime of the StringRef.
*/
StringRef (String::CharPointerType stringLiteral) noexcept;
/** Creates a StringRef from a String.
The StringRef object does NOT take ownership or copy the data from the String,
so you must ensure that the String is not modified or deleted during the lifetime
of the StringRef.
*/
StringRef (const String& string) noexcept;
//==============================================================================
/** Returns a raw pointer to the underlying string data. */
operator const String::CharPointerType::CharType*() const noexcept { return text.getAddress(); }
/** Returns a pointer to the underlying string data as a char pointer object. */
operator String::CharPointerType() const noexcept { return text; }
/** Returns true if the string is empty. */
bool isEmpty() const noexcept { return text.isEmpty(); }
/** Returns true if the string is not empty. */
bool isNotEmpty() const noexcept { return ! text.isEmpty(); }
/** Returns the number of characters in the string. */
int length() const noexcept { return text.length(); }
/** Compares this StringRef with a String. */
bool operator== (const String& s) const noexcept { return text.compare (s.getCharPointer()) == 0; }
/** Compares this StringRef with a String. */
bool operator!= (const String& s) const noexcept { return text.compare (s.getCharPointer()) != 0; }
/** Case-sensitive comparison of two StringRefs. */
bool operator== (StringRef s) const noexcept { return text.compare (s.text) == 0; }
/** Case-sensitive comparison of two StringRefs. */
bool operator!= (StringRef s) const noexcept { return text.compare (s.text) != 0; }
//==============================================================================
/** The text that is referenced. */
String::CharPointerType text;
};
//==============================================================================
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, StringRef string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, StringRef string2) noexcept;
#endif // JUCE_STRINGREF_H_INCLUDED

+ 66
- 69
modules/juce_core/xml/juce_XmlElement.cpp View File

@@ -42,7 +42,7 @@ XmlElement::XmlAttributeNode::XmlAttributeNode (const String& n, const String& v
#endif
}
inline bool XmlElement::XmlAttributeNode::hasName (const String& nameToMatch) const noexcept
bool XmlElement::XmlAttributeNode::hasName (StringRef nameToMatch) const noexcept
{
return name.equalsIgnoreCase (nameToMatch);
}
@@ -74,9 +74,7 @@ XmlElement& XmlElement::operator= (const XmlElement& other)
{
removeAllAttributes();
deleteAllChildElements();
tagName = other.tagName;
copyChildrenAndAttributesFrom (other);
}
@@ -85,10 +83,10 @@ XmlElement& XmlElement::operator= (const XmlElement& other)
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
XmlElement::XmlElement (XmlElement&& other) noexcept
: nextListItem (static_cast <LinkedListPointer <XmlElement>&&> (other.nextListItem)),
firstChildElement (static_cast <LinkedListPointer <XmlElement>&&> (other.firstChildElement)),
attributes (static_cast <LinkedListPointer <XmlAttributeNode>&&> (other.attributes)),
tagName (static_cast <String&&> (other.tagName))
: nextListItem (static_cast<LinkedListPointer<XmlElement>&&> (other.nextListItem)),
firstChildElement (static_cast<LinkedListPointer<XmlElement>&&> (other.firstChildElement)),
attributes (static_cast<LinkedListPointer<XmlAttributeNode>&&> (other.attributes)),
tagName (static_cast<String&&> (other.tagName))
{
}
@@ -99,10 +97,10 @@ XmlElement& XmlElement::operator= (XmlElement&& other) noexcept
removeAllAttributes();
deleteAllChildElements();
nextListItem = static_cast <LinkedListPointer <XmlElement>&&> (other.nextListItem);
firstChildElement = static_cast <LinkedListPointer <XmlElement>&&> (other.firstChildElement);
attributes = static_cast <LinkedListPointer <XmlAttributeNode>&&> (other.attributes);
tagName = static_cast <String&&> (other.tagName);
nextListItem = static_cast<LinkedListPointer<XmlElement>&&> (other.nextListItem);
firstChildElement = static_cast<LinkedListPointer<XmlElement>&&> (other.firstChildElement);
attributes = static_cast<LinkedListPointer<XmlAttributeNode>&&> (other.attributes);
tagName = static_cast<String&&> (other.tagName);
return *this;
}
@@ -163,8 +161,8 @@ namespace XmlOutputFunctions
static bool isLegalXmlChar (const uint32 c) noexcept
{
static const unsigned char legalChars[] = { 0, 0, 0, 0, 187, 255, 255, 175, 255, 255, 255, 191, 254, 255, 255, 127 };
static const unsigned char legalChars[] = { 0, 0, 0, 0, 187, 255, 255, 175, 255,
255, 255, 191, 254, 255, 255, 127 };
return c < sizeof (legalChars) * 8
&& (legalChars [c >> 3] & (1 << (c & 7))) != 0;
}
@@ -297,10 +295,10 @@ void XmlElement::writeElementAsText (OutputStream& outputStream,
}
}
String XmlElement::createDocument (const String& dtdToUse,
String XmlElement::createDocument (StringRef dtdToUse,
const bool allOnOneLine,
const bool includeXmlHeader,
const String& encodingType,
StringRef encodingType,
const int lineWrapLength) const
{
MemoryOutputStream mem (2048);
@@ -310,10 +308,10 @@ String XmlElement::createDocument (const String& dtdToUse,
}
void XmlElement::writeToStream (OutputStream& output,
const String& dtdToUse,
StringRef dtdToUse,
const bool allOnOneLine,
const bool includeXmlHeader,
const String& encodingType,
StringRef encodingType,
const int lineWrapLength) const
{
using namespace XmlOutputFunctions;
@@ -345,8 +343,8 @@ void XmlElement::writeToStream (OutputStream& output,
}
bool XmlElement::writeToFile (const File& file,
const String& dtdToUse,
const String& encodingType,
StringRef dtdToUse,
StringRef encodingType,
const int lineWrapLength) const
{
TemporaryFile tempFile (file);
@@ -364,7 +362,7 @@ bool XmlElement::writeToFile (const File& file,
}
//==============================================================================
bool XmlElement::hasTagName (const String& possibleTagName) const noexcept
bool XmlElement::hasTagName (StringRef possibleTagName) const noexcept
{
const bool matches = tagName.equalsIgnoreCase (possibleTagName);
@@ -385,12 +383,12 @@ String XmlElement::getTagNameWithoutNamespace() const
return tagName.fromLastOccurrenceOf (":", false, false);
}
bool XmlElement::hasTagNameIgnoringNamespace (const String& possibleTagName) const
bool XmlElement::hasTagNameIgnoringNamespace (StringRef possibleTagName) const
{
return hasTagName (possibleTagName) || getTagNameWithoutNamespace() == possibleTagName;
}
XmlElement* XmlElement::getNextElementWithTagName (const String& requiredTagName) const
XmlElement* XmlElement::getNextElementWithTagName (StringRef requiredTagName) const
{
XmlElement* e = nextListItem;
@@ -408,89 +406,90 @@ int XmlElement::getNumAttributes() const noexcept
const String& XmlElement::getAttributeName (const int index) const noexcept
{
const XmlAttributeNode* const att = attributes [index];
return att != nullptr ? att->name : String::empty;
if (const XmlAttributeNode* const att = attributes [index])
return att->name;
return String::empty;
}
const String& XmlElement::getAttributeValue (const int index) const noexcept
{
const XmlAttributeNode* const att = attributes [index];
return att != nullptr ? att->value : String::empty;
if (const XmlAttributeNode* const att = attributes [index])
return att->value;
return String::empty;
}
bool XmlElement::hasAttribute (const String& attributeName) const noexcept
XmlElement::XmlAttributeNode* XmlElement::getAttribute (StringRef attributeName) const noexcept
{
for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem)
for (XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem)
if (att->hasName (attributeName))
return true;
return att;
return false;
return nullptr;
}
bool XmlElement::hasAttribute (StringRef attributeName) const noexcept
{
return getAttribute (attributeName) != nullptr;
}
//==============================================================================
const String& XmlElement::getStringAttribute (const String& attributeName) const noexcept
const String& XmlElement::getStringAttribute (StringRef attributeName) const noexcept
{
for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem)
if (att->hasName (attributeName))
return att->value;
if (const XmlAttributeNode* att = getAttribute (attributeName))
return att->value;
return String::empty;
}
String XmlElement::getStringAttribute (const String& attributeName, const String& defaultReturnValue) const
String XmlElement::getStringAttribute (StringRef attributeName, const String& defaultReturnValue) const
{
for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem)
if (att->hasName (attributeName))
return att->value;
if (const XmlAttributeNode* att = getAttribute (attributeName))
return att->value;
return defaultReturnValue;
}
int XmlElement::getIntAttribute (const String& attributeName, const int defaultReturnValue) const
int XmlElement::getIntAttribute (StringRef attributeName, const int defaultReturnValue) const
{
for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem)
if (att->hasName (attributeName))
return att->value.getIntValue();
if (const XmlAttributeNode* att = getAttribute (attributeName))
return att->value.getIntValue();
return defaultReturnValue;
}
double XmlElement::getDoubleAttribute (const String& attributeName, const double defaultReturnValue) const
double XmlElement::getDoubleAttribute (StringRef attributeName, const double defaultReturnValue) const
{
for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem)
if (att->hasName (attributeName))
return att->value.getDoubleValue();
if (const XmlAttributeNode* att = getAttribute (attributeName))
return att->value.getDoubleValue();
return defaultReturnValue;
}
bool XmlElement::getBoolAttribute (const String& attributeName, const bool defaultReturnValue) const
bool XmlElement::getBoolAttribute (StringRef attributeName, const bool defaultReturnValue) const
{
for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem)
if (const XmlAttributeNode* att = getAttribute (attributeName))
{
if (att->hasName (attributeName))
{
const juce_wchar firstChar = *(att->value.getCharPointer().findEndOfWhitespace());
const juce_wchar firstChar = *(att->value.getCharPointer().findEndOfWhitespace());
return firstChar == '1'
|| firstChar == 't'
|| firstChar == 'y'
|| firstChar == 'T'
|| firstChar == 'Y';
}
return firstChar == '1'
|| firstChar == 't'
|| firstChar == 'y'
|| firstChar == 'T'
|| firstChar == 'Y';
}
return defaultReturnValue;
}
bool XmlElement::compareAttribute (const String& attributeName,
const String& stringToCompareAgainst,
bool XmlElement::compareAttribute (StringRef attributeName,
StringRef stringToCompareAgainst,
const bool ignoreCase) const noexcept
{
for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem)
if (att->hasName (attributeName))
return ignoreCase ? att->value.equalsIgnoreCase (stringToCompareAgainst)
: att->value == stringToCompareAgainst;
if (const XmlAttributeNode* att = getAttribute (attributeName))
return ignoreCase ? att->value.equalsIgnoreCase (stringToCompareAgainst)
: att->value == stringToCompareAgainst;
return false;
}
@@ -561,7 +560,7 @@ XmlElement* XmlElement::getChildElement (const int index) const noexcept
return firstChildElement [index].get();
}
XmlElement* XmlElement::getChildByName (const String& childName) const noexcept
XmlElement* XmlElement::getChildByName (StringRef childName) const noexcept
{
for (XmlElement* child = firstChildElement; child != nullptr; child = child->nextListItem)
if (child->hasTagName (childName))
@@ -576,8 +575,7 @@ void XmlElement::addChildElement (XmlElement* const newNode) noexcept
firstChildElement.append (newNode);
}
void XmlElement::insertChildElement (XmlElement* const newNode,
int indexToInsertAt) noexcept
void XmlElement::insertChildElement (XmlElement* const newNode, int indexToInsertAt) noexcept
{
if (newNode != nullptr)
{
@@ -700,7 +698,7 @@ void XmlElement::deleteAllChildElements() noexcept
firstChildElement.deleteAll();
}
void XmlElement::deleteAllChildElementsWithTagName (const String& name) noexcept
void XmlElement::deleteAllChildElementsWithTagName (StringRef name) noexcept
{
for (XmlElement* child = firstChildElement; child != nullptr;)
{
@@ -791,8 +789,7 @@ String XmlElement::getAllSubText() const
return mem.toUTF8();
}
String XmlElement::getChildElementAllSubText (const String& childTagName,
const String& defaultReturnValue) const
String XmlElement::getChildElementAllSubText (StringRef childTagName, const String& defaultReturnValue) const
{
if (const XmlElement* const child = getChildByName (childTagName))
return child->getAllSubText();


+ 28
- 43
modules/juce_core/xml/juce_XmlElement.h View File

@@ -193,10 +193,10 @@ public:
determines how lists of attributes get broken up
@see writeToStream, writeToFile
*/
String createDocument (const String& dtdToUse,
String createDocument (StringRef dtdToUse,
bool allOnOneLine = false,
bool includeXmlHeader = true,
const String& encodingType = "UTF-8",
StringRef encodingType = "UTF-8",
int lineWrapLength = 60) const;
/** Writes the document to a stream as UTF-8.
@@ -215,10 +215,10 @@ public:
@see writeToFile, createDocument
*/
void writeToStream (OutputStream& output,
const String& dtdToUse,
StringRef dtdToUse,
bool allOnOneLine = false,
bool includeXmlHeader = true,
const String& encodingType = "UTF-8",
StringRef encodingType = "UTF-8",
int lineWrapLength = 60) const;
/** Writes the element to a file as an XML document.
@@ -241,8 +241,8 @@ public:
@see createDocument
*/
bool writeToFile (const File& destinationFile,
const String& dtdToUse,
const String& encodingType = "UTF-8",
StringRef dtdToUse,
StringRef encodingType = "UTF-8",
int lineWrapLength = 60) const;
//==============================================================================
@@ -250,7 +250,7 @@ public:
E.g. for an element such as \<MOOSE legs="4" antlers="2">, this would return "MOOSE".
@see hasTagName
*/
inline const String& getTagName() const noexcept { return tagName; }
const String& getTagName() const noexcept { return tagName; }
/** Returns the namespace portion of the tag-name, or an empty string if none is specified. */
String getNamespace() const;
@@ -262,13 +262,13 @@ public:
@param possibleTagName the tag name you're comparing it with
@see getTagName
*/
bool hasTagName (const String& possibleTagName) const noexcept;
bool hasTagName (StringRef possibleTagName) const noexcept;
/** Tests whether this element has a particular tag name, ignoring any XML namespace prefix.
So a test for e.g. "xyz" will return true for "xyz" and also "foo:xyz", "bar::xyz", etc.
@see getTagName
*/
bool hasTagNameIgnoringNamespace (const String& possibleTagName) const;
bool hasTagNameIgnoringNamespace (StringRef possibleTagName) const;
//==============================================================================
/** Returns the number of XML attributes this element contains.
@@ -300,13 +300,13 @@ public:
// Attribute-handling methods..
/** Checks whether the element contains an attribute with a certain name. */
bool hasAttribute (const String& attributeName) const noexcept;
bool hasAttribute (StringRef attributeName) const noexcept;
/** Returns the value of a named attribute.
@param attributeName the name of the attribute to look up
*/
const String& getStringAttribute (const String& attributeName) const noexcept;
const String& getStringAttribute (StringRef attributeName) const noexcept;
/** Returns the value of a named attribute.
@@ -314,8 +314,7 @@ public:
@param defaultReturnValue a value to return if the element doesn't have an attribute
with this name
*/
String getStringAttribute (const String& attributeName,
const String& defaultReturnValue) const;
String getStringAttribute (StringRef attributeName, const String& defaultReturnValue) const;
/** Compares the value of a named attribute with a value passed-in.
@@ -325,8 +324,8 @@ public:
@returns true if the value of the attribute is the same as the string passed-in;
false if it's different (or if no such attribute exists)
*/
bool compareAttribute (const String& attributeName,
const String& stringToCompareAgainst,
bool compareAttribute (StringRef attributeName,
StringRef stringToCompareAgainst,
bool ignoreCase = false) const noexcept;
/** Returns the value of a named attribute as an integer.
@@ -339,8 +338,7 @@ public:
with this name
@see setAttribute
*/
int getIntAttribute (const String& attributeName,
int defaultReturnValue = 0) const;
int getIntAttribute (StringRef attributeName, int defaultReturnValue = 0) const;
/** Returns the value of a named attribute as floating-point.
@@ -352,8 +350,7 @@ public:
with this name
@see setAttribute
*/
double getDoubleAttribute (const String& attributeName,
double defaultReturnValue = 0.0) const;
double getDoubleAttribute (StringRef attributeName, double defaultReturnValue = 0.0) const;
/** Returns the value of a named attribute as a boolean.
@@ -365,8 +362,7 @@ public:
@param defaultReturnValue a value to return if the element doesn't have an attribute
with this name
*/
bool getBoolAttribute (const String& attributeName,
bool defaultReturnValue = false) const;
bool getBoolAttribute (StringRef attributeName, bool defaultReturnValue = false) const;
/** Adds a named attribute to the element.
@@ -381,8 +377,7 @@ public:
@param newValue the value to set it to
@see removeAttribute
*/
void setAttribute (const String& attributeName,
const String& newValue);
void setAttribute (const String& attributeName, const String& newValue);
/** Adds a named attribute to the element, setting it to an integer value.
@@ -396,8 +391,7 @@ public:
@param attributeName the name of the attribute to set
@param newValue the value to set it to
*/
void setAttribute (const String& attributeName,
int newValue);
void setAttribute (const String& attributeName, int newValue);
/** Adds a named attribute to the element, setting it to a floating-point value.
@@ -411,8 +405,7 @@ public:
@param attributeName the name of the attribute to set
@param newValue the value to set it to
*/
void setAttribute (const String& attributeName,
double newValue);
void setAttribute (const String& attributeName, double newValue);
/** Removes a named attribute from the element.
@@ -421,17 +414,14 @@ public:
*/
void removeAttribute (const String& attributeName) noexcept;
/** Removes all attributes from this element.
*/
/** Removes all attributes from this element. */
void removeAllAttributes() noexcept;
//==============================================================================
// Child element methods..
/** Returns the first of this element's sub-elements.
see getNextElement() for an example of how to iterate the sub-elements.
@see forEachXmlChildElement
*/
XmlElement* getFirstChildElement() const noexcept { return firstChildElement; }
@@ -472,10 +462,9 @@ public:
@see getNextElement, forEachXmlChildElementWithTagName
*/
XmlElement* getNextElementWithTagName (const String& requiredTagName) const;
XmlElement* getNextElementWithTagName (StringRef requiredTagName) const;
/** Returns the number of sub-elements in this element.
@see getChildElement
*/
int getNumChildElements() const noexcept;
@@ -496,7 +485,7 @@ public:
@returns the first element with this tag name, or nullptr if none is found
@see getNextElement, isTextElement, getChildElement
*/
XmlElement* getChildByName (const String& tagNameToLookFor) const noexcept;
XmlElement* getChildByName (StringRef tagNameToLookFor) const noexcept;
//==============================================================================
/** Appends an element to this element's list of children.
@@ -560,16 +549,14 @@ public:
bool shouldDeleteTheChild) noexcept;
/** Deletes all the child elements in the element.
@see removeChildElement, deleteAllChildElementsWithTagName
*/
void deleteAllChildElements() noexcept;
/** Deletes all the child elements with a given tag name.
@see removeChildElement
*/
void deleteAllChildElementsWithTagName (const String& tagName) noexcept;
void deleteAllChildElementsWithTagName (StringRef tagName) noexcept;
/** Returns true if the given element is a child of this one. */
bool containsChildElement (const XmlElement* possibleChild) const noexcept;
@@ -676,23 +663,20 @@ public:
@see getAllSubText
*/
String getChildElementAllSubText (const String& childTagName,
String getChildElementAllSubText (StringRef childTagName,
const String& defaultReturnValue) const;
/** Appends a section of text to this element.
@see isTextElement, getText, getAllSubText
*/
void addTextElement (const String& text);
/** Removes all the text elements from this element.
@see isTextElement, getText, getAllSubText, addTextElement
*/
void deleteAllTextElements() noexcept;
/** Creates a text element that can be added to a parent element.
*/
/** Creates a text element that can be added to a parent element. */
static XmlElement* createTextElement (const String& text);
//==============================================================================
@@ -705,7 +689,7 @@ private:
LinkedListPointer<XmlAttributeNode> nextListItem;
String name, value;
bool hasName (const String&) const noexcept;
bool hasName (StringRef) const noexcept;
private:
XmlAttributeNode& operator= (const XmlAttributeNode&);
@@ -726,6 +710,7 @@ private:
void writeElementAsText (OutputStream&, int indentationLevel, int lineWrapLength) const;
void getChildElementsAsArray (XmlElement**) const noexcept;
void reorderChildElements (XmlElement**, int) noexcept;
XmlAttributeNode* getAttribute (StringRef) const noexcept;
JUCE_LEAK_DETECTOR (XmlElement)
};


+ 4
- 4
modules/juce_graphics/geometry/juce_Rectangle.h View File

@@ -814,10 +814,10 @@ public:
@see toString
*/
static Rectangle fromString (const String& stringVersion)
static Rectangle fromString (StringRef stringVersion)
{
StringArray toks;
toks.addTokens (stringVersion.trim(), ",; \t\r\n", String::empty);
toks.addTokens (stringVersion.text.findEndOfWhitespace(), ",; \t\r\n", String::empty);
return Rectangle (parseIntAfterSpace (toks[0]),
parseIntAfterSpace (toks[1]),
@@ -836,8 +836,8 @@ private:
Point<ValueType> pos;
ValueType w, h;
static int parseIntAfterSpace (const String& s) noexcept
{ return s.getCharPointer().findEndOfWhitespace().getIntValue32(); }
static int parseIntAfterSpace (StringRef s) noexcept
{ return s.text.findEndOfWhitespace().getIntValue32(); }
void copyWithRounding (Rectangle<int>& result) const noexcept { result = getSmallestIntegerContainer(); }
void copyWithRounding (Rectangle<float>& result) const noexcept { result = toFloat(); }


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

@@ -1553,7 +1553,7 @@ int Component::getIndexOfChildComponent (const Component* const child) const noe
return childComponentList.indexOf (const_cast <Component*> (child));
}
Component* Component::findChildWithID (const String& targetID) const noexcept
Component* Component::findChildWithID (StringRef targetID) const noexcept
{
for (int i = childComponentList.size(); --i >= 0;)
{


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

@@ -683,7 +683,7 @@ public:
/** Looks for a child component with the specified ID.
@see setComponentID, getComponentID
*/
Component* findChildWithID (const String& componentID) const noexcept;
Component* findChildWithID (StringRef componentID) const noexcept;
/** Adds a child component to this one.


Loading…
Cancel
Save