| @@ -8676,14 +8676,27 @@ BEGIN_JUCE_NAMESPACE | |||||
| MemoryInputStream::MemoryInputStream (const void* const sourceData, | MemoryInputStream::MemoryInputStream (const void* const sourceData, | ||||
| const size_t sourceDataSize, | const size_t sourceDataSize, | ||||
| const bool keepInternalCopy) | const bool keepInternalCopy) | ||||
| : data ((const char*) sourceData), | |||||
| : data (static_cast <const char*> (sourceData)), | |||||
| dataSize (sourceDataSize), | dataSize (sourceDataSize), | ||||
| position (0) | position (0) | ||||
| { | { | ||||
| if (keepInternalCopy) | if (keepInternalCopy) | ||||
| { | { | ||||
| internalCopy.append (data, sourceDataSize); | internalCopy.append (data, sourceDataSize); | ||||
| data = (const char*) internalCopy.getData(); | |||||
| data = static_cast <const char*> (internalCopy.getData()); | |||||
| } | |||||
| } | |||||
| MemoryInputStream::MemoryInputStream (const MemoryBlock& sourceData, | |||||
| const bool keepInternalCopy) | |||||
| : data (static_cast <const char*> (sourceData.getData())), | |||||
| dataSize (sourceData.getSize()), | |||||
| position (0) | |||||
| { | |||||
| if (keepInternalCopy) | |||||
| { | |||||
| internalCopy = sourceData; | |||||
| data = static_cast <const char*> (internalCopy.getData()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -8696,7 +8709,7 @@ int64 MemoryInputStream::getTotalLength() | |||||
| return dataSize; | return dataSize; | ||||
| } | } | ||||
| int MemoryInputStream::read (void* buffer, int howMany) | |||||
| int MemoryInputStream::read (void* const buffer, const int howMany) | |||||
| { | { | ||||
| jassert (howMany >= 0); | jassert (howMany >= 0); | ||||
| const int num = jmin (howMany, (int) (dataSize - position)); | const int num = jmin (howMany, (int) (dataSize - position)); | ||||
| @@ -8710,10 +8723,9 @@ bool MemoryInputStream::isExhausted() | |||||
| return (position >= dataSize); | return (position >= dataSize); | ||||
| } | } | ||||
| bool MemoryInputStream::setPosition (int64 pos) | |||||
| bool MemoryInputStream::setPosition (const int64 pos) | |||||
| { | { | ||||
| position = (int) jlimit ((int64) 0, (int64) dataSize, pos); | position = (int) jlimit ((int64) 0, (int64) dataSize, pos); | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -8731,7 +8743,7 @@ BEGIN_JUCE_NAMESPACE | |||||
| MemoryOutputStream::MemoryOutputStream (const size_t initialSize, | MemoryOutputStream::MemoryOutputStream (const size_t initialSize, | ||||
| const size_t blockSizeToIncreaseBy, | const size_t blockSizeToIncreaseBy, | ||||
| MemoryBlock* const memoryBlockToWriteTo) throw() | |||||
| MemoryBlock* const memoryBlockToWriteTo) | |||||
| : data (memoryBlockToWriteTo), | : data (memoryBlockToWriteTo), | ||||
| position (0), | position (0), | ||||
| size (0), | size (0), | ||||
| @@ -8743,7 +8755,7 @@ MemoryOutputStream::MemoryOutputStream (const size_t initialSize, | |||||
| data->setSize (initialSize, false); | data->setSize (initialSize, false); | ||||
| } | } | ||||
| MemoryOutputStream::~MemoryOutputStream() throw() | |||||
| MemoryOutputStream::~MemoryOutputStream() | |||||
| { | { | ||||
| flush(); | flush(); | ||||
| } | } | ||||
| @@ -8760,7 +8772,7 @@ void MemoryOutputStream::reset() throw() | |||||
| size = 0; | size = 0; | ||||
| } | } | ||||
| bool MemoryOutputStream::write (const void* buffer, int howMany) | |||||
| bool MemoryOutputStream::write (const void* const buffer, int howMany) | |||||
| { | { | ||||
| if (howMany > 0) | if (howMany > 0) | ||||
| { | { | ||||
| @@ -8785,10 +8797,12 @@ bool MemoryOutputStream::write (const void* buffer, int howMany) | |||||
| const char* MemoryOutputStream::getData() const throw() | const char* MemoryOutputStream::getData() const throw() | ||||
| { | { | ||||
| char* const d = static_cast <char*> (data->getData()); | |||||
| if (data->getSize() > size) | if (data->getSize() > size) | ||||
| ((char*) data->getData()) [size] = 0; | |||||
| d [size] = 0; | |||||
| return (const char*) data->getData(); | |||||
| return d; | |||||
| } | } | ||||
| size_t MemoryOutputStream::getDataSize() const throw() | size_t MemoryOutputStream::getDataSize() const throw() | ||||
| @@ -10507,6 +10521,11 @@ String::String (const String& other) throw() | |||||
| StringHolder::retain (text); | StringHolder::retain (text); | ||||
| } | } | ||||
| void String::swapWith (String& other) throw() | |||||
| { | |||||
| swapVariables (text, other.text); | |||||
| } | |||||
| String& String::operator= (const String& other) throw() | String& String::operator= (const String& other) throw() | ||||
| { | { | ||||
| juce_wchar* const newText = other.text; | juce_wchar* const newText = other.text; | ||||
| @@ -10520,7 +10539,7 @@ String::String (const size_t numChars, const int /*dummyVariable*/) | |||||
| { | { | ||||
| } | } | ||||
| String::String (const char* const t) throw() | |||||
| String::String (const char* const t) | |||||
| { | { | ||||
| if (t != 0 && *t != 0) | if (t != 0 && *t != 0) | ||||
| { | { | ||||
| @@ -10534,7 +10553,7 @@ String::String (const char* const t) throw() | |||||
| } | } | ||||
| } | } | ||||
| String::String (const juce_wchar* const t) throw() | |||||
| String::String (const juce_wchar* const t) | |||||
| { | { | ||||
| if (t != 0 && *t != 0) | if (t != 0 && *t != 0) | ||||
| { | { | ||||
| @@ -10548,7 +10567,7 @@ String::String (const juce_wchar* const t) throw() | |||||
| } | } | ||||
| } | } | ||||
| String::String (const char* const t, const size_t maxChars) throw() | |||||
| String::String (const char* const t, const size_t maxChars) | |||||
| { | { | ||||
| int i; | int i; | ||||
| for (i = 0; (size_t) i < maxChars; ++i) | for (i = 0; (size_t) i < maxChars; ++i) | ||||
| @@ -10567,7 +10586,7 @@ String::String (const char* const t, const size_t maxChars) throw() | |||||
| } | } | ||||
| } | } | ||||
| String::String (const juce_wchar* const t, const size_t maxChars) throw() | |||||
| String::String (const juce_wchar* const t, const size_t maxChars) | |||||
| { | { | ||||
| int i; | int i; | ||||
| for (i = 0; (size_t) i < maxChars; ++i) | for (i = 0; (size_t) i < maxChars; ++i) | ||||
| @@ -10586,7 +10605,7 @@ String::String (const juce_wchar* const t, const size_t maxChars) throw() | |||||
| } | } | ||||
| } | } | ||||
| const String String::charToString (const juce_wchar character) throw() | |||||
| const String String::charToString (const juce_wchar character) | |||||
| { | { | ||||
| juce_wchar temp[] = { character, 0 }; | juce_wchar temp[] = { character, 0 }; | ||||
| return String (temp); | return String (temp); | ||||
| @@ -10710,7 +10729,7 @@ namespace NumberToStringConverters | |||||
| } | } | ||||
| } | } | ||||
| String::String (const int number) throw() | |||||
| String::String (const int number) | |||||
| { | { | ||||
| juce_wchar buffer [16]; | juce_wchar buffer [16]; | ||||
| juce_wchar* const end = buffer + numElementsInArray (buffer); | juce_wchar* const end = buffer + numElementsInArray (buffer); | ||||
| @@ -10718,7 +10737,7 @@ String::String (const int number) throw() | |||||
| createInternal (start, end - start - 1); | createInternal (start, end - start - 1); | ||||
| } | } | ||||
| String::String (const unsigned int number) throw() | |||||
| String::String (const unsigned int number) | |||||
| { | { | ||||
| juce_wchar buffer [16]; | juce_wchar buffer [16]; | ||||
| juce_wchar* const end = buffer + numElementsInArray (buffer); | juce_wchar* const end = buffer + numElementsInArray (buffer); | ||||
| @@ -10726,7 +10745,7 @@ String::String (const unsigned int number) throw() | |||||
| createInternal (start, end - start - 1); | createInternal (start, end - start - 1); | ||||
| } | } | ||||
| String::String (const short number) throw() | |||||
| String::String (const short number) | |||||
| { | { | ||||
| juce_wchar buffer [16]; | juce_wchar buffer [16]; | ||||
| juce_wchar* const end = buffer + numElementsInArray (buffer); | juce_wchar* const end = buffer + numElementsInArray (buffer); | ||||
| @@ -10734,7 +10753,7 @@ String::String (const short number) throw() | |||||
| createInternal (start, end - start - 1); | createInternal (start, end - start - 1); | ||||
| } | } | ||||
| String::String (const unsigned short number) throw() | |||||
| String::String (const unsigned short number) | |||||
| { | { | ||||
| juce_wchar buffer [16]; | juce_wchar buffer [16]; | ||||
| juce_wchar* const end = buffer + numElementsInArray (buffer); | juce_wchar* const end = buffer + numElementsInArray (buffer); | ||||
| @@ -10742,7 +10761,7 @@ String::String (const unsigned short number) throw() | |||||
| createInternal (start, end - start - 1); | createInternal (start, end - start - 1); | ||||
| } | } | ||||
| String::String (const int64 number) throw() | |||||
| String::String (const int64 number) | |||||
| { | { | ||||
| juce_wchar buffer [32]; | juce_wchar buffer [32]; | ||||
| juce_wchar* const end = buffer + numElementsInArray (buffer); | juce_wchar* const end = buffer + numElementsInArray (buffer); | ||||
| @@ -10750,7 +10769,7 @@ String::String (const int64 number) throw() | |||||
| createInternal (start, end - start - 1); | createInternal (start, end - start - 1); | ||||
| } | } | ||||
| String::String (const uint64 number) throw() | |||||
| String::String (const uint64 number) | |||||
| { | { | ||||
| juce_wchar buffer [32]; | juce_wchar buffer [32]; | ||||
| juce_wchar* const end = buffer + numElementsInArray (buffer); | juce_wchar* const end = buffer + numElementsInArray (buffer); | ||||
| @@ -10758,7 +10777,7 @@ String::String (const uint64 number) throw() | |||||
| createInternal (start, end - start - 1); | createInternal (start, end - start - 1); | ||||
| } | } | ||||
| String::String (const float number, const int numberOfDecimalPlaces) throw() | |||||
| String::String (const float number, const int numberOfDecimalPlaces) | |||||
| { | { | ||||
| juce_wchar buffer [48]; | juce_wchar buffer [48]; | ||||
| size_t len; | size_t len; | ||||
| @@ -10766,7 +10785,7 @@ String::String (const float number, const int numberOfDecimalPlaces) throw() | |||||
| createInternal (start, len); | createInternal (start, len); | ||||
| } | } | ||||
| String::String (const double number, const int numberOfDecimalPlaces) throw() | |||||
| String::String (const double number, const int numberOfDecimalPlaces) | |||||
| { | { | ||||
| juce_wchar buffer [48]; | juce_wchar buffer [48]; | ||||
| size_t len; | size_t len; | ||||
| @@ -11441,9 +11460,8 @@ const String String::paddedRight (const juce_wchar padCharacter, int minimumLeng | |||||
| return *this + String::empty.paddedLeft (padCharacter, paddingNeeded); | return *this + String::empty.paddedLeft (padCharacter, paddingNeeded); | ||||
| } | } | ||||
| const String String::replaceSection (int index, | |||||
| int numCharsToReplace, | |||||
| const juce_wchar* const stringToInsert) const throw() | |||||
| const String String::replaceSection (int index, int numCharsToReplace, | |||||
| const juce_wchar* const stringToInsert) const | |||||
| { | { | ||||
| if (index < 0) | if (index < 0) | ||||
| { | { | ||||
| @@ -11502,7 +11520,7 @@ const String String::replaceSection (int index, | |||||
| const String String::replace (const juce_wchar* const stringToReplace, | const String String::replace (const juce_wchar* const stringToReplace, | ||||
| const juce_wchar* const stringToInsert, | const juce_wchar* const stringToInsert, | ||||
| const bool ignoreCase) const throw() | |||||
| const bool ignoreCase) const | |||||
| { | { | ||||
| const int stringToReplaceLen = CharacterFunctions::length (stringToReplace); | const int stringToReplaceLen = CharacterFunctions::length (stringToReplace); | ||||
| const int stringToInsertLen = CharacterFunctions::length (stringToInsert); | const int stringToInsertLen = CharacterFunctions::length (stringToInsert); | ||||
| @@ -11520,8 +11538,7 @@ const String String::replace (const juce_wchar* const stringToReplace, | |||||
| return result; | return result; | ||||
| } | } | ||||
| const String String::replaceCharacter (const juce_wchar charToReplace, | |||||
| const juce_wchar charToInsert) const throw() | |||||
| const String String::replaceCharacter (const juce_wchar charToReplace, const juce_wchar charToInsert) const | |||||
| { | { | ||||
| const int index = indexOfChar (charToReplace); | const int index = indexOfChar (charToReplace); | ||||
| @@ -11545,7 +11562,7 @@ const String String::replaceCharacter (const juce_wchar charToReplace, | |||||
| } | } | ||||
| const String String::replaceCharacters (const String& charactersToReplace, | const String String::replaceCharacters (const String& charactersToReplace, | ||||
| const juce_wchar* const charactersToInsertInstead) const throw() | |||||
| const juce_wchar* const charactersToInsertInstead) const | |||||
| { | { | ||||
| String result (*this); | String result (*this); | ||||
| result.dupeInternalIfMultiplyReferenced(); | result.dupeInternalIfMultiplyReferenced(); | ||||
| @@ -11620,7 +11637,7 @@ bool String::endsWithIgnoreCase (const juce_wchar* const other) const throw() | |||||
| && CharacterFunctions::compareIgnoreCase (text + thisLen - otherLen, other) == 0; | && CharacterFunctions::compareIgnoreCase (text + thisLen - otherLen, other) == 0; | ||||
| } | } | ||||
| const String String::toUpperCase() const throw() | |||||
| const String String::toUpperCase() const | |||||
| { | { | ||||
| String result (*this); | String result (*this); | ||||
| result.dupeInternalIfMultiplyReferenced(); | result.dupeInternalIfMultiplyReferenced(); | ||||
| @@ -11628,7 +11645,7 @@ const String String::toUpperCase() const throw() | |||||
| return result; | return result; | ||||
| } | } | ||||
| const String String::toLowerCase() const throw() | |||||
| const String String::toLowerCase() const | |||||
| { | { | ||||
| String result (*this); | String result (*this); | ||||
| result.dupeInternalIfMultiplyReferenced(); | result.dupeInternalIfMultiplyReferenced(); | ||||
| @@ -11636,7 +11653,7 @@ const String String::toLowerCase() const throw() | |||||
| return result; | return result; | ||||
| } | } | ||||
| juce_wchar& String::operator[] (const int index) throw() | |||||
| juce_wchar& String::operator[] (const int index) | |||||
| { | { | ||||
| jassert (((unsigned int) index) <= (unsigned int) length()); | jassert (((unsigned int) index) <= (unsigned int) length()); | ||||
| @@ -11647,11 +11664,10 @@ juce_wchar& String::operator[] (const int index) throw() | |||||
| juce_wchar String::getLastCharacter() const throw() | juce_wchar String::getLastCharacter() const throw() | ||||
| { | { | ||||
| return (isEmpty()) ? ((juce_wchar) 0) | |||||
| : text [length() - 1]; | |||||
| return isEmpty() ? juce_wchar() : text [length() - 1]; | |||||
| } | } | ||||
| const String String::substring (int start, int end) const throw() | |||||
| const String String::substring (int start, int end) const | |||||
| { | { | ||||
| if (start < 0) | if (start < 0) | ||||
| start = 0; | start = 0; | ||||
| @@ -11672,11 +11688,10 @@ const String String::substring (int start, int end) const throw() | |||||
| end = len; | end = len; | ||||
| } | } | ||||
| return String (text + start, | |||||
| end - start); | |||||
| return String (text + start, end - start); | |||||
| } | } | ||||
| const String String::substring (const int start) const throw() | |||||
| const String String::substring (const int start) const | |||||
| { | { | ||||
| if (start <= 0) | if (start <= 0) | ||||
| return *this; | return *this; | ||||
| @@ -11689,19 +11704,19 @@ const String String::substring (const int start) const throw() | |||||
| return String (text + start, len - start); | return String (text + start, len - start); | ||||
| } | } | ||||
| const String String::dropLastCharacters (const int numberToDrop) const throw() | |||||
| const String String::dropLastCharacters (const int numberToDrop) const | |||||
| { | { | ||||
| return String (text, jmax (0, length() - numberToDrop)); | return String (text, jmax (0, length() - numberToDrop)); | ||||
| } | } | ||||
| const String String::getLastCharacters (const int numCharacters) const throw() | |||||
| const String String::getLastCharacters (const int numCharacters) const | |||||
| { | { | ||||
| return String (text + jmax (0, length() - jmax (0, numCharacters))); | return String (text + jmax (0, length() - jmax (0, numCharacters))); | ||||
| } | } | ||||
| const String String::fromFirstOccurrenceOf (const juce_wchar* const sub, | const String String::fromFirstOccurrenceOf (const juce_wchar* const sub, | ||||
| const bool includeSubString, | const bool includeSubString, | ||||
| const bool ignoreCase) const throw() | |||||
| const bool ignoreCase) const | |||||
| { | { | ||||
| const int i = ignoreCase ? indexOfIgnoreCase (sub) | const int i = ignoreCase ? indexOfIgnoreCase (sub) | ||||
| : indexOf (sub); | : indexOf (sub); | ||||
| @@ -11714,7 +11729,7 @@ const String String::fromFirstOccurrenceOf (const juce_wchar* const sub, | |||||
| const String String::fromLastOccurrenceOf (const juce_wchar* const sub, | const String String::fromLastOccurrenceOf (const juce_wchar* const sub, | ||||
| const bool includeSubString, | const bool includeSubString, | ||||
| const bool ignoreCase) const throw() | |||||
| const bool ignoreCase) const | |||||
| { | { | ||||
| const int i = ignoreCase ? lastIndexOfIgnoreCase (sub) | const int i = ignoreCase ? lastIndexOfIgnoreCase (sub) | ||||
| : lastIndexOf (sub); | : lastIndexOf (sub); | ||||
| @@ -11727,7 +11742,7 @@ const String String::fromLastOccurrenceOf (const juce_wchar* const sub, | |||||
| const String String::upToFirstOccurrenceOf (const juce_wchar* const sub, | const String String::upToFirstOccurrenceOf (const juce_wchar* const sub, | ||||
| const bool includeSubString, | const bool includeSubString, | ||||
| const bool ignoreCase) const throw() | |||||
| const bool ignoreCase) const | |||||
| { | { | ||||
| const int i = ignoreCase ? indexOfIgnoreCase (sub) | const int i = ignoreCase ? indexOfIgnoreCase (sub) | ||||
| : indexOf (sub); | : indexOf (sub); | ||||
| @@ -11740,7 +11755,7 @@ const String String::upToFirstOccurrenceOf (const juce_wchar* const sub, | |||||
| const String String::upToLastOccurrenceOf (const juce_wchar* const sub, | const String String::upToLastOccurrenceOf (const juce_wchar* const sub, | ||||
| const bool includeSubString, | const bool includeSubString, | ||||
| const bool ignoreCase) const throw() | |||||
| const bool ignoreCase) const | |||||
| { | { | ||||
| const int i = ignoreCase ? lastIndexOfIgnoreCase (sub) | const int i = ignoreCase ? lastIndexOfIgnoreCase (sub) | ||||
| : lastIndexOf (sub); | : lastIndexOf (sub); | ||||
| @@ -11750,7 +11765,7 @@ const String String::upToLastOccurrenceOf (const juce_wchar* const sub, | |||||
| return substring (0, includeSubString ? i + CharacterFunctions::length (sub) : i); | return substring (0, includeSubString ? i + CharacterFunctions::length (sub) : i); | ||||
| } | } | ||||
| bool String::isQuotedString() const throw() | |||||
| bool String::isQuotedString() const | |||||
| { | { | ||||
| const String trimmed (trimStart()); | const String trimmed (trimStart()); | ||||
| @@ -11758,7 +11773,7 @@ bool String::isQuotedString() const throw() | |||||
| || trimmed[0] == T('\''); | || trimmed[0] == T('\''); | ||||
| } | } | ||||
| const String String::unquoted() const throw() | |||||
| const String String::unquoted() const | |||||
| { | { | ||||
| String s (*this); | String s (*this); | ||||
| @@ -11774,7 +11789,7 @@ const String String::unquoted() const throw() | |||||
| return s; | return s; | ||||
| } | } | ||||
| const String String::quoted (const juce_wchar quoteCharacter) const throw() | |||||
| const String String::quoted (const juce_wchar quoteCharacter) const | |||||
| { | { | ||||
| if (isEmpty()) | if (isEmpty()) | ||||
| return charToString (quoteCharacter) + quoteCharacter; | return charToString (quoteCharacter) + quoteCharacter; | ||||
| @@ -11790,7 +11805,7 @@ const String String::quoted (const juce_wchar quoteCharacter) const throw() | |||||
| return t; | return t; | ||||
| } | } | ||||
| const String String::trim() const throw() | |||||
| const String String::trim() const | |||||
| { | { | ||||
| if (isEmpty()) | if (isEmpty()) | ||||
| return empty; | return empty; | ||||
| @@ -11816,7 +11831,7 @@ const String String::trim() const throw() | |||||
| return *this; | return *this; | ||||
| } | } | ||||
| const String String::trimStart() const throw() | |||||
| const String String::trimStart() const | |||||
| { | { | ||||
| if (isEmpty()) | if (isEmpty()) | ||||
| return empty; | return empty; | ||||
| @@ -11832,7 +11847,7 @@ const String String::trimStart() const throw() | |||||
| return String (t); | return String (t); | ||||
| } | } | ||||
| const String String::trimEnd() const throw() | |||||
| const String String::trimEnd() const | |||||
| { | { | ||||
| if (isEmpty()) | if (isEmpty()) | ||||
| return empty; | return empty; | ||||
| @@ -11845,7 +11860,7 @@ const String String::trimEnd() const throw() | |||||
| return String (text, (int) (++endT - text)); | return String (text, (int) (++endT - text)); | ||||
| } | } | ||||
| const String String::trimCharactersAtStart (const juce_wchar* charactersToTrim) const throw() | |||||
| const String String::trimCharactersAtStart (const juce_wchar* charactersToTrim) const | |||||
| { | { | ||||
| jassert (charactersToTrim != 0); | jassert (charactersToTrim != 0); | ||||
| @@ -11863,7 +11878,7 @@ const String String::trimCharactersAtStart (const juce_wchar* charactersToTrim) | |||||
| return String (t); | return String (t); | ||||
| } | } | ||||
| const String String::trimCharactersAtEnd (const juce_wchar* charactersToTrim) const throw() | |||||
| const String String::trimCharactersAtEnd (const juce_wchar* charactersToTrim) const | |||||
| { | { | ||||
| jassert (charactersToTrim != 0); | jassert (charactersToTrim != 0); | ||||
| @@ -11878,7 +11893,7 @@ const String String::trimCharactersAtEnd (const juce_wchar* charactersToTrim) co | |||||
| return String (text, (int) (++endT - text)); | return String (text, (int) (++endT - text)); | ||||
| } | } | ||||
| const String String::retainCharacters (const juce_wchar* const charactersToRetain) const throw() | |||||
| const String String::retainCharacters (const juce_wchar* const charactersToRetain) const | |||||
| { | { | ||||
| jassert (charactersToRetain != 0); | jassert (charactersToRetain != 0); | ||||
| @@ -11901,7 +11916,7 @@ const String String::retainCharacters (const juce_wchar* const charactersToRetai | |||||
| return result; | return result; | ||||
| } | } | ||||
| const String String::removeCharacters (const juce_wchar* const charactersToRemove) const throw() | |||||
| const String String::removeCharacters (const juce_wchar* const charactersToRemove) const | |||||
| { | { | ||||
| jassert (charactersToRemove != 0); | jassert (charactersToRemove != 0); | ||||
| @@ -11924,12 +11939,12 @@ const String String::removeCharacters (const juce_wchar* const charactersToRemov | |||||
| return result; | return result; | ||||
| } | } | ||||
| const String String::initialSectionContainingOnly (const juce_wchar* const permittedCharacters) const throw() | |||||
| const String String::initialSectionContainingOnly (const juce_wchar* const permittedCharacters) const | |||||
| { | { | ||||
| return substring (0, CharacterFunctions::getIntialSectionContainingOnly (text, permittedCharacters)); | return substring (0, CharacterFunctions::getIntialSectionContainingOnly (text, permittedCharacters)); | ||||
| } | } | ||||
| const String String::initialSectionNotContaining (const juce_wchar* const charactersToStopAt) const throw() | |||||
| const String String::initialSectionNotContaining (const juce_wchar* const charactersToStopAt) const | |||||
| { | { | ||||
| jassert (charactersToStopAt != 0); | jassert (charactersToStopAt != 0); | ||||
| @@ -12031,7 +12046,7 @@ double String::getDoubleValue() const throw() | |||||
| static const juce_wchar* const hexDigits = T("0123456789abcdef"); | static const juce_wchar* const hexDigits = T("0123456789abcdef"); | ||||
| const String String::toHexString (const int number) throw() | |||||
| const String String::toHexString (const int number) | |||||
| { | { | ||||
| juce_wchar buffer[32]; | juce_wchar buffer[32]; | ||||
| juce_wchar* const end = buffer + 32; | juce_wchar* const end = buffer + 32; | ||||
| @@ -12049,7 +12064,7 @@ const String String::toHexString (const int number) throw() | |||||
| return String (t, (int) (((char*) end) - (char*) t) - 1); | return String (t, (int) (((char*) end) - (char*) t) - 1); | ||||
| } | } | ||||
| const String String::toHexString (const int64 number) throw() | |||||
| const String String::toHexString (const int64 number) | |||||
| { | { | ||||
| juce_wchar buffer[32]; | juce_wchar buffer[32]; | ||||
| juce_wchar* const end = buffer + 32; | juce_wchar* const end = buffer + 32; | ||||
| @@ -12067,14 +12082,14 @@ const String String::toHexString (const int64 number) throw() | |||||
| return String (t, (int) (((char*) end) - (char*) t)); | return String (t, (int) (((char*) end) - (char*) t)); | ||||
| } | } | ||||
| const String String::toHexString (const short number) throw() | |||||
| const String String::toHexString (const short number) | |||||
| { | { | ||||
| return toHexString ((int) (unsigned short) number); | return toHexString ((int) (unsigned short) number); | ||||
| } | } | ||||
| const String String::toHexString (const unsigned char* data, | const String String::toHexString (const unsigned char* data, | ||||
| const int size, | const int size, | ||||
| const int groupSize) throw() | |||||
| const int groupSize) | |||||
| { | { | ||||
| if (size <= 0) | if (size <= 0) | ||||
| return empty; | return empty; | ||||
| @@ -12141,8 +12156,7 @@ int64 String::getHexValue64() const throw() | |||||
| return result; | return result; | ||||
| } | } | ||||
| const String String::createStringFromData (const void* const data_, | |||||
| const int size) throw() | |||||
| const String String::createStringFromData (const void* const data_, const int size) | |||||
| { | { | ||||
| const char* const data = (const char*) data_; | const char* const data = (const char*) data_; | ||||
| @@ -12750,40 +12764,32 @@ const String StringArray::joinIntoString (const String& separator, int start, in | |||||
| return result; | return result; | ||||
| } | } | ||||
| int StringArray::addTokens (const tchar* const text, const bool preserveQuotedStrings) | |||||
| int StringArray::addTokens (const String& text, const bool preserveQuotedStrings) | |||||
| { | { | ||||
| return addTokens (text, | |||||
| T(" \n\r\t"), | |||||
| preserveQuotedStrings ? T("\"") : 0); | |||||
| return addTokens (text, T(" \n\r\t"), preserveQuotedStrings ? T("\"") : 0); | |||||
| } | } | ||||
| int StringArray::addTokens (const tchar* const text, const tchar* breakCharacters, const tchar* quoteCharacters) | |||||
| int StringArray::addTokens (const String& text, const String& breakCharacters, const String& quoteCharacters) | |||||
| { | { | ||||
| int num = 0; | int num = 0; | ||||
| if (text != 0 && *text != 0) | |||||
| if (text.isNotEmpty()) | |||||
| { | { | ||||
| if (breakCharacters == 0) | |||||
| breakCharacters = T(""); | |||||
| if (quoteCharacters == 0) | |||||
| quoteCharacters = T(""); | |||||
| bool insideQuotes = false; | bool insideQuotes = false; | ||||
| tchar currentQuoteChar = 0; | |||||
| juce_wchar currentQuoteChar = 0; | |||||
| int i = 0; | int i = 0; | ||||
| int tokenStart = 0; | int tokenStart = 0; | ||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| const tchar c = text[i]; | |||||
| const juce_wchar c = text[i]; | |||||
| bool isBreak = (c == 0); | bool isBreak = (c == 0); | ||||
| if (! (insideQuotes || isBreak)) | if (! (insideQuotes || isBreak)) | ||||
| { | { | ||||
| const tchar* b = breakCharacters; | |||||
| const juce_wchar* b = breakCharacters; | |||||
| while (*b != 0) | while (*b != 0) | ||||
| { | { | ||||
| if (*b++ == c) | if (*b++ == c) | ||||
| @@ -12797,7 +12803,7 @@ int StringArray::addTokens (const tchar* const text, const tchar* breakCharacter | |||||
| if (! isBreak) | if (! isBreak) | ||||
| { | { | ||||
| bool isQuote = false; | bool isQuote = false; | ||||
| const tchar* q = quoteCharacters; | |||||
| const juce_wchar* q = quoteCharacters; | |||||
| while (*q != 0) | while (*q != 0) | ||||
| { | { | ||||
| if (*q++ == c) | if (*q++ == c) | ||||
| @@ -12825,7 +12831,7 @@ int StringArray::addTokens (const tchar* const text, const tchar* breakCharacter | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| add (String (text + tokenStart, i - tokenStart)); | |||||
| add (String (static_cast <const juce_wchar*> (text) + tokenStart, i - tokenStart)); | |||||
| ++num; | ++num; | ||||
| tokenStart = i + 1; | tokenStart = i + 1; | ||||
| @@ -12841,47 +12847,45 @@ int StringArray::addTokens (const tchar* const text, const tchar* breakCharacter | |||||
| return num; | return num; | ||||
| } | } | ||||
| int StringArray::addLines (const tchar* text) | |||||
| int StringArray::addLines (const String& sourceText) | |||||
| { | { | ||||
| int numLines = 0; | int numLines = 0; | ||||
| const juce_wchar* text = sourceText; | |||||
| if (text != 0) | |||||
| while (*text != 0) | |||||
| { | { | ||||
| const juce_wchar* const startOfLine = text; | |||||
| while (*text != 0) | while (*text != 0) | ||||
| { | { | ||||
| const tchar* const startOfLine = text; | |||||
| while (*text != 0) | |||||
| if (*text == T('\r')) | |||||
| { | { | ||||
| if (*text == T('\r')) | |||||
| { | |||||
| ++text; | |||||
| if (*text == T('\n')) | |||||
| ++text; | |||||
| break; | |||||
| } | |||||
| ++text; | |||||
| if (*text == T('\n')) | if (*text == T('\n')) | ||||
| { | |||||
| ++text; | ++text; | ||||
| break; | |||||
| } | |||||
| break; | |||||
| } | |||||
| if (*text == T('\n')) | |||||
| { | |||||
| ++text; | ++text; | ||||
| break; | |||||
| } | } | ||||
| const tchar* endOfLine = text; | |||||
| if (endOfLine > startOfLine && (*(endOfLine - 1) == T('\r') || *(endOfLine - 1) == T('\n'))) | |||||
| --endOfLine; | |||||
| ++text; | |||||
| } | |||||
| const juce_wchar* endOfLine = text; | |||||
| if (endOfLine > startOfLine && (*(endOfLine - 1) == T('\r') || *(endOfLine - 1) == T('\n'))) | |||||
| --endOfLine; | |||||
| if (endOfLine > startOfLine && (*(endOfLine - 1) == T('\r') || *(endOfLine - 1) == T('\n'))) | |||||
| --endOfLine; | |||||
| if (endOfLine > startOfLine && (*(endOfLine - 1) == T('\r') || *(endOfLine - 1) == T('\n'))) | |||||
| --endOfLine; | |||||
| add (String (startOfLine, jmax (0, (int) (endOfLine - startOfLine)))); | |||||
| add (String (startOfLine, jmax (0, (int) (endOfLine - startOfLine)))); | |||||
| ++numLines; | |||||
| } | |||||
| ++numLines; | |||||
| } | } | ||||
| return numLines; | return numLines; | ||||
| @@ -13098,7 +13102,7 @@ void XmlDocument::setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw | |||||
| ignoreEmptyTextElements = shouldBeIgnored; | ignoreEmptyTextElements = shouldBeIgnored; | ||||
| } | } | ||||
| bool XmlDocument::isXmlIdentifierCharSlow (const tchar c) throw() | |||||
| bool XmlDocument::isXmlIdentifierCharSlow (const juce_wchar c) throw() | |||||
| { | { | ||||
| return CharacterFunctions::isLetterOrDigit (c) | return CharacterFunctions::isLetterOrDigit (c) | ||||
| || c == T('_') | || c == T('_') | ||||
| @@ -13107,7 +13111,7 @@ bool XmlDocument::isXmlIdentifierCharSlow (const tchar c) throw() | |||||
| || c == T('.'); | || c == T('.'); | ||||
| } | } | ||||
| inline bool XmlDocument::isXmlIdentifierChar (const tchar c) const throw() | |||||
| inline bool XmlDocument::isXmlIdentifierChar (const juce_wchar c) const throw() | |||||
| { | { | ||||
| return (c > 0 && c <= 127) ? identifierLookupTable [(int) c] | return (c > 0 && c <= 127) ? identifierLookupTable [(int) c] | ||||
| : isXmlIdentifierCharSlow (c); | : isXmlIdentifierCharSlow (c); | ||||
| @@ -13150,7 +13154,7 @@ XmlElement* XmlDocument::getDocumentElement (const bool onlyReadOuterDocumentEle | |||||
| needToLoadDTD = true; | needToLoadDTD = true; | ||||
| for (int i = 0; i < 128; ++i) | for (int i = 0; i < 128; ++i) | ||||
| identifierLookupTable[i] = isXmlIdentifierCharSlow ((tchar) i); | |||||
| identifierLookupTable[i] = isXmlIdentifierCharSlow ((juce_wchar) i); | |||||
| if (textToParse.isEmpty()) | if (textToParse.isEmpty()) | ||||
| { | { | ||||
| @@ -13200,7 +13204,7 @@ const String XmlDocument::getFileContents (const String& filename) const | |||||
| return String::empty; | return String::empty; | ||||
| } | } | ||||
| tchar XmlDocument::readNextChar() throw() | |||||
| juce_wchar XmlDocument::readNextChar() throw() | |||||
| { | { | ||||
| if (*input != 0) | if (*input != 0) | ||||
| { | { | ||||
| @@ -13216,7 +13220,7 @@ tchar XmlDocument::readNextChar() throw() | |||||
| int XmlDocument::findNextTokenLength() throw() | int XmlDocument::findNextTokenLength() throw() | ||||
| { | { | ||||
| int len = 0; | int len = 0; | ||||
| tchar c = *input; | |||||
| juce_wchar c = *input; | |||||
| while (isXmlIdentifierChar (c)) | while (isXmlIdentifierChar (c)) | ||||
| c = input [++len]; | c = input [++len]; | ||||
| @@ -13226,7 +13230,7 @@ int XmlDocument::findNextTokenLength() throw() | |||||
| void XmlDocument::skipHeader() throw() | void XmlDocument::skipHeader() throw() | ||||
| { | { | ||||
| const tchar* const found = CharacterFunctions::find (input, T("<?xml")); | |||||
| const juce_wchar* const found = CharacterFunctions::find (input, T("<?xml")); | |||||
| if (found != 0) | if (found != 0) | ||||
| { | { | ||||
| @@ -13240,7 +13244,7 @@ void XmlDocument::skipHeader() throw() | |||||
| } | } | ||||
| skipNextWhiteSpace(); | skipNextWhiteSpace(); | ||||
| const tchar* docType = CharacterFunctions::find (input, T("<!DOCTYPE")); | |||||
| const juce_wchar* docType = CharacterFunctions::find (input, T("<!DOCTYPE")); | |||||
| if (docType == 0) | if (docType == 0) | ||||
| return; | return; | ||||
| @@ -13251,7 +13255,7 @@ void XmlDocument::skipHeader() throw() | |||||
| while (n > 0) | while (n > 0) | ||||
| { | { | ||||
| const tchar c = readNextChar(); | |||||
| const juce_wchar c = readNextChar(); | |||||
| if (outOfData) | if (outOfData) | ||||
| return; | return; | ||||
| @@ -13270,7 +13274,7 @@ void XmlDocument::skipNextWhiteSpace() throw() | |||||
| { | { | ||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| tchar c = *input; | |||||
| juce_wchar c = *input; | |||||
| while (CharacterFunctions::isWhitespace (c)) | while (CharacterFunctions::isWhitespace (c)) | ||||
| c = *++input; | c = *++input; | ||||
| @@ -13286,7 +13290,7 @@ void XmlDocument::skipNextWhiteSpace() throw() | |||||
| && input[2] == T('-') | && input[2] == T('-') | ||||
| && input[3] == T('-')) | && input[3] == T('-')) | ||||
| { | { | ||||
| const tchar* const closeComment = CharacterFunctions::find (input, T("-->")); | |||||
| const juce_wchar* const closeComment = CharacterFunctions::find (input, T("-->")); | |||||
| if (closeComment == 0) | if (closeComment == 0) | ||||
| { | { | ||||
| @@ -13299,7 +13303,7 @@ void XmlDocument::skipNextWhiteSpace() throw() | |||||
| } | } | ||||
| else if (input[1] == T('?')) | else if (input[1] == T('?')) | ||||
| { | { | ||||
| const tchar* const closeBracket = CharacterFunctions::find (input, T("?>")); | |||||
| const juce_wchar* const closeBracket = CharacterFunctions::find (input, T("?>")); | |||||
| if (closeBracket == 0) | if (closeBracket == 0) | ||||
| { | { | ||||
| @@ -13318,11 +13322,11 @@ void XmlDocument::skipNextWhiteSpace() throw() | |||||
| void XmlDocument::readQuotedString (String& result) throw() | void XmlDocument::readQuotedString (String& result) throw() | ||||
| { | { | ||||
| const tchar quote = readNextChar(); | |||||
| const juce_wchar quote = readNextChar(); | |||||
| while (! outOfData) | while (! outOfData) | ||||
| { | { | ||||
| const tchar c = readNextChar(); | |||||
| const juce_wchar c = readNextChar(); | |||||
| if (c == quote) | if (c == quote) | ||||
| break; | break; | ||||
| @@ -13335,11 +13339,11 @@ void XmlDocument::readQuotedString (String& result) throw() | |||||
| else | else | ||||
| { | { | ||||
| --input; | --input; | ||||
| const tchar* const start = input; | |||||
| const juce_wchar* const start = input; | |||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| const tchar character = *input; | |||||
| const juce_wchar character = *input; | |||||
| if (character == quote) | if (character == quote) | ||||
| { | { | ||||
| @@ -13403,7 +13407,7 @@ XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements) throw | |||||
| { | { | ||||
| skipNextWhiteSpace(); | skipNextWhiteSpace(); | ||||
| const tchar c = *input; | |||||
| const juce_wchar c = *input; | |||||
| // empty tag.. | // empty tag.. | ||||
| if (c == T('/') && input[1] == T('>')) | if (c == T('/') && input[1] == T('>')) | ||||
| @@ -13431,7 +13435,7 @@ XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements) throw | |||||
| if (attNameLen > 0) | if (attNameLen > 0) | ||||
| { | { | ||||
| const tchar* attNameStart = input; | |||||
| const juce_wchar* attNameStart = input; | |||||
| input += attNameLen; | input += attNameLen; | ||||
| skipNextWhiteSpace(); | skipNextWhiteSpace(); | ||||
| @@ -13440,7 +13444,7 @@ XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements) throw | |||||
| { | { | ||||
| skipNextWhiteSpace(); | skipNextWhiteSpace(); | ||||
| const tchar nextChar = *input; | |||||
| const juce_wchar nextChar = *input; | |||||
| if (nextChar == T('"') || nextChar == T('\'')) | if (nextChar == T('"') || nextChar == T('\'')) | ||||
| { | { | ||||
| @@ -13508,7 +13512,7 @@ void XmlDocument::readChildElements (XmlElement* parent) throw() | |||||
| && input[8] == T('[')) | && input[8] == T('[')) | ||||
| { | { | ||||
| input += 9; | input += 9; | ||||
| const tchar* const inputStart = input; | |||||
| const juce_wchar* const inputStart = input; | |||||
| int len = 0; | int len = 0; | ||||
| @@ -13578,7 +13582,7 @@ void XmlDocument::readChildElements (XmlElement* parent) throw() | |||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| const tchar c = *input; | |||||
| const juce_wchar c = *input; | |||||
| if (c == T('<')) | if (c == T('<')) | ||||
| break; | break; | ||||
| @@ -13597,10 +13601,10 @@ void XmlDocument::readChildElements (XmlElement* parent) throw() | |||||
| if (entity.startsWithChar (T('<')) && entity [1] != 0) | if (entity.startsWithChar (T('<')) && entity [1] != 0) | ||||
| { | { | ||||
| const tchar* const oldInput = input; | |||||
| const juce_wchar* const oldInput = input; | |||||
| const bool oldOutOfData = outOfData; | const bool oldOutOfData = outOfData; | ||||
| input = (const tchar*) entity; | |||||
| input = entity; | |||||
| outOfData = false; | outOfData = false; | ||||
| for (;;) | for (;;) | ||||
| @@ -13628,12 +13632,12 @@ void XmlDocument::readChildElements (XmlElement* parent) throw() | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| const tchar* start = input; | |||||
| const juce_wchar* start = input; | |||||
| int len = 0; | int len = 0; | ||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| const tchar nextChar = *input; | |||||
| const juce_wchar nextChar = *input; | |||||
| if (nextChar == T('<') || nextChar == T('&')) | if (nextChar == T('<') || nextChar == T('&')) | ||||
| { | { | ||||
| @@ -13742,12 +13746,12 @@ void XmlDocument::readEntity (String& result) throw() | |||||
| return; | return; | ||||
| } | } | ||||
| result << (tchar) charCode; | |||||
| result << (juce_wchar) charCode; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| const tchar* const entityNameStart = input; | |||||
| const tchar* const closingSemiColon = CharacterFunctions::find (input, T(";")); | |||||
| const juce_wchar* const entityNameStart = input; | |||||
| const juce_wchar* const closingSemiColon = CharacterFunctions::find (input, T(";")); | |||||
| if (closingSemiColon == 0) | if (closingSemiColon == 0) | ||||
| { | { | ||||
| @@ -13790,11 +13794,11 @@ const String XmlDocument::expandEntity (const String& ent) | |||||
| { | { | ||||
| if (ent[1] == T('x') || ent[1] == T('X')) | if (ent[1] == T('x') || ent[1] == T('X')) | ||||
| { | { | ||||
| return String::charToString ((tchar) ent.substring (2).getHexValue32()); | |||||
| return String::charToString (static_cast <juce_wchar> (ent.substring (2).getHexValue32())); | |||||
| } | } | ||||
| else if (ent[1] >= T('0') && ent[1] <= T('9')) | else if (ent[1] >= T('0') && ent[1] <= T('9')) | ||||
| { | { | ||||
| return String::charToString ((tchar) ent.substring (1).getIntValue()); | |||||
| return String::charToString (static_cast <juce_wchar> (ent.substring (1).getIntValue())); | |||||
| } | } | ||||
| setLastError ("illegal escape sequence", false); | setLastError ("illegal escape sequence", false); | ||||
| @@ -14471,7 +14475,7 @@ bool XmlElement::getBoolAttribute (const String& attributeName, | |||||
| { | { | ||||
| if (att->name.equalsIgnoreCase (attributeName)) | if (att->name.equalsIgnoreCase (attributeName)) | ||||
| { | { | ||||
| tchar firstChar = att->value[0]; | |||||
| juce_wchar firstChar = att->value[0]; | |||||
| if (CharacterFunctions::isWhitespace (firstChar)) | if (CharacterFunctions::isWhitespace (firstChar)) | ||||
| firstChar = att->value.trimStart() [0]; | firstChar = att->value.trimStart() [0]; | ||||
| @@ -14516,7 +14520,7 @@ void XmlElement::setAttribute (const String& attributeName, | |||||
| { | { | ||||
| #ifdef JUCE_DEBUG | #ifdef JUCE_DEBUG | ||||
| // check the identifier being passed in is legal.. | // check the identifier being passed in is legal.. | ||||
| const tchar* t = attributeName; | |||||
| const juce_wchar* t = attributeName; | |||||
| while (*t != 0) | while (*t != 0) | ||||
| { | { | ||||
| jassert (CharacterFunctions::isLetterOrDigit (*t) | jassert (CharacterFunctions::isLetterOrDigit (*t) | ||||
| @@ -14953,7 +14957,7 @@ bool XmlElement::isTextElement() const throw() | |||||
| return tagName.isEmpty(); | return tagName.isEmpty(); | ||||
| } | } | ||||
| static const tchar* const juce_xmltextContentAttributeName = T("text"); | |||||
| static const juce_wchar* const juce_xmltextContentAttributeName = T("text"); | |||||
| const String XmlElement::getText() const throw() | const String XmlElement::getText() const throw() | ||||
| { | { | ||||
| @@ -84664,7 +84668,7 @@ private: | |||||
| StringArray tokens; | StringArray tokens; | ||||
| tokens.addTokens (t.fromFirstOccurrenceOf (T("("), false, false) | tokens.addTokens (t.fromFirstOccurrenceOf (T("("), false, false) | ||||
| .upToFirstOccurrenceOf (T(")"), false, false), | .upToFirstOccurrenceOf (T(")"), false, false), | ||||
| T(", "), 0); | |||||
| T(", "), String::empty); | |||||
| tokens.removeEmptyStrings (true); | tokens.removeEmptyStrings (true); | ||||
| @@ -241547,7 +241551,7 @@ void FileChooser::showPlatformDialog (Array<File>& results, | |||||
| const ScopedAutoReleasePool pool; | const ScopedAutoReleasePool pool; | ||||
| StringArray* filters = new StringArray(); | StringArray* filters = new StringArray(); | ||||
| filters->addTokens (filter.replaceCharacters (T(",:"), T(";;")), T(";"), 0); | |||||
| filters->addTokens (filter.replaceCharacters (T(",:"), T(";;")), T(";"), String::empty); | |||||
| filters->trim(); | filters->trim(); | ||||
| filters->removeEmptyStrings(); | filters->removeEmptyStrings(); | ||||
| @@ -247884,7 +247888,7 @@ void FileChooser::showPlatformDialog (Array<File>& results, | |||||
| const ScopedAutoReleasePool pool; | const ScopedAutoReleasePool pool; | ||||
| StringArray* filters = new StringArray(); | StringArray* filters = new StringArray(); | ||||
| filters->addTokens (filter.replaceCharacters (T(",:"), T(";;")), T(";"), 0); | |||||
| filters->addTokens (filter.replaceCharacters (T(",:"), T(";;")), T(";"), String::empty); | |||||
| filters->trim(); | filters->trim(); | ||||
| filters->removeEmptyStrings(); | filters->removeEmptyStrings(); | ||||
| @@ -249834,7 +249838,7 @@ public: | |||||
| { | { | ||||
| bufferSizes.add ((int) ranges[0].mMinimum); | bufferSizes.add ((int) ranges[0].mMinimum); | ||||
| for (int i = 32; i < 8192; i += 32) | |||||
| for (int i = 32; i < 2048; i += 32) | |||||
| { | { | ||||
| for (int j = size / (int) sizeof (AudioValueRange); --j >= 0;) | for (int j = size / (int) sizeof (AudioValueRange); --j >= 0;) | ||||
| { | { | ||||
| @@ -1071,15 +1071,15 @@ public: | |||||
| String (const String& other) throw(); | String (const String& other) throw(); | ||||
| String (const char* text) throw(); | |||||
| String (const char* text); | |||||
| String (const char* text, size_t maxChars) throw(); | |||||
| String (const char* text, size_t maxChars); | |||||
| String (const juce_wchar* unicodeText) throw(); | |||||
| String (const juce_wchar* unicodeText); | |||||
| String (const juce_wchar* unicodeText, size_t maxChars) throw(); | |||||
| String (const juce_wchar* unicodeText, size_t maxChars); | |||||
| static const String charToString (juce_wchar character) throw(); | |||||
| static const String charToString (juce_wchar character); | |||||
| ~String() throw(); | ~String() throw(); | ||||
| @@ -1196,73 +1196,73 @@ public: | |||||
| */ | */ | ||||
| inline const juce_wchar& operator[] (int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text [index]; } | inline const juce_wchar& operator[] (int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text [index]; } | ||||
| juce_wchar& operator[] (int index) throw(); | |||||
| juce_wchar& operator[] (int index); | |||||
| juce_wchar getLastCharacter() const throw(); | juce_wchar getLastCharacter() const throw(); | ||||
| const String substring (int startIndex, int endIndex) const throw(); | |||||
| const String substring (int startIndex, int endIndex) const; | |||||
| const String substring (int startIndex) const throw(); | |||||
| const String substring (int startIndex) const; | |||||
| const String dropLastCharacters (int numberToDrop) const throw(); | |||||
| const String dropLastCharacters (int numberToDrop) const; | |||||
| const String getLastCharacters (int numCharacters) const throw(); | |||||
| const String getLastCharacters (int numCharacters) const; | |||||
| const String fromFirstOccurrenceOf (const juce_wchar* substringToStartFrom, | const String fromFirstOccurrenceOf (const juce_wchar* substringToStartFrom, | ||||
| bool includeSubStringInResult, | bool includeSubStringInResult, | ||||
| bool ignoreCase) const throw(); | |||||
| bool ignoreCase) const; | |||||
| const String fromLastOccurrenceOf (const juce_wchar* substringToFind, | const String fromLastOccurrenceOf (const juce_wchar* substringToFind, | ||||
| bool includeSubStringInResult, | bool includeSubStringInResult, | ||||
| bool ignoreCase) const throw(); | |||||
| bool ignoreCase) const; | |||||
| const String upToFirstOccurrenceOf (const juce_wchar* substringToEndWith, | const String upToFirstOccurrenceOf (const juce_wchar* substringToEndWith, | ||||
| bool includeSubStringInResult, | bool includeSubStringInResult, | ||||
| bool ignoreCase) const throw(); | |||||
| bool ignoreCase) const; | |||||
| const String upToLastOccurrenceOf (const juce_wchar* substringToFind, | const String upToLastOccurrenceOf (const juce_wchar* substringToFind, | ||||
| bool includeSubStringInResult, | bool includeSubStringInResult, | ||||
| bool ignoreCase) const throw(); | |||||
| bool ignoreCase) const; | |||||
| const String trim() const throw(); | |||||
| const String trimStart() const throw(); | |||||
| const String trimEnd() const throw(); | |||||
| const String trim() const; | |||||
| const String trimStart() const; | |||||
| const String trimEnd() const; | |||||
| const String trimCharactersAtStart (const juce_wchar* charactersToTrim) const throw(); | |||||
| const String trimCharactersAtStart (const juce_wchar* charactersToTrim) const; | |||||
| const String trimCharactersAtEnd (const juce_wchar* charactersToTrim) const throw(); | |||||
| const String trimCharactersAtEnd (const juce_wchar* charactersToTrim) const; | |||||
| const String toUpperCase() const throw(); | |||||
| const String toUpperCase() const; | |||||
| const String toLowerCase() const throw(); | |||||
| const String toLowerCase() const; | |||||
| const String replaceSection (int startIndex, | const String replaceSection (int startIndex, | ||||
| int numCharactersToReplace, | int numCharactersToReplace, | ||||
| const juce_wchar* stringToInsert) const throw(); | |||||
| const juce_wchar* stringToInsert) const; | |||||
| const String replace (const juce_wchar* stringToReplace, | const String replace (const juce_wchar* stringToReplace, | ||||
| const juce_wchar* stringToInsertInstead, | const juce_wchar* stringToInsertInstead, | ||||
| bool ignoreCase = false) const throw(); | |||||
| bool ignoreCase = false) const; | |||||
| const String replaceCharacter (juce_wchar characterToReplace, | const String replaceCharacter (juce_wchar characterToReplace, | ||||
| juce_wchar characterToInsertInstead) const throw(); | |||||
| juce_wchar characterToInsertInstead) const; | |||||
| const String replaceCharacters (const String& charactersToReplace, | const String replaceCharacters (const String& charactersToReplace, | ||||
| const juce_wchar* charactersToInsertInstead) const throw(); | |||||
| const juce_wchar* charactersToInsertInstead) const; | |||||
| const String retainCharacters (const juce_wchar* charactersToRetain) const throw(); | |||||
| const String retainCharacters (const juce_wchar* charactersToRetain) const; | |||||
| const String removeCharacters (const juce_wchar* charactersToRemove) const throw(); | |||||
| const String removeCharacters (const juce_wchar* charactersToRemove) const; | |||||
| const String initialSectionContainingOnly (const juce_wchar* permittedCharacters) const throw(); | |||||
| const String initialSectionContainingOnly (const juce_wchar* permittedCharacters) const; | |||||
| const String initialSectionNotContaining (const juce_wchar* charactersToStopAt) const throw(); | |||||
| const String initialSectionNotContaining (const juce_wchar* charactersToStopAt) const; | |||||
| bool isQuotedString() const throw(); | |||||
| bool isQuotedString() const; | |||||
| const String unquoted() const throw(); | |||||
| const String unquoted() const; | |||||
| const String quoted (juce_wchar quoteCharacter = JUCE_T('"')) const throw(); | |||||
| const String quoted (juce_wchar quoteCharacter = JUCE_T('"')) const; | |||||
| static const String repeatedString (const juce_wchar* stringToRepeat, | static const String repeatedString (const juce_wchar* stringToRepeat, | ||||
| int numberOfTimesToRepeat); | int numberOfTimesToRepeat); | ||||
| @@ -1271,28 +1271,27 @@ public: | |||||
| const String paddedRight (juce_wchar padCharacter, int minimumLength) const; | const String paddedRight (juce_wchar padCharacter, int minimumLength) const; | ||||
| static const String createStringFromData (const void* data, | |||||
| int size) throw(); | |||||
| static const String createStringFromData (const void* data, int size); | |||||
| // Numeric conversions.. | // Numeric conversions.. | ||||
| explicit String (int decimalInteger) throw(); | |||||
| explicit String (int decimalInteger); | |||||
| explicit String (unsigned int decimalInteger) throw(); | |||||
| explicit String (unsigned int decimalInteger); | |||||
| explicit String (short decimalInteger) throw(); | |||||
| explicit String (short decimalInteger); | |||||
| explicit String (unsigned short decimalInteger) throw(); | |||||
| explicit String (unsigned short decimalInteger); | |||||
| explicit String (int64 largeIntegerValue) throw(); | |||||
| explicit String (int64 largeIntegerValue); | |||||
| explicit String (uint64 largeIntegerValue) throw(); | |||||
| explicit String (uint64 largeIntegerValue); | |||||
| explicit String (float floatValue, | explicit String (float floatValue, | ||||
| int numberOfDecimalPlaces = 0) throw(); | |||||
| int numberOfDecimalPlaces = 0); | |||||
| explicit String (double doubleValue, | explicit String (double doubleValue, | ||||
| int numberOfDecimalPlaces = 0) throw(); | |||||
| int numberOfDecimalPlaces = 0); | |||||
| int getIntValue() const throw(); | int getIntValue() const throw(); | ||||
| @@ -1308,15 +1307,15 @@ public: | |||||
| int64 getHexValue64() const throw(); | int64 getHexValue64() const throw(); | ||||
| static const String toHexString (int number) throw(); | |||||
| static const String toHexString (int number); | |||||
| static const String toHexString (int64 number) throw(); | |||||
| static const String toHexString (int64 number); | |||||
| static const String toHexString (short number) throw(); | |||||
| static const String toHexString (short number); | |||||
| static const String toHexString (const unsigned char* data, | static const String toHexString (const unsigned char* data, | ||||
| int size, | int size, | ||||
| int groupSize = 1) throw(); | |||||
| int groupSize = 1); | |||||
| inline operator const juce_wchar*() const throw() { return text; } | inline operator const juce_wchar*() const throw() { return text; } | ||||
| @@ -1340,6 +1339,8 @@ public: | |||||
| void preallocateStorage (size_t numCharsNeeded); | void preallocateStorage (size_t numCharsNeeded); | ||||
| void swapWith (String& other) throw(); | |||||
| class JUCE_API Concatenator | class JUCE_API Concatenator | ||||
| { | { | ||||
| public: | public: | ||||
| @@ -3886,14 +3887,14 @@ public: | |||||
| int startIndex = 0, | int startIndex = 0, | ||||
| int numElementsToAdd = -1); | int numElementsToAdd = -1); | ||||
| int addTokens (const tchar* const stringToTokenise, | |||||
| int addTokens (const String& stringToTokenise, | |||||
| const bool preserveQuotedStrings); | const bool preserveQuotedStrings); | ||||
| int addTokens (const tchar* const stringToTokenise, | |||||
| const tchar* breakCharacters, | |||||
| const tchar* quoteCharacters); | |||||
| int addTokens (const String& stringToTokenise, | |||||
| const String& breakCharacters, | |||||
| const String& quoteCharacters); | |||||
| int addLines (const tchar* stringToBreakUp); | |||||
| int addLines (const String& stringToBreakUp); | |||||
| void clear(); | void clear(); | ||||
| @@ -8296,9 +8297,12 @@ class JUCE_API MemoryInputStream : public InputStream | |||||
| { | { | ||||
| public: | public: | ||||
| MemoryInputStream (const void* const sourceData, | |||||
| const size_t sourceDataSize, | |||||
| const bool keepInternalCopyOfData); | |||||
| MemoryInputStream (const void* sourceData, | |||||
| size_t sourceDataSize, | |||||
| bool keepInternalCopyOfData); | |||||
| MemoryInputStream (const MemoryBlock& data, | |||||
| bool keepInternalCopyOfData); | |||||
| ~MemoryInputStream(); | ~MemoryInputStream(); | ||||
| @@ -8331,11 +8335,11 @@ class JUCE_API MemoryOutputStream : public OutputStream | |||||
| { | { | ||||
| public: | public: | ||||
| MemoryOutputStream (const size_t initialSize = 256, | |||||
| const size_t granularity = 256, | |||||
| MemoryBlock* const memoryBlockToWriteTo = 0) throw(); | |||||
| MemoryOutputStream (size_t initialSize = 256, | |||||
| size_t granularity = 256, | |||||
| MemoryBlock* memoryBlockToWriteTo = 0); | |||||
| ~MemoryOutputStream() throw(); | |||||
| ~MemoryOutputStream(); | |||||
| const char* getData() const throw(); | const char* getData() const throw(); | ||||
| @@ -8493,7 +8497,7 @@ public: | |||||
| private: | private: | ||||
| String originalText; | String originalText; | ||||
| const tchar* input; | |||||
| const juce_wchar* input; | |||||
| bool outOfData, errorOccurred; | bool outOfData, errorOccurred; | ||||
| bool identifierLookupTable [128]; | bool identifierLookupTable [128]; | ||||
| @@ -8505,14 +8509,14 @@ private: | |||||
| void setLastError (const String& desc, const bool carryOn) throw(); | void setLastError (const String& desc, const bool carryOn) throw(); | ||||
| void skipHeader() throw(); | void skipHeader() throw(); | ||||
| void skipNextWhiteSpace() throw(); | void skipNextWhiteSpace() throw(); | ||||
| tchar readNextChar() throw(); | |||||
| juce_wchar readNextChar() throw(); | |||||
| XmlElement* readNextElement (const bool alsoParseSubElements) throw(); | XmlElement* readNextElement (const bool alsoParseSubElements) throw(); | ||||
| void readChildElements (XmlElement* parent) throw(); | void readChildElements (XmlElement* parent) throw(); | ||||
| int findNextTokenLength() throw(); | int findNextTokenLength() throw(); | ||||
| void readQuotedString (String& result) throw(); | void readQuotedString (String& result) throw(); | ||||
| void readEntity (String& result) throw(); | void readEntity (String& result) throw(); | ||||
| static bool isXmlIdentifierCharSlow (const tchar c) throw(); | |||||
| bool isXmlIdentifierChar (const tchar c) const throw(); | |||||
| static bool isXmlIdentifierCharSlow (juce_wchar c) throw(); | |||||
| bool isXmlIdentifierChar (juce_wchar c) const throw(); | |||||
| const String getFileContents (const String& filename) const; | const String getFileContents (const String& filename) const; | ||||
| const String expandEntity (const String& entity); | const String expandEntity (const String& entity); | ||||
| @@ -1139,7 +1139,7 @@ private: | |||||
| StringArray tokens; | StringArray tokens; | ||||
| tokens.addTokens (t.fromFirstOccurrenceOf (T("("), false, false) | tokens.addTokens (t.fromFirstOccurrenceOf (T("("), false, false) | ||||
| .upToFirstOccurrenceOf (T(")"), false, false), | .upToFirstOccurrenceOf (T(")"), false, false), | ||||
| T(", "), 0); | |||||
| T(", "), String::empty); | |||||
| tokens.removeEmptyStrings (true); | tokens.removeEmptyStrings (true); | ||||
| @@ -27,7 +27,6 @@ | |||||
| BEGIN_JUCE_NAMESPACE | BEGIN_JUCE_NAMESPACE | ||||
| #include "juce_MemoryInputStream.h" | #include "juce_MemoryInputStream.h" | ||||
| @@ -35,14 +34,27 @@ BEGIN_JUCE_NAMESPACE | |||||
| MemoryInputStream::MemoryInputStream (const void* const sourceData, | MemoryInputStream::MemoryInputStream (const void* const sourceData, | ||||
| const size_t sourceDataSize, | const size_t sourceDataSize, | ||||
| const bool keepInternalCopy) | const bool keepInternalCopy) | ||||
| : data ((const char*) sourceData), | |||||
| : data (static_cast <const char*> (sourceData)), | |||||
| dataSize (sourceDataSize), | dataSize (sourceDataSize), | ||||
| position (0) | position (0) | ||||
| { | { | ||||
| if (keepInternalCopy) | if (keepInternalCopy) | ||||
| { | { | ||||
| internalCopy.append (data, sourceDataSize); | internalCopy.append (data, sourceDataSize); | ||||
| data = (const char*) internalCopy.getData(); | |||||
| data = static_cast <const char*> (internalCopy.getData()); | |||||
| } | |||||
| } | |||||
| MemoryInputStream::MemoryInputStream (const MemoryBlock& sourceData, | |||||
| const bool keepInternalCopy) | |||||
| : data (static_cast <const char*> (sourceData.getData())), | |||||
| dataSize (sourceData.getSize()), | |||||
| position (0) | |||||
| { | |||||
| if (keepInternalCopy) | |||||
| { | |||||
| internalCopy = sourceData; | |||||
| data = static_cast <const char*> (internalCopy.getData()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -55,7 +67,7 @@ int64 MemoryInputStream::getTotalLength() | |||||
| return dataSize; | return dataSize; | ||||
| } | } | ||||
| int MemoryInputStream::read (void* buffer, int howMany) | |||||
| int MemoryInputStream::read (void* const buffer, const int howMany) | |||||
| { | { | ||||
| jassert (howMany >= 0); | jassert (howMany >= 0); | ||||
| const int num = jmin (howMany, (int) (dataSize - position)); | const int num = jmin (howMany, (int) (dataSize - position)); | ||||
| @@ -69,10 +81,9 @@ bool MemoryInputStream::isExhausted() | |||||
| return (position >= dataSize); | return (position >= dataSize); | ||||
| } | } | ||||
| bool MemoryInputStream::setPosition (int64 pos) | |||||
| bool MemoryInputStream::setPosition (const int64 pos) | |||||
| { | { | ||||
| position = (int) jlimit ((int64) 0, (int64) dataSize, pos); | position = (int) jlimit ((int64) 0, (int64) dataSize, pos); | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -50,9 +50,21 @@ public: | |||||
| true, the stream will make its own copy of the | true, the stream will make its own copy of the | ||||
| data and use that. | data and use that. | ||||
| */ | */ | ||||
| MemoryInputStream (const void* const sourceData, | |||||
| const size_t sourceDataSize, | |||||
| const bool keepInternalCopyOfData); | |||||
| MemoryInputStream (const void* sourceData, | |||||
| size_t sourceDataSize, | |||||
| bool keepInternalCopyOfData); | |||||
| /** Creates a MemoryInputStream. | |||||
| @param data a block of data to use as the stream's source | |||||
| @param keepInternalCopyOfData if false, the stream will just keep a reference to | |||||
| the source data, so this data shouldn't be changed | |||||
| for the lifetime of the stream; if this parameter is | |||||
| true, the stream will make its own copy of the | |||||
| data and use that. | |||||
| */ | |||||
| MemoryInputStream (const MemoryBlock& data, | |||||
| bool keepInternalCopyOfData); | |||||
| /** Destructor. */ | /** Destructor. */ | ||||
| ~MemoryInputStream(); | ~MemoryInputStream(); | ||||
| @@ -64,7 +76,6 @@ public: | |||||
| bool isExhausted(); | bool isExhausted(); | ||||
| int read (void* destBuffer, int maxBytesToRead); | int read (void* destBuffer, int maxBytesToRead); | ||||
| //============================================================================== | //============================================================================== | ||||
| juce_UseDebuggingNewOperator | juce_UseDebuggingNewOperator | ||||
| @@ -34,7 +34,7 @@ BEGIN_JUCE_NAMESPACE | |||||
| //============================================================================== | //============================================================================== | ||||
| MemoryOutputStream::MemoryOutputStream (const size_t initialSize, | MemoryOutputStream::MemoryOutputStream (const size_t initialSize, | ||||
| const size_t blockSizeToIncreaseBy, | const size_t blockSizeToIncreaseBy, | ||||
| MemoryBlock* const memoryBlockToWriteTo) throw() | |||||
| MemoryBlock* const memoryBlockToWriteTo) | |||||
| : data (memoryBlockToWriteTo), | : data (memoryBlockToWriteTo), | ||||
| position (0), | position (0), | ||||
| size (0), | size (0), | ||||
| @@ -46,7 +46,7 @@ MemoryOutputStream::MemoryOutputStream (const size_t initialSize, | |||||
| data->setSize (initialSize, false); | data->setSize (initialSize, false); | ||||
| } | } | ||||
| MemoryOutputStream::~MemoryOutputStream() throw() | |||||
| MemoryOutputStream::~MemoryOutputStream() | |||||
| { | { | ||||
| flush(); | flush(); | ||||
| } | } | ||||
| @@ -63,7 +63,7 @@ void MemoryOutputStream::reset() throw() | |||||
| size = 0; | size = 0; | ||||
| } | } | ||||
| bool MemoryOutputStream::write (const void* buffer, int howMany) | |||||
| bool MemoryOutputStream::write (const void* const buffer, int howMany) | |||||
| { | { | ||||
| if (howMany > 0) | if (howMany > 0) | ||||
| { | { | ||||
| @@ -88,10 +88,12 @@ bool MemoryOutputStream::write (const void* buffer, int howMany) | |||||
| const char* MemoryOutputStream::getData() const throw() | const char* MemoryOutputStream::getData() const throw() | ||||
| { | { | ||||
| char* const d = static_cast <char*> (data->getData()); | |||||
| if (data->getSize() > size) | if (data->getSize() > size) | ||||
| ((char*) data->getData()) [size] = 0; | |||||
| d [size] = 0; | |||||
| return (const char*) data->getData(); | |||||
| return d; | |||||
| } | } | ||||
| size_t MemoryOutputStream::getDataSize() const throw() | size_t MemoryOutputStream::getDataSize() const throw() | ||||
| @@ -50,15 +50,15 @@ public: | |||||
| will allocate its own storage internally, which you can | will allocate its own storage internally, which you can | ||||
| access using getData() and getDataSize() | access using getData() and getDataSize() | ||||
| */ | */ | ||||
| MemoryOutputStream (const size_t initialSize = 256, | |||||
| const size_t granularity = 256, | |||||
| MemoryBlock* const memoryBlockToWriteTo = 0) throw(); | |||||
| MemoryOutputStream (size_t initialSize = 256, | |||||
| size_t granularity = 256, | |||||
| MemoryBlock* memoryBlockToWriteTo = 0); | |||||
| /** Destructor. | /** Destructor. | ||||
| This will free any data that was written to it. | This will free any data that was written to it. | ||||
| */ | */ | ||||
| ~MemoryOutputStream() throw(); | |||||
| ~MemoryOutputStream(); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns a pointer to the data that has been written to the stream. | /** Returns a pointer to the data that has been written to the stream. | ||||
| @@ -244,7 +244,7 @@ public: | |||||
| { | { | ||||
| bufferSizes.add ((int) ranges[0].mMinimum); | bufferSizes.add ((int) ranges[0].mMinimum); | ||||
| for (int i = 32; i < 8192; i += 32) | |||||
| for (int i = 32; i < 2048; i += 32) | |||||
| { | { | ||||
| for (int j = size / (int) sizeof (AudioValueRange); --j >= 0;) | for (int j = size / (int) sizeof (AudioValueRange); --j >= 0;) | ||||
| { | { | ||||
| @@ -93,7 +93,7 @@ void FileChooser::showPlatformDialog (Array<File>& results, | |||||
| const ScopedAutoReleasePool pool; | const ScopedAutoReleasePool pool; | ||||
| StringArray* filters = new StringArray(); | StringArray* filters = new StringArray(); | ||||
| filters->addTokens (filter.replaceCharacters (T(",:"), T(";;")), T(";"), 0); | |||||
| filters->addTokens (filter.replaceCharacters (T(",:"), T(";;")), T(";"), String::empty); | |||||
| filters->trim(); | filters->trim(); | ||||
| filters->removeEmptyStrings(); | filters->removeEmptyStrings(); | ||||
| @@ -184,6 +184,11 @@ String::String (const String& other) throw() | |||||
| StringHolder::retain (text); | StringHolder::retain (text); | ||||
| } | } | ||||
| void String::swapWith (String& other) throw() | |||||
| { | |||||
| swapVariables (text, other.text); | |||||
| } | |||||
| String& String::operator= (const String& other) throw() | String& String::operator= (const String& other) throw() | ||||
| { | { | ||||
| juce_wchar* const newText = other.text; | juce_wchar* const newText = other.text; | ||||
| @@ -197,7 +202,7 @@ String::String (const size_t numChars, const int /*dummyVariable*/) | |||||
| { | { | ||||
| } | } | ||||
| String::String (const char* const t) throw() | |||||
| String::String (const char* const t) | |||||
| { | { | ||||
| if (t != 0 && *t != 0) | if (t != 0 && *t != 0) | ||||
| { | { | ||||
| @@ -211,7 +216,7 @@ String::String (const char* const t) throw() | |||||
| } | } | ||||
| } | } | ||||
| String::String (const juce_wchar* const t) throw() | |||||
| String::String (const juce_wchar* const t) | |||||
| { | { | ||||
| if (t != 0 && *t != 0) | if (t != 0 && *t != 0) | ||||
| { | { | ||||
| @@ -225,7 +230,7 @@ String::String (const juce_wchar* const t) throw() | |||||
| } | } | ||||
| } | } | ||||
| String::String (const char* const t, const size_t maxChars) throw() | |||||
| String::String (const char* const t, const size_t maxChars) | |||||
| { | { | ||||
| int i; | int i; | ||||
| for (i = 0; (size_t) i < maxChars; ++i) | for (i = 0; (size_t) i < maxChars; ++i) | ||||
| @@ -244,7 +249,7 @@ String::String (const char* const t, const size_t maxChars) throw() | |||||
| } | } | ||||
| } | } | ||||
| String::String (const juce_wchar* const t, const size_t maxChars) throw() | |||||
| String::String (const juce_wchar* const t, const size_t maxChars) | |||||
| { | { | ||||
| int i; | int i; | ||||
| for (i = 0; (size_t) i < maxChars; ++i) | for (i = 0; (size_t) i < maxChars; ++i) | ||||
| @@ -263,7 +268,7 @@ String::String (const juce_wchar* const t, const size_t maxChars) throw() | |||||
| } | } | ||||
| } | } | ||||
| const String String::charToString (const juce_wchar character) throw() | |||||
| const String String::charToString (const juce_wchar character) | |||||
| { | { | ||||
| juce_wchar temp[] = { character, 0 }; | juce_wchar temp[] = { character, 0 }; | ||||
| return String (temp); | return String (temp); | ||||
| @@ -389,7 +394,7 @@ namespace NumberToStringConverters | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| String::String (const int number) throw() | |||||
| String::String (const int number) | |||||
| { | { | ||||
| juce_wchar buffer [16]; | juce_wchar buffer [16]; | ||||
| juce_wchar* const end = buffer + numElementsInArray (buffer); | juce_wchar* const end = buffer + numElementsInArray (buffer); | ||||
| @@ -397,7 +402,7 @@ String::String (const int number) throw() | |||||
| createInternal (start, end - start - 1); | createInternal (start, end - start - 1); | ||||
| } | } | ||||
| String::String (const unsigned int number) throw() | |||||
| String::String (const unsigned int number) | |||||
| { | { | ||||
| juce_wchar buffer [16]; | juce_wchar buffer [16]; | ||||
| juce_wchar* const end = buffer + numElementsInArray (buffer); | juce_wchar* const end = buffer + numElementsInArray (buffer); | ||||
| @@ -405,7 +410,7 @@ String::String (const unsigned int number) throw() | |||||
| createInternal (start, end - start - 1); | createInternal (start, end - start - 1); | ||||
| } | } | ||||
| String::String (const short number) throw() | |||||
| String::String (const short number) | |||||
| { | { | ||||
| juce_wchar buffer [16]; | juce_wchar buffer [16]; | ||||
| juce_wchar* const end = buffer + numElementsInArray (buffer); | juce_wchar* const end = buffer + numElementsInArray (buffer); | ||||
| @@ -413,7 +418,7 @@ String::String (const short number) throw() | |||||
| createInternal (start, end - start - 1); | createInternal (start, end - start - 1); | ||||
| } | } | ||||
| String::String (const unsigned short number) throw() | |||||
| String::String (const unsigned short number) | |||||
| { | { | ||||
| juce_wchar buffer [16]; | juce_wchar buffer [16]; | ||||
| juce_wchar* const end = buffer + numElementsInArray (buffer); | juce_wchar* const end = buffer + numElementsInArray (buffer); | ||||
| @@ -421,7 +426,7 @@ String::String (const unsigned short number) throw() | |||||
| createInternal (start, end - start - 1); | createInternal (start, end - start - 1); | ||||
| } | } | ||||
| String::String (const int64 number) throw() | |||||
| String::String (const int64 number) | |||||
| { | { | ||||
| juce_wchar buffer [32]; | juce_wchar buffer [32]; | ||||
| juce_wchar* const end = buffer + numElementsInArray (buffer); | juce_wchar* const end = buffer + numElementsInArray (buffer); | ||||
| @@ -429,7 +434,7 @@ String::String (const int64 number) throw() | |||||
| createInternal (start, end - start - 1); | createInternal (start, end - start - 1); | ||||
| } | } | ||||
| String::String (const uint64 number) throw() | |||||
| String::String (const uint64 number) | |||||
| { | { | ||||
| juce_wchar buffer [32]; | juce_wchar buffer [32]; | ||||
| juce_wchar* const end = buffer + numElementsInArray (buffer); | juce_wchar* const end = buffer + numElementsInArray (buffer); | ||||
| @@ -437,7 +442,7 @@ String::String (const uint64 number) throw() | |||||
| createInternal (start, end - start - 1); | createInternal (start, end - start - 1); | ||||
| } | } | ||||
| String::String (const float number, const int numberOfDecimalPlaces) throw() | |||||
| String::String (const float number, const int numberOfDecimalPlaces) | |||||
| { | { | ||||
| juce_wchar buffer [48]; | juce_wchar buffer [48]; | ||||
| size_t len; | size_t len; | ||||
| @@ -445,7 +450,7 @@ String::String (const float number, const int numberOfDecimalPlaces) throw() | |||||
| createInternal (start, len); | createInternal (start, len); | ||||
| } | } | ||||
| String::String (const double number, const int numberOfDecimalPlaces) throw() | |||||
| String::String (const double number, const int numberOfDecimalPlaces) | |||||
| { | { | ||||
| juce_wchar buffer [48]; | juce_wchar buffer [48]; | ||||
| size_t len; | size_t len; | ||||
| @@ -1128,9 +1133,8 @@ const String String::paddedRight (const juce_wchar padCharacter, int minimumLeng | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| const String String::replaceSection (int index, | |||||
| int numCharsToReplace, | |||||
| const juce_wchar* const stringToInsert) const throw() | |||||
| const String String::replaceSection (int index, int numCharsToReplace, | |||||
| const juce_wchar* const stringToInsert) const | |||||
| { | { | ||||
| if (index < 0) | if (index < 0) | ||||
| { | { | ||||
| @@ -1189,7 +1193,7 @@ const String String::replaceSection (int index, | |||||
| const String String::replace (const juce_wchar* const stringToReplace, | const String String::replace (const juce_wchar* const stringToReplace, | ||||
| const juce_wchar* const stringToInsert, | const juce_wchar* const stringToInsert, | ||||
| const bool ignoreCase) const throw() | |||||
| const bool ignoreCase) const | |||||
| { | { | ||||
| const int stringToReplaceLen = CharacterFunctions::length (stringToReplace); | const int stringToReplaceLen = CharacterFunctions::length (stringToReplace); | ||||
| const int stringToInsertLen = CharacterFunctions::length (stringToInsert); | const int stringToInsertLen = CharacterFunctions::length (stringToInsert); | ||||
| @@ -1207,8 +1211,7 @@ const String String::replace (const juce_wchar* const stringToReplace, | |||||
| return result; | return result; | ||||
| } | } | ||||
| const String String::replaceCharacter (const juce_wchar charToReplace, | |||||
| const juce_wchar charToInsert) const throw() | |||||
| const String String::replaceCharacter (const juce_wchar charToReplace, const juce_wchar charToInsert) const | |||||
| { | { | ||||
| const int index = indexOfChar (charToReplace); | const int index = indexOfChar (charToReplace); | ||||
| @@ -1232,7 +1235,7 @@ const String String::replaceCharacter (const juce_wchar charToReplace, | |||||
| } | } | ||||
| const String String::replaceCharacters (const String& charactersToReplace, | const String String::replaceCharacters (const String& charactersToReplace, | ||||
| const juce_wchar* const charactersToInsertInstead) const throw() | |||||
| const juce_wchar* const charactersToInsertInstead) const | |||||
| { | { | ||||
| String result (*this); | String result (*this); | ||||
| result.dupeInternalIfMultiplyReferenced(); | result.dupeInternalIfMultiplyReferenced(); | ||||
| @@ -1309,7 +1312,7 @@ bool String::endsWithIgnoreCase (const juce_wchar* const other) const throw() | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| const String String::toUpperCase() const throw() | |||||
| const String String::toUpperCase() const | |||||
| { | { | ||||
| String result (*this); | String result (*this); | ||||
| result.dupeInternalIfMultiplyReferenced(); | result.dupeInternalIfMultiplyReferenced(); | ||||
| @@ -1317,7 +1320,7 @@ const String String::toUpperCase() const throw() | |||||
| return result; | return result; | ||||
| } | } | ||||
| const String String::toLowerCase() const throw() | |||||
| const String String::toLowerCase() const | |||||
| { | { | ||||
| String result (*this); | String result (*this); | ||||
| result.dupeInternalIfMultiplyReferenced(); | result.dupeInternalIfMultiplyReferenced(); | ||||
| @@ -1326,7 +1329,7 @@ const String String::toLowerCase() const throw() | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| juce_wchar& String::operator[] (const int index) throw() | |||||
| juce_wchar& String::operator[] (const int index) | |||||
| { | { | ||||
| jassert (((unsigned int) index) <= (unsigned int) length()); | jassert (((unsigned int) index) <= (unsigned int) length()); | ||||
| @@ -1337,11 +1340,10 @@ juce_wchar& String::operator[] (const int index) throw() | |||||
| juce_wchar String::getLastCharacter() const throw() | juce_wchar String::getLastCharacter() const throw() | ||||
| { | { | ||||
| return (isEmpty()) ? ((juce_wchar) 0) | |||||
| : text [length() - 1]; | |||||
| return isEmpty() ? juce_wchar() : text [length() - 1]; | |||||
| } | } | ||||
| const String String::substring (int start, int end) const throw() | |||||
| const String String::substring (int start, int end) const | |||||
| { | { | ||||
| if (start < 0) | if (start < 0) | ||||
| start = 0; | start = 0; | ||||
| @@ -1362,11 +1364,10 @@ const String String::substring (int start, int end) const throw() | |||||
| end = len; | end = len; | ||||
| } | } | ||||
| return String (text + start, | |||||
| end - start); | |||||
| return String (text + start, end - start); | |||||
| } | } | ||||
| const String String::substring (const int start) const throw() | |||||
| const String String::substring (const int start) const | |||||
| { | { | ||||
| if (start <= 0) | if (start <= 0) | ||||
| return *this; | return *this; | ||||
| @@ -1379,19 +1380,19 @@ const String String::substring (const int start) const throw() | |||||
| return String (text + start, len - start); | return String (text + start, len - start); | ||||
| } | } | ||||
| const String String::dropLastCharacters (const int numberToDrop) const throw() | |||||
| const String String::dropLastCharacters (const int numberToDrop) const | |||||
| { | { | ||||
| return String (text, jmax (0, length() - numberToDrop)); | return String (text, jmax (0, length() - numberToDrop)); | ||||
| } | } | ||||
| const String String::getLastCharacters (const int numCharacters) const throw() | |||||
| const String String::getLastCharacters (const int numCharacters) const | |||||
| { | { | ||||
| return String (text + jmax (0, length() - jmax (0, numCharacters))); | return String (text + jmax (0, length() - jmax (0, numCharacters))); | ||||
| } | } | ||||
| const String String::fromFirstOccurrenceOf (const juce_wchar* const sub, | const String String::fromFirstOccurrenceOf (const juce_wchar* const sub, | ||||
| const bool includeSubString, | const bool includeSubString, | ||||
| const bool ignoreCase) const throw() | |||||
| const bool ignoreCase) const | |||||
| { | { | ||||
| const int i = ignoreCase ? indexOfIgnoreCase (sub) | const int i = ignoreCase ? indexOfIgnoreCase (sub) | ||||
| : indexOf (sub); | : indexOf (sub); | ||||
| @@ -1402,10 +1403,9 @@ const String String::fromFirstOccurrenceOf (const juce_wchar* const sub, | |||||
| return substring (includeSubString ? i : i + CharacterFunctions::length (sub)); | return substring (includeSubString ? i : i + CharacterFunctions::length (sub)); | ||||
| } | } | ||||
| const String String::fromLastOccurrenceOf (const juce_wchar* const sub, | const String String::fromLastOccurrenceOf (const juce_wchar* const sub, | ||||
| const bool includeSubString, | const bool includeSubString, | ||||
| const bool ignoreCase) const throw() | |||||
| const bool ignoreCase) const | |||||
| { | { | ||||
| const int i = ignoreCase ? lastIndexOfIgnoreCase (sub) | const int i = ignoreCase ? lastIndexOfIgnoreCase (sub) | ||||
| : lastIndexOf (sub); | : lastIndexOf (sub); | ||||
| @@ -1418,7 +1418,7 @@ const String String::fromLastOccurrenceOf (const juce_wchar* const sub, | |||||
| const String String::upToFirstOccurrenceOf (const juce_wchar* const sub, | const String String::upToFirstOccurrenceOf (const juce_wchar* const sub, | ||||
| const bool includeSubString, | const bool includeSubString, | ||||
| const bool ignoreCase) const throw() | |||||
| const bool ignoreCase) const | |||||
| { | { | ||||
| const int i = ignoreCase ? indexOfIgnoreCase (sub) | const int i = ignoreCase ? indexOfIgnoreCase (sub) | ||||
| : indexOf (sub); | : indexOf (sub); | ||||
| @@ -1431,7 +1431,7 @@ const String String::upToFirstOccurrenceOf (const juce_wchar* const sub, | |||||
| const String String::upToLastOccurrenceOf (const juce_wchar* const sub, | const String String::upToLastOccurrenceOf (const juce_wchar* const sub, | ||||
| const bool includeSubString, | const bool includeSubString, | ||||
| const bool ignoreCase) const throw() | |||||
| const bool ignoreCase) const | |||||
| { | { | ||||
| const int i = ignoreCase ? lastIndexOfIgnoreCase (sub) | const int i = ignoreCase ? lastIndexOfIgnoreCase (sub) | ||||
| : lastIndexOf (sub); | : lastIndexOf (sub); | ||||
| @@ -1441,7 +1441,7 @@ const String String::upToLastOccurrenceOf (const juce_wchar* const sub, | |||||
| return substring (0, includeSubString ? i + CharacterFunctions::length (sub) : i); | return substring (0, includeSubString ? i + CharacterFunctions::length (sub) : i); | ||||
| } | } | ||||
| bool String::isQuotedString() const throw() | |||||
| bool String::isQuotedString() const | |||||
| { | { | ||||
| const String trimmed (trimStart()); | const String trimmed (trimStart()); | ||||
| @@ -1449,7 +1449,7 @@ bool String::isQuotedString() const throw() | |||||
| || trimmed[0] == T('\''); | || trimmed[0] == T('\''); | ||||
| } | } | ||||
| const String String::unquoted() const throw() | |||||
| const String String::unquoted() const | |||||
| { | { | ||||
| String s (*this); | String s (*this); | ||||
| @@ -1465,7 +1465,7 @@ const String String::unquoted() const throw() | |||||
| return s; | return s; | ||||
| } | } | ||||
| const String String::quoted (const juce_wchar quoteCharacter) const throw() | |||||
| const String String::quoted (const juce_wchar quoteCharacter) const | |||||
| { | { | ||||
| if (isEmpty()) | if (isEmpty()) | ||||
| return charToString (quoteCharacter) + quoteCharacter; | return charToString (quoteCharacter) + quoteCharacter; | ||||
| @@ -1482,7 +1482,7 @@ const String String::quoted (const juce_wchar quoteCharacter) const throw() | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| const String String::trim() const throw() | |||||
| const String String::trim() const | |||||
| { | { | ||||
| if (isEmpty()) | if (isEmpty()) | ||||
| return empty; | return empty; | ||||
| @@ -1508,7 +1508,7 @@ const String String::trim() const throw() | |||||
| return *this; | return *this; | ||||
| } | } | ||||
| const String String::trimStart() const throw() | |||||
| const String String::trimStart() const | |||||
| { | { | ||||
| if (isEmpty()) | if (isEmpty()) | ||||
| return empty; | return empty; | ||||
| @@ -1524,7 +1524,7 @@ const String String::trimStart() const throw() | |||||
| return String (t); | return String (t); | ||||
| } | } | ||||
| const String String::trimEnd() const throw() | |||||
| const String String::trimEnd() const | |||||
| { | { | ||||
| if (isEmpty()) | if (isEmpty()) | ||||
| return empty; | return empty; | ||||
| @@ -1537,7 +1537,7 @@ const String String::trimEnd() const throw() | |||||
| return String (text, (int) (++endT - text)); | return String (text, (int) (++endT - text)); | ||||
| } | } | ||||
| const String String::trimCharactersAtStart (const juce_wchar* charactersToTrim) const throw() | |||||
| const String String::trimCharactersAtStart (const juce_wchar* charactersToTrim) const | |||||
| { | { | ||||
| jassert (charactersToTrim != 0); | jassert (charactersToTrim != 0); | ||||
| @@ -1555,7 +1555,7 @@ const String String::trimCharactersAtStart (const juce_wchar* charactersToTrim) | |||||
| return String (t); | return String (t); | ||||
| } | } | ||||
| const String String::trimCharactersAtEnd (const juce_wchar* charactersToTrim) const throw() | |||||
| const String String::trimCharactersAtEnd (const juce_wchar* charactersToTrim) const | |||||
| { | { | ||||
| jassert (charactersToTrim != 0); | jassert (charactersToTrim != 0); | ||||
| @@ -1571,7 +1571,7 @@ const String String::trimCharactersAtEnd (const juce_wchar* charactersToTrim) co | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| const String String::retainCharacters (const juce_wchar* const charactersToRetain) const throw() | |||||
| const String String::retainCharacters (const juce_wchar* const charactersToRetain) const | |||||
| { | { | ||||
| jassert (charactersToRetain != 0); | jassert (charactersToRetain != 0); | ||||
| @@ -1594,7 +1594,7 @@ const String String::retainCharacters (const juce_wchar* const charactersToRetai | |||||
| return result; | return result; | ||||
| } | } | ||||
| const String String::removeCharacters (const juce_wchar* const charactersToRemove) const throw() | |||||
| const String String::removeCharacters (const juce_wchar* const charactersToRemove) const | |||||
| { | { | ||||
| jassert (charactersToRemove != 0); | jassert (charactersToRemove != 0); | ||||
| @@ -1617,12 +1617,12 @@ const String String::removeCharacters (const juce_wchar* const charactersToRemov | |||||
| return result; | return result; | ||||
| } | } | ||||
| const String String::initialSectionContainingOnly (const juce_wchar* const permittedCharacters) const throw() | |||||
| const String String::initialSectionContainingOnly (const juce_wchar* const permittedCharacters) const | |||||
| { | { | ||||
| return substring (0, CharacterFunctions::getIntialSectionContainingOnly (text, permittedCharacters)); | return substring (0, CharacterFunctions::getIntialSectionContainingOnly (text, permittedCharacters)); | ||||
| } | } | ||||
| const String String::initialSectionNotContaining (const juce_wchar* const charactersToStopAt) const throw() | |||||
| const String String::initialSectionNotContaining (const juce_wchar* const charactersToStopAt) const | |||||
| { | { | ||||
| jassert (charactersToStopAt != 0); | jassert (charactersToStopAt != 0); | ||||
| @@ -1726,7 +1726,7 @@ double String::getDoubleValue() const throw() | |||||
| static const juce_wchar* const hexDigits = T("0123456789abcdef"); | static const juce_wchar* const hexDigits = T("0123456789abcdef"); | ||||
| const String String::toHexString (const int number) throw() | |||||
| const String String::toHexString (const int number) | |||||
| { | { | ||||
| juce_wchar buffer[32]; | juce_wchar buffer[32]; | ||||
| juce_wchar* const end = buffer + 32; | juce_wchar* const end = buffer + 32; | ||||
| @@ -1744,7 +1744,7 @@ const String String::toHexString (const int number) throw() | |||||
| return String (t, (int) (((char*) end) - (char*) t) - 1); | return String (t, (int) (((char*) end) - (char*) t) - 1); | ||||
| } | } | ||||
| const String String::toHexString (const int64 number) throw() | |||||
| const String String::toHexString (const int64 number) | |||||
| { | { | ||||
| juce_wchar buffer[32]; | juce_wchar buffer[32]; | ||||
| juce_wchar* const end = buffer + 32; | juce_wchar* const end = buffer + 32; | ||||
| @@ -1762,14 +1762,14 @@ const String String::toHexString (const int64 number) throw() | |||||
| return String (t, (int) (((char*) end) - (char*) t)); | return String (t, (int) (((char*) end) - (char*) t)); | ||||
| } | } | ||||
| const String String::toHexString (const short number) throw() | |||||
| const String String::toHexString (const short number) | |||||
| { | { | ||||
| return toHexString ((int) (unsigned short) number); | return toHexString ((int) (unsigned short) number); | ||||
| } | } | ||||
| const String String::toHexString (const unsigned char* data, | const String String::toHexString (const unsigned char* data, | ||||
| const int size, | const int size, | ||||
| const int groupSize) throw() | |||||
| const int groupSize) | |||||
| { | { | ||||
| if (size <= 0) | if (size <= 0) | ||||
| return empty; | return empty; | ||||
| @@ -1837,8 +1837,7 @@ int64 String::getHexValue64() const throw() | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| const String String::createStringFromData (const void* const data_, | |||||
| const int size) throw() | |||||
| const String String::createStringFromData (const void* const data_, const int size) | |||||
| { | { | ||||
| const char* const data = (const char*) data_; | const char* const data = (const char*) data_; | ||||
| @@ -54,30 +54,29 @@ public: | |||||
| String (const String& other) throw(); | String (const String& other) throw(); | ||||
| /** Creates a string from a zero-terminated text string. | /** Creates a string from a zero-terminated text string. | ||||
| The string is assumed to be stored in the default system encoding. | The string is assumed to be stored in the default system encoding. | ||||
| */ | */ | ||||
| String (const char* text) throw(); | |||||
| String (const char* text); | |||||
| /** Creates a string from an string of characters. | /** Creates a string from an string of characters. | ||||
| This will use up the the first maxChars characters of the string (or | This will use up the the first maxChars characters of the string (or | ||||
| less if the string is actually shorter) | less if the string is actually shorter) | ||||
| */ | */ | ||||
| String (const char* text, size_t maxChars) throw(); | |||||
| String (const char* text, size_t maxChars); | |||||
| /** Creates a string from a zero-terminated unicode text string. */ | /** Creates a string from a zero-terminated unicode text string. */ | ||||
| String (const juce_wchar* unicodeText) throw(); | |||||
| String (const juce_wchar* unicodeText); | |||||
| /** Creates a string from a unicode text string. | /** Creates a string from a unicode text string. | ||||
| This will use up the the first maxChars characters of the string (or | This will use up the the first maxChars characters of the string (or | ||||
| less if the string is actually shorter) | less if the string is actually shorter) | ||||
| */ | */ | ||||
| String (const juce_wchar* unicodeText, size_t maxChars) throw(); | |||||
| String (const juce_wchar* unicodeText, size_t maxChars); | |||||
| /** Creates a string from a single character. */ | /** Creates a string from a single character. */ | ||||
| static const String charToString (juce_wchar character) throw(); | |||||
| static const String charToString (juce_wchar character); | |||||
| /** Destructor. */ | /** Destructor. */ | ||||
| ~String() throw(); | ~String() throw(); | ||||
| @@ -441,7 +440,7 @@ public: | |||||
| Note that the index passed-in is not checked to see whether it's in-range, so | Note that the index passed-in is not checked to see whether it's in-range, so | ||||
| be careful when using this. | be careful when using this. | ||||
| */ | */ | ||||
| juce_wchar& operator[] (int index) throw(); | |||||
| juce_wchar& operator[] (int index); | |||||
| /** Returns the final character of the string. | /** Returns the final character of the string. | ||||
| @@ -460,7 +459,7 @@ public: | |||||
| this index are returned | this index are returned | ||||
| @see fromFirstOccurrenceOf, dropLastCharacters, getLastCharacters, upToFirstOccurrenceOf | @see fromFirstOccurrenceOf, dropLastCharacters, getLastCharacters, upToFirstOccurrenceOf | ||||
| */ | */ | ||||
| const String substring (int startIndex, int endIndex) const throw(); | |||||
| const String substring (int startIndex, int endIndex) const; | |||||
| /** Returns a section of the string, starting from a given position. | /** Returns a section of the string, starting from a given position. | ||||
| @@ -470,7 +469,7 @@ public: | |||||
| @returns the substring from startIndex up to the end of the string | @returns the substring from startIndex up to the end of the string | ||||
| @see dropLastCharacters, getLastCharacters, fromFirstOccurrenceOf, upToFirstOccurrenceOf, fromLastOccurrenceOf | @see dropLastCharacters, getLastCharacters, fromFirstOccurrenceOf, upToFirstOccurrenceOf, fromLastOccurrenceOf | ||||
| */ | */ | ||||
| const String substring (int startIndex) const throw(); | |||||
| const String substring (int startIndex) const; | |||||
| /** Returns a version of this string with a number of characters removed | /** Returns a version of this string with a number of characters removed | ||||
| from the end. | from the end. | ||||
| @@ -481,7 +480,7 @@ public: | |||||
| original string will be returned. | original string will be returned. | ||||
| @see substring, fromFirstOccurrenceOf, upToFirstOccurrenceOf, fromLastOccurrenceOf, getLastCharacter | @see substring, fromFirstOccurrenceOf, upToFirstOccurrenceOf, fromLastOccurrenceOf, getLastCharacter | ||||
| */ | */ | ||||
| const String dropLastCharacters (int numberToDrop) const throw(); | |||||
| const String dropLastCharacters (int numberToDrop) const; | |||||
| /** Returns a number of characters from the end of the string. | /** Returns a number of characters from the end of the string. | ||||
| @@ -490,7 +489,7 @@ public: | |||||
| @see substring, dropLastCharacters, getLastCharacter | @see substring, dropLastCharacters, getLastCharacter | ||||
| */ | */ | ||||
| const String getLastCharacters (int numCharacters) const throw(); | |||||
| const String getLastCharacters (int numCharacters) const; | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns a section of the string starting from a given substring. | /** Returns a section of the string starting from a given substring. | ||||
| @@ -510,7 +509,7 @@ public: | |||||
| */ | */ | ||||
| const String fromFirstOccurrenceOf (const juce_wchar* substringToStartFrom, | const String fromFirstOccurrenceOf (const juce_wchar* substringToStartFrom, | ||||
| bool includeSubStringInResult, | bool includeSubStringInResult, | ||||
| bool ignoreCase) const throw(); | |||||
| bool ignoreCase) const; | |||||
| /** Returns a section of the string starting from the last occurrence of a given substring. | /** Returns a section of the string starting from the last occurrence of a given substring. | ||||
| @@ -522,7 +521,7 @@ public: | |||||
| */ | */ | ||||
| const String fromLastOccurrenceOf (const juce_wchar* substringToFind, | const String fromLastOccurrenceOf (const juce_wchar* substringToFind, | ||||
| bool includeSubStringInResult, | bool includeSubStringInResult, | ||||
| bool ignoreCase) const throw(); | |||||
| bool ignoreCase) const; | |||||
| /** Returns the start of this string, up to the first occurrence of a substring. | /** Returns the start of this string, up to the first occurrence of a substring. | ||||
| @@ -539,7 +538,7 @@ public: | |||||
| */ | */ | ||||
| const String upToFirstOccurrenceOf (const juce_wchar* substringToEndWith, | const String upToFirstOccurrenceOf (const juce_wchar* substringToEndWith, | ||||
| bool includeSubStringInResult, | bool includeSubStringInResult, | ||||
| bool ignoreCase) const throw(); | |||||
| bool ignoreCase) const; | |||||
| /** Returns the start of this string, up to the last occurrence of a substring. | /** Returns the start of this string, up to the last occurrence of a substring. | ||||
| @@ -550,15 +549,15 @@ public: | |||||
| */ | */ | ||||
| const String upToLastOccurrenceOf (const juce_wchar* substringToFind, | const String upToLastOccurrenceOf (const juce_wchar* substringToFind, | ||||
| bool includeSubStringInResult, | bool includeSubStringInResult, | ||||
| bool ignoreCase) const throw(); | |||||
| bool ignoreCase) const; | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns a copy of this string with any whitespace characters removed from the start and end. */ | /** Returns a copy of this string with any whitespace characters removed from the start and end. */ | ||||
| const String trim() const throw(); | |||||
| const String trim() const; | |||||
| /** Returns a copy of this string with any whitespace characters removed from the start. */ | /** Returns a copy of this string with any whitespace characters removed from the start. */ | ||||
| const String trimStart() const throw(); | |||||
| const String trimStart() const; | |||||
| /** Returns a copy of this string with any whitespace characters removed from the end. */ | /** Returns a copy of this string with any whitespace characters removed from the end. */ | ||||
| const String trimEnd() const throw(); | |||||
| const String trimEnd() const; | |||||
| /** Returns a copy of this string, having removed a specified set of characters from its start. | /** Returns a copy of this string, having removed a specified set of characters from its start. | ||||
| Characters are removed from the start of the string until it finds one that is not in the | Characters are removed from the start of the string until it finds one that is not in the | ||||
| @@ -566,7 +565,7 @@ public: | |||||
| @param charactersToTrim the set of characters to remove. This must not be null. | @param charactersToTrim the set of characters to remove. This must not be null. | ||||
| @see trim, trimStart, trimCharactersAtEnd | @see trim, trimStart, trimCharactersAtEnd | ||||
| */ | */ | ||||
| const String trimCharactersAtStart (const juce_wchar* charactersToTrim) const throw(); | |||||
| const String trimCharactersAtStart (const juce_wchar* charactersToTrim) const; | |||||
| /** Returns a copy of this string, having removed a specified set of characters from its end. | /** Returns a copy of this string, having removed a specified set of characters from its end. | ||||
| Characters are removed from the end of the string until it finds one that is not in the | Characters are removed from the end of the string until it finds one that is not in the | ||||
| @@ -574,14 +573,14 @@ public: | |||||
| @param charactersToTrim the set of characters to remove. This must not be null. | @param charactersToTrim the set of characters to remove. This must not be null. | ||||
| @see trim, trimEnd, trimCharactersAtStart | @see trim, trimEnd, trimCharactersAtStart | ||||
| */ | */ | ||||
| const String trimCharactersAtEnd (const juce_wchar* charactersToTrim) const throw(); | |||||
| const String trimCharactersAtEnd (const juce_wchar* charactersToTrim) const; | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns an upper-case version of this string. */ | /** Returns an upper-case version of this string. */ | ||||
| const String toUpperCase() const throw(); | |||||
| const String toUpperCase() const; | |||||
| /** Returns an lower-case version of this string. */ | /** Returns an lower-case version of this string. */ | ||||
| const String toLowerCase() const throw(); | |||||
| const String toLowerCase() const; | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Replaces a sub-section of the string with another string. | /** Replaces a sub-section of the string with another string. | ||||
| @@ -601,7 +600,7 @@ public: | |||||
| */ | */ | ||||
| const String replaceSection (int startIndex, | const String replaceSection (int startIndex, | ||||
| int numCharactersToReplace, | int numCharactersToReplace, | ||||
| const juce_wchar* stringToInsert) const throw(); | |||||
| const juce_wchar* stringToInsert) const; | |||||
| /** Replaces all occurrences of a substring with another string. | /** Replaces all occurrences of a substring with another string. | ||||
| @@ -612,11 +611,11 @@ public: | |||||
| */ | */ | ||||
| const String replace (const juce_wchar* stringToReplace, | const String replace (const juce_wchar* stringToReplace, | ||||
| const juce_wchar* stringToInsertInstead, | const juce_wchar* stringToInsertInstead, | ||||
| bool ignoreCase = false) const throw(); | |||||
| bool ignoreCase = false) const; | |||||
| /** Returns a string with all occurrences of a character replaced with a different one. */ | /** Returns a string with all occurrences of a character replaced with a different one. */ | ||||
| const String replaceCharacter (juce_wchar characterToReplace, | const String replaceCharacter (juce_wchar characterToReplace, | ||||
| juce_wchar characterToInsertInstead) const throw(); | |||||
| juce_wchar characterToInsertInstead) const; | |||||
| /** Replaces a set of characters with another set. | /** Replaces a set of characters with another set. | ||||
| @@ -629,7 +628,7 @@ public: | |||||
| Note that this is a const method, and won't affect the string itself. | Note that this is a const method, and won't affect the string itself. | ||||
| */ | */ | ||||
| const String replaceCharacters (const String& charactersToReplace, | const String replaceCharacters (const String& charactersToReplace, | ||||
| const juce_wchar* charactersToInsertInstead) const throw(); | |||||
| const juce_wchar* charactersToInsertInstead) const; | |||||
| /** Returns a version of this string that only retains a fixed set of characters. | /** Returns a version of this string that only retains a fixed set of characters. | ||||
| @@ -640,7 +639,7 @@ public: | |||||
| Note that this is a const method, and won't alter the string itself. | Note that this is a const method, and won't alter the string itself. | ||||
| */ | */ | ||||
| const String retainCharacters (const juce_wchar* charactersToRetain) const throw(); | |||||
| const String retainCharacters (const juce_wchar* charactersToRetain) const; | |||||
| /** Returns a version of this string with a set of characters removed. | /** Returns a version of this string with a set of characters removed. | ||||
| @@ -651,21 +650,21 @@ public: | |||||
| Note that this is a const method, and won't alter the string itself. | Note that this is a const method, and won't alter the string itself. | ||||
| */ | */ | ||||
| const String removeCharacters (const juce_wchar* charactersToRemove) const throw(); | |||||
| const String removeCharacters (const juce_wchar* charactersToRemove) const; | |||||
| /** Returns a section from the start of the string that only contains a certain set of characters. | /** Returns a section from the start of the string that only contains a certain set of characters. | ||||
| This returns the leftmost section of the string, up to (and not including) the | This returns the leftmost section of the string, up to (and not including) the | ||||
| first character that doesn't appear in the string passed in. | first character that doesn't appear in the string passed in. | ||||
| */ | */ | ||||
| const String initialSectionContainingOnly (const juce_wchar* permittedCharacters) const throw(); | |||||
| const String initialSectionContainingOnly (const juce_wchar* permittedCharacters) const; | |||||
| /** Returns a section from the start of the string that only contains a certain set of characters. | /** Returns a section from the start of the string that only contains a certain set of characters. | ||||
| This returns the leftmost section of the string, up to (and not including) the | This returns the leftmost section of the string, up to (and not including) the | ||||
| first character that occurs in the string passed in. | first character that occurs in the string passed in. | ||||
| */ | */ | ||||
| const String initialSectionNotContaining (const juce_wchar* charactersToStopAt) const throw(); | |||||
| const String initialSectionNotContaining (const juce_wchar* charactersToStopAt) const; | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Checks whether the string might be in quotation marks. | /** Checks whether the string might be in quotation marks. | ||||
| @@ -674,7 +673,7 @@ public: | |||||
| It is also true if there is whitespace before the quote, but it doesn't check the end of the string. | It is also true if there is whitespace before the quote, but it doesn't check the end of the string. | ||||
| @see unquoted, quoted | @see unquoted, quoted | ||||
| */ | */ | ||||
| bool isQuotedString() const throw(); | |||||
| bool isQuotedString() const; | |||||
| /** Removes quotation marks from around the string, (if there are any). | /** Removes quotation marks from around the string, (if there are any). | ||||
| @@ -686,7 +685,7 @@ public: | |||||
| @see isQuotedString, quoted | @see isQuotedString, quoted | ||||
| */ | */ | ||||
| const String unquoted() const throw(); | |||||
| const String unquoted() const; | |||||
| /** Adds quotation marks around a string. | /** Adds quotation marks around a string. | ||||
| @@ -699,7 +698,7 @@ public: | |||||
| @param quoteCharacter the character to add at the start and end | @param quoteCharacter the character to add at the start and end | ||||
| @see isQuotedString, unquoted | @see isQuotedString, unquoted | ||||
| */ | */ | ||||
| const String quoted (juce_wchar quoteCharacter = JUCE_T('"')) const throw(); | |||||
| const String quoted (juce_wchar quoteCharacter = JUCE_T('"')) const; | |||||
| //============================================================================== | //============================================================================== | ||||
| @@ -729,8 +728,7 @@ public: | |||||
| Should be able to handle Unicode endianness correctly, by looking at | Should be able to handle Unicode endianness correctly, by looking at | ||||
| the first two bytes. | the first two bytes. | ||||
| */ | */ | ||||
| static const String createStringFromData (const void* data, | |||||
| int size) throw(); | |||||
| static const String createStringFromData (const void* data, int size); | |||||
| //============================================================================== | //============================================================================== | ||||
| // Numeric conversions.. | // Numeric conversions.. | ||||
| @@ -739,37 +737,37 @@ public: | |||||
| @see getIntValue, getFloatValue, getDoubleValue, toHexString | @see getIntValue, getFloatValue, getDoubleValue, toHexString | ||||
| */ | */ | ||||
| explicit String (int decimalInteger) throw(); | |||||
| explicit String (int decimalInteger); | |||||
| /** Creates a string containing this unsigned 32-bit integer as a decimal number. | /** Creates a string containing this unsigned 32-bit integer as a decimal number. | ||||
| @see getIntValue, getFloatValue, getDoubleValue, toHexString | @see getIntValue, getFloatValue, getDoubleValue, toHexString | ||||
| */ | */ | ||||
| explicit String (unsigned int decimalInteger) throw(); | |||||
| explicit String (unsigned int decimalInteger); | |||||
| /** Creates a string containing this signed 16-bit integer as a decimal number. | /** Creates a string containing this signed 16-bit integer as a decimal number. | ||||
| @see getIntValue, getFloatValue, getDoubleValue, toHexString | @see getIntValue, getFloatValue, getDoubleValue, toHexString | ||||
| */ | */ | ||||
| explicit String (short decimalInteger) throw(); | |||||
| explicit String (short decimalInteger); | |||||
| /** Creates a string containing this unsigned 16-bit integer as a decimal number. | /** Creates a string containing this unsigned 16-bit integer as a decimal number. | ||||
| @see getIntValue, getFloatValue, getDoubleValue, toHexString | @see getIntValue, getFloatValue, getDoubleValue, toHexString | ||||
| */ | */ | ||||
| explicit String (unsigned short decimalInteger) throw(); | |||||
| explicit String (unsigned short decimalInteger); | |||||
| /** Creates a string containing this signed 64-bit integer as a decimal number. | /** Creates a string containing this signed 64-bit integer as a decimal number. | ||||
| @see getLargeIntValue, getFloatValue, getDoubleValue, toHexString | @see getLargeIntValue, getFloatValue, getDoubleValue, toHexString | ||||
| */ | */ | ||||
| explicit String (int64 largeIntegerValue) throw(); | |||||
| explicit String (int64 largeIntegerValue); | |||||
| /** Creates a string containing this unsigned 64-bit integer as a decimal number. | /** Creates a string containing this unsigned 64-bit integer as a decimal number. | ||||
| @see getLargeIntValue, getFloatValue, getDoubleValue, toHexString | @see getLargeIntValue, getFloatValue, getDoubleValue, toHexString | ||||
| */ | */ | ||||
| explicit String (uint64 largeIntegerValue) throw(); | |||||
| explicit String (uint64 largeIntegerValue); | |||||
| /** Creates a string representing this floating-point number. | /** Creates a string representing this floating-point number. | ||||
| @@ -780,7 +778,7 @@ public: | |||||
| @see getDoubleValue, getIntValue | @see getDoubleValue, getIntValue | ||||
| */ | */ | ||||
| explicit String (float floatValue, | explicit String (float floatValue, | ||||
| int numberOfDecimalPlaces = 0) throw(); | |||||
| int numberOfDecimalPlaces = 0); | |||||
| /** Creates a string representing this floating-point number. | /** Creates a string representing this floating-point number. | ||||
| @@ -792,7 +790,7 @@ public: | |||||
| @see getFloatValue, getIntValue | @see getFloatValue, getIntValue | ||||
| */ | */ | ||||
| explicit String (double doubleValue, | explicit String (double doubleValue, | ||||
| int numberOfDecimalPlaces = 0) throw(); | |||||
| int numberOfDecimalPlaces = 0); | |||||
| /** Reads the value of the string as a decimal number (up to 32 bits in size). | /** Reads the value of the string as a decimal number (up to 32 bits in size). | ||||
| @@ -855,13 +853,13 @@ public: | |||||
| int64 getHexValue64() const throw(); | int64 getHexValue64() const throw(); | ||||
| /** Creates a string representing this 32-bit value in hexadecimal. */ | /** Creates a string representing this 32-bit value in hexadecimal. */ | ||||
| static const String toHexString (int number) throw(); | |||||
| static const String toHexString (int number); | |||||
| /** Creates a string representing this 64-bit value in hexadecimal. */ | /** Creates a string representing this 64-bit value in hexadecimal. */ | ||||
| static const String toHexString (int64 number) throw(); | |||||
| static const String toHexString (int64 number); | |||||
| /** Creates a string representing this 16-bit value in hexadecimal. */ | /** Creates a string representing this 16-bit value in hexadecimal. */ | ||||
| static const String toHexString (short number) throw(); | |||||
| static const String toHexString (short number); | |||||
| /** Creates a string containing a hex dump of a block of binary data. | /** Creates a string containing a hex dump of a block of binary data. | ||||
| @@ -874,7 +872,7 @@ public: | |||||
| */ | */ | ||||
| static const String toHexString (const unsigned char* data, | static const String toHexString (const unsigned char* data, | ||||
| int size, | int size, | ||||
| int groupSize = 1) throw(); | |||||
| int groupSize = 1); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns a unicode version of this string. | /** Returns a unicode version of this string. | ||||
| @@ -987,6 +985,11 @@ public: | |||||
| */ | */ | ||||
| void preallocateStorage (size_t numCharsNeeded); | void preallocateStorage (size_t numCharsNeeded); | ||||
| /** Swaps the contents of this string with another one. | |||||
| This is a very fast operation, as no allocation or copying needs to be done. | |||||
| */ | |||||
| void swapWith (String& other) throw(); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** A helper class to improve performance when concatenating many large strings | /** A helper class to improve performance when concatenating many large strings | ||||
| together. | together. | ||||
| @@ -327,40 +327,32 @@ const String StringArray::joinIntoString (const String& separator, int start, in | |||||
| return result; | return result; | ||||
| } | } | ||||
| int StringArray::addTokens (const tchar* const text, const bool preserveQuotedStrings) | |||||
| int StringArray::addTokens (const String& text, const bool preserveQuotedStrings) | |||||
| { | { | ||||
| return addTokens (text, | |||||
| T(" \n\r\t"), | |||||
| preserveQuotedStrings ? T("\"") : 0); | |||||
| return addTokens (text, T(" \n\r\t"), preserveQuotedStrings ? T("\"") : 0); | |||||
| } | } | ||||
| int StringArray::addTokens (const tchar* const text, const tchar* breakCharacters, const tchar* quoteCharacters) | |||||
| int StringArray::addTokens (const String& text, const String& breakCharacters, const String& quoteCharacters) | |||||
| { | { | ||||
| int num = 0; | int num = 0; | ||||
| if (text != 0 && *text != 0) | |||||
| if (text.isNotEmpty()) | |||||
| { | { | ||||
| if (breakCharacters == 0) | |||||
| breakCharacters = T(""); | |||||
| if (quoteCharacters == 0) | |||||
| quoteCharacters = T(""); | |||||
| bool insideQuotes = false; | bool insideQuotes = false; | ||||
| tchar currentQuoteChar = 0; | |||||
| juce_wchar currentQuoteChar = 0; | |||||
| int i = 0; | int i = 0; | ||||
| int tokenStart = 0; | int tokenStart = 0; | ||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| const tchar c = text[i]; | |||||
| const juce_wchar c = text[i]; | |||||
| bool isBreak = (c == 0); | bool isBreak = (c == 0); | ||||
| if (! (insideQuotes || isBreak)) | if (! (insideQuotes || isBreak)) | ||||
| { | { | ||||
| const tchar* b = breakCharacters; | |||||
| const juce_wchar* b = breakCharacters; | |||||
| while (*b != 0) | while (*b != 0) | ||||
| { | { | ||||
| if (*b++ == c) | if (*b++ == c) | ||||
| @@ -374,7 +366,7 @@ int StringArray::addTokens (const tchar* const text, const tchar* breakCharacter | |||||
| if (! isBreak) | if (! isBreak) | ||||
| { | { | ||||
| bool isQuote = false; | bool isQuote = false; | ||||
| const tchar* q = quoteCharacters; | |||||
| const juce_wchar* q = quoteCharacters; | |||||
| while (*q != 0) | while (*q != 0) | ||||
| { | { | ||||
| if (*q++ == c) | if (*q++ == c) | ||||
| @@ -402,7 +394,7 @@ int StringArray::addTokens (const tchar* const text, const tchar* breakCharacter | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| add (String (text + tokenStart, i - tokenStart)); | |||||
| add (String (static_cast <const juce_wchar*> (text) + tokenStart, i - tokenStart)); | |||||
| ++num; | ++num; | ||||
| tokenStart = i + 1; | tokenStart = i + 1; | ||||
| @@ -418,47 +410,45 @@ int StringArray::addTokens (const tchar* const text, const tchar* breakCharacter | |||||
| return num; | return num; | ||||
| } | } | ||||
| int StringArray::addLines (const tchar* text) | |||||
| int StringArray::addLines (const String& sourceText) | |||||
| { | { | ||||
| int numLines = 0; | int numLines = 0; | ||||
| const juce_wchar* text = sourceText; | |||||
| if (text != 0) | |||||
| while (*text != 0) | |||||
| { | { | ||||
| const juce_wchar* const startOfLine = text; | |||||
| while (*text != 0) | while (*text != 0) | ||||
| { | { | ||||
| const tchar* const startOfLine = text; | |||||
| while (*text != 0) | |||||
| if (*text == T('\r')) | |||||
| { | { | ||||
| if (*text == T('\r')) | |||||
| { | |||||
| ++text; | |||||
| if (*text == T('\n')) | |||||
| ++text; | |||||
| break; | |||||
| } | |||||
| ++text; | |||||
| if (*text == T('\n')) | if (*text == T('\n')) | ||||
| { | |||||
| ++text; | ++text; | ||||
| break; | |||||
| } | |||||
| break; | |||||
| } | |||||
| if (*text == T('\n')) | |||||
| { | |||||
| ++text; | ++text; | ||||
| break; | |||||
| } | } | ||||
| const tchar* endOfLine = text; | |||||
| if (endOfLine > startOfLine && (*(endOfLine - 1) == T('\r') || *(endOfLine - 1) == T('\n'))) | |||||
| --endOfLine; | |||||
| ++text; | |||||
| } | |||||
| if (endOfLine > startOfLine && (*(endOfLine - 1) == T('\r') || *(endOfLine - 1) == T('\n'))) | |||||
| --endOfLine; | |||||
| const juce_wchar* endOfLine = text; | |||||
| if (endOfLine > startOfLine && (*(endOfLine - 1) == T('\r') || *(endOfLine - 1) == T('\n'))) | |||||
| --endOfLine; | |||||
| add (String (startOfLine, jmax (0, (int) (endOfLine - startOfLine)))); | |||||
| if (endOfLine > startOfLine && (*(endOfLine - 1) == T('\r') || *(endOfLine - 1) == T('\n'))) | |||||
| --endOfLine; | |||||
| ++numLines; | |||||
| } | |||||
| add (String (startOfLine, jmax (0, (int) (endOfLine - startOfLine)))); | |||||
| ++numLines; | |||||
| } | } | ||||
| return numLines; | return numLines; | ||||
| @@ -187,7 +187,7 @@ public: | |||||
| @returns the number of tokens added | @returns the number of tokens added | ||||
| */ | */ | ||||
| int addTokens (const tchar* const stringToTokenise, | |||||
| int addTokens (const String& stringToTokenise, | |||||
| const bool preserveQuotedStrings); | const bool preserveQuotedStrings); | ||||
| /** Breaks up a string into tokens and adds them to this array. | /** Breaks up a string into tokens and adds them to this array. | ||||
| @@ -203,9 +203,9 @@ public: | |||||
| between quotes is not broken up into tokens. | between quotes is not broken up into tokens. | ||||
| @returns the number of tokens added | @returns the number of tokens added | ||||
| */ | */ | ||||
| int addTokens (const tchar* const stringToTokenise, | |||||
| const tchar* breakCharacters, | |||||
| const tchar* quoteCharacters); | |||||
| int addTokens (const String& stringToTokenise, | |||||
| const String& breakCharacters, | |||||
| const String& quoteCharacters); | |||||
| /** Breaks up a string into lines and adds them to this array. | /** Breaks up a string into lines and adds them to this array. | ||||
| @@ -213,7 +213,7 @@ public: | |||||
| to the array. Line-break characters are omitted from the strings that are added to | to the array. Line-break characters are omitted from the strings that are added to | ||||
| the array. | the array. | ||||
| */ | */ | ||||
| int addLines (const tchar* stringToBreakUp); | |||||
| int addLines (const String& stringToBreakUp); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Removes all elements from the array. */ | /** Removes all elements from the array. */ | ||||
| @@ -57,7 +57,7 @@ void XmlDocument::setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw | |||||
| ignoreEmptyTextElements = shouldBeIgnored; | ignoreEmptyTextElements = shouldBeIgnored; | ||||
| } | } | ||||
| bool XmlDocument::isXmlIdentifierCharSlow (const tchar c) throw() | |||||
| bool XmlDocument::isXmlIdentifierCharSlow (const juce_wchar c) throw() | |||||
| { | { | ||||
| return CharacterFunctions::isLetterOrDigit (c) | return CharacterFunctions::isLetterOrDigit (c) | ||||
| || c == T('_') | || c == T('_') | ||||
| @@ -66,7 +66,7 @@ bool XmlDocument::isXmlIdentifierCharSlow (const tchar c) throw() | |||||
| || c == T('.'); | || c == T('.'); | ||||
| } | } | ||||
| inline bool XmlDocument::isXmlIdentifierChar (const tchar c) const throw() | |||||
| inline bool XmlDocument::isXmlIdentifierChar (const juce_wchar c) const throw() | |||||
| { | { | ||||
| return (c > 0 && c <= 127) ? identifierLookupTable [(int) c] | return (c > 0 && c <= 127) ? identifierLookupTable [(int) c] | ||||
| : isXmlIdentifierCharSlow (c); | : isXmlIdentifierCharSlow (c); | ||||
| @@ -109,7 +109,7 @@ XmlElement* XmlDocument::getDocumentElement (const bool onlyReadOuterDocumentEle | |||||
| needToLoadDTD = true; | needToLoadDTD = true; | ||||
| for (int i = 0; i < 128; ++i) | for (int i = 0; i < 128; ++i) | ||||
| identifierLookupTable[i] = isXmlIdentifierCharSlow ((tchar) i); | |||||
| identifierLookupTable[i] = isXmlIdentifierCharSlow ((juce_wchar) i); | |||||
| if (textToParse.isEmpty()) | if (textToParse.isEmpty()) | ||||
| { | { | ||||
| @@ -159,7 +159,7 @@ const String XmlDocument::getFileContents (const String& filename) const | |||||
| return String::empty; | return String::empty; | ||||
| } | } | ||||
| tchar XmlDocument::readNextChar() throw() | |||||
| juce_wchar XmlDocument::readNextChar() throw() | |||||
| { | { | ||||
| if (*input != 0) | if (*input != 0) | ||||
| { | { | ||||
| @@ -175,7 +175,7 @@ tchar XmlDocument::readNextChar() throw() | |||||
| int XmlDocument::findNextTokenLength() throw() | int XmlDocument::findNextTokenLength() throw() | ||||
| { | { | ||||
| int len = 0; | int len = 0; | ||||
| tchar c = *input; | |||||
| juce_wchar c = *input; | |||||
| while (isXmlIdentifierChar (c)) | while (isXmlIdentifierChar (c)) | ||||
| c = input [++len]; | c = input [++len]; | ||||
| @@ -185,7 +185,7 @@ int XmlDocument::findNextTokenLength() throw() | |||||
| void XmlDocument::skipHeader() throw() | void XmlDocument::skipHeader() throw() | ||||
| { | { | ||||
| const tchar* const found = CharacterFunctions::find (input, T("<?xml")); | |||||
| const juce_wchar* const found = CharacterFunctions::find (input, T("<?xml")); | |||||
| if (found != 0) | if (found != 0) | ||||
| { | { | ||||
| @@ -199,7 +199,7 @@ void XmlDocument::skipHeader() throw() | |||||
| } | } | ||||
| skipNextWhiteSpace(); | skipNextWhiteSpace(); | ||||
| const tchar* docType = CharacterFunctions::find (input, T("<!DOCTYPE")); | |||||
| const juce_wchar* docType = CharacterFunctions::find (input, T("<!DOCTYPE")); | |||||
| if (docType == 0) | if (docType == 0) | ||||
| return; | return; | ||||
| @@ -210,7 +210,7 @@ void XmlDocument::skipHeader() throw() | |||||
| while (n > 0) | while (n > 0) | ||||
| { | { | ||||
| const tchar c = readNextChar(); | |||||
| const juce_wchar c = readNextChar(); | |||||
| if (outOfData) | if (outOfData) | ||||
| return; | return; | ||||
| @@ -229,7 +229,7 @@ void XmlDocument::skipNextWhiteSpace() throw() | |||||
| { | { | ||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| tchar c = *input; | |||||
| juce_wchar c = *input; | |||||
| while (CharacterFunctions::isWhitespace (c)) | while (CharacterFunctions::isWhitespace (c)) | ||||
| c = *++input; | c = *++input; | ||||
| @@ -245,7 +245,7 @@ void XmlDocument::skipNextWhiteSpace() throw() | |||||
| && input[2] == T('-') | && input[2] == T('-') | ||||
| && input[3] == T('-')) | && input[3] == T('-')) | ||||
| { | { | ||||
| const tchar* const closeComment = CharacterFunctions::find (input, T("-->")); | |||||
| const juce_wchar* const closeComment = CharacterFunctions::find (input, T("-->")); | |||||
| if (closeComment == 0) | if (closeComment == 0) | ||||
| { | { | ||||
| @@ -258,7 +258,7 @@ void XmlDocument::skipNextWhiteSpace() throw() | |||||
| } | } | ||||
| else if (input[1] == T('?')) | else if (input[1] == T('?')) | ||||
| { | { | ||||
| const tchar* const closeBracket = CharacterFunctions::find (input, T("?>")); | |||||
| const juce_wchar* const closeBracket = CharacterFunctions::find (input, T("?>")); | |||||
| if (closeBracket == 0) | if (closeBracket == 0) | ||||
| { | { | ||||
| @@ -277,11 +277,11 @@ void XmlDocument::skipNextWhiteSpace() throw() | |||||
| void XmlDocument::readQuotedString (String& result) throw() | void XmlDocument::readQuotedString (String& result) throw() | ||||
| { | { | ||||
| const tchar quote = readNextChar(); | |||||
| const juce_wchar quote = readNextChar(); | |||||
| while (! outOfData) | while (! outOfData) | ||||
| { | { | ||||
| const tchar c = readNextChar(); | |||||
| const juce_wchar c = readNextChar(); | |||||
| if (c == quote) | if (c == quote) | ||||
| break; | break; | ||||
| @@ -294,11 +294,11 @@ void XmlDocument::readQuotedString (String& result) throw() | |||||
| else | else | ||||
| { | { | ||||
| --input; | --input; | ||||
| const tchar* const start = input; | |||||
| const juce_wchar* const start = input; | |||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| const tchar character = *input; | |||||
| const juce_wchar character = *input; | |||||
| if (character == quote) | if (character == quote) | ||||
| { | { | ||||
| @@ -362,7 +362,7 @@ XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements) throw | |||||
| { | { | ||||
| skipNextWhiteSpace(); | skipNextWhiteSpace(); | ||||
| const tchar c = *input; | |||||
| const juce_wchar c = *input; | |||||
| // empty tag.. | // empty tag.. | ||||
| if (c == T('/') && input[1] == T('>')) | if (c == T('/') && input[1] == T('>')) | ||||
| @@ -390,7 +390,7 @@ XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements) throw | |||||
| if (attNameLen > 0) | if (attNameLen > 0) | ||||
| { | { | ||||
| const tchar* attNameStart = input; | |||||
| const juce_wchar* attNameStart = input; | |||||
| input += attNameLen; | input += attNameLen; | ||||
| skipNextWhiteSpace(); | skipNextWhiteSpace(); | ||||
| @@ -399,7 +399,7 @@ XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements) throw | |||||
| { | { | ||||
| skipNextWhiteSpace(); | skipNextWhiteSpace(); | ||||
| const tchar nextChar = *input; | |||||
| const juce_wchar nextChar = *input; | |||||
| if (nextChar == T('"') || nextChar == T('\'')) | if (nextChar == T('"') || nextChar == T('\'')) | ||||
| { | { | ||||
| @@ -467,7 +467,7 @@ void XmlDocument::readChildElements (XmlElement* parent) throw() | |||||
| && input[8] == T('[')) | && input[8] == T('[')) | ||||
| { | { | ||||
| input += 9; | input += 9; | ||||
| const tchar* const inputStart = input; | |||||
| const juce_wchar* const inputStart = input; | |||||
| int len = 0; | int len = 0; | ||||
| @@ -537,7 +537,7 @@ void XmlDocument::readChildElements (XmlElement* parent) throw() | |||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| const tchar c = *input; | |||||
| const juce_wchar c = *input; | |||||
| if (c == T('<')) | if (c == T('<')) | ||||
| break; | break; | ||||
| @@ -556,10 +556,10 @@ void XmlDocument::readChildElements (XmlElement* parent) throw() | |||||
| if (entity.startsWithChar (T('<')) && entity [1] != 0) | if (entity.startsWithChar (T('<')) && entity [1] != 0) | ||||
| { | { | ||||
| const tchar* const oldInput = input; | |||||
| const juce_wchar* const oldInput = input; | |||||
| const bool oldOutOfData = outOfData; | const bool oldOutOfData = outOfData; | ||||
| input = (const tchar*) entity; | |||||
| input = entity; | |||||
| outOfData = false; | outOfData = false; | ||||
| for (;;) | for (;;) | ||||
| @@ -587,12 +587,12 @@ void XmlDocument::readChildElements (XmlElement* parent) throw() | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| const tchar* start = input; | |||||
| const juce_wchar* start = input; | |||||
| int len = 0; | int len = 0; | ||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| const tchar nextChar = *input; | |||||
| const juce_wchar nextChar = *input; | |||||
| if (nextChar == T('<') || nextChar == T('&')) | if (nextChar == T('<') || nextChar == T('&')) | ||||
| { | { | ||||
| @@ -701,12 +701,12 @@ void XmlDocument::readEntity (String& result) throw() | |||||
| return; | return; | ||||
| } | } | ||||
| result << (tchar) charCode; | |||||
| result << (juce_wchar) charCode; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| const tchar* const entityNameStart = input; | |||||
| const tchar* const closingSemiColon = CharacterFunctions::find (input, T(";")); | |||||
| const juce_wchar* const entityNameStart = input; | |||||
| const juce_wchar* const closingSemiColon = CharacterFunctions::find (input, T(";")); | |||||
| if (closingSemiColon == 0) | if (closingSemiColon == 0) | ||||
| { | { | ||||
| @@ -749,11 +749,11 @@ const String XmlDocument::expandEntity (const String& ent) | |||||
| { | { | ||||
| if (ent[1] == T('x') || ent[1] == T('X')) | if (ent[1] == T('x') || ent[1] == T('X')) | ||||
| { | { | ||||
| return String::charToString ((tchar) ent.substring (2).getHexValue32()); | |||||
| return String::charToString (static_cast <juce_wchar> (ent.substring (2).getHexValue32())); | |||||
| } | } | ||||
| else if (ent[1] >= T('0') && ent[1] <= T('9')) | else if (ent[1] >= T('0') && ent[1] <= T('9')) | ||||
| { | { | ||||
| return String::charToString ((tchar) ent.substring (1).getIntValue()); | |||||
| return String::charToString (static_cast <juce_wchar> (ent.substring (1).getIntValue())); | |||||
| } | } | ||||
| setLastError ("illegal escape sequence", false); | setLastError ("illegal escape sequence", false); | ||||
| @@ -131,7 +131,7 @@ public: | |||||
| private: | private: | ||||
| String originalText; | String originalText; | ||||
| const tchar* input; | |||||
| const juce_wchar* input; | |||||
| bool outOfData, errorOccurred; | bool outOfData, errorOccurred; | ||||
| bool identifierLookupTable [128]; | bool identifierLookupTable [128]; | ||||
| @@ -143,14 +143,14 @@ private: | |||||
| void setLastError (const String& desc, const bool carryOn) throw(); | void setLastError (const String& desc, const bool carryOn) throw(); | ||||
| void skipHeader() throw(); | void skipHeader() throw(); | ||||
| void skipNextWhiteSpace() throw(); | void skipNextWhiteSpace() throw(); | ||||
| tchar readNextChar() throw(); | |||||
| juce_wchar readNextChar() throw(); | |||||
| XmlElement* readNextElement (const bool alsoParseSubElements) throw(); | XmlElement* readNextElement (const bool alsoParseSubElements) throw(); | ||||
| void readChildElements (XmlElement* parent) throw(); | void readChildElements (XmlElement* parent) throw(); | ||||
| int findNextTokenLength() throw(); | int findNextTokenLength() throw(); | ||||
| void readQuotedString (String& result) throw(); | void readQuotedString (String& result) throw(); | ||||
| void readEntity (String& result) throw(); | void readEntity (String& result) throw(); | ||||
| static bool isXmlIdentifierCharSlow (const tchar c) throw(); | |||||
| bool isXmlIdentifierChar (const tchar c) const throw(); | |||||
| static bool isXmlIdentifierCharSlow (juce_wchar c) throw(); | |||||
| bool isXmlIdentifierChar (juce_wchar c) const throw(); | |||||
| const String getFileContents (const String& filename) const; | const String getFileContents (const String& filename) const; | ||||
| const String expandEntity (const String& entity); | const String expandEntity (const String& entity); | ||||
| @@ -599,7 +599,7 @@ bool XmlElement::getBoolAttribute (const String& attributeName, | |||||
| { | { | ||||
| if (att->name.equalsIgnoreCase (attributeName)) | if (att->name.equalsIgnoreCase (attributeName)) | ||||
| { | { | ||||
| tchar firstChar = att->value[0]; | |||||
| juce_wchar firstChar = att->value[0]; | |||||
| if (CharacterFunctions::isWhitespace (firstChar)) | if (CharacterFunctions::isWhitespace (firstChar)) | ||||
| firstChar = att->value.trimStart() [0]; | firstChar = att->value.trimStart() [0]; | ||||
| @@ -645,7 +645,7 @@ void XmlElement::setAttribute (const String& attributeName, | |||||
| { | { | ||||
| #ifdef JUCE_DEBUG | #ifdef JUCE_DEBUG | ||||
| // check the identifier being passed in is legal.. | // check the identifier being passed in is legal.. | ||||
| const tchar* t = attributeName; | |||||
| const juce_wchar* t = attributeName; | |||||
| while (*t != 0) | while (*t != 0) | ||||
| { | { | ||||
| jassert (CharacterFunctions::isLetterOrDigit (*t) | jassert (CharacterFunctions::isLetterOrDigit (*t) | ||||
| @@ -1084,7 +1084,7 @@ bool XmlElement::isTextElement() const throw() | |||||
| return tagName.isEmpty(); | return tagName.isEmpty(); | ||||
| } | } | ||||
| static const tchar* const juce_xmltextContentAttributeName = T("text"); | |||||
| static const juce_wchar* const juce_xmltextContentAttributeName = T("text"); | |||||
| const String XmlElement::getText() const throw() | const String XmlElement::getText() const throw() | ||||
| { | { | ||||