Browse Source

Compiler fixes for String and var. Fix for TextEditor redraw problems.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
80afd8aee7
6 changed files with 81 additions and 73 deletions
  1. +7
    -5
      src/containers/juce_Variant.cpp
  2. +8
    -3
      src/containers/juce_Variant.h
  3. +1
    -1
      src/gui/components/controls/juce_TextEditor.cpp
  4. +1
    -0
      src/gui/components/layout/juce_ComponentAnimator.cpp
  5. +32
    -32
      src/text/juce_String.cpp
  6. +32
    -32
      src/text/juce_String.h

+ 7
- 5
src/containers/juce_Variant.cpp View File

@@ -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)


+ 8
- 3
src/containers/juce_Variant.h View File

@@ -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__

+ 1
- 1
src/gui/components/controls/juce_TextEditor.cpp View File

@@ -1322,7 +1322,7 @@ void TextEditor::repaintText (const Range<int>& range)
if (range.getEnd() >= getTotalNumChars())
{
y2 = getHeight();
y2 = textHolder->getHeight();
}
else
{


+ 1
- 0
src/gui/components/layout/juce_ComponentAnimator.cpp View File

@@ -28,6 +28,7 @@
BEGIN_JUCE_NAMESPACE
#include "juce_ComponentAnimator.h"
#include "../../../core/juce_Time.h"
//==============================================================================


+ 32
- 32
src/text/juce_String.cpp View File

@@ -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).


+ 32
- 32
src/text/juce_String.h View File

@@ -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 <charT, traits>& operator<< (std::basic_ostream <charT, trait
}
/** Writes a string to an OutputStream as UTF8. */
OutputStream& JUCE_PUBLIC_FUNCTION operator<< (OutputStream& stream, const String& text);
OutputStream& operator<< (OutputStream& stream, const String& text);
#endif // __JUCE_STRING_JUCEHEADER__

Loading…
Cancel
Save