From addd649b275d7a976effa38c9abdce8b10a26fea Mon Sep 17 00:00:00 2001 From: jules Date: Fri, 13 Sep 2013 16:12:05 +0100 Subject: [PATCH] Disambiguations to keep the MS compiler happy when using UTF32 string mode. --- modules/juce_core/text/juce_NewLine.h | 3 +++ modules/juce_core/text/juce_String.cpp | 5 +++++ modules/juce_core/text/juce_String.h | 3 +++ modules/juce_core/text/juce_StringRef.h | 3 +++ 4 files changed, 14 insertions(+) diff --git a/modules/juce_core/text/juce_NewLine.h b/modules/juce_core/text/juce_NewLine.h index b5462427a9..980ac23cff 100644 --- a/modules/juce_core/text/juce_NewLine.h +++ b/modules/juce_core/text/juce_NewLine.h @@ -79,5 +79,8 @@ extern NewLine newLine; */ JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, const NewLine&); +#if JUCE_STRING_UTF_TYPE != 8 && ! defined (DOXYGEN) + inline String operator+ (String s1, const NewLine&) { return s1 += NewLine::getDefault(); } +#endif #endif // JUCE_NEWLINE_H_INCLUDED diff --git a/modules/juce_core/text/juce_String.cpp b/modules/juce_core/text/juce_String.cpp index 7895571981..139c2bb4b2 100644 --- a/modules/juce_core/text/juce_String.cpp +++ b/modules/juce_core/text/juce_String.cpp @@ -580,6 +580,11 @@ bool String::equalsIgnoreCase (const char* const t) const noexcept : isEmpty(); } +bool String::equalsIgnoreCase (StringRef t) const noexcept +{ + return text.compareIgnoreCase (t.text) == 0; +} + bool String::equalsIgnoreCase (const String& other) const noexcept { return text == other.text diff --git a/modules/juce_core/text/juce_String.h b/modules/juce_core/text/juce_String.h index 0df7504b31..e48a20f512 100644 --- a/modules/juce_core/text/juce_String.h +++ b/modules/juce_core/text/juce_String.h @@ -296,6 +296,9 @@ public: /** Case-insensitive comparison with another string. */ bool equalsIgnoreCase (const String& other) const noexcept; + /** Case-insensitive comparison with another string. */ + bool equalsIgnoreCase (StringRef other) const noexcept; + /** Case-insensitive comparison with another string. */ bool equalsIgnoreCase (const wchar_t* other) const noexcept; diff --git a/modules/juce_core/text/juce_StringRef.h b/modules/juce_core/text/juce_StringRef.h index 4b66a791d0..40e926880d 100644 --- a/modules/juce_core/text/juce_StringRef.h +++ b/modules/juce_core/text/juce_StringRef.h @@ -128,5 +128,8 @@ JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, StringRef string2 /** Case-sensitive comparison of two strings. */ JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, StringRef string2) noexcept; +#if JUCE_STRING_UTF_TYPE != 8 && ! defined (DOXYGEN) + inline String operator+ (String s1, StringRef s2) { return s1 += String (s2.text); } +#endif #endif // JUCE_STRINGREF_H_INCLUDED