diff --git a/src/containers/juce_Variant.cpp b/src/containers/juce_Variant.cpp index 9a3dddb897..7e2893a75a 100644 --- a/src/containers/juce_Variant.cpp +++ b/src/containers/juce_Variant.cpp @@ -209,7 +209,8 @@ DynamicObject* var::getObject() const return type == objectType ? value.objectValue : 0; } -bool var::operator== (const var& other) const throw() +//============================================================================== +bool var::equals (const var& other) const throw() { switch (type) { @@ -226,11 +227,12 @@ bool var::operator== (const var& other) const throw() return false; } -bool var::operator!= (const var& other) const throw() -{ - return ! operator== (other); -} +bool operator== (const var& v1, const var& v2) throw() { return v1.equals (v2); } +bool operator!= (const var& v1, const var& v2) throw() { return ! v1.equals (v2); } +bool operator== (const var& v1, const String& v2) throw() { return v1.toString() == v2; } +bool operator!= (const var& v1, const String& v2) throw() { return v1.toString() != v2; } +//============================================================================== void var::writeToStream (OutputStream& output) const { switch (type) diff --git a/src/containers/juce_Variant.h b/src/containers/juce_Variant.h index 7e9fce5095..b9051eaebd 100644 --- a/src/containers/juce_Variant.h +++ b/src/containers/juce_Variant.h @@ -96,9 +96,6 @@ public: bool isObject() const throw() { return type == objectType; } bool isMethod() const throw() { return type == methodType; } - bool operator== (const var& other) const throw(); - bool operator!= (const var& other) const throw(); - //============================================================================== /** Writes a binary representation of this value to a stream. The data can be read back later using readFromStream(). @@ -170,6 +167,9 @@ public: //============================================================================== juce_UseDebuggingNewOperator + /** Returns true if this var has the same value as the one supplied. */ + bool equals (const var& other) const throw(); + private: enum Type { @@ -196,5 +196,10 @@ private: ValueUnion value; }; +bool operator== (const var& v1, const var& v2) throw(); +bool operator!= (const var& v1, const var& v2) throw(); +bool operator== (const var& v1, const String& v2) throw(); +bool operator!= (const var& v1, const String& v2) throw(); + #endif // __JUCE_VARIANT_JUCEHEADER__ diff --git a/src/gui/components/controls/juce_TextEditor.cpp b/src/gui/components/controls/juce_TextEditor.cpp index 7ae40440b7..d1e34afb8e 100644 --- a/src/gui/components/controls/juce_TextEditor.cpp +++ b/src/gui/components/controls/juce_TextEditor.cpp @@ -1322,7 +1322,7 @@ void TextEditor::repaintText (const Range& range) if (range.getEnd() >= getTotalNumChars()) { - y2 = getHeight(); + y2 = textHolder->getHeight(); } else { diff --git a/src/gui/components/layout/juce_ComponentAnimator.cpp b/src/gui/components/layout/juce_ComponentAnimator.cpp index 6d1fb0f1b7..6742d41250 100644 --- a/src/gui/components/layout/juce_ComponentAnimator.cpp +++ b/src/gui/components/layout/juce_ComponentAnimator.cpp @@ -28,6 +28,7 @@ BEGIN_JUCE_NAMESPACE #include "juce_ComponentAnimator.h" +#include "../../../core/juce_Time.h" //============================================================================== diff --git a/src/text/juce_String.cpp b/src/text/juce_String.cpp index 92ae75dc64..517d4bb000 100644 --- a/src/text/juce_String.cpp +++ b/src/text/juce_String.cpp @@ -507,52 +507,52 @@ String& String::operator= (const String& other) throw() } //============================================================================== -bool JUCE_PUBLIC_FUNCTION operator== (const String& string1, const String& string2) throw() +bool operator== (const String& string1, const String& string2) throw() { return string1.compare (string2) == 0; } -bool JUCE_PUBLIC_FUNCTION operator== (const String& string1, const char* string2) throw() +bool operator== (const String& string1, const char* string2) throw() { return string1.compare (string2) == 0; } -bool JUCE_PUBLIC_FUNCTION operator== (const String& string1, const juce_wchar* string2) throw() +bool operator== (const String& string1, const juce_wchar* string2) throw() { return string1.compare (string2) == 0; } -bool JUCE_PUBLIC_FUNCTION operator!= (const String& string1, const String& string2) throw() +bool operator!= (const String& string1, const String& string2) throw() { return string1.compare (string2) != 0; } -bool JUCE_PUBLIC_FUNCTION operator!= (const String& string1, const char* string2) throw() +bool operator!= (const String& string1, const char* string2) throw() { return string1.compare (string2) != 0; } -bool JUCE_PUBLIC_FUNCTION operator!= (const String& string1, const juce_wchar* string2) throw() +bool operator!= (const String& string1, const juce_wchar* string2) throw() { return string1.compare (string2) != 0; } -bool JUCE_PUBLIC_FUNCTION operator> (const String& string1, const String& string2) throw() +bool operator> (const String& string1, const String& string2) throw() { return string1.compare (string2) > 0; } -bool JUCE_PUBLIC_FUNCTION operator< (const String& string1, const String& string2) throw() +bool operator< (const String& string1, const String& string2) throw() { return string1.compare (string2) < 0; } -bool JUCE_PUBLIC_FUNCTION operator>= (const String& string1, const String& string2) throw() +bool operator>= (const String& string1, const String& string2) throw() { return string1.compare (string2) >= 0; } -bool JUCE_PUBLIC_FUNCTION operator<= (const String& string1, const String& string2) throw() +bool operator<= (const String& string1, const String& string2) throw() { return string1.compare (string2) <= 0; } @@ -665,114 +665,114 @@ void String::append (const tchar* const other, const int howMany) } //============================================================================== -const String JUCE_PUBLIC_FUNCTION operator+ (const char* const string1, const String& string2) +const String operator+ (const char* const string1, const String& string2) { String s (string1); return s += string2; } -const String JUCE_PUBLIC_FUNCTION operator+ (const juce_wchar* const string1, const String& string2) +const String operator+ (const juce_wchar* const string1, const String& string2) { String s (string1); return s += string2; } -const String JUCE_PUBLIC_FUNCTION operator+ (const char string1, const String& string2) +const String operator+ (const char string1, const String& string2) { return String::charToString (string1) + string2; } -const String JUCE_PUBLIC_FUNCTION operator+ (const juce_wchar string1, const String& string2) +const String operator+ (const juce_wchar string1, const String& string2) { return String::charToString (string1) + string2; } -const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const String& string2) +const String operator+ (String string1, const String& string2) { return string1 += string2; } -const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const char* const string2) +const String operator+ (String string1, const char* const string2) { return string1 += string2; } -const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const juce_wchar* const string2) +const String operator+ (String string1, const juce_wchar* const string2) { return string1 += string2; } -const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const char string2) +const String operator+ (String string1, const char string2) { return string1 += string2; } -const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const juce_wchar string2) +const String operator+ (String string1, const juce_wchar string2) { return string1 += string2; } -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const char characterToAppend) +String& operator<< (String& string1, const char characterToAppend) { return string1 += characterToAppend; } -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const juce_wchar characterToAppend) +String& operator<< (String& string1, const juce_wchar characterToAppend) { return string1 += characterToAppend; } -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const char* const string2) +String& operator<< (String& string1, const char* const string2) { return string1 += string2; } -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const juce_wchar* const string2) +String& operator<< (String& string1, const juce_wchar* const string2) { return string1 += string2; } -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const String& string2) +String& operator<< (String& string1, const String& string2) { return string1 += string2; } -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const short number) +String& operator<< (String& string1, const short number) { return string1 += (int) number; } -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const int number) +String& operator<< (String& string1, const int number) { return string1 += number; } -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const unsigned int number) +String& operator<< (String& string1, const unsigned int number) { return string1 += number; } -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const long number) +String& operator<< (String& string1, const long number) { return string1 += (int) number; } -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const unsigned long number) +String& operator<< (String& string1, const unsigned long number) { return string1 += (unsigned int) number; } -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const float number) +String& operator<< (String& string1, const float number) { return string1 += String (number); } -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const double number) +String& operator<< (String& string1, const double number) { return string1 += String (number); } -OutputStream& JUCE_PUBLIC_FUNCTION operator<< (OutputStream& stream, const String& text) +OutputStream& operator<< (OutputStream& stream, const String& text) { // (This avoids using toUTF8() to prevent the memory bloat that it would leave behind // if lots of large, persistent strings were to be written to streams). diff --git a/src/text/juce_String.h b/src/text/juce_String.h index f4a0884569..1ef4a08f10 100644 --- a/src/text/juce_String.h +++ b/src/text/juce_String.h @@ -1072,73 +1072,73 @@ private: //============================================================================== /** Concatenates two strings. */ -const String JUCE_PUBLIC_FUNCTION operator+ (const char* string1, const String& string2); +const String operator+ (const char* string1, const String& string2); /** Concatenates two strings. */ -const String JUCE_PUBLIC_FUNCTION operator+ (const juce_wchar* string1, const String& string2); +const String operator+ (const juce_wchar* string1, const String& string2); /** Concatenates two strings. */ -const String JUCE_PUBLIC_FUNCTION operator+ (char string1, const String& string2); +const String operator+ (char string1, const String& string2); /** Concatenates two strings. */ -const String JUCE_PUBLIC_FUNCTION operator+ (juce_wchar string1, const String& string2); +const String operator+ (juce_wchar string1, const String& string2); /** Concatenates two strings. */ -const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const String& string2); +const String operator+ (String string1, const String& string2); /** Concatenates two strings. */ -const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const char* string2); +const String operator+ (String string1, const char* string2); /** Concatenates two strings. */ -const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const juce_wchar* string2); +const String operator+ (String string1, const juce_wchar* string2); /** Concatenates two strings. */ -const String JUCE_PUBLIC_FUNCTION operator+ (String string1, char characterToAppend); +const String operator+ (String string1, char characterToAppend); /** Concatenates two strings. */ -const String JUCE_PUBLIC_FUNCTION operator+ (String string1, juce_wchar characterToAppend); +const String operator+ (String string1, juce_wchar characterToAppend); //============================================================================== /** Appends a character at the end of a string. */ -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const char characterToAppend); +String& operator<< (String& string1, const char characterToAppend); /** Appends a character at the end of a string. */ -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const juce_wchar characterToAppend); +String& operator<< (String& string1, const juce_wchar characterToAppend); /** Appends a string to the end of the first one. */ -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const char* const string2); +String& operator<< (String& string1, const char* const string2); /** Appends a string to the end of the first one. */ -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const juce_wchar* const string2); +String& operator<< (String& string1, const juce_wchar* const string2); /** Appends a string to the end of the first one. */ -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const String& string2); +String& operator<< (String& string1, const String& string2); /** Appends a decimal number at the end of a string. */ -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const short number); +String& operator<< (String& string1, const short number); /** Appends a decimal number at the end of a string. */ -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const int number); +String& operator<< (String& string1, const int number); /** Appends a decimal number at the end of a string. */ -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const unsigned int number); +String& operator<< (String& string1, const unsigned int number); /** Appends a decimal number at the end of a string. */ -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const long number); +String& operator<< (String& string1, const long number); /** Appends a decimal number at the end of a string. */ -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const unsigned long number); +String& operator<< (String& string1, const unsigned long number); /** Appends a decimal number at the end of a string. */ -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const float number); +String& operator<< (String& string1, const float number); /** Appends a decimal number at the end of a string. */ -String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const double number); +String& operator<< (String& string1, const double number); //============================================================================== /** Case-sensitive comparison of two strings. */ -bool JUCE_PUBLIC_FUNCTION operator== (const String& string1, const String& string2) throw(); +bool operator== (const String& string1, const String& string2) throw(); /** Case-sensitive comparison of two strings. */ -bool JUCE_PUBLIC_FUNCTION operator== (const String& string1, const char* string2) throw(); +bool operator== (const String& string1, const char* string2) throw(); /** Case-sensitive comparison of two strings. */ -bool JUCE_PUBLIC_FUNCTION operator== (const String& string1, const juce_wchar* string2) throw(); +bool operator== (const String& string1, const juce_wchar* string2) throw(); /** Case-sensitive comparison of two strings. */ -bool JUCE_PUBLIC_FUNCTION operator!= (const String& string1, const String& string2) throw(); +bool operator!= (const String& string1, const String& string2) throw(); /** Case-sensitive comparison of two strings. */ -bool JUCE_PUBLIC_FUNCTION operator!= (const String& string1, const char* string2) throw(); +bool operator!= (const String& string1, const char* string2) throw(); /** Case-sensitive comparison of two strings. */ -bool JUCE_PUBLIC_FUNCTION operator!= (const String& string1, const juce_wchar* string2) throw(); +bool operator!= (const String& string1, const juce_wchar* string2) throw(); /** Case-sensitive comparison of two strings. */ -bool JUCE_PUBLIC_FUNCTION operator> (const String& string1, const String& string2) throw(); +bool operator> (const String& string1, const String& string2) throw(); /** Case-sensitive comparison of two strings. */ -bool JUCE_PUBLIC_FUNCTION operator< (const String& string1, const String& string2) throw(); +bool operator< (const String& string1, const String& string2) throw(); /** Case-sensitive comparison of two strings. */ -bool JUCE_PUBLIC_FUNCTION operator>= (const String& string1, const String& string2) throw(); +bool operator>= (const String& string1, const String& string2) throw(); /** Case-sensitive comparison of two strings. */ -bool JUCE_PUBLIC_FUNCTION operator<= (const String& string1, const String& string2) throw(); +bool operator<= (const String& string1, const String& string2) throw(); //============================================================================== /** This streaming override allows you to pass a juce String directly into std output streams. @@ -1151,7 +1151,7 @@ std::basic_ostream & operator<< (std::basic_ostream