From 8ea44694dccf6cd2ad633b89253da8f3797923e5 Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Thu, 17 Mar 2011 15:01:15 +0000 Subject: [PATCH] Fix for alt modifier key in win32. --- juce_amalgamated.cpp | 205 ++++++-------------- juce_amalgamated.h | 2 +- src/core/juce_StandardHeader.h | 2 +- src/native/windows/juce_win32_Windowing.cpp | 72 +++---- src/text/juce_String.cpp | 135 +++---------- 5 files changed, 121 insertions(+), 295 deletions(-) diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index e9b9d9b484..6add57b217 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -11973,85 +11973,22 @@ int64 String::hashCode64() const throw() return result; } -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const String& string2) throw() -{ - return string1.compare (string2) == 0; -} - -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const char* const string2) throw() -{ - return string1.compare (string2) == 0; -} - -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const wchar_t* const string2) throw() -{ - return string1.compare (string2) == 0; -} - -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF8& string2) throw() -{ - return string1.getCharPointer().compare (string2) == 0; -} - -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF16& string2) throw() -{ - return string1.getCharPointer().compare (string2) == 0; -} - -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF32& string2) throw() -{ - return string1.getCharPointer().compare (string2) == 0; -} - -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) throw() -{ - return string1.compare (string2) != 0; -} - -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const char* const string2) throw() -{ - return string1.compare (string2) != 0; -} - -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const wchar_t* const string2) throw() -{ - return string1.compare (string2) != 0; -} - -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF8& string2) throw() -{ - return string1.getCharPointer().compare (string2) != 0; -} - -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF16& string2) throw() -{ - return string1.getCharPointer().compare (string2) != 0; -} - -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF32& string2) throw() -{ - return string1.getCharPointer().compare (string2) != 0; -} - -JUCE_API bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) throw() -{ - return string1.compare (string2) > 0; -} - -JUCE_API bool JUCE_CALLTYPE operator< (const String& string1, const String& string2) throw() -{ - return string1.compare (string2) < 0; -} - -JUCE_API bool JUCE_CALLTYPE operator>= (const String& string1, const String& string2) throw() -{ - return string1.compare (string2) >= 0; -} - -JUCE_API bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) throw() -{ - return string1.compare (string2) <= 0; -} +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const String& s2) throw() { return s1.compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const char* const s2) throw() { return s1.compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const wchar_t* const s2) throw() { return s1.compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF8& s2) throw() { return s1.getCharPointer().compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF16& s2) throw() { return s1.getCharPointer().compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF32& s2) throw() { return s1.getCharPointer().compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const String& s2) throw() { return s1.compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const char* const s2) throw() { return s1.compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const wchar_t* const s2) throw() { return s1.compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF8& s2) throw() { return s1.getCharPointer().compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF16& s2) throw() { return s1.getCharPointer().compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF32& s2) throw() { return s1.getCharPointer().compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator> (const String& s1, const String& s2) throw() { return s1.compare (s2) > 0; } +JUCE_API bool JUCE_CALLTYPE operator< (const String& s1, const String& s2) throw() { return s1.compare (s2) < 0; } +JUCE_API bool JUCE_CALLTYPE operator>= (const String& s1, const String& s2) throw() { return s1.compare (s2) >= 0; } +JUCE_API bool JUCE_CALLTYPE operator<= (const String& s1, const String& s2) throw() { return s1.compare (s2) <= 0; } bool String::equalsIgnoreCase (const wchar_t* const t) const throw() { @@ -12071,25 +12008,10 @@ bool String::equalsIgnoreCase (const String& other) const throw() || text.compareIgnoreCase (other.text) == 0; } -int String::compare (const String& other) const throw() -{ - return (text == other.text) ? 0 : text.compare (other.text); -} - -int String::compare (const char* const other) const throw() -{ - return text.compare (CharPointer_UTF8 (other)); -} - -int String::compare (const wchar_t* const other) const throw() -{ - return text.compare (castToCharPointer_wchar_t (other)); -} - -int String::compareIgnoreCase (const String& other) const throw() -{ - return (text == other.text) ? 0 : text.compareIgnoreCase (other.text); -} +int String::compare (const String& other) const throw() { return (text == other.text) ? 0 : text.compare (other.text); } +int String::compare (const char* const other) const throw() { return text.compare (CharPointer_UTF8 (other)); } +int String::compare (const wchar_t* const other) const throw() { return text.compare (castToCharPointer_wchar_t (other)); } +int String::compareIgnoreCase (const String& other) const throw() { return (text == other.text) ? 0 : text.compareIgnoreCase (other.text); } int String::compareLexicographically (const String& other) const throw() { @@ -12203,21 +12125,10 @@ JUCE_API const String JUCE_CALLTYPE operator+ (const wchar_t* const string1, con return s += string2; } -JUCE_API const String JUCE_CALLTYPE operator+ (const char string1, const String& string2) -{ - return String::charToString (string1) + string2; -} - -JUCE_API const String JUCE_CALLTYPE operator+ (const wchar_t string1, const String& string2) -{ - return String::charToString (string1) + string2; -} - +JUCE_API const String JUCE_CALLTYPE operator+ (const char s1, const String& s2) { return String::charToString (s1) + s2; } +JUCE_API const String JUCE_CALLTYPE operator+ (const wchar_t s1, const String& s2) { return String::charToString (s1) + s2; } #if ! JUCE_NATIVE_WCHAR_IS_UTF32 -JUCE_API const String JUCE_CALLTYPE operator+ (const juce_wchar string1, const String& string2) -{ - return String::charToString (string1) + string2; -} +JUCE_API const String JUCE_CALLTYPE operator+ (const juce_wchar s1, const String& s2) { return String::charToString (s1) + s2; } #endif JUCE_API const String JUCE_CALLTYPE operator+ (String s1, const String& s2) { return s1 += s2; } @@ -246330,32 +246241,6 @@ namespace IconConverters long improbableWindowNumber = 0xf965aa01; // also referenced by messaging.cpp -bool KeyPress::isKeyCurrentlyDown (const int keyCode) -{ - SHORT k = (SHORT) keyCode; - - if ((keyCode & extendedKeyModifier) == 0 - && (k >= (SHORT) 'a' && k <= (SHORT) 'z')) - k += (SHORT) 'A' - (SHORT) 'a'; - - const SHORT translatedValues[] = { (SHORT) ',', VK_OEM_COMMA, - (SHORT) '+', VK_OEM_PLUS, - (SHORT) '-', VK_OEM_MINUS, - (SHORT) '.', VK_OEM_PERIOD, - (SHORT) ';', VK_OEM_1, - (SHORT) ':', VK_OEM_1, - (SHORT) '/', VK_OEM_2, - (SHORT) '?', VK_OEM_2, - (SHORT) '[', VK_OEM_4, - (SHORT) ']', VK_OEM_6 }; - - for (int i = 0; i < numElementsInArray (translatedValues); i += 2) - if (k == translatedValues [i]) - k = translatedValues [i + 1]; - - return (GetKeyState (k) & 0x8000) != 0; -} - class Win32ComponentPeer : public ComponentPeer { public: @@ -246853,18 +246738,20 @@ public: } } - bool isInside (HWND h) const + bool isInside (HWND h) const throw() { return GetAncestor (hwnd, GA_ROOT) == h; } + static bool isKeyDown (const int key) throw() { return (GetAsyncKeyState (key) & 0x8000) != 0; } + static void updateKeyModifiers() throw() { int keyMods = 0; - if (GetKeyState (VK_SHIFT) & 0x8000) keyMods |= ModifierKeys::shiftModifier; - if (GetKeyState (VK_CONTROL) & 0x8000) keyMods |= ModifierKeys::ctrlModifier; - if (GetKeyState (VK_MENU) & 0x8000) keyMods |= ModifierKeys::altModifier; - if (GetKeyState (VK_RMENU) & 0x8000) keyMods &= ~(ModifierKeys::ctrlModifier | ModifierKeys::altModifier); + if (isKeyDown (VK_SHIFT)) keyMods |= ModifierKeys::shiftModifier; + if (isKeyDown (VK_CONTROL)) keyMods |= ModifierKeys::ctrlModifier; + if (isKeyDown (VK_MENU)) keyMods |= ModifierKeys::altModifier; + if (isKeyDown (VK_RMENU)) keyMods &= ~(ModifierKeys::ctrlModifier | ModifierKeys::altModifier); currentModifiers = currentModifiers.withOnlyMouseButtons().withFlags (keyMods); } @@ -248237,9 +248124,9 @@ const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() throw() Win32ComponentPeer::updateKeyModifiers(); int mouseMods = 0; - if ((GetKeyState (VK_LBUTTON) & 0x8000) != 0) mouseMods |= ModifierKeys::leftButtonModifier; - if ((GetKeyState (VK_RBUTTON) & 0x8000) != 0) mouseMods |= ModifierKeys::rightButtonModifier; - if ((GetKeyState (VK_MBUTTON) & 0x8000) != 0) mouseMods |= ModifierKeys::middleButtonModifier; + if (Win32ComponentPeer::isKeyDown (VK_LBUTTON)) mouseMods |= ModifierKeys::leftButtonModifier; + if (Win32ComponentPeer::isKeyDown (VK_RBUTTON)) mouseMods |= ModifierKeys::rightButtonModifier; + if (Win32ComponentPeer::isKeyDown (VK_MBUTTON)) mouseMods |= ModifierKeys::middleButtonModifier; Win32ComponentPeer::currentModifiers = Win32ComponentPeer::currentModifiers.withoutMouseButtons().withFlags (mouseMods); @@ -248247,6 +248134,32 @@ const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() throw() return Win32ComponentPeer::currentModifiers; } +bool KeyPress::isKeyCurrentlyDown (const int keyCode) +{ + SHORT k = (SHORT) keyCode; + + if ((keyCode & extendedKeyModifier) == 0 + && (k >= (SHORT) 'a' && k <= (SHORT) 'z')) + k += (SHORT) 'A' - (SHORT) 'a'; + + const SHORT translatedValues[] = { (SHORT) ',', VK_OEM_COMMA, + (SHORT) '+', VK_OEM_PLUS, + (SHORT) '-', VK_OEM_MINUS, + (SHORT) '.', VK_OEM_PERIOD, + (SHORT) ';', VK_OEM_1, + (SHORT) ':', VK_OEM_1, + (SHORT) '/', VK_OEM_2, + (SHORT) '?', VK_OEM_2, + (SHORT) '[', VK_OEM_4, + (SHORT) ']', VK_OEM_6 }; + + for (int i = 0; i < numElementsInArray (translatedValues); i += 2) + if (k == translatedValues [i]) + k = translatedValues [i + 1]; + + return Win32ComponentPeer::isKeyDown (k); +} + void SystemTrayIconComponent::setIconImage (const Image& newImage) { Win32ComponentPeer* const wp = dynamic_cast (getPeer()); diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 6cf4e0d2aa..64793f4f21 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -73,7 +73,7 @@ namespace JuceDummyNamespace {} */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 53 -#define JUCE_BUILDNUMBER 54 +#define JUCE_BUILDNUMBER 55 /** Current Juce version number. diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index 574ea8a553..c8a4ec58de 100644 --- a/src/core/juce_StandardHeader.h +++ b/src/core/juce_StandardHeader.h @@ -33,7 +33,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 53 -#define JUCE_BUILDNUMBER 54 +#define JUCE_BUILDNUMBER 55 /** Current Juce version number. diff --git a/src/native/windows/juce_win32_Windowing.cpp b/src/native/windows/juce_win32_Windowing.cpp index 5bb169c919..728afc739c 100644 --- a/src/native/windows/juce_win32_Windowing.cpp +++ b/src/native/windows/juce_win32_Windowing.cpp @@ -425,33 +425,6 @@ namespace IconConverters long improbableWindowNumber = 0xf965aa01; // also referenced by messaging.cpp -//============================================================================== -bool KeyPress::isKeyCurrentlyDown (const int keyCode) -{ - SHORT k = (SHORT) keyCode; - - if ((keyCode & extendedKeyModifier) == 0 - && (k >= (SHORT) 'a' && k <= (SHORT) 'z')) - k += (SHORT) 'A' - (SHORT) 'a'; - - const SHORT translatedValues[] = { (SHORT) ',', VK_OEM_COMMA, - (SHORT) '+', VK_OEM_PLUS, - (SHORT) '-', VK_OEM_MINUS, - (SHORT) '.', VK_OEM_PERIOD, - (SHORT) ';', VK_OEM_1, - (SHORT) ':', VK_OEM_1, - (SHORT) '/', VK_OEM_2, - (SHORT) '?', VK_OEM_2, - (SHORT) '[', VK_OEM_4, - (SHORT) ']', VK_OEM_6 }; - - for (int i = 0; i < numElementsInArray (translatedValues); i += 2) - if (k == translatedValues [i]) - k = translatedValues [i + 1]; - - return (GetKeyState (k) & 0x8000) != 0; -} - //============================================================================== class Win32ComponentPeer : public ComponentPeer { @@ -955,19 +928,21 @@ public: } //============================================================================== - bool isInside (HWND h) const + bool isInside (HWND h) const throw() { return GetAncestor (hwnd, GA_ROOT) == h; } //============================================================================== + static bool isKeyDown (const int key) throw() { return (GetAsyncKeyState (key) & 0x8000) != 0; } + static void updateKeyModifiers() throw() { int keyMods = 0; - if (GetKeyState (VK_SHIFT) & 0x8000) keyMods |= ModifierKeys::shiftModifier; - if (GetKeyState (VK_CONTROL) & 0x8000) keyMods |= ModifierKeys::ctrlModifier; - if (GetKeyState (VK_MENU) & 0x8000) keyMods |= ModifierKeys::altModifier; - if (GetKeyState (VK_RMENU) & 0x8000) keyMods &= ~(ModifierKeys::ctrlModifier | ModifierKeys::altModifier); + if (isKeyDown (VK_SHIFT)) keyMods |= ModifierKeys::shiftModifier; + if (isKeyDown (VK_CONTROL)) keyMods |= ModifierKeys::ctrlModifier; + if (isKeyDown (VK_MENU)) keyMods |= ModifierKeys::altModifier; + if (isKeyDown (VK_RMENU)) keyMods &= ~(ModifierKeys::ctrlModifier | ModifierKeys::altModifier); currentModifiers = currentModifiers.withOnlyMouseButtons().withFlags (keyMods); } @@ -2357,9 +2332,9 @@ const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() throw() Win32ComponentPeer::updateKeyModifiers(); int mouseMods = 0; - if ((GetKeyState (VK_LBUTTON) & 0x8000) != 0) mouseMods |= ModifierKeys::leftButtonModifier; - if ((GetKeyState (VK_RBUTTON) & 0x8000) != 0) mouseMods |= ModifierKeys::rightButtonModifier; - if ((GetKeyState (VK_MBUTTON) & 0x8000) != 0) mouseMods |= ModifierKeys::middleButtonModifier; + if (Win32ComponentPeer::isKeyDown (VK_LBUTTON)) mouseMods |= ModifierKeys::leftButtonModifier; + if (Win32ComponentPeer::isKeyDown (VK_RBUTTON)) mouseMods |= ModifierKeys::rightButtonModifier; + if (Win32ComponentPeer::isKeyDown (VK_MBUTTON)) mouseMods |= ModifierKeys::middleButtonModifier; Win32ComponentPeer::currentModifiers = Win32ComponentPeer::currentModifiers.withoutMouseButtons().withFlags (mouseMods); @@ -2367,6 +2342,33 @@ const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() throw() return Win32ComponentPeer::currentModifiers; } +//============================================================================== +bool KeyPress::isKeyCurrentlyDown (const int keyCode) +{ + SHORT k = (SHORT) keyCode; + + if ((keyCode & extendedKeyModifier) == 0 + && (k >= (SHORT) 'a' && k <= (SHORT) 'z')) + k += (SHORT) 'A' - (SHORT) 'a'; + + const SHORT translatedValues[] = { (SHORT) ',', VK_OEM_COMMA, + (SHORT) '+', VK_OEM_PLUS, + (SHORT) '-', VK_OEM_MINUS, + (SHORT) '.', VK_OEM_PERIOD, + (SHORT) ';', VK_OEM_1, + (SHORT) ':', VK_OEM_1, + (SHORT) '/', VK_OEM_2, + (SHORT) '?', VK_OEM_2, + (SHORT) '[', VK_OEM_4, + (SHORT) ']', VK_OEM_6 }; + + for (int i = 0; i < numElementsInArray (translatedValues); i += 2) + if (k == translatedValues [i]) + k = translatedValues [i + 1]; + + return Win32ComponentPeer::isKeyDown (k); +} + //============================================================================== void SystemTrayIconComponent::setIconImage (const Image& newImage) { diff --git a/src/text/juce_String.cpp b/src/text/juce_String.cpp index 525ea04620..6a33cc4057 100644 --- a/src/text/juce_String.cpp +++ b/src/text/juce_String.cpp @@ -511,85 +511,22 @@ int64 String::hashCode64() const throw() } //============================================================================== -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const String& string2) throw() -{ - return string1.compare (string2) == 0; -} - -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const char* const string2) throw() -{ - return string1.compare (string2) == 0; -} - -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const wchar_t* const string2) throw() -{ - return string1.compare (string2) == 0; -} - -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF8& string2) throw() -{ - return string1.getCharPointer().compare (string2) == 0; -} - -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF16& string2) throw() -{ - return string1.getCharPointer().compare (string2) == 0; -} - -JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF32& string2) throw() -{ - return string1.getCharPointer().compare (string2) == 0; -} - -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) throw() -{ - return string1.compare (string2) != 0; -} - -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const char* const string2) throw() -{ - return string1.compare (string2) != 0; -} - -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const wchar_t* const string2) throw() -{ - return string1.compare (string2) != 0; -} - -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF8& string2) throw() -{ - return string1.getCharPointer().compare (string2) != 0; -} - -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF16& string2) throw() -{ - return string1.getCharPointer().compare (string2) != 0; -} - -JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF32& string2) throw() -{ - return string1.getCharPointer().compare (string2) != 0; -} - -JUCE_API bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) throw() -{ - return string1.compare (string2) > 0; -} - -JUCE_API bool JUCE_CALLTYPE operator< (const String& string1, const String& string2) throw() -{ - return string1.compare (string2) < 0; -} - -JUCE_API bool JUCE_CALLTYPE operator>= (const String& string1, const String& string2) throw() -{ - return string1.compare (string2) >= 0; -} - -JUCE_API bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) throw() -{ - return string1.compare (string2) <= 0; -} +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const String& s2) throw() { return s1.compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const char* const s2) throw() { return s1.compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const wchar_t* const s2) throw() { return s1.compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF8& s2) throw() { return s1.getCharPointer().compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF16& s2) throw() { return s1.getCharPointer().compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF32& s2) throw() { return s1.getCharPointer().compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const String& s2) throw() { return s1.compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const char* const s2) throw() { return s1.compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const wchar_t* const s2) throw() { return s1.compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF8& s2) throw() { return s1.getCharPointer().compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF16& s2) throw() { return s1.getCharPointer().compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF32& s2) throw() { return s1.getCharPointer().compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator> (const String& s1, const String& s2) throw() { return s1.compare (s2) > 0; } +JUCE_API bool JUCE_CALLTYPE operator< (const String& s1, const String& s2) throw() { return s1.compare (s2) < 0; } +JUCE_API bool JUCE_CALLTYPE operator>= (const String& s1, const String& s2) throw() { return s1.compare (s2) >= 0; } +JUCE_API bool JUCE_CALLTYPE operator<= (const String& s1, const String& s2) throw() { return s1.compare (s2) <= 0; } bool String::equalsIgnoreCase (const wchar_t* const t) const throw() { @@ -609,25 +546,10 @@ bool String::equalsIgnoreCase (const String& other) const throw() || text.compareIgnoreCase (other.text) == 0; } -int String::compare (const String& other) const throw() -{ - return (text == other.text) ? 0 : text.compare (other.text); -} - -int String::compare (const char* const other) const throw() -{ - return text.compare (CharPointer_UTF8 (other)); -} - -int String::compare (const wchar_t* const other) const throw() -{ - return text.compare (castToCharPointer_wchar_t (other)); -} - -int String::compareIgnoreCase (const String& other) const throw() -{ - return (text == other.text) ? 0 : text.compareIgnoreCase (other.text); -} +int String::compare (const String& other) const throw() { return (text == other.text) ? 0 : text.compare (other.text); } +int String::compare (const char* const other) const throw() { return text.compare (CharPointer_UTF8 (other)); } +int String::compare (const wchar_t* const other) const throw() { return text.compare (castToCharPointer_wchar_t (other)); } +int String::compareIgnoreCase (const String& other) const throw() { return (text == other.text) ? 0 : text.compareIgnoreCase (other.text); } int String::compareLexicographically (const String& other) const throw() { @@ -743,21 +665,10 @@ JUCE_API const String JUCE_CALLTYPE operator+ (const wchar_t* const string1, con return s += string2; } -JUCE_API const String JUCE_CALLTYPE operator+ (const char string1, const String& string2) -{ - return String::charToString (string1) + string2; -} - -JUCE_API const String JUCE_CALLTYPE operator+ (const wchar_t string1, const String& string2) -{ - return String::charToString (string1) + string2; -} - +JUCE_API const String JUCE_CALLTYPE operator+ (const char s1, const String& s2) { return String::charToString (s1) + s2; } +JUCE_API const String JUCE_CALLTYPE operator+ (const wchar_t s1, const String& s2) { return String::charToString (s1) + s2; } #if ! JUCE_NATIVE_WCHAR_IS_UTF32 -JUCE_API const String JUCE_CALLTYPE operator+ (const juce_wchar string1, const String& string2) -{ - return String::charToString (string1) + string2; -} +JUCE_API const String JUCE_CALLTYPE operator+ (const juce_wchar s1, const String& s2) { return String::charToString (s1) + s2; } #endif JUCE_API const String JUCE_CALLTYPE operator+ (String s1, const String& s2) { return s1 += s2; }