1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-29 02:40:05 +00:00

Added a couple of extra StringRef and NewLine concatenation operators

This commit is contained in:
jules 2015-10-31 14:57:33 +00:00 committed by Joshua Gerrard
parent 09afb3b1c6
commit 3d3eec675e
3 changed files with 10 additions and 15 deletions

View file

@ -77,11 +77,12 @@ extern NewLine newLine;
myString << "Hello World" << newLine << newLine;
@endcode
*/
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, const NewLine&);
JUCE_API String JUCE_CALLTYPE operator+ (const NewLine&, const NewLine&);
inline String& operator<< (String& string1, const NewLine&) { return string1 += NewLine::getDefault(); }
inline String& operator+= (String& s1, const NewLine&) { return s1 += NewLine::getDefault(); }
inline String operator+ (String s1, const NewLine&) { return s1 += NewLine::getDefault(); }
inline String& operator+= (String& s1, const NewLine&) { return s1 += NewLine::getDefault(); }
inline String operator+ (const NewLine&, const NewLine&) { return String (NewLine::getDefault()) + NewLine::getDefault(); }
inline String operator+ (String s1, const NewLine&) { return s1 += NewLine::getDefault(); }
inline String operator+ (const NewLine&, const char* s2) { return String (NewLine::getDefault()) + s2; }
#endif // JUCE_NEWLINE_H_INCLUDED

View file

@ -881,16 +881,6 @@ JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, StringRef
return stream;
}
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, const NewLine&)
{
return string1 += NewLine::getDefault();
}
JUCE_API String JUCE_CALLTYPE operator+ (const NewLine&, const NewLine&)
{
return String (NewLine::getDefault()) + NewLine::getDefault();
}
//==============================================================================
int String::indexOfChar (const juce_wchar character) const noexcept
{

View file

@ -131,6 +131,10 @@ 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;
inline String operator+ (String s1, StringRef s2) { return s1 += String (s2.text); }
inline String operator+ (String s1, StringRef s2) { return s1 += String (s2.text); }
inline String operator+ (StringRef s1, const String& s2) { return String (s1.text) + s2; }
inline String operator+ (const char* s1, StringRef s2) { return String (s1) + String (s2.text); }
inline String operator+ (StringRef s1, const char* s2) { return String (s1.text) + String (s2); }
#endif // JUCE_STRINGREF_H_INCLUDED