| @@ -1474,7 +1474,7 @@ class HeapBlock | |||
| { | |||
| public: | |||
| HeapBlock() : data (0) | |||
| HeapBlock() throw() : data (0) | |||
| { | |||
| } | |||
| @@ -1488,26 +1488,26 @@ public: | |||
| ::juce_free (data); | |||
| } | |||
| inline operator ElementType*() const { return data; } | |||
| inline operator ElementType*() const throw() { return data; } | |||
| inline operator void*() const { return (void*) data; } | |||
| inline operator void*() const throw() { return (void*) data; } | |||
| inline ElementType* operator->() const { return data; } | |||
| inline ElementType* operator->() const throw() { return data; } | |||
| template <class CastType> | |||
| inline operator CastType*() const { return (CastType*) data; } | |||
| inline operator CastType*() const throw() { return (CastType*) data; } | |||
| template <typename IndexType> | |||
| inline ElementType& operator[] (IndexType index) const { return data [index]; } | |||
| inline ElementType& operator[] (IndexType index) const throw() { return data [index]; } | |||
| template <typename IndexType> | |||
| inline ElementType* operator+ (IndexType index) const { return data + index; } | |||
| inline ElementType* operator+ (IndexType index) const throw() { return data + index; } | |||
| inline ElementType** operator&() const { return (ElementType**) &data; } | |||
| inline ElementType** operator&() const throw() { return (ElementType**) &data; } | |||
| inline bool operator== (const ElementType* const otherPointer) const { return otherPointer == data; } | |||
| inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; } | |||
| inline bool operator!= (const ElementType* const otherPointer) const { return otherPointer != data; } | |||
| inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; } | |||
| void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) | |||
| { | |||
| @@ -1545,7 +1545,7 @@ public: | |||
| data = 0; | |||
| } | |||
| void swapWith (HeapBlock <ElementType>& other) | |||
| void swapWith (HeapBlock <ElementType>& other) throw() | |||
| { | |||
| swapVariables (data, other.data); | |||
| } | |||
| @@ -1588,19 +1588,19 @@ public: | |||
| } | |||
| } | |||
| void ensureAllocatedSize (int minNumElements) | |||
| void ensureAllocatedSize (const int minNumElements) | |||
| { | |||
| if (minNumElements > numAllocated) | |||
| setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7); | |||
| } | |||
| void shrinkToNoMoreThan (int maxNumElements) | |||
| void shrinkToNoMoreThan (const int maxNumElements) | |||
| { | |||
| if (maxNumElements < numAllocated) | |||
| setAllocatedSize (maxNumElements); | |||
| } | |||
| void swapWith (ArrayAllocationBase <ElementType>& other) | |||
| void swapWith (ArrayAllocationBase <ElementType>& other) throw() | |||
| { | |||
| elements.swapWith (other.elements); | |||
| swapVariables (numAllocated, other.numAllocated); | |||
| @@ -1873,7 +1873,8 @@ public: | |||
| #endif // __JUCE_CRITICALSECTION_JUCEHEADER__ | |||
| /********* End of inlined file: juce_CriticalSection.h *********/ | |||
| template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection> | |||
| template <typename ElementType, | |||
| typename TypeOfCriticalSectionToUse = DummyCriticalSection> | |||
| class Array | |||
| { | |||
| public: | |||
| @@ -1883,7 +1884,7 @@ public: | |||
| { | |||
| } | |||
| Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other) throw() | |||
| Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other) | |||
| { | |||
| other.lockArray(); | |||
| numUsed = other.numUsed; | |||
| @@ -1895,14 +1896,14 @@ public: | |||
| other.unlockArray(); | |||
| } | |||
| Array (const ElementType* values) throw() | |||
| explicit Array (const ElementType* values) | |||
| : numUsed (0) | |||
| { | |||
| while (*values != 0) | |||
| add (*values++); | |||
| } | |||
| Array (const ElementType* values, int numValues) throw() | |||
| Array (const ElementType* values, int numValues) | |||
| : numUsed (numValues) | |||
| { | |||
| data.setAllocatedSize (numValues); | |||
| @@ -1911,50 +1912,25 @@ public: | |||
| new (data.elements + i) ElementType (values[i]); | |||
| } | |||
| ~Array() throw() | |||
| ~Array() | |||
| { | |||
| for (int i = 0; i < numUsed; ++i) | |||
| data.elements[i].~ElementType(); | |||
| } | |||
| const Array <ElementType, TypeOfCriticalSectionToUse>& operator= (const Array <ElementType, TypeOfCriticalSectionToUse>& other) throw() | |||
| Array <ElementType, TypeOfCriticalSectionToUse>& operator= (const Array <ElementType, TypeOfCriticalSectionToUse>& other) | |||
| { | |||
| if (this != &other) | |||
| { | |||
| other.lockArray(); | |||
| lock.enter(); | |||
| if (other.size() > numUsed) | |||
| { | |||
| data.ensureAllocatedSize (other.size()); | |||
| int i = 0; | |||
| for (; i < numUsed; ++i) | |||
| data.elements[i] = other.data.elements[i]; | |||
| numUsed = other.size(); | |||
| for (; i < numUsed; ++i) | |||
| new (data.elements + i) ElementType (other.data.elements[i]); | |||
| } | |||
| else | |||
| { | |||
| numUsed = other.size(); | |||
| for (int i = 0; i < numUsed; ++i) | |||
| data.elements[i] = other.data.elements[i]; | |||
| minimiseStorageOverheads(); | |||
| } | |||
| lock.exit(); | |||
| other.unlockArray(); | |||
| Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other); | |||
| swapWithArray (otherCopy); | |||
| } | |||
| return *this; | |||
| } | |||
| template <class OtherArrayType> | |||
| bool operator== (const OtherArrayType& other) const throw() | |||
| bool operator== (const OtherArrayType& other) const | |||
| { | |||
| lock.enter(); | |||
| @@ -1978,12 +1954,12 @@ public: | |||
| } | |||
| template <class OtherArrayType> | |||
| bool operator!= (const OtherArrayType& other) const throw() | |||
| bool operator!= (const OtherArrayType& other) const | |||
| { | |||
| return ! operator== (other); | |||
| } | |||
| void clear() throw() | |||
| void clear() | |||
| { | |||
| lock.enter(); | |||
| @@ -1995,7 +1971,7 @@ public: | |||
| lock.exit(); | |||
| } | |||
| void clearQuick() throw() | |||
| void clearQuick() | |||
| { | |||
| lock.enter(); | |||
| @@ -2011,22 +1987,22 @@ public: | |||
| return numUsed; | |||
| } | |||
| inline ElementType operator[] (const int index) const throw() | |||
| inline ElementType operator[] (const int index) const | |||
| { | |||
| lock.enter(); | |||
| const ElementType result = (((unsigned int) index) < (unsigned int) numUsed) | |||
| const ElementType result ((((unsigned int) index) < (unsigned int) numUsed) | |||
| ? data.elements [index] | |||
| : ElementType(); | |||
| : ElementType()); | |||
| lock.exit(); | |||
| return result; | |||
| } | |||
| inline ElementType getUnchecked (const int index) const throw() | |||
| inline const ElementType getUnchecked (const int index) const | |||
| { | |||
| lock.enter(); | |||
| jassert (((unsigned int) index) < (unsigned int) numUsed); | |||
| const ElementType result = data.elements [index]; | |||
| const ElementType result (data.elements [index]); | |||
| lock.exit(); | |||
| return result; | |||
| @@ -2041,27 +2017,27 @@ public: | |||
| return result; | |||
| } | |||
| inline ElementType getFirst() const throw() | |||
| inline ElementType getFirst() const | |||
| { | |||
| lock.enter(); | |||
| const ElementType result = (numUsed > 0) ? data.elements [0] | |||
| : ElementType(); | |||
| const ElementType result ((numUsed > 0) ? data.elements [0] | |||
| : ElementType()); | |||
| lock.exit(); | |||
| return result; | |||
| } | |||
| inline ElementType getLast() const throw() | |||
| inline ElementType getLast() const | |||
| { | |||
| lock.enter(); | |||
| const ElementType result = (numUsed > 0) ? data.elements [numUsed - 1] | |||
| : ElementType(); | |||
| const ElementType result ((numUsed > 0) ? data.elements [numUsed - 1] | |||
| : ElementType()); | |||
| lock.exit(); | |||
| return result; | |||
| } | |||
| int indexOf (const ElementType elementToLookFor) const throw() | |||
| int indexOf (const ElementType& elementToLookFor) const | |||
| { | |||
| int result = -1; | |||
| @@ -2083,28 +2059,13 @@ public: | |||
| return result; | |||
| } | |||
| bool contains (const ElementType elementToLookFor) const throw() | |||
| bool contains (const ElementType& elementToLookFor) const | |||
| { | |||
| lock.enter(); | |||
| const ElementType* e = data.elements; | |||
| int num = numUsed; | |||
| while (num >= 4) | |||
| { | |||
| if (*e == elementToLookFor | |||
| || *++e == elementToLookFor | |||
| || *++e == elementToLookFor | |||
| || *++e == elementToLookFor) | |||
| { | |||
| lock.exit(); | |||
| return true; | |||
| } | |||
| num -= 4; | |||
| ++e; | |||
| } | |||
| while (num > 0) | |||
| { | |||
| if (elementToLookFor == *e) | |||
| @@ -2121,7 +2082,7 @@ public: | |||
| return false; | |||
| } | |||
| void add (const ElementType newElement) throw() | |||
| void add (const ElementType& newElement) | |||
| { | |||
| lock.enter(); | |||
| data.ensureAllocatedSize (numUsed + 1); | |||
| @@ -2129,7 +2090,7 @@ public: | |||
| lock.exit(); | |||
| } | |||
| void insert (int indexToInsertAt, const ElementType newElement) throw() | |||
| void insert (int indexToInsertAt, const ElementType& newElement) | |||
| { | |||
| lock.enter(); | |||
| data.ensureAllocatedSize (numUsed + 1); | |||
| @@ -2153,8 +2114,8 @@ public: | |||
| lock.exit(); | |||
| } | |||
| void insertMultiple (int indexToInsertAt, const ElementType newElement, | |||
| int numberOfTimesToInsertIt) throw() | |||
| void insertMultiple (int indexToInsertAt, const ElementType& newElement, | |||
| int numberOfTimesToInsertIt) | |||
| { | |||
| if (numberOfTimesToInsertIt > 0) | |||
| { | |||
| @@ -2184,7 +2145,7 @@ public: | |||
| void insertArray (int indexToInsertAt, | |||
| const ElementType* newElements, | |||
| int numberOfElements) throw() | |||
| int numberOfElements) | |||
| { | |||
| if (numberOfElements > 0) | |||
| { | |||
| @@ -2212,7 +2173,7 @@ public: | |||
| } | |||
| } | |||
| void addIfNotAlreadyThere (const ElementType newElement) throw() | |||
| void addIfNotAlreadyThere (const ElementType& newElement) | |||
| { | |||
| lock.enter(); | |||
| @@ -2222,8 +2183,7 @@ public: | |||
| lock.exit(); | |||
| } | |||
| void set (const int indexToChange, | |||
| const ElementType newValue) throw() | |||
| void set (const int indexToChange, const ElementType& newValue) | |||
| { | |||
| jassert (indexToChange >= 0); | |||
| @@ -2242,8 +2202,7 @@ public: | |||
| lock.exit(); | |||
| } | |||
| void setUnchecked (const int indexToChange, | |||
| const ElementType newValue) throw() | |||
| void setUnchecked (const int indexToChange, const ElementType& newValue) | |||
| { | |||
| lock.enter(); | |||
| jassert (((unsigned int) indexToChange) < (unsigned int) numUsed); | |||
| @@ -2251,8 +2210,7 @@ public: | |||
| lock.exit(); | |||
| } | |||
| void addArray (const ElementType* elementsToAdd, | |||
| int numElementsToAdd) throw() | |||
| void addArray (const ElementType* elementsToAdd, int numElementsToAdd) | |||
| { | |||
| lock.enter(); | |||
| @@ -2280,7 +2238,7 @@ public: | |||
| template <class OtherArrayType> | |||
| void addArray (const OtherArrayType& arrayToAddFrom, | |||
| int startIndex = 0, | |||
| int numElementsToAdd = -1) throw() | |||
| int numElementsToAdd = -1) | |||
| { | |||
| arrayToAddFrom.lockArray(); | |||
| lock.enter(); | |||
| @@ -2302,8 +2260,7 @@ public: | |||
| } | |||
| template <class ElementComparator> | |||
| void addSorted (ElementComparator& comparator, | |||
| const ElementType newElement) throw() | |||
| void addSorted (ElementComparator& comparator, const ElementType& newElement) | |||
| { | |||
| lock.enter(); | |||
| insert (findInsertIndexInSortedArray (comparator, (ElementType*) data.elements, newElement, 0, numUsed), newElement); | |||
| @@ -2311,8 +2268,7 @@ public: | |||
| } | |||
| template <class ElementComparator> | |||
| int indexOfSorted (ElementComparator& comparator, | |||
| const ElementType elementToLookFor) const throw() | |||
| int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const | |||
| { | |||
| (void) comparator; // if you pass in an object with a static compareElements() method, this | |||
| // avoids getting warning messages about the parameter being unused | |||
| @@ -2350,7 +2306,7 @@ public: | |||
| } | |||
| } | |||
| ElementType remove (const int indexToRemove) throw() | |||
| ElementType remove (const int indexToRemove) | |||
| { | |||
| lock.enter(); | |||
| @@ -2379,7 +2335,7 @@ public: | |||
| } | |||
| } | |||
| void removeValue (const ElementType valueToRemove) throw() | |||
| void removeValue (const ElementType& valueToRemove) | |||
| { | |||
| lock.enter(); | |||
| ElementType* e = data.elements; | |||
| @@ -2398,8 +2354,7 @@ public: | |||
| lock.exit(); | |||
| } | |||
| void removeRange (int startIndex, | |||
| int numberToRemove) throw() | |||
| void removeRange (int startIndex, int numberToRemove) | |||
| { | |||
| lock.enter(); | |||
| const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove); | |||
| @@ -2426,7 +2381,7 @@ public: | |||
| lock.exit(); | |||
| } | |||
| void removeLast (int howManyToRemove = 1) throw() | |||
| void removeLast (int howManyToRemove = 1) | |||
| { | |||
| lock.enter(); | |||
| @@ -2445,7 +2400,7 @@ public: | |||
| } | |||
| template <class OtherArrayType> | |||
| void removeValuesIn (const OtherArrayType& otherArray) throw() | |||
| void removeValuesIn (const OtherArrayType& otherArray) | |||
| { | |||
| otherArray.lockArray(); | |||
| lock.enter(); | |||
| @@ -2469,7 +2424,7 @@ public: | |||
| } | |||
| template <class OtherArrayType> | |||
| void removeValuesNotIn (const OtherArrayType& otherArray) throw() | |||
| void removeValuesNotIn (const OtherArrayType& otherArray) | |||
| { | |||
| otherArray.lockArray(); | |||
| lock.enter(); | |||
| @@ -2493,7 +2448,7 @@ public: | |||
| } | |||
| void swap (const int index1, | |||
| const int index2) throw() | |||
| const int index2) | |||
| { | |||
| lock.enter(); | |||
| @@ -2507,8 +2462,7 @@ public: | |||
| lock.exit(); | |||
| } | |||
| void move (const int currentIndex, | |||
| int newIndex) throw() | |||
| void move (const int currentIndex, int newIndex) throw() | |||
| { | |||
| if (currentIndex != newIndex) | |||
| { | |||
| @@ -2542,14 +2496,14 @@ public: | |||
| } | |||
| } | |||
| void minimiseStorageOverheads() throw() | |||
| void minimiseStorageOverheads() | |||
| { | |||
| lock.enter(); | |||
| data.shrinkToNoMoreThan (numUsed); | |||
| lock.exit(); | |||
| } | |||
| void ensureStorageAllocated (const int minNumElements) throw() | |||
| void ensureStorageAllocated (const int minNumElements) | |||
| { | |||
| lock.enter(); | |||
| data.ensureAllocatedSize (minNumElements); | |||
| @@ -2558,7 +2512,7 @@ public: | |||
| template <class ElementComparator> | |||
| void sort (ElementComparator& comparator, | |||
| const bool retainOrderOfEquivalentItems = false) const throw() | |||
| const bool retainOrderOfEquivalentItems = false) const | |||
| { | |||
| (void) comparator; // if you pass in an object with a static compareElements() method, this | |||
| // avoids getting warning messages about the parameter being unused | |||
| @@ -2616,7 +2570,7 @@ public: | |||
| ~BitArray() throw(); | |||
| const BitArray& operator= (const BitArray& other) throw(); | |||
| BitArray& operator= (const BitArray& other) throw(); | |||
| bool operator== (const BitArray& other) const throw(); | |||
| bool operator!= (const BitArray& other) const throw(); | |||
| @@ -2741,7 +2695,7 @@ public: | |||
| ~MemoryBlock() throw(); | |||
| const MemoryBlock& operator= (const MemoryBlock& other) throw(); | |||
| MemoryBlock& operator= (const MemoryBlock& other) throw(); | |||
| bool operator== (const MemoryBlock& other) const throw(); | |||
| @@ -2822,22 +2776,22 @@ class JUCE_API ScopedPointer | |||
| { | |||
| public: | |||
| inline ScopedPointer() : object (0) | |||
| inline ScopedPointer() throw() : object (0) | |||
| { | |||
| } | |||
| inline ScopedPointer (ObjectType* const objectToTakePossessionOf) | |||
| inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw() | |||
| : object (objectToTakePossessionOf) | |||
| { | |||
| } | |||
| ScopedPointer (ScopedPointer& objectToTransferFrom) | |||
| ScopedPointer (ScopedPointer& objectToTransferFrom) throw() | |||
| : object (objectToTransferFrom.object) | |||
| { | |||
| objectToTransferFrom.object = 0; | |||
| } | |||
| inline ~ScopedPointer() { delete object; } | |||
| inline ~ScopedPointer() { delete object; } | |||
| const ScopedPointer& operator= (ScopedPointer& objectToTransferFrom) | |||
| { | |||
| @@ -2868,24 +2822,24 @@ public: | |||
| return *this; | |||
| } | |||
| inline operator ObjectType*() const { return object; } | |||
| inline operator ObjectType*() const throw() { return object; } | |||
| inline ObjectType& operator*() const { return *object; } | |||
| inline ObjectType& operator*() const throw() { return *object; } | |||
| inline ObjectType* operator->() const { return object; } | |||
| inline ObjectType* operator->() const throw() { return object; } | |||
| template <class CastType> | |||
| inline operator CastType*() const { return static_cast <CastType*> (object); } | |||
| inline operator CastType*() const throw() { return static_cast <CastType*> (object); } | |||
| inline ObjectType** operator&() const { return (ObjectType**) &object; } | |||
| inline ObjectType** operator&() const throw() { return (ObjectType**) &object; } | |||
| ObjectType* release() { ObjectType* const o = object; object = 0; return o; } | |||
| ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; } | |||
| inline bool operator== (const ObjectType* const otherPointer) const { return otherPointer == object; } | |||
| inline bool operator== (const ObjectType* const otherPointer) const throw() { return otherPointer == object; } | |||
| inline bool operator!= (const ObjectType* const otherPointer) const { return otherPointer != object; } | |||
| inline bool operator!= (const ObjectType* const otherPointer) const throw() { return otherPointer != object; } | |||
| void swapWith (ScopedPointer <ObjectType>& other) | |||
| void swapWith (ScopedPointer <ObjectType>& other) throw() | |||
| { | |||
| // Two ScopedPointers should never be able to refer to the same object - if | |||
| // this happens, you must have done something dodgy! | |||
| @@ -2899,7 +2853,7 @@ private: | |||
| ObjectType* object; | |||
| // (Required as an alternative to the overloaded & operator). | |||
| ScopedPointer* getAddress() { return this; } | |||
| ScopedPointer* getAddress() const throw() { return this; } | |||
| }; | |||
| #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__ | |||
| @@ -3409,88 +3363,85 @@ public: | |||
| StringArray() throw(); | |||
| StringArray (const StringArray& other) throw(); | |||
| StringArray (const StringArray& other); | |||
| StringArray (const juce_wchar** const strings, | |||
| const int numberOfStrings) throw(); | |||
| const int numberOfStrings); | |||
| StringArray (const char** const strings, | |||
| const int numberOfStrings) throw(); | |||
| const int numberOfStrings); | |||
| StringArray (const juce_wchar** const strings) throw(); | |||
| explicit StringArray (const juce_wchar** const strings); | |||
| StringArray (const char** const strings) throw(); | |||
| explicit StringArray (const char** const strings); | |||
| virtual ~StringArray() throw(); | |||
| ~StringArray(); | |||
| const StringArray& operator= (const StringArray& other) throw(); | |||
| const StringArray& operator= (const StringArray& other); | |||
| bool operator== (const StringArray& other) const throw(); | |||
| bool operator== (const StringArray& other) const; | |||
| bool operator!= (const StringArray& other) const throw(); | |||
| bool operator!= (const StringArray& other) const; | |||
| inline int size() const throw() { return strings.size(); }; | |||
| const String& operator[] (const int index) const throw(); | |||
| bool contains (const String& stringToLookFor, | |||
| const bool ignoreCase = false) const throw(); | |||
| const bool ignoreCase = false) const; | |||
| int indexOf (const String& stringToLookFor, | |||
| const bool ignoreCase = false, | |||
| int startIndex = 0) const throw(); | |||
| int startIndex = 0) const; | |||
| void add (const String& stringToAdd) throw(); | |||
| void add (const String& stringToAdd); | |||
| void insert (const int index, | |||
| const String& stringToAdd) throw(); | |||
| void insert (const int index, const String& stringToAdd); | |||
| void addIfNotAlreadyThere (const String& stringToAdd, | |||
| const bool ignoreCase = false) throw(); | |||
| void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false); | |||
| void set (const int index, | |||
| const String& newString) throw(); | |||
| void set (const int index, const String& newString); | |||
| void addArray (const StringArray& other, | |||
| int startIndex = 0, | |||
| int numElementsToAdd = -1) throw(); | |||
| int numElementsToAdd = -1); | |||
| int addTokens (const tchar* const stringToTokenise, | |||
| const bool preserveQuotedStrings) throw(); | |||
| const bool preserveQuotedStrings); | |||
| int addTokens (const tchar* const stringToTokenise, | |||
| const tchar* breakCharacters, | |||
| const tchar* quoteCharacters) throw(); | |||
| const tchar* quoteCharacters); | |||
| int addLines (const tchar* stringToBreakUp) throw(); | |||
| int addLines (const tchar* stringToBreakUp); | |||
| void clear() throw(); | |||
| void clear(); | |||
| void remove (const int index) throw(); | |||
| void remove (const int index); | |||
| void removeString (const String& stringToRemove, | |||
| const bool ignoreCase = false) throw(); | |||
| const bool ignoreCase = false); | |||
| void removeDuplicates (const bool ignoreCase) throw(); | |||
| void removeDuplicates (const bool ignoreCase); | |||
| void removeEmptyStrings (const bool removeWhitespaceStrings = true) throw(); | |||
| void removeEmptyStrings (const bool removeWhitespaceStrings = true); | |||
| void move (const int currentIndex, int newIndex) throw(); | |||
| void trim() throw(); | |||
| void trim(); | |||
| void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing, | |||
| const bool appendNumberToFirstInstance, | |||
| const tchar* const preNumberString = defaultPreNumberString, | |||
| const tchar* const postNumberString = defaultPostNumberString) throw(); | |||
| const tchar* const postNumberString = defaultPostNumberString); | |||
| const String joinIntoString (const String& separatorString, | |||
| int startIndex = 0, | |||
| int numberOfElements = -1) const throw(); | |||
| int numberOfElements = -1) const; | |||
| void sort (const bool ignoreCase) throw(); | |||
| void sort (const bool ignoreCase); | |||
| void minimiseStorageOverheads() throw(); | |||
| void minimiseStorageOverheads(); | |||
| juce_UseDebuggingNewOperator | |||
| @@ -4739,26 +4690,12 @@ public: | |||
| other.unlockArray(); | |||
| } | |||
| const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw() | |||
| ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw() | |||
| { | |||
| if (this != &other) | |||
| { | |||
| other.lockArray(); | |||
| lock.enter(); | |||
| clear(); | |||
| data.ensureAllocatedSize (other.numUsed); | |||
| numUsed = other.numUsed; | |||
| memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*)); | |||
| minimiseStorageOverheads(); | |||
| for (int i = numUsed; --i >= 0;) | |||
| if (data.elements[i] != 0) | |||
| data.elements[i]->incReferenceCount(); | |||
| lock.exit(); | |||
| other.unlockArray(); | |||
| ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other); | |||
| swapWithArray (other); | |||
| } | |||
| return *this; | |||
| @@ -5133,6 +5070,16 @@ public: | |||
| } | |||
| } | |||
| void swapWithArray (ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& otherArray) throw() | |||
| { | |||
| lock.enter(); | |||
| otherArray.lock.enter(); | |||
| data.swapWith (otherArray.data); | |||
| swapVariables (numUsed, otherArray.numUsed); | |||
| otherArray.lock.exit(); | |||
| lock.exit(); | |||
| } | |||
| bool operator== (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw() | |||
| { | |||
| other.lockArray(); | |||
| @@ -5244,7 +5191,7 @@ public: | |||
| { | |||
| } | |||
| const SortedSet <ElementType, TypeOfCriticalSectionToUse>& operator= (const SortedSet <ElementType, TypeOfCriticalSectionToUse>& other) throw() | |||
| SortedSet <ElementType, TypeOfCriticalSectionToUse>& operator= (const SortedSet <ElementType, TypeOfCriticalSectionToUse>& other) throw() | |||
| { | |||
| if (this != &other) | |||
| { | |||
| @@ -5918,33 +5865,35 @@ public: | |||
| ~var(); | |||
| var (const var& valueToCopy) throw(); | |||
| var (const var& valueToCopy); | |||
| var (const int value) throw(); | |||
| var (const bool value) throw(); | |||
| var (const double value) throw(); | |||
| var (const char* const value) throw(); | |||
| var (const juce_wchar* const value) throw(); | |||
| var (const String& value) throw(); | |||
| var (DynamicObject* const object) throw(); | |||
| var (const char* const value); | |||
| var (const juce_wchar* const value); | |||
| var (const String& value); | |||
| var (DynamicObject* const object); | |||
| var (MethodFunction method) throw(); | |||
| const var& operator= (const var& valueToCopy) throw(); | |||
| const var& operator= (const int value) throw(); | |||
| const var& operator= (const bool value) throw(); | |||
| const var& operator= (const double value) throw(); | |||
| const var& operator= (const char* const value) throw(); | |||
| const var& operator= (const juce_wchar* const value) throw(); | |||
| const var& operator= (const String& value) throw(); | |||
| const var& operator= (DynamicObject* const object) throw(); | |||
| const var& operator= (MethodFunction method) throw(); | |||
| operator int() const throw(); | |||
| operator bool() const throw(); | |||
| operator float() const throw(); | |||
| operator double() const throw(); | |||
| operator const String() const throw(); | |||
| const String toString() const throw(); | |||
| DynamicObject* getObject() const throw(); | |||
| var& operator= (const var& valueToCopy); | |||
| var& operator= (int value); | |||
| var& operator= (bool value); | |||
| var& operator= (double value); | |||
| var& operator= (const char* value); | |||
| var& operator= (const juce_wchar* value); | |||
| var& operator= (const String& value); | |||
| var& operator= (DynamicObject* object); | |||
| var& operator= (MethodFunction method); | |||
| void swapWith (var& other) throw(); | |||
| operator int() const; | |||
| operator bool() const; | |||
| operator float() const; | |||
| operator double() const; | |||
| operator const String() const; | |||
| const String toString() const; | |||
| DynamicObject* getObject() const; | |||
| bool isVoid() const throw() { return type == voidType; } | |||
| bool isInt() const throw() { return type == intType; } | |||
| @@ -5957,16 +5906,16 @@ public: | |||
| bool operator== (const var& other) const throw(); | |||
| bool operator!= (const var& other) const throw(); | |||
| void writeToStream (OutputStream& output) const throw(); | |||
| void writeToStream (OutputStream& output) const; | |||
| static const var readFromStream (InputStream& input) throw(); | |||
| static const var readFromStream (InputStream& input); | |||
| class JUCE_API identifier | |||
| { | |||
| public: | |||
| identifier (const char* const name) throw(); | |||
| identifier (const String& name) throw(); | |||
| ~identifier() throw(); | |||
| identifier (const char* const name); | |||
| identifier (const String& name); | |||
| ~identifier(); | |||
| bool operator== (const identifier& other) const throw() | |||
| { | |||
| @@ -5978,7 +5927,7 @@ public: | |||
| int hashCode; | |||
| }; | |||
| const var operator[] (const identifier& propertyName) const throw(); | |||
| const var operator[] (const identifier& propertyName) const; | |||
| const var call (const identifier& method) const; | |||
| const var call (const identifier& method, const var& arg1) const; | |||
| @@ -6005,9 +5954,7 @@ private: | |||
| methodType | |||
| }; | |||
| Type type; | |||
| union | |||
| union ValueUnion | |||
| { | |||
| int intValue; | |||
| bool boolValue; | |||
| @@ -6015,9 +5962,10 @@ private: | |||
| String* stringValue; | |||
| DynamicObject* objectValue; | |||
| MethodFunction methodValue; | |||
| } value; | |||
| }; | |||
| void releaseValue() throw(); | |||
| Type type; | |||
| ValueUnion value; | |||
| }; | |||
| class JUCE_API DynamicObject : public ReferenceCountedObject | |||
| @@ -6861,6 +6809,18 @@ private: | |||
| #endif | |||
| #if JUCE_LINUX | |||
| class ScopedXLock | |||
| { | |||
| public: | |||
| ScopedXLock(); | |||
| ~ScopedXLock(); | |||
| }; | |||
| #endif | |||
| #if JUCE_MAC | |||
| class JUCE_API AppleRemoteDevice | |||
| @@ -16815,7 +16775,7 @@ public: | |||
| MidiMessageSequence (const MidiMessageSequence& other); | |||
| const MidiMessageSequence& operator= (const MidiMessageSequence& other); | |||
| MidiMessageSequence& operator= (const MidiMessageSequence& other); | |||
| ~MidiMessageSequence(); | |||
| @@ -16885,6 +16845,8 @@ public: | |||
| const double time, | |||
| OwnedArray<MidiMessage>& resultMessages); | |||
| void swapWith (MidiMessageSequence& other) throw(); | |||
| juce_UseDebuggingNewOperator | |||
| static int compareElements (const MidiMessageSequence::MidiEventHolder* const first, | |||
| @@ -22578,6 +22540,11 @@ public: | |||
| bool show (int width = 0,int height = 0); | |||
| enum ColourIds | |||
| { | |||
| titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */ | |||
| }; | |||
| void buttonClicked (Button* button); | |||
| void closeButtonPressed(); | |||
| void selectionChanged(); | |||
| @@ -45,6 +45,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../core/juce_Initialisation.h" | |||
| #include "../threads/juce_Process.h" | |||
| #include "../core/juce_PlatformUtilities.h" | |||
| #include "../text/juce_LocalisedStrings.h" | |||
| void juce_setCurrentThreadName (const String& name); | |||
| @@ -139,8 +140,8 @@ void JUCEApplication::getCommandInfo (const CommandID commandID, ApplicationComm | |||
| { | |||
| if (commandID == StandardApplicationCommandIDs::quit) | |||
| { | |||
| result.setInfo ("Quit", | |||
| "Quits the application", | |||
| result.setInfo (TRANS("Quit"), | |||
| TRANS("Quits the application"), | |||
| "Application", | |||
| 0); | |||
| @@ -50,11 +50,8 @@ MidiBuffer::MidiBuffer (const MidiBuffer& other) throw() | |||
| const MidiBuffer& MidiBuffer::operator= (const MidiBuffer& other) throw() | |||
| { | |||
| if (this != &other) | |||
| { | |||
| bytesUsed = other.bytesUsed; | |||
| data = other.data; | |||
| } | |||
| bytesUsed = other.bytesUsed; | |||
| data = other.data; | |||
| return *this; | |||
| } | |||
| @@ -44,19 +44,18 @@ MidiMessageSequence::MidiMessageSequence (const MidiMessageSequence& other) | |||
| list.add (new MidiEventHolder (other.list.getUnchecked(i)->message)); | |||
| } | |||
| const MidiMessageSequence& MidiMessageSequence::operator= (const MidiMessageSequence& other) | |||
| MidiMessageSequence& MidiMessageSequence::operator= (const MidiMessageSequence& other) | |||
| { | |||
| if (this != &other) | |||
| { | |||
| clear(); | |||
| for (int i = 0; i < other.list.size(); ++i) | |||
| list.add (new MidiEventHolder (other.list.getUnchecked(i)->message)); | |||
| } | |||
| MidiMessageSequence otherCopy (other); | |||
| swapWith (otherCopy); | |||
| return *this; | |||
| } | |||
| void MidiMessageSequence::swapWith (MidiMessageSequence& other) throw() | |||
| { | |||
| list.swapWithArray (other.list); | |||
| } | |||
| MidiMessageSequence::~MidiMessageSequence() | |||
| { | |||
| } | |||
| @@ -50,7 +50,7 @@ public: | |||
| MidiMessageSequence (const MidiMessageSequence& other); | |||
| /** Replaces this sequence with another one. */ | |||
| const MidiMessageSequence& operator= (const MidiMessageSequence& other); | |||
| MidiMessageSequence& operator= (const MidiMessageSequence& other); | |||
| /** Destructor. */ | |||
| ~MidiMessageSequence(); | |||
| @@ -265,6 +265,10 @@ public: | |||
| const double time, | |||
| OwnedArray<MidiMessage>& resultMessages); | |||
| //============================================================================== | |||
| /** Swaps this sequence with another one. */ | |||
| void swapWith (MidiMessageSequence& other) throw(); | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| @@ -33,25 +33,30 @@ | |||
| //============================================================================== | |||
| /** | |||
| Holds a list of primitive objects, such as ints, doubles, or pointers. | |||
| Holds a list of simple objects, such as ints, doubles, or pointers. | |||
| Examples of arrays are: Array<int> or Array<MyClass*> | |||
| Examples of arrays are: Array<int>, Array<Rectangle> or Array<MyClass*> | |||
| Note that when holding pointers to objects, the array doesn't take any ownership | |||
| of the objects - for doing this, see the OwnedArray class or the ReferenceCountedArray class. | |||
| The array can be used to hold simple, non-polymorphic objects as well as primitive types - to | |||
| do so, the class must fulfil these requirements: | |||
| - it must have a copy constructor and operator= | |||
| - it must be able to be relocated in memory by a memcpy without this causing a problem - so no | |||
| objects whose functionality relies on pointers or references to themselves can be used. | |||
| If you're using a class or struct as the element type, it must be | |||
| capable of being copied or moved with a straightforward memcpy, rather than | |||
| needing construction and destruction code. | |||
| You can of course have an array of pointers to any kind of object, e.g. Array <MyClass*>, but if | |||
| you do this, the array doesn't take any ownership of the objects - see the OwnedArray class or the | |||
| ReferenceCountedArray class for more powerful ways of holding lists of objects. | |||
| For holding lists of strings, use the specialised class StringArray. | |||
| For holding lists of strings, you can use Array <String>, but it's usually better to use the | |||
| specialised class StringArray, which provides more useful functions. | |||
| To make all the array's methods thread-safe, pass in "CriticalSection" as the templated | |||
| TypeOfCriticalSectionToUse parameter, instead of the default DummyCriticalSection. | |||
| @see OwnedArray, ReferenceCountedArray, StringArray, CriticalSection | |||
| */ | |||
| template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection> | |||
| template <typename ElementType, | |||
| typename TypeOfCriticalSectionToUse = DummyCriticalSection> | |||
| class Array | |||
| { | |||
| public: | |||
| @@ -65,7 +70,7 @@ public: | |||
| /** Creates a copy of another array. | |||
| @param other the array to copy | |||
| */ | |||
| Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other) throw() | |||
| Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other) | |||
| { | |||
| other.lockArray(); | |||
| numUsed = other.numUsed; | |||
| @@ -81,7 +86,7 @@ public: | |||
| @param values the array to copy from | |||
| */ | |||
| Array (const ElementType* values) throw() | |||
| explicit Array (const ElementType* values) | |||
| : numUsed (0) | |||
| { | |||
| while (*values != 0) | |||
| @@ -93,7 +98,7 @@ public: | |||
| @param values the array to copy from | |||
| @param numValues the number of values in the array | |||
| */ | |||
| Array (const ElementType* values, int numValues) throw() | |||
| Array (const ElementType* values, int numValues) | |||
| : numUsed (numValues) | |||
| { | |||
| data.setAllocatedSize (numValues); | |||
| @@ -103,7 +108,7 @@ public: | |||
| } | |||
| /** Destructor. */ | |||
| ~Array() throw() | |||
| ~Array() | |||
| { | |||
| for (int i = 0; i < numUsed; ++i) | |||
| data.elements[i].~ElementType(); | |||
| @@ -112,37 +117,12 @@ public: | |||
| /** Copies another array. | |||
| @param other the array to copy | |||
| */ | |||
| const Array <ElementType, TypeOfCriticalSectionToUse>& operator= (const Array <ElementType, TypeOfCriticalSectionToUse>& other) throw() | |||
| Array <ElementType, TypeOfCriticalSectionToUse>& operator= (const Array <ElementType, TypeOfCriticalSectionToUse>& other) | |||
| { | |||
| if (this != &other) | |||
| { | |||
| other.lockArray(); | |||
| lock.enter(); | |||
| if (other.size() > numUsed) | |||
| { | |||
| data.ensureAllocatedSize (other.size()); | |||
| int i = 0; | |||
| for (; i < numUsed; ++i) | |||
| data.elements[i] = other.data.elements[i]; | |||
| numUsed = other.size(); | |||
| for (; i < numUsed; ++i) | |||
| new (data.elements + i) ElementType (other.data.elements[i]); | |||
| } | |||
| else | |||
| { | |||
| numUsed = other.size(); | |||
| for (int i = 0; i < numUsed; ++i) | |||
| data.elements[i] = other.data.elements[i]; | |||
| minimiseStorageOverheads(); | |||
| } | |||
| lock.exit(); | |||
| other.unlockArray(); | |||
| Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other); | |||
| swapWithArray (otherCopy); | |||
| } | |||
| return *this; | |||
| @@ -155,7 +135,7 @@ public: | |||
| @param other the other array to compare with | |||
| */ | |||
| template <class OtherArrayType> | |||
| bool operator== (const OtherArrayType& other) const throw() | |||
| bool operator== (const OtherArrayType& other) const | |||
| { | |||
| lock.enter(); | |||
| @@ -184,7 +164,7 @@ public: | |||
| @param other the other array to compare with | |||
| */ | |||
| template <class OtherArrayType> | |||
| bool operator!= (const OtherArrayType& other) const throw() | |||
| bool operator!= (const OtherArrayType& other) const | |||
| { | |||
| return ! operator== (other); | |||
| } | |||
| @@ -197,7 +177,7 @@ public: | |||
| @see clearQuick | |||
| */ | |||
| void clear() throw() | |||
| void clear() | |||
| { | |||
| lock.enter(); | |||
| @@ -213,7 +193,7 @@ public: | |||
| @see clear | |||
| */ | |||
| void clearQuick() throw() | |||
| void clearQuick() | |||
| { | |||
| lock.enter(); | |||
| @@ -242,12 +222,12 @@ public: | |||
| @param index the index of the element being requested (0 is the first element in the array) | |||
| @see getUnchecked, getFirst, getLast | |||
| */ | |||
| inline ElementType operator[] (const int index) const throw() | |||
| inline ElementType operator[] (const int index) const | |||
| { | |||
| lock.enter(); | |||
| const ElementType result = (((unsigned int) index) < (unsigned int) numUsed) | |||
| const ElementType result ((((unsigned int) index) < (unsigned int) numUsed) | |||
| ? data.elements [index] | |||
| : ElementType(); | |||
| : ElementType()); | |||
| lock.exit(); | |||
| return result; | |||
| @@ -262,11 +242,11 @@ public: | |||
| @param index the index of the element being requested (0 is the first element in the array) | |||
| @see operator[], getFirst, getLast | |||
| */ | |||
| inline ElementType getUnchecked (const int index) const throw() | |||
| inline const ElementType getUnchecked (const int index) const | |||
| { | |||
| lock.enter(); | |||
| jassert (((unsigned int) index) < (unsigned int) numUsed); | |||
| const ElementType result = data.elements [index]; | |||
| const ElementType result (data.elements [index]); | |||
| lock.exit(); | |||
| return result; | |||
| @@ -294,11 +274,11 @@ public: | |||
| @see operator[], getUnchecked, getLast | |||
| */ | |||
| inline ElementType getFirst() const throw() | |||
| inline ElementType getFirst() const | |||
| { | |||
| lock.enter(); | |||
| const ElementType result = (numUsed > 0) ? data.elements [0] | |||
| : ElementType(); | |||
| const ElementType result ((numUsed > 0) ? data.elements [0] | |||
| : ElementType()); | |||
| lock.exit(); | |||
| return result; | |||
| @@ -308,11 +288,11 @@ public: | |||
| @see operator[], getUnchecked, getFirst | |||
| */ | |||
| inline ElementType getLast() const throw() | |||
| inline ElementType getLast() const | |||
| { | |||
| lock.enter(); | |||
| const ElementType result = (numUsed > 0) ? data.elements [numUsed - 1] | |||
| : ElementType(); | |||
| const ElementType result ((numUsed > 0) ? data.elements [numUsed - 1] | |||
| : ElementType()); | |||
| lock.exit(); | |||
| return result; | |||
| @@ -327,7 +307,7 @@ public: | |||
| @param elementToLookFor the value or object to look for | |||
| @returns the index of the object, or -1 if it's not found | |||
| */ | |||
| int indexOf (const ElementType elementToLookFor) const throw() | |||
| int indexOf (const ElementType& elementToLookFor) const | |||
| { | |||
| int result = -1; | |||
| @@ -354,28 +334,13 @@ public: | |||
| @param elementToLookFor the value or object to look for | |||
| @returns true if the item is found | |||
| */ | |||
| bool contains (const ElementType elementToLookFor) const throw() | |||
| bool contains (const ElementType& elementToLookFor) const | |||
| { | |||
| lock.enter(); | |||
| const ElementType* e = data.elements; | |||
| int num = numUsed; | |||
| while (num >= 4) | |||
| { | |||
| if (*e == elementToLookFor | |||
| || *++e == elementToLookFor | |||
| || *++e == elementToLookFor | |||
| || *++e == elementToLookFor) | |||
| { | |||
| lock.exit(); | |||
| return true; | |||
| } | |||
| num -= 4; | |||
| ++e; | |||
| } | |||
| while (num > 0) | |||
| { | |||
| if (elementToLookFor == *e) | |||
| @@ -398,7 +363,7 @@ public: | |||
| @param newElement the new object to add to the array | |||
| @see set, insert, addIfNotAlreadyThere, addSorted, addArray | |||
| */ | |||
| void add (const ElementType newElement) throw() | |||
| void add (const ElementType& newElement) | |||
| { | |||
| lock.enter(); | |||
| data.ensureAllocatedSize (numUsed + 1); | |||
| @@ -418,7 +383,7 @@ public: | |||
| @param newElement the new object to add to the array | |||
| @see add, addSorted, set | |||
| */ | |||
| void insert (int indexToInsertAt, const ElementType newElement) throw() | |||
| void insert (int indexToInsertAt, const ElementType& newElement) | |||
| { | |||
| lock.enter(); | |||
| data.ensureAllocatedSize (numUsed + 1); | |||
| @@ -454,8 +419,8 @@ public: | |||
| @param numberOfTimesToInsertIt how many copies of the value to insert | |||
| @see insert, add, addSorted, set | |||
| */ | |||
| void insertMultiple (int indexToInsertAt, const ElementType newElement, | |||
| int numberOfTimesToInsertIt) throw() | |||
| void insertMultiple (int indexToInsertAt, const ElementType& newElement, | |||
| int numberOfTimesToInsertIt) | |||
| { | |||
| if (numberOfTimesToInsertIt > 0) | |||
| { | |||
| @@ -497,7 +462,7 @@ public: | |||
| */ | |||
| void insertArray (int indexToInsertAt, | |||
| const ElementType* newElements, | |||
| int numberOfElements) throw() | |||
| int numberOfElements) | |||
| { | |||
| if (numberOfElements > 0) | |||
| { | |||
| @@ -533,7 +498,7 @@ public: | |||
| @param newElement the new object to add to the array | |||
| */ | |||
| void addIfNotAlreadyThere (const ElementType newElement) throw() | |||
| void addIfNotAlreadyThere (const ElementType& newElement) | |||
| { | |||
| lock.enter(); | |||
| @@ -552,8 +517,7 @@ public: | |||
| @param newValue the new value to set for this index. | |||
| @see add, insert | |||
| */ | |||
| void set (const int indexToChange, | |||
| const ElementType newValue) throw() | |||
| void set (const int indexToChange, const ElementType& newValue) | |||
| { | |||
| jassert (indexToChange >= 0); | |||
| @@ -581,8 +545,7 @@ public: | |||
| @param newValue the new value to set for this index. | |||
| @see set, getUnchecked | |||
| */ | |||
| void setUnchecked (const int indexToChange, | |||
| const ElementType newValue) throw() | |||
| void setUnchecked (const int indexToChange, const ElementType& newValue) | |||
| { | |||
| lock.enter(); | |||
| jassert (((unsigned int) indexToChange) < (unsigned int) numUsed); | |||
| @@ -596,8 +559,7 @@ public: | |||
| @param numElementsToAdd how many elements are in this other array | |||
| @see add | |||
| */ | |||
| void addArray (const ElementType* elementsToAdd, | |||
| int numElementsToAdd) throw() | |||
| void addArray (const ElementType* elementsToAdd, int numElementsToAdd) | |||
| { | |||
| lock.enter(); | |||
| @@ -639,7 +601,7 @@ public: | |||
| template <class OtherArrayType> | |||
| void addArray (const OtherArrayType& arrayToAddFrom, | |||
| int startIndex = 0, | |||
| int numElementsToAdd = -1) throw() | |||
| int numElementsToAdd = -1) | |||
| { | |||
| arrayToAddFrom.lockArray(); | |||
| lock.enter(); | |||
| @@ -672,8 +634,7 @@ public: | |||
| @see add, sort | |||
| */ | |||
| template <class ElementComparator> | |||
| void addSorted (ElementComparator& comparator, | |||
| const ElementType newElement) throw() | |||
| void addSorted (ElementComparator& comparator, const ElementType& newElement) | |||
| { | |||
| lock.enter(); | |||
| insert (findInsertIndexInSortedArray (comparator, (ElementType*) data.elements, newElement, 0, numUsed), newElement); | |||
| @@ -693,8 +654,7 @@ public: | |||
| @see addSorted, sort | |||
| */ | |||
| template <class ElementComparator> | |||
| int indexOfSorted (ElementComparator& comparator, | |||
| const ElementType elementToLookFor) const throw() | |||
| int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const | |||
| { | |||
| (void) comparator; // if you pass in an object with a static compareElements() method, this | |||
| // avoids getting warning messages about the parameter being unused | |||
| @@ -743,7 +703,7 @@ public: | |||
| @returns the element that has been removed | |||
| @see removeValue, removeRange | |||
| */ | |||
| ElementType remove (const int indexToRemove) throw() | |||
| ElementType remove (const int indexToRemove) | |||
| { | |||
| lock.enter(); | |||
| @@ -780,7 +740,7 @@ public: | |||
| @param valueToRemove the object to try to remove | |||
| @see remove, removeRange | |||
| */ | |||
| void removeValue (const ElementType valueToRemove) throw() | |||
| void removeValue (const ElementType& valueToRemove) | |||
| { | |||
| lock.enter(); | |||
| ElementType* e = data.elements; | |||
| @@ -811,8 +771,7 @@ public: | |||
| @param numberToRemove how many elements should be removed | |||
| @see remove, removeValue | |||
| */ | |||
| void removeRange (int startIndex, | |||
| int numberToRemove) throw() | |||
| void removeRange (int startIndex, int numberToRemove) | |||
| { | |||
| lock.enter(); | |||
| const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove); | |||
| @@ -844,7 +803,7 @@ public: | |||
| @param howManyToRemove how many elements to remove from the end of the array | |||
| @see remove, removeValue, removeRange | |||
| */ | |||
| void removeLast (int howManyToRemove = 1) throw() | |||
| void removeLast (int howManyToRemove = 1) | |||
| { | |||
| lock.enter(); | |||
| @@ -868,7 +827,7 @@ public: | |||
| @see removeValuesNotIn, remove, removeValue, removeRange | |||
| */ | |||
| template <class OtherArrayType> | |||
| void removeValuesIn (const OtherArrayType& otherArray) throw() | |||
| void removeValuesIn (const OtherArrayType& otherArray) | |||
| { | |||
| otherArray.lockArray(); | |||
| lock.enter(); | |||
| @@ -899,7 +858,7 @@ public: | |||
| @see removeValuesIn, remove, removeValue, removeRange | |||
| */ | |||
| template <class OtherArrayType> | |||
| void removeValuesNotIn (const OtherArrayType& otherArray) throw() | |||
| void removeValuesNotIn (const OtherArrayType& otherArray) | |||
| { | |||
| otherArray.lockArray(); | |||
| lock.enter(); | |||
| @@ -931,7 +890,7 @@ public: | |||
| @param index2 index of the other element to swap | |||
| */ | |||
| void swap (const int index1, | |||
| const int index2) throw() | |||
| const int index2) | |||
| { | |||
| lock.enter(); | |||
| @@ -959,8 +918,7 @@ public: | |||
| is less than zero, the value will be moved to the end | |||
| of the array | |||
| */ | |||
| void move (const int currentIndex, | |||
| int newIndex) throw() | |||
| void move (const int currentIndex, int newIndex) throw() | |||
| { | |||
| if (currentIndex != newIndex) | |||
| { | |||
| @@ -1001,7 +959,7 @@ public: | |||
| removing elements, they may have quite a lot of unused space allocated. | |||
| This method will reduce the amount of allocated storage to a minimum. | |||
| */ | |||
| void minimiseStorageOverheads() throw() | |||
| void minimiseStorageOverheads() | |||
| { | |||
| lock.enter(); | |||
| data.shrinkToNoMoreThan (numUsed); | |||
| @@ -1014,7 +972,7 @@ public: | |||
| the array won't have to keep dynamically resizing itself as the elements | |||
| are added, and it'll therefore be more efficient. | |||
| */ | |||
| void ensureStorageAllocated (const int minNumElements) throw() | |||
| void ensureStorageAllocated (const int minNumElements) | |||
| { | |||
| lock.enter(); | |||
| data.ensureAllocatedSize (minNumElements); | |||
| @@ -1050,7 +1008,7 @@ public: | |||
| */ | |||
| template <class ElementComparator> | |||
| void sort (ElementComparator& comparator, | |||
| const bool retainOrderOfEquivalentItems = false) const throw() | |||
| const bool retainOrderOfEquivalentItems = false) const | |||
| { | |||
| (void) comparator; // if you pass in an object with a static compareElements() method, this | |||
| // avoids getting warning messages about the parameter being unused | |||
| @@ -83,7 +83,7 @@ public: | |||
| @param minNumElements the minimum number of elements that are needed | |||
| */ | |||
| void ensureAllocatedSize (int minNumElements) | |||
| void ensureAllocatedSize (const int minNumElements) | |||
| { | |||
| if (minNumElements > numAllocated) | |||
| setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7); | |||
| @@ -92,14 +92,14 @@ public: | |||
| /** Minimises the amount of storage allocated so that it's no more than | |||
| the given number of elements. | |||
| */ | |||
| void shrinkToNoMoreThan (int maxNumElements) | |||
| void shrinkToNoMoreThan (const int maxNumElements) | |||
| { | |||
| if (maxNumElements < numAllocated) | |||
| setAllocatedSize (maxNumElements); | |||
| } | |||
| /** Swap the contents of two objects. */ | |||
| void swapWith (ArrayAllocationBase <ElementType>& other) | |||
| void swapWith (ArrayAllocationBase <ElementType>& other) throw() | |||
| { | |||
| elements.swapWith (other.elements); | |||
| swapVariables (numAllocated, other.numAllocated); | |||
| @@ -90,7 +90,7 @@ BitArray::~BitArray() throw() | |||
| { | |||
| } | |||
| const BitArray& BitArray::operator= (const BitArray& other) throw() | |||
| BitArray& BitArray::operator= (const BitArray& other) throw() | |||
| { | |||
| if (this != &other) | |||
| { | |||
| @@ -75,7 +75,7 @@ public: | |||
| //============================================================================== | |||
| /** Copies another BitArray onto this one. */ | |||
| const BitArray& operator= (const BitArray& other) throw(); | |||
| BitArray& operator= (const BitArray& other) throw(); | |||
| /** Two arrays are the same if the same bits are set. */ | |||
| bool operator== (const BitArray& other) const throw(); | |||
| @@ -78,7 +78,7 @@ public: | |||
| After creation, you can resize the array using the malloc(), calloc(), | |||
| or realloc() methods. | |||
| */ | |||
| HeapBlock() : data (0) | |||
| HeapBlock() throw() : data (0) | |||
| { | |||
| } | |||
| @@ -108,54 +108,54 @@ public: | |||
| This may be a null pointer if the data hasn't yet been allocated, or if it has been | |||
| freed by calling the free() method. | |||
| */ | |||
| inline operator ElementType*() const { return data; } | |||
| inline operator ElementType*() const throw() { return data; } | |||
| /** Returns a void pointer to the allocated data. | |||
| This may be a null pointer if the data hasn't yet been allocated, or if it has been | |||
| freed by calling the free() method. | |||
| */ | |||
| inline operator void*() const { return (void*) data; } | |||
| inline operator void*() const throw() { return (void*) data; } | |||
| /** Lets you use indirect calls to the first element in the array. | |||
| Obviously this will cause problems if the array hasn't been initialised, because it'll | |||
| be referencing a null pointer. | |||
| */ | |||
| inline ElementType* operator->() const { return data; } | |||
| inline ElementType* operator->() const throw() { return data; } | |||
| /** Returns a pointer to the data by casting it to any type you need. | |||
| */ | |||
| template <class CastType> | |||
| inline operator CastType*() const { return (CastType*) data; } | |||
| inline operator CastType*() const throw() { return (CastType*) data; } | |||
| /** Returns a reference to one of the data elements. | |||
| Obviously there's no bounds-checking here, as this object is just a dumb pointer and | |||
| has no idea of the size it currently has allocated. | |||
| */ | |||
| template <typename IndexType> | |||
| inline ElementType& operator[] (IndexType index) const { return data [index]; } | |||
| inline ElementType& operator[] (IndexType index) const throw() { return data [index]; } | |||
| /** Returns a pointer to a data element at an offset from the start of the array. | |||
| This is the same as doing pointer arithmetic on the raw pointer itself. | |||
| */ | |||
| template <typename IndexType> | |||
| inline ElementType* operator+ (IndexType index) const { return data + index; } | |||
| inline ElementType* operator+ (IndexType index) const throw() { return data + index; } | |||
| /** Returns a reference to the raw data pointer. | |||
| Beware that the pointer returned here will become invalid as soon as you call | |||
| any of the allocator methods on this object! | |||
| */ | |||
| inline ElementType** operator&() const { return (ElementType**) &data; } | |||
| inline ElementType** operator&() const throw() { return (ElementType**) &data; } | |||
| //============================================================================== | |||
| /** Compares the pointer with another pointer. | |||
| This can be handy for checking whether this is a null pointer. | |||
| */ | |||
| inline bool operator== (const ElementType* const otherPointer) const { return otherPointer == data; } | |||
| inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; } | |||
| /** Compares the pointer with another pointer. | |||
| This can be handy for checking whether this is a null pointer. | |||
| */ | |||
| inline bool operator!= (const ElementType* const otherPointer) const { return otherPointer != data; } | |||
| inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; } | |||
| //============================================================================== | |||
| /** Allocates a specified amount of memory. | |||
| @@ -224,7 +224,7 @@ public: | |||
| /** Swaps this object's data with the data of another HeapBlock. | |||
| The two objects simply exchange their data pointers. | |||
| */ | |||
| void swapWith (HeapBlock <ElementType>& other) | |||
| void swapWith (HeapBlock <ElementType>& other) throw() | |||
| { | |||
| swapVariables (data, other.data); | |||
| } | |||
| @@ -84,7 +84,7 @@ MemoryBlock::~MemoryBlock() throw() | |||
| jassert (size == 0 || data != 0); // non-zero size but no data allocated? | |||
| } | |||
| const MemoryBlock& MemoryBlock::operator= (const MemoryBlock& other) throw() | |||
| MemoryBlock& MemoryBlock::operator= (const MemoryBlock& other) throw() | |||
| { | |||
| if (this != &other) | |||
| { | |||
| @@ -68,7 +68,7 @@ public: | |||
| This block will be resized and copied to exactly match the other one. | |||
| */ | |||
| const MemoryBlock& operator= (const MemoryBlock& other) throw(); | |||
| MemoryBlock& operator= (const MemoryBlock& other) throw(); | |||
| //============================================================================== | |||
| /** Compares two memory blocks. | |||
| @@ -77,26 +77,12 @@ public: | |||
| Any existing objects in this array will first be released. | |||
| */ | |||
| const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw() | |||
| ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw() | |||
| { | |||
| if (this != &other) | |||
| { | |||
| other.lockArray(); | |||
| lock.enter(); | |||
| clear(); | |||
| data.ensureAllocatedSize (other.numUsed); | |||
| numUsed = other.numUsed; | |||
| memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*)); | |||
| minimiseStorageOverheads(); | |||
| for (int i = numUsed; --i >= 0;) | |||
| if (data.elements[i] != 0) | |||
| data.elements[i]->incReferenceCount(); | |||
| lock.exit(); | |||
| other.unlockArray(); | |||
| ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other); | |||
| swapWithArray (other); | |||
| } | |||
| return *this; | |||
| @@ -642,6 +628,22 @@ public: | |||
| } | |||
| } | |||
| //============================================================================== | |||
| /** This swaps the contents of this array with those of another array. | |||
| If you need to exchange two arrays, this is vastly quicker than using copy-by-value | |||
| because it just swaps their internal pointers. | |||
| */ | |||
| void swapWithArray (ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& otherArray) throw() | |||
| { | |||
| lock.enter(); | |||
| otherArray.lock.enter(); | |||
| data.swapWith (otherArray.data); | |||
| swapVariables (numUsed, otherArray.numUsed); | |||
| otherArray.lock.exit(); | |||
| lock.exit(); | |||
| } | |||
| //============================================================================== | |||
| /** Compares this array to another one. | |||
| @@ -50,12 +50,12 @@ class JUCE_API ScopedPointer | |||
| public: | |||
| //============================================================================== | |||
| /** Creates a ScopedPointer containing a null pointer. */ | |||
| inline ScopedPointer() : object (0) | |||
| inline ScopedPointer() throw() : object (0) | |||
| { | |||
| } | |||
| /** Creates a ScopedPointer that owns the specified object. */ | |||
| inline ScopedPointer (ObjectType* const objectToTakePossessionOf) | |||
| inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw() | |||
| : object (objectToTakePossessionOf) | |||
| { | |||
| } | |||
| @@ -66,7 +66,7 @@ public: | |||
| the pointer from the other object to this one, and the other object is reset to | |||
| be a null pointer. | |||
| */ | |||
| ScopedPointer (ScopedPointer& objectToTransferFrom) | |||
| ScopedPointer (ScopedPointer& objectToTransferFrom) throw() | |||
| : object (objectToTransferFrom.object) | |||
| { | |||
| objectToTransferFrom.object = 0; | |||
| @@ -75,7 +75,7 @@ public: | |||
| /** Destructor. | |||
| This will delete the object that this ScopedPointer currently refers to. | |||
| */ | |||
| inline ~ScopedPointer() { delete object; } | |||
| inline ~ScopedPointer() { delete object; } | |||
| /** Changes this ScopedPointer to point to a new object. | |||
| @@ -125,45 +125,45 @@ public: | |||
| //============================================================================== | |||
| /** Returns the object that this ScopedPointer refers to. | |||
| */ | |||
| inline operator ObjectType*() const { return object; } | |||
| inline operator ObjectType*() const throw() { return object; } | |||
| /** Returns the object that this ScopedPointer refers to. | |||
| */ | |||
| inline ObjectType& operator*() const { return *object; } | |||
| inline ObjectType& operator*() const throw() { return *object; } | |||
| /** Lets you access methods and properties of the object that this ScopedPointer refers to. */ | |||
| inline ObjectType* operator->() const { return object; } | |||
| inline ObjectType* operator->() const throw() { return object; } | |||
| /** Returns a pointer to the object by casting it to whatever type you need. */ | |||
| template <class CastType> | |||
| inline operator CastType*() const { return static_cast <CastType*> (object); } | |||
| inline operator CastType*() const throw() { return static_cast <CastType*> (object); } | |||
| /** Returns a reference to the address of the object that this ScopedPointer refers to. */ | |||
| inline ObjectType** operator&() const { return (ObjectType**) &object; } | |||
| inline ObjectType** operator&() const throw() { return (ObjectType**) &object; } | |||
| //============================================================================== | |||
| /** Removes the current object from this ScopedPointer without deleting it. | |||
| This will return the current object, and set the ScopedPointer to a null pointer. | |||
| */ | |||
| ObjectType* release() { ObjectType* const o = object; object = 0; return o; } | |||
| ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; } | |||
| //============================================================================== | |||
| /** Compares the pointer with another pointer. | |||
| This can be handy for checking whether this is a null pointer. | |||
| */ | |||
| inline bool operator== (const ObjectType* const otherPointer) const { return otherPointer == object; } | |||
| inline bool operator== (const ObjectType* const otherPointer) const throw() { return otherPointer == object; } | |||
| /** Compares the pointer with another pointer. | |||
| This can be handy for checking whether this is a null pointer. | |||
| */ | |||
| inline bool operator!= (const ObjectType* const otherPointer) const { return otherPointer != object; } | |||
| inline bool operator!= (const ObjectType* const otherPointer) const throw() { return otherPointer != object; } | |||
| //============================================================================== | |||
| /** Swaps this object with that of another ScopedPointer. | |||
| The two objects simply exchange their pointers. | |||
| */ | |||
| void swapWith (ScopedPointer <ObjectType>& other) | |||
| void swapWith (ScopedPointer <ObjectType>& other) throw() | |||
| { | |||
| // Two ScopedPointers should never be able to refer to the same object - if | |||
| // this happens, you must have done something dodgy! | |||
| @@ -177,7 +177,7 @@ private: | |||
| ObjectType* object; | |||
| // (Required as an alternative to the overloaded & operator). | |||
| ScopedPointer* getAddress() { return this; } | |||
| ScopedPointer* getAddress() const throw() { return this; } | |||
| }; | |||
| @@ -88,7 +88,7 @@ public: | |||
| /** Copies another set over this one. | |||
| @param other the set to copy | |||
| */ | |||
| const SortedSet <ElementType, TypeOfCriticalSectionToUse>& operator= (const SortedSet <ElementType, TypeOfCriticalSectionToUse>& other) throw() | |||
| SortedSet <ElementType, TypeOfCriticalSectionToUse>& operator= (const SortedSet <ElementType, TypeOfCriticalSectionToUse>& other) throw() | |||
| { | |||
| if (this != &other) | |||
| { | |||
| @@ -735,7 +735,7 @@ ValueTree ValueTree::fromXml (const XmlElement& xml) | |||
| const int numAtts = xml.getNumAttributes(); // xxx inefficient - should write an att iterator.. | |||
| for (int i = 0; i < numAtts; ++i) | |||
| v.setProperty (xml.getAttributeName (i), xml.getAttributeValue (i), 0); | |||
| v.setProperty (xml.getAttributeName (i), var (xml.getAttributeValue (i)), 0); | |||
| forEachXmlChildElement (xml, e) | |||
| { | |||
| @@ -37,7 +37,7 @@ var::var() throw() | |||
| value.doubleValue = 0; | |||
| } | |||
| void var::releaseValue() throw() | |||
| var::~var() | |||
| { | |||
| if (type == stringType) | |||
| delete value.stringValue; | |||
| @@ -45,13 +45,8 @@ void var::releaseValue() throw() | |||
| value.objectValue->decReferenceCount(); | |||
| } | |||
| var::~var() | |||
| { | |||
| releaseValue(); | |||
| } | |||
| //============================================================================== | |||
| var::var (const var& valueToCopy) throw() | |||
| var::var (const var& valueToCopy) | |||
| : type (valueToCopy.type), | |||
| value (valueToCopy.value) | |||
| { | |||
| @@ -79,25 +74,25 @@ var::var (const double value_) throw() | |||
| value.doubleValue = value_; | |||
| } | |||
| var::var (const String& value_) throw() | |||
| var::var (const String& value_) | |||
| : type (stringType) | |||
| { | |||
| value.stringValue = new String (value_); | |||
| } | |||
| var::var (const char* const value_) throw() | |||
| var::var (const char* const value_) | |||
| : type (stringType) | |||
| { | |||
| value.stringValue = new String (value_); | |||
| } | |||
| var::var (const juce_wchar* const value_) throw() | |||
| var::var (const juce_wchar* const value_) | |||
| : type (stringType) | |||
| { | |||
| value.stringValue = new String (value_); | |||
| } | |||
| var::var (DynamicObject* const object) throw() | |||
| var::var (DynamicObject* const object) | |||
| : type (objectType) | |||
| { | |||
| value.objectValue = object; | |||
| @@ -113,131 +108,24 @@ var::var (MethodFunction method_) throw() | |||
| } | |||
| //============================================================================== | |||
| const var& var::operator= (const var& valueToCopy) throw() | |||
| { | |||
| if (this != &valueToCopy) | |||
| { | |||
| if (type == valueToCopy.type) | |||
| { | |||
| switch (type) | |||
| { | |||
| case voidType: | |||
| break; | |||
| case intType: | |||
| case boolType: | |||
| case doubleType: | |||
| value = valueToCopy.value; | |||
| break; | |||
| case stringType: | |||
| *(value.stringValue) = *(valueToCopy.value.stringValue); | |||
| break; | |||
| case objectType: | |||
| if (valueToCopy.value.objectValue != 0) | |||
| valueToCopy.value.objectValue->incReferenceCount(); | |||
| if (value.objectValue != 0) | |||
| value.objectValue->decReferenceCount(); | |||
| value.objectValue = valueToCopy.value.objectValue; | |||
| break; | |||
| default: | |||
| jassertfalse; | |||
| break; | |||
| } | |||
| } | |||
| else | |||
| { | |||
| releaseValue(); | |||
| type = valueToCopy.type; | |||
| if (type == stringType) | |||
| { | |||
| value.stringValue = new String (*(valueToCopy.value.stringValue)); | |||
| } | |||
| else | |||
| { | |||
| value = valueToCopy.value; | |||
| if (type == objectType && value.objectValue != 0) | |||
| value.objectValue->incReferenceCount(); | |||
| } | |||
| } | |||
| } | |||
| return *this; | |||
| } | |||
| const var& var::operator= (const int value_) throw() | |||
| { | |||
| releaseValue(); | |||
| type = intType; | |||
| value.intValue = value_; | |||
| return *this; | |||
| } | |||
| const var& var::operator= (const bool value_) throw() | |||
| { | |||
| releaseValue(); | |||
| type = boolType; | |||
| value.boolValue = value_; | |||
| return *this; | |||
| } | |||
| const var& var::operator= (const double value_) throw() | |||
| { | |||
| releaseValue(); | |||
| type = doubleType; | |||
| value.doubleValue = value_; | |||
| return *this; | |||
| } | |||
| const var& var::operator= (const char* const value_) throw() | |||
| { | |||
| releaseValue(); | |||
| type = stringType; | |||
| value.stringValue = new String (value_); | |||
| return *this; | |||
| } | |||
| const var& var::operator= (const juce_wchar* const value_) throw() | |||
| { | |||
| releaseValue(); | |||
| type = stringType; | |||
| value.stringValue = new String (value_); | |||
| return *this; | |||
| } | |||
| const var& var::operator= (const String& value_) throw() | |||
| void var::swapWith (var& other) throw() | |||
| { | |||
| releaseValue(); | |||
| type = stringType; | |||
| value.stringValue = new String (value_); | |||
| return *this; | |||
| } | |||
| const var& var::operator= (DynamicObject* const value_) throw() | |||
| { | |||
| value_->incReferenceCount(); | |||
| releaseValue(); | |||
| type = objectType; | |||
| value.objectValue = value_; | |||
| return *this; | |||
| swapVariables (type, other.type); | |||
| swapVariables (value, other.value); | |||
| } | |||
| const var& var::operator= (MethodFunction method_) throw() | |||
| { | |||
| releaseValue(); | |||
| type = doubleType; | |||
| value.methodValue = method_; | |||
| return *this; | |||
| } | |||
| var& var::operator= (const var& value_) { var newValue (value_); swapWith (newValue); return *this; } | |||
| var& var::operator= (int value_) { var newValue (value_); swapWith (newValue); return *this; } | |||
| var& var::operator= (bool value_) { var newValue (value_); swapWith (newValue); return *this; } | |||
| var& var::operator= (double value_) { var newValue (value_); swapWith (newValue); return *this; } | |||
| var& var::operator= (const char* value_) { var newValue (value_); swapWith (newValue); return *this; } | |||
| var& var::operator= (const juce_wchar* value_) { var newValue (value_); swapWith (newValue); return *this; } | |||
| var& var::operator= (const String& value_) { var newValue (value_); swapWith (newValue); return *this; } | |||
| var& var::operator= (DynamicObject* value_) { var newValue (value_); swapWith (newValue); return *this; } | |||
| var& var::operator= (MethodFunction value_) { var newValue (value_); swapWith (newValue); return *this; } | |||
| //============================================================================== | |||
| var::operator int() const throw() | |||
| var::operator int() const | |||
| { | |||
| switch (type) | |||
| { | |||
| @@ -253,7 +141,7 @@ var::operator int() const throw() | |||
| return 0; | |||
| } | |||
| var::operator bool() const throw() | |||
| var::operator bool() const | |||
| { | |||
| switch (type) | |||
| { | |||
| @@ -271,12 +159,12 @@ var::operator bool() const throw() | |||
| return false; | |||
| } | |||
| var::operator float() const throw() | |||
| var::operator float() const | |||
| { | |||
| return (float) operator double(); | |||
| } | |||
| var::operator double() const throw() | |||
| var::operator double() const | |||
| { | |||
| switch (type) | |||
| { | |||
| @@ -292,7 +180,7 @@ var::operator double() const throw() | |||
| return 0.0; | |||
| } | |||
| const String var::toString() const throw() | |||
| const String var::toString() const | |||
| { | |||
| switch (type) | |||
| { | |||
| @@ -308,12 +196,12 @@ const String var::toString() const throw() | |||
| return String::empty; | |||
| } | |||
| var::operator const String() const throw() | |||
| var::operator const String() const | |||
| { | |||
| return toString(); | |||
| } | |||
| DynamicObject* var::getObject() const throw() | |||
| DynamicObject* var::getObject() const | |||
| { | |||
| return type == objectType ? value.objectValue : 0; | |||
| } | |||
| @@ -339,7 +227,7 @@ bool var::operator!= (const var& other) const throw() | |||
| return ! operator== (other); | |||
| } | |||
| void var::writeToStream (OutputStream& output) const throw() | |||
| void var::writeToStream (OutputStream& output) const | |||
| { | |||
| switch (type) | |||
| { | |||
| @@ -362,7 +250,7 @@ void var::writeToStream (OutputStream& output) const throw() | |||
| } | |||
| } | |||
| const var var::readFromStream (InputStream& input) throw() | |||
| const var var::readFromStream (InputStream& input) | |||
| { | |||
| const int numBytes = input.readCompressedInt(); | |||
| @@ -388,7 +276,7 @@ const var var::readFromStream (InputStream& input) throw() | |||
| return var(); | |||
| } | |||
| const var var::operator[] (const var::identifier& propertyName) const throw() | |||
| const var var::operator[] (const var::identifier& propertyName) const | |||
| { | |||
| if (type == objectType && value.objectValue != 0) | |||
| return value.objectValue->getProperty (propertyName); | |||
| @@ -453,21 +341,21 @@ const var var::call (const var::identifier& method, const var& arg1, const var& | |||
| //============================================================================== | |||
| var::identifier::identifier (const String& name_) throw() | |||
| var::identifier::identifier (const String& name_) | |||
| : name (name_), | |||
| hashCode (name_.hashCode()) | |||
| { | |||
| jassert (name_.isNotEmpty()); | |||
| } | |||
| var::identifier::identifier (const char* const name_) throw() | |||
| var::identifier::identifier (const char* const name_) | |||
| : name (name_), | |||
| hashCode (name.hashCode()) | |||
| { | |||
| jassert (name.isNotEmpty()); | |||
| } | |||
| var::identifier::~identifier() throw() | |||
| var::identifier::~identifier() | |||
| { | |||
| } | |||
| @@ -531,13 +419,13 @@ const var DynamicObject::invokeMethod (const var::identifier& methodName, | |||
| const var* parameters, | |||
| int numParameters) | |||
| { | |||
| return getProperty (methodName).invoke (this, parameters, numParameters); | |||
| return getProperty (methodName).invoke (var (this), parameters, numParameters); | |||
| } | |||
| void DynamicObject::setMethod (const var::identifier& name, | |||
| var::MethodFunction methodFunction) | |||
| { | |||
| setProperty (name, methodFunction); | |||
| setProperty (name, var (methodFunction)); | |||
| } | |||
| void DynamicObject::clear() | |||
| @@ -59,33 +59,35 @@ public: | |||
| /** Destructor. */ | |||
| ~var(); | |||
| var (const var& valueToCopy) throw(); | |||
| var (const var& valueToCopy); | |||
| var (const int value) throw(); | |||
| var (const bool value) throw(); | |||
| var (const double value) throw(); | |||
| var (const char* const value) throw(); | |||
| var (const juce_wchar* const value) throw(); | |||
| var (const String& value) throw(); | |||
| var (DynamicObject* const object) throw(); | |||
| var (const char* const value); | |||
| var (const juce_wchar* const value); | |||
| var (const String& value); | |||
| var (DynamicObject* const object); | |||
| var (MethodFunction method) throw(); | |||
| const var& operator= (const var& valueToCopy) throw(); | |||
| const var& operator= (const int value) throw(); | |||
| const var& operator= (const bool value) throw(); | |||
| const var& operator= (const double value) throw(); | |||
| const var& operator= (const char* const value) throw(); | |||
| const var& operator= (const juce_wchar* const value) throw(); | |||
| const var& operator= (const String& value) throw(); | |||
| const var& operator= (DynamicObject* const object) throw(); | |||
| const var& operator= (MethodFunction method) throw(); | |||
| operator int() const throw(); | |||
| operator bool() const throw(); | |||
| operator float() const throw(); | |||
| operator double() const throw(); | |||
| operator const String() const throw(); | |||
| const String toString() const throw(); | |||
| DynamicObject* getObject() const throw(); | |||
| var& operator= (const var& valueToCopy); | |||
| var& operator= (int value); | |||
| var& operator= (bool value); | |||
| var& operator= (double value); | |||
| var& operator= (const char* value); | |||
| var& operator= (const juce_wchar* value); | |||
| var& operator= (const String& value); | |||
| var& operator= (DynamicObject* object); | |||
| var& operator= (MethodFunction method); | |||
| void swapWith (var& other) throw(); | |||
| operator int() const; | |||
| operator bool() const; | |||
| operator float() const; | |||
| operator double() const; | |||
| operator const String() const; | |||
| const String toString() const; | |||
| DynamicObject* getObject() const; | |||
| bool isVoid() const throw() { return type == voidType; } | |||
| bool isInt() const throw() { return type == intType; } | |||
| @@ -102,21 +104,21 @@ public: | |||
| /** Writes a binary representation of this value to a stream. | |||
| The data can be read back later using readFromStream(). | |||
| */ | |||
| void writeToStream (OutputStream& output) const throw(); | |||
| void writeToStream (OutputStream& output) const; | |||
| /** Reads back a stored binary representation of a value. | |||
| The data in the stream must have been written using writeToStream(), or this | |||
| will have unpredictable results. | |||
| */ | |||
| static const var readFromStream (InputStream& input) throw(); | |||
| static const var readFromStream (InputStream& input); | |||
| //============================================================================== | |||
| class JUCE_API identifier | |||
| { | |||
| public: | |||
| identifier (const char* const name) throw(); | |||
| identifier (const String& name) throw(); | |||
| ~identifier() throw(); | |||
| identifier (const char* const name); | |||
| identifier (const String& name); | |||
| ~identifier(); | |||
| bool operator== (const identifier& other) const throw() | |||
| { | |||
| @@ -129,7 +131,7 @@ public: | |||
| }; | |||
| /** If this variant is an object, this returns one of its properties. */ | |||
| const var operator[] (const identifier& propertyName) const throw(); | |||
| const var operator[] (const identifier& propertyName) const; | |||
| //============================================================================== | |||
| /** If this variant is an object, this invokes one of its methods with no arguments. */ | |||
| @@ -167,9 +169,7 @@ private: | |||
| methodType | |||
| }; | |||
| Type type; | |||
| union | |||
| union ValueUnion | |||
| { | |||
| int intValue; | |||
| bool boolValue; | |||
| @@ -177,9 +177,10 @@ private: | |||
| String* stringValue; | |||
| DynamicObject* objectValue; | |||
| MethodFunction methodValue; | |||
| } value; | |||
| }; | |||
| void releaseValue() throw(); | |||
| Type type; | |||
| ValueUnion value; | |||
| }; | |||
| //============================================================================== | |||
| @@ -196,9 +196,9 @@ public: | |||
| }; | |||
| //============================================================================== | |||
| #if JUCE_MAC || JUCE_IPHONE | |||
| //============================================================================== | |||
| /** A handy C++ wrapper that creates and deletes an NSAutoreleasePool object | |||
| using RAII. | |||
| */ | |||
| @@ -217,9 +217,33 @@ private: | |||
| #endif | |||
| #if JUCE_MAC | |||
| //============================================================================== | |||
| #if JUCE_LINUX | |||
| /** A handy class that uses XLockDisplay and XUnlockDisplay to lock the X server | |||
| using an RAII approach. | |||
| */ | |||
| class ScopedXLock | |||
| { | |||
| public: | |||
| /** Creating a ScopedXLock object locks the X display. | |||
| This uses XLockDisplay() to grab the display that Juce is using. | |||
| */ | |||
| ScopedXLock(); | |||
| /** Deleting a ScopedXLock object unlocks the X display. | |||
| This calls XUnlockDisplay() to release the lock. | |||
| */ | |||
| ~ScopedXLock(); | |||
| }; | |||
| #endif | |||
| //============================================================================== | |||
| #if JUCE_MAC | |||
| /** | |||
| A wrapper class for picking up events from an Apple IR remote control device. | |||
| @@ -76,9 +76,7 @@ Uuid::Uuid (const Uuid& other) | |||
| Uuid& Uuid::operator= (const Uuid& other) | |||
| { | |||
| if (this != &other) | |||
| value = other.value; | |||
| value = other.value; | |||
| return *this; | |||
| } | |||
| @@ -77,14 +77,11 @@ public: | |||
| //============================================================================== | |||
| /** A set of colour IDs to use to change the colour of various aspects of the label. | |||
| /** A set of colour IDs to use to change the colour of various aspects of the list. | |||
| These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() | |||
| methods. | |||
| Note that you can also use the constants from TextEditor::ColourIds to change the | |||
| colour of the text editor that is opened when a label is editable. | |||
| @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour | |||
| */ | |||
| enum ColourIds | |||
| @@ -156,7 +156,7 @@ FileChooserDialogBox::ContentComponent::~ContentComponent() | |||
| void FileChooserDialogBox::ContentComponent::paint (Graphics& g) | |||
| { | |||
| g.setColour (Colours::black); | |||
| g.setColour (getLookAndFeel().findColour (FileChooserDialogBox::titleTextColourId)); | |||
| text.draw (g); | |||
| } | |||
| @@ -106,6 +106,19 @@ public: | |||
| bool show (int width = 0,int height = 0); | |||
| //============================================================================== | |||
| /** A set of colour IDs to use to change the colour of various aspects of the box. | |||
| These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() | |||
| methods. | |||
| @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour | |||
| */ | |||
| enum ColourIds | |||
| { | |||
| titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */ | |||
| }; | |||
| //============================================================================== | |||
| /** @internal */ | |||
| void buttonClicked (Button* button); | |||
| @@ -55,6 +55,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../filebrowser/juce_DirectoryContentsDisplayComponent.h" | |||
| #include "../filebrowser/juce_FileSearchPathListComponent.h" | |||
| #include "../filebrowser/juce_FileBrowserComponent.h" | |||
| #include "../filebrowser/juce_FileChooserDialogBox.h" | |||
| #include "../layout/juce_GroupComponent.h" | |||
| #include "../properties/juce_PropertyComponent.h" | |||
| #include "../juce_Desktop.h" | |||
| @@ -198,33 +199,35 @@ LookAndFeel::LookAndFeel() | |||
| GroupComponent::outlineColourId, 0x66000000, | |||
| GroupComponent::textColourId, 0xff000000, | |||
| DirectoryContentsDisplayComponent::highlightColourId, textHighlightColour, | |||
| DirectoryContentsDisplayComponent::textColourId, 0xff000000, | |||
| DirectoryContentsDisplayComponent::highlightColourId, textHighlightColour, | |||
| DirectoryContentsDisplayComponent::textColourId, 0xff000000, | |||
| 0x1000440, /*LassoComponent::lassoFillColourId*/ 0x66dddddd, | |||
| 0x1000441, /*LassoComponent::lassoOutlineColourId*/ 0x99111111, | |||
| 0x1000440, /*LassoComponent::lassoFillColourId*/ 0x66dddddd, | |||
| 0x1000441, /*LassoComponent::lassoOutlineColourId*/ 0x99111111, | |||
| MidiKeyboardComponent::whiteNoteColourId, 0xffffffff, | |||
| MidiKeyboardComponent::blackNoteColourId, 0xff000000, | |||
| MidiKeyboardComponent::keySeparatorLineColourId, 0x66000000, | |||
| MidiKeyboardComponent::mouseOverKeyOverlayColourId, 0x80ffff00, | |||
| MidiKeyboardComponent::keyDownOverlayColourId, 0xffb6b600, | |||
| MidiKeyboardComponent::textLabelColourId, 0xff000000, | |||
| MidiKeyboardComponent::upDownButtonBackgroundColourId, 0xffd3d3d3, | |||
| MidiKeyboardComponent::upDownButtonArrowColourId, 0xff000000, | |||
| MidiKeyboardComponent::whiteNoteColourId, 0xffffffff, | |||
| MidiKeyboardComponent::blackNoteColourId, 0xff000000, | |||
| MidiKeyboardComponent::keySeparatorLineColourId, 0x66000000, | |||
| MidiKeyboardComponent::mouseOverKeyOverlayColourId, 0x80ffff00, | |||
| MidiKeyboardComponent::keyDownOverlayColourId, 0xffb6b600, | |||
| MidiKeyboardComponent::textLabelColourId, 0xff000000, | |||
| MidiKeyboardComponent::upDownButtonBackgroundColourId, 0xffd3d3d3, | |||
| MidiKeyboardComponent::upDownButtonArrowColourId, 0xff000000, | |||
| CodeEditorComponent::backgroundColourId, 0xffffffff, | |||
| CodeEditorComponent::caretColourId, 0xff000000, | |||
| CodeEditorComponent::highlightColourId, textHighlightColour, | |||
| CodeEditorComponent::defaultTextColourId, 0xff000000, | |||
| CodeEditorComponent::backgroundColourId, 0xffffffff, | |||
| CodeEditorComponent::caretColourId, 0xff000000, | |||
| CodeEditorComponent::highlightColourId, textHighlightColour, | |||
| CodeEditorComponent::defaultTextColourId, 0xff000000, | |||
| ColourSelector::backgroundColourId, 0xffe5e5e5, | |||
| ColourSelector::labelTextColourId, 0xff000000, | |||
| ColourSelector::backgroundColourId, 0xffe5e5e5, | |||
| ColourSelector::labelTextColourId, 0xff000000, | |||
| KeyMappingEditorComponent::backgroundColourId, 0x00000000, | |||
| KeyMappingEditorComponent::textColourId, 0xff000000, | |||
| KeyMappingEditorComponent::backgroundColourId, 0x00000000, | |||
| KeyMappingEditorComponent::textColourId, 0xff000000, | |||
| FileSearchPathListComponent::backgroundColourId, 0xffffffff, | |||
| FileSearchPathListComponent::backgroundColourId, 0xffffffff, | |||
| FileChooserDialogBox::titleTextColourId, 0xff000000, | |||
| }; | |||
| for (int i = 0; i < numElementsInArray (standardColours); i += 2) | |||
| @@ -309,7 +309,8 @@ int MidiKeyboardComponent::remappedXYToNote (int x, int y, float& mousePositionV | |||
| if (x >= kx && x < kx + kw) | |||
| { | |||
| mousePositionVelocity = y / (float) getHeight(); | |||
| const int whiteNoteLength = (orientation == horizontalKeyboard) ? getHeight() : getWidth(); | |||
| mousePositionVelocity = y / (float) whiteNoteLength; | |||
| return note; | |||
| } | |||
| } | |||
| @@ -57,17 +57,14 @@ PositionedRectangle::PositionedRectangle (const PositionedRectangle& other) thro | |||
| const PositionedRectangle& PositionedRectangle::operator= (const PositionedRectangle& other) throw() | |||
| { | |||
| if (this != &other) | |||
| { | |||
| x = other.x; | |||
| y = other.y; | |||
| w = other.w; | |||
| h = other.h; | |||
| xMode = other.xMode; | |||
| yMode = other.yMode; | |||
| wMode = other.wMode; | |||
| hMode = other.hMode; | |||
| } | |||
| x = other.x; | |||
| y = other.y; | |||
| w = other.w; | |||
| h = other.h; | |||
| xMode = other.xMode; | |||
| yMode = other.yMode; | |||
| wMode = other.wMode; | |||
| hMode = other.hMode; | |||
| return *this; | |||
| } | |||
| @@ -49,9 +49,7 @@ RectangleList::RectangleList (const RectangleList& other) throw() | |||
| const RectangleList& RectangleList::operator= (const RectangleList& other) throw() | |||
| { | |||
| if (this != &other) | |||
| rects = other.rects; | |||
| rects = other.rects; | |||
| return *this; | |||
| } | |||
| @@ -52,14 +52,22 @@ extern void juce_windowMessageReceive (XEvent* event); | |||
| // Defined in Clipboard.cpp | |||
| extern void juce_handleSelectionRequest (XSelectionRequestEvent &evt); | |||
| //============================================================================== | |||
| ScopedXLock::ScopedXLock() { XLockDisplay (display); } | |||
| ScopedXLock::~ScopedXLock() { XUnlockDisplay (display); } | |||
| //============================================================================== | |||
| class InternalMessageQueue | |||
| { | |||
| public: | |||
| InternalMessageQueue() | |||
| : bytesInSocket (0) | |||
| { | |||
| int ret = ::socketpair (AF_LOCAL, SOCK_STREAM, 0, fd); | |||
| (void) ret; jassert (ret == 0); | |||
| setNonBlocking (fd[0]); | |||
| setNonBlocking (fd[1]); | |||
| } | |||
| ~InternalMessageQueue() | |||
| @@ -70,11 +78,20 @@ public: | |||
| void postMessage (Message* msg) | |||
| { | |||
| const int maxBytesInSocketQueue = 128; | |||
| ScopedLock sl (lock); | |||
| queue.add (msg); | |||
| const unsigned char x = 0xff; | |||
| write (fd[0], &x, 1); | |||
| if (bytesInSocket < maxBytesInSocketQueue) | |||
| { | |||
| ++bytesInSocket; | |||
| ScopedUnlock ul (lock); | |||
| const unsigned char x = 0xff; | |||
| size_t bytesWritten = write (fd[0], &x, 1); | |||
| (void) bytesWritten; | |||
| } | |||
| } | |||
| bool isEmpty() const | |||
| @@ -83,20 +100,22 @@ public: | |||
| return queue.size() == 0; | |||
| } | |||
| Message* popMessage() | |||
| Message* popNextMessage() | |||
| { | |||
| Message* m = 0; | |||
| ScopedLock sl (lock); | |||
| if (queue.size() != 0) | |||
| if (bytesInSocket > 0) | |||
| { | |||
| unsigned char x; | |||
| read (fd[1], &x, 1); | |||
| --bytesInSocket; | |||
| m = queue.getUnchecked(0); | |||
| queue.remove (0, false /* deleteObject */); | |||
| ScopedUnlock ul (lock); | |||
| unsigned char x; | |||
| size_t numBytes = read (fd[1], &x, 1); | |||
| (void) numBytes; | |||
| } | |||
| Message* m = queue[0]; | |||
| queue.remove (0, false /* deleteObject */); | |||
| return m; | |||
| } | |||
| @@ -106,6 +125,19 @@ private: | |||
| CriticalSection lock; | |||
| OwnedArray <Message> queue; | |||
| int fd[2]; | |||
| int bytesInSocket; | |||
| static bool setNonBlocking (int handle) | |||
| { | |||
| int socketFlags = fcntl (handle, F_GETFL, 0); | |||
| if (socketFlags == -1) | |||
| return false; | |||
| socketFlags |= O_NONBLOCK; | |||
| return fcntl (handle, F_SETFL, socketFlags) == 0; | |||
| } | |||
| }; | |||
| //============================================================================== | |||
| @@ -370,9 +402,16 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* func | |||
| // Wait for an event (either XEvent, or an internal Message) | |||
| static bool juce_sleepUntilEvent (const int timeoutMs) | |||
| { | |||
| if ((display != 0 && XPending (display)) || ! juce_internalMessageQueue->isEmpty()) | |||
| if (! juce_internalMessageQueue->isEmpty()) | |||
| return true; | |||
| if (display != 0) | |||
| { | |||
| ScopedXLock xlock; | |||
| if (XPending (display)) | |||
| return true; | |||
| } | |||
| struct timeval tv; | |||
| tv.tv_sec = 0; | |||
| tv.tv_usec = timeoutMs * 1000; | |||
| @@ -385,23 +424,32 @@ static bool juce_sleepUntilEvent (const int timeoutMs) | |||
| if (display != 0) | |||
| { | |||
| ScopedXLock xlock; | |||
| int fd1 = XConnectionNumber (display); | |||
| FD_SET (fd1, &readset); | |||
| fdmax = jmax (fd0, fd1); | |||
| } | |||
| int ret = select (fdmax + 1, &readset, 0, 0, &tv); | |||
| const int ret = select (fdmax + 1, &readset, 0, 0, &tv); | |||
| return (ret > 0); // ret <= 0 if error or timeout | |||
| } | |||
| // Handle next XEvent (if any) | |||
| static bool juce_dispatchNextXEvent() | |||
| { | |||
| if (display == 0 || ! XPending (display)) | |||
| if (display == 0) | |||
| return false; | |||
| XEvent evt; | |||
| XNextEvent (display, &evt); | |||
| { | |||
| ScopedXLock xlock; | |||
| if (! XPending (display)) | |||
| return false; | |||
| XNextEvent (display, &evt); | |||
| } | |||
| if (evt.type == SelectionRequest && evt.xany.window == juce_messageWindowHandle) | |||
| { | |||
| @@ -418,10 +466,10 @@ static bool juce_dispatchNextXEvent() | |||
| // Handle next internal Message (if any) | |||
| static bool juce_dispatchNextInternalMessage() | |||
| { | |||
| if (juce_internalMessageQueue->isEmpty()) | |||
| return false; | |||
| ScopedPointer <Message> msg (juce_internalMessageQueue->popNextMessage()); | |||
| ScopedPointer <Message> msg (juce_internalMessageQueue->popMessage()); | |||
| if (msg == 0) | |||
| return false; | |||
| if (msg->intParameter1 == MessageThreadFuncCall::uniqueID) | |||
| { | |||
| @@ -130,6 +130,7 @@ static void getMousePos (int& x, int& y, int& mouseMods) throw() | |||
| unsigned int mask; | |||
| mouseMods = 0; | |||
| ScopedXLock xlock; | |||
| if (XQueryPointer (display, | |||
| RootWindow (display, DefaultScreen (display)), | |||
| @@ -201,6 +202,7 @@ bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw() | |||
| } | |||
| } | |||
| ScopedXLock xlock; | |||
| return keyDown (XKeysymToKeycode (display, keysym)); | |||
| } | |||
| @@ -209,6 +211,7 @@ bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw() | |||
| // modifier constants: check what they're mapped to | |||
| static void getModifierMapping() throw() | |||
| { | |||
| ScopedXLock xlock; | |||
| const int altLeftCode = XKeysymToKeycode (display, XK_Alt_L); | |||
| const int numLockCode = XKeysymToKeycode (display, XK_Num_Lock); | |||
| @@ -325,6 +328,8 @@ static bool updateKeyModifiersFromSym (KeySym sym, const bool press) throw() | |||
| #if JUCE_USE_XSHM | |||
| static bool isShmAvailable() throw() | |||
| { | |||
| ScopedXLock xlock; | |||
| static bool isChecked = false; | |||
| static bool isAvailable = false; | |||
| @@ -384,6 +389,8 @@ static bool isShmAvailable() throw() | |||
| //============================================================================== | |||
| static Pixmap juce_createColourPixmapFromImage (Display* display, const Image& image) | |||
| { | |||
| ScopedXLock xlock; | |||
| const int width = image.getWidth(); | |||
| const int height = image.getHeight(); | |||
| HeapBlock <uint32> colour (width * height); | |||
| @@ -408,6 +415,8 @@ static Pixmap juce_createColourPixmapFromImage (Display* display, const Image& i | |||
| static Pixmap juce_createMaskPixmapFromImage (Display* display, const Image& image) | |||
| { | |||
| ScopedXLock xlock; | |||
| const int width = image.getWidth(); | |||
| const int height = image.getHeight(); | |||
| const int stride = (width + 7) >> 3; | |||
| @@ -447,6 +456,7 @@ public: | |||
| pixelStride = (format_ == RGB) ? 3 : 4; | |||
| lineStride = ((w * pixelStride + 3) & ~3); | |||
| ScopedXLock xlock; | |||
| Visual* const visual = DefaultVisual (display, DefaultScreen (display)); | |||
| #if JUCE_USE_XSHM | |||
| @@ -545,6 +555,8 @@ public: | |||
| ~XBitmapImage() | |||
| { | |||
| ScopedXLock xlock; | |||
| #if JUCE_USE_XSHM | |||
| if (usingXShm) | |||
| { | |||
| @@ -566,6 +578,8 @@ public: | |||
| void blitToWindow (Window window, int dx, int dy, int dw, int dh, int sx, int sy) | |||
| { | |||
| ScopedXLock xlock; | |||
| static GC gc = 0; | |||
| if (gc == 0) | |||
| @@ -688,6 +702,7 @@ public: | |||
| { | |||
| XPointer peer = 0; | |||
| ScopedXLock xlock; | |||
| if (! XFindContext (display, (XID) windowHandle, improbableNumber, &peer)) | |||
| { | |||
| if (peer != 0 && ! ((LinuxComponentPeer*) peer)->isValidMessageListener()) | |||
| @@ -699,6 +714,7 @@ public: | |||
| void setVisible (bool shouldBeVisible) | |||
| { | |||
| ScopedXLock xlock; | |||
| if (shouldBeVisible) | |||
| XMapWindow (display, windowH); | |||
| else | |||
| @@ -733,6 +749,8 @@ public: | |||
| ww = jmax (1, w); | |||
| wh = jmax (1, h); | |||
| ScopedXLock xlock; | |||
| // Make sure the Window manager does what we want | |||
| XSizeHints* hints = XAllocSizeHints(); | |||
| hints->flags = USSize | USPosition; | |||
| @@ -807,6 +825,7 @@ public: | |||
| clientMsg.message_type = wm_ChangeState; | |||
| clientMsg.data.l[0] = IconicState; | |||
| ScopedXLock xlock; | |||
| XSendEvent (display, root, false, | |||
| SubstructureRedirectMask | SubstructureNotifyMask, | |||
| (XEvent*) &clientMsg); | |||
| @@ -826,6 +845,7 @@ public: | |||
| Atom actualType; | |||
| int actualFormat; | |||
| ScopedXLock xlock; | |||
| if (XGetWindowProperty (display, windowH, wm_State, 0, 64, False, | |||
| wm_State, &actualType, &actualFormat, &nitems, &bytesLeft, | |||
| &stateProp) == Success | |||
| @@ -871,6 +891,7 @@ public: | |||
| uint32 windowListSize = 0; | |||
| Window parent, root; | |||
| ScopedXLock xlock; | |||
| if (XQueryTree (display, windowH, &root, &parent, &windowList, &windowListSize) != 0) | |||
| { | |||
| if (windowList != 0) | |||
| @@ -888,6 +909,7 @@ public: | |||
| uint32 windowListSize = 0; | |||
| bool result = false; | |||
| ScopedXLock xlock; | |||
| Window parent, root = RootWindow (display, DefaultScreen (display)); | |||
| if (XQueryTree (display, root, &root, &parent, &windowList, &windowListSize) != 0) | |||
| @@ -945,6 +967,7 @@ public: | |||
| unsigned int bw, depth; | |||
| int wx, wy, w, h; | |||
| ScopedXLock xlock; | |||
| if (! XGetGeometry (display, (::Drawable) windowH, &root, | |||
| &wx, &wy, (unsigned int*) &w, (unsigned int*) &h, | |||
| &bw, &depth)) | |||
| @@ -972,10 +995,13 @@ public: | |||
| if (wasVisible) | |||
| setVisible (false); // doesn't always seem to work if the window is visible when this is done.. | |||
| XSetWindowAttributes swa; | |||
| swa.override_redirect = alwaysOnTop ? True : False; | |||
| { | |||
| ScopedXLock xlock; | |||
| XSetWindowAttributes swa; | |||
| swa.override_redirect = alwaysOnTop ? True : False; | |||
| XChangeWindowAttributes (display, windowH, CWOverrideRedirect, &swa); | |||
| XChangeWindowAttributes (display, windowH, CWOverrideRedirect, &swa); | |||
| } | |||
| if (wasVisible) | |||
| setVisible (true); | |||
| @@ -1005,18 +1031,21 @@ public: | |||
| ev.xclient.data.l[3] = 0; | |||
| ev.xclient.data.l[4] = 0; | |||
| XSendEvent (display, RootWindow (display, DefaultScreen (display)), | |||
| False, | |||
| SubstructureRedirectMask | SubstructureNotifyMask, | |||
| &ev); | |||
| { | |||
| ScopedXLock xlock; | |||
| XSendEvent (display, RootWindow (display, DefaultScreen (display)), | |||
| False, | |||
| SubstructureRedirectMask | SubstructureNotifyMask, | |||
| &ev); | |||
| XWindowAttributes attr; | |||
| XGetWindowAttributes (display, windowH, &attr); | |||
| XWindowAttributes attr; | |||
| XGetWindowAttributes (display, windowH, &attr); | |||
| if (attr.override_redirect) | |||
| XRaiseWindow (display, windowH); | |||
| if (attr.override_redirect) | |||
| XRaiseWindow (display, windowH); | |||
| XSync (display, False); | |||
| XSync (display, False); | |||
| } | |||
| handleBroughtToFront(); | |||
| } | |||
| @@ -1032,6 +1061,7 @@ public: | |||
| Window newStack[] = { otherPeer->windowH, windowH }; | |||
| ScopedXLock xlock; | |||
| XRestackWindows (display, newStack, 2); | |||
| } | |||
| } | |||
| @@ -1040,6 +1070,7 @@ public: | |||
| { | |||
| int revert; | |||
| Window focusedWindow = 0; | |||
| ScopedXLock xlock; | |||
| XGetInputFocus (display, &focusedWindow, &revert); | |||
| return focusedWindow == windowH; | |||
| @@ -1048,6 +1079,7 @@ public: | |||
| void grabFocus() | |||
| { | |||
| XWindowAttributes atts; | |||
| ScopedXLock xlock; | |||
| if (windowH != 0 | |||
| && XGetWindowAttributes (display, windowH, &atts) | |||
| @@ -1092,6 +1124,7 @@ public: | |||
| for (int x = 0; x < newIcon.getWidth(); ++x) | |||
| data[index++] = newIcon.getPixelAt (x, y).getARGB(); | |||
| ScopedXLock xlock; | |||
| XChangeProperty (display, windowH, | |||
| XInternAtom (display, "_NET_WM_ICON", False), | |||
| XA_CARDINAL, 32, PropModeReplace, | |||
| @@ -1116,6 +1149,7 @@ public: | |||
| void deleteIconPixmaps() | |||
| { | |||
| ScopedXLock xlock; | |||
| XWMHints* wmHints = XGetWMHints (display, windowH); | |||
| if (wmHints != 0) | |||
| @@ -1144,6 +1178,7 @@ public: | |||
| { | |||
| case 2: // 'KeyPress' | |||
| { | |||
| ScopedXLock xlock; | |||
| XKeyEvent* const keyEvent = (XKeyEvent*) &event->xkey; | |||
| updateKeyStates (keyEvent->keycode, true); | |||
| @@ -1254,6 +1289,7 @@ public: | |||
| const XKeyEvent* const keyEvent = (const XKeyEvent*) &event->xkey; | |||
| updateKeyStates (keyEvent->keycode, false); | |||
| ScopedXLock xlock; | |||
| KeySym sym = XKeycodeToKeysym (display, keyEvent->keycode, 0); | |||
| const int oldMods = currentModifiers; | |||
| @@ -1363,7 +1399,11 @@ public: | |||
| Window wRoot = 0, wParent = 0; | |||
| Window* wChild = 0; | |||
| unsigned int numChildren; | |||
| XQueryTree (display, windowH, &wRoot, &wParent, &wChild, &numChildren); | |||
| { | |||
| ScopedXLock xlock; | |||
| XQueryTree (display, windowH, &wRoot, &wParent, &wChild, &numChildren); | |||
| } | |||
| if (wParent != 0 | |||
| && wParent != windowH | |||
| @@ -1458,6 +1498,7 @@ public: | |||
| // Batch together all pending expose events | |||
| XExposeEvent* exposeEvent = (XExposeEvent*) &event->xexpose; | |||
| XEvent nextEvent; | |||
| ScopedXLock xlock; | |||
| if (exposeEvent->window != windowH) | |||
| { | |||
| @@ -1526,7 +1567,11 @@ public: | |||
| Window wRoot = 0; | |||
| Window* wChild = 0; | |||
| unsigned int numChildren; | |||
| XQueryTree (display, windowH, &wRoot, &parentWindow, &wChild, &numChildren); | |||
| { | |||
| ScopedXLock xlock; | |||
| XQueryTree (display, windowH, &wRoot, &parentWindow, &wChild, &numChildren); | |||
| } | |||
| if (parentWindow == windowH || parentWindow == wRoot) | |||
| parentWindow = 0; | |||
| @@ -1553,6 +1598,7 @@ public: | |||
| if (mappingEvent->request != MappingPointer) | |||
| { | |||
| // Deal with modifier/keyboard mapping | |||
| ScopedXLock xlock; | |||
| XRefreshKeyboardMapping (mappingEvent); | |||
| getModifierMapping(); | |||
| } | |||
| @@ -1572,6 +1618,7 @@ public: | |||
| { | |||
| XWindowAttributes atts; | |||
| ScopedXLock xlock; | |||
| if (clientMsg->window != 0 | |||
| && XGetWindowAttributes (display, clientMsg->window, &atts)) | |||
| { | |||
| @@ -1622,8 +1669,11 @@ public: | |||
| default: | |||
| #if JUCE_USE_XSHM | |||
| { | |||
| ScopedXLock xlock; | |||
| if (event->xany.type == XShmGetEventBase (display)) | |||
| repainter->notifyPaintCompleted(); | |||
| } | |||
| #endif | |||
| break; | |||
| } | |||
| @@ -1631,12 +1681,14 @@ public: | |||
| void showMouseCursor (Cursor cursor) throw() | |||
| { | |||
| ScopedXLock xlock; | |||
| XDefineCursor (display, windowH, cursor); | |||
| } | |||
| //============================================================================== | |||
| void setTaskBarIcon (const Image& image) | |||
| { | |||
| ScopedXLock xlock; | |||
| deleteTaskBarIcon(); | |||
| taskbarImage = image.createCopy(); | |||
| @@ -1720,6 +1772,7 @@ private: | |||
| if (useARGBImagesForRendering) | |||
| { | |||
| ScopedXLock xlock; | |||
| XShmSegmentInfo segmentinfo; | |||
| XImage* const testImage | |||
| @@ -1764,11 +1817,13 @@ private: | |||
| void performAnyPendingRepaintsNow() | |||
| { | |||
| #if JUCE_USE_XSHM | |||
| if (! shmCompletedDrawing) | |||
| { | |||
| startTimer (repaintTimerPeriod); | |||
| return; | |||
| } | |||
| #endif | |||
| peer->clearMaskedRegion(); | |||
| @@ -1870,6 +1925,7 @@ private: | |||
| motifHints.flags = 2; /* MWM_HINTS_DECORATIONS */ | |||
| motifHints.decorations = 0; | |||
| ScopedXLock xlock; | |||
| XChangeProperty (display, wndH, hints, hints, 32, PropModeReplace, | |||
| (unsigned char*) &motifHints, 4); | |||
| } | |||
| @@ -1880,6 +1936,7 @@ private: | |||
| { | |||
| long gnomeHints = 0; | |||
| ScopedXLock xlock; | |||
| XChangeProperty (display, wndH, hints, hints, 32, PropModeReplace, | |||
| (unsigned char*) &gnomeHints, 1); | |||
| } | |||
| @@ -1890,6 +1947,7 @@ private: | |||
| { | |||
| long kwmHints = 2; /*KDE_tinyDecoration*/ | |||
| ScopedXLock xlock; | |||
| XChangeProperty (display, wndH, hints, hints, 32, PropModeReplace, | |||
| (unsigned char*) &kwmHints, 1); | |||
| } | |||
| @@ -1898,6 +1956,7 @@ private: | |||
| if (hints != None) | |||
| { | |||
| ScopedXLock xlock; | |||
| int netHints [2]; | |||
| int numHints = 0; | |||
| if ((styleFlags & windowIsTemporary) != 0) | |||
| @@ -1920,6 +1979,7 @@ private: | |||
| void addWindowButtons (Window wndH) | |||
| { | |||
| ScopedXLock xlock; | |||
| Atom hints = XInternAtom (display, "_MOTIF_WM_HINTS", True); | |||
| if (hints != None) | |||
| @@ -1975,6 +2035,7 @@ private: | |||
| void createWindow() | |||
| { | |||
| ScopedXLock xlock; | |||
| static bool atomsInitialised = false; | |||
| if (! atomsInitialised) | |||
| @@ -2173,6 +2234,8 @@ private: | |||
| void destroyWindow() | |||
| { | |||
| ScopedXLock xlock; | |||
| XPointer handlePointer; | |||
| if (! XFindContext (display, (XID) windowH, improbableNumber, &handlePointer)) | |||
| XDeleteContext (display, (XID) windowH, improbableNumber); | |||
| @@ -2203,6 +2266,7 @@ private: | |||
| { | |||
| XTextProperty nameProperty; | |||
| char* strings[] = { (char*) title }; | |||
| ScopedXLock xlock; | |||
| if (XStringListToTextProperty (strings, 1, &nameProperty)) | |||
| { | |||
| @@ -2221,6 +2285,7 @@ private: | |||
| } | |||
| else if (windowBorder.getTopAndBottom() == 0 && windowBorder.getLeftAndRight() == 0) | |||
| { | |||
| ScopedXLock xlock; | |||
| Atom hints = XInternAtom (display, "_NET_FRAME_EXTENTS", True); | |||
| if (hints != None) | |||
| @@ -2253,6 +2318,7 @@ private: | |||
| { | |||
| Window root, child; | |||
| unsigned int bw, depth; | |||
| ScopedXLock xlock; | |||
| if (! XGetGeometry (display, (::Drawable) windowH, &root, | |||
| &wx, &wy, (unsigned int*) &ww, (unsigned int*) &wh, | |||
| @@ -2285,6 +2351,7 @@ private: | |||
| msg.format = 32; | |||
| msg.data.l[0] = windowH; | |||
| ScopedXLock xlock; | |||
| XSendEvent (display, dragAndDropSourceWindow, False, 0, (XEvent*) &msg); | |||
| } | |||
| @@ -2404,6 +2471,7 @@ private: | |||
| unsigned long count = 0, remaining = 0; | |||
| unsigned char* data = 0; | |||
| ScopedXLock xlock; | |||
| XGetWindowProperty (display, dragAndDropSourceWindow, XA_XdndTypeList, | |||
| 0, 0x8000000L, False, XA_ATOM, &actual, &format, | |||
| &count, &remaining, &data); | |||
| @@ -2461,6 +2529,7 @@ private: | |||
| uint8* data = 0; | |||
| unsigned long count = 0, remaining = 0; | |||
| int format = 0; | |||
| ScopedXLock xlock; | |||
| if (XGetWindowProperty (display, evt->xany.window, evt->xselection.property, | |||
| dropData.getSize() / 4, 65536, 1, AnyPropertyType, &actual, | |||
| @@ -2499,6 +2568,7 @@ private: | |||
| { | |||
| dragAndDropTimestamp = clientMsg->data.l[2]; | |||
| ScopedXLock xlock; | |||
| XConvertSelection (display, | |||
| XA_XdndSelection, | |||
| dragAndDropCurrentMimeType, | |||
| @@ -2570,6 +2640,7 @@ void juce_updateMultiMonitorInfo (Array <Rectangle>& monitorCoords, const bool / | |||
| #if JUCE_USE_XINERAMA | |||
| int major_opcode, first_event, first_error; | |||
| ScopedXLock xlock; | |||
| if (XQueryExtension (display, "XINERAMA", &major_opcode, &first_event, &first_error)) | |||
| { | |||
| typedef Bool (*tXineramaIsActive) (Display*); | |||
| @@ -2675,6 +2746,7 @@ void Desktop::getMousePosition (int& x, int& y) throw() | |||
| void Desktop::setMousePosition (int x, int y) throw() | |||
| { | |||
| ScopedXLock xlock; | |||
| Window root = RootWindow (display, DefaultScreen (display)); | |||
| XWarpPointer (display, None, root, 0, 0, 0, 0, x, y); | |||
| } | |||
| @@ -2700,6 +2772,7 @@ void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | |||
| xScreenSaverSuspend = (tXScreenSaverSuspend) dlsym (h, "XScreenSaverSuspend"); | |||
| } | |||
| ScopedXLock xlock; | |||
| if (xScreenSaverSuspend != 0) | |||
| xScreenSaverSuspend (display, ! isEnabled); | |||
| } | |||
| @@ -2713,6 +2786,7 @@ bool Desktop::isScreenSaverEnabled() throw() | |||
| //============================================================================== | |||
| void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw() | |||
| { | |||
| ScopedXLock xlock; | |||
| Window root = RootWindow (display, DefaultScreen (display)); | |||
| const unsigned int imageW = image.getWidth(); | |||
| const unsigned int imageH = image.getHeight(); | |||
| @@ -2779,6 +2853,7 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot | |||
| void juce_deleteMouseCursor (void* const cursorHandle, const bool) throw() | |||
| { | |||
| ScopedXLock xlock; | |||
| if (cursorHandle != None) | |||
| XFreeCursor (display, (Cursor) cursorHandle); | |||
| } | |||
| @@ -2889,6 +2964,7 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro | |||
| return (void*) None; // Use parent cursor | |||
| } | |||
| ScopedXLock xlock; | |||
| return (void*) XCreateFontCursor (display, shape); | |||
| } | |||
| @@ -2938,6 +3014,7 @@ public: | |||
| if (peer == 0) | |||
| return; | |||
| ScopedXLock xlock; | |||
| XSync (display, False); | |||
| GLint attribs [64]; | |||
| @@ -3005,6 +3082,7 @@ public: | |||
| { | |||
| makeInactive(); | |||
| ScopedXLock xlock; | |||
| glXDestroyContext (display, renderContext); | |||
| XUnmapWindow (display, embeddedWindow); | |||
| @@ -3015,17 +3093,20 @@ public: | |||
| { | |||
| jassert (renderContext != 0); | |||
| ScopedXLock xlock; | |||
| return glXMakeCurrent (display, embeddedWindow, renderContext) | |||
| && XSync (display, False); | |||
| } | |||
| bool makeInactive() const throw() | |||
| { | |||
| ScopedXLock xlock; | |||
| return (! isActive()) || glXMakeCurrent (display, None, 0); | |||
| } | |||
| bool isActive() const throw() | |||
| { | |||
| ScopedXLock xlock; | |||
| return glXGetCurrentContext() == renderContext; | |||
| } | |||
| @@ -3041,12 +3122,14 @@ public: | |||
| void updateWindowPosition (int x, int y, int w, int h, int) | |||
| { | |||
| ScopedXLock xlock; | |||
| XMoveResizeWindow (display, embeddedWindow, | |||
| x, y, jmax (1, w), jmax (1, h)); | |||
| } | |||
| void swapBuffers() | |||
| { | |||
| ScopedXLock xlock; | |||
| glXSwapBuffers (display, embeddedWindow); | |||
| } | |||
| @@ -177,7 +177,9 @@ public: | |||
| keyCode: 0]; | |||
| [menu performKeyEquivalent: f35Event]; | |||
| [menu removeItem: item]; | |||
| if ([menu indexOfItem: item] >= 0) | |||
| [menu removeItem: item]; // (this throws if the item isn't actually in the menu) | |||
| } | |||
| static NSMenuItem* findMenuItem (NSMenu* const menu, const ApplicationCommandTarget::InvocationInfo& info) | |||
| @@ -149,17 +149,21 @@ bool juce_dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages | |||
| if (returnIfNoPendingMessages && ! PeekMessage (&m, (HWND) 0, 0, 0, 0)) | |||
| return false; | |||
| if (GetMessage (&m, (HWND) 0, 0, 0) > 0) | |||
| if (GetMessage (&m, (HWND) 0, 0, 0) >= 0) | |||
| { | |||
| if (m.message == specialId | |||
| && m.hwnd == juce_messageWindowHandle) | |||
| if (m.message == specialId && m.hwnd == juce_messageWindowHandle) | |||
| { | |||
| MessageManager::getInstance()->deliverMessage ((void*) m.lParam); | |||
| } | |||
| else if (m.message == WM_QUIT) | |||
| { | |||
| if (JUCEApplication::getInstance()) | |||
| JUCEApplication::getInstance()->systemRequestedQuit(); | |||
| } | |||
| else if (! isEventBlockedByModalComps (m)) | |||
| { | |||
| if (GetWindowLong (m.hwnd, GWLP_USERDATA) != improbableWindowNumber | |||
| && (m.message == WM_LBUTTONDOWN || m.message == WM_RBUTTONDOWN)) | |||
| if ((m.message == WM_LBUTTONDOWN || m.message == WM_RBUTTONDOWN) | |||
| && GetWindowLong (m.hwnd, GWLP_USERDATA) != improbableWindowNumber) | |||
| { | |||
| // if it's someone else's window being clicked on, and the focus is | |||
| // currently on a juce window, pass the kb focus over.. | |||
| @@ -2042,11 +2042,6 @@ private: | |||
| return 0; | |||
| case WM_QUIT: | |||
| if (JUCEApplication::getInstance() != 0) | |||
| JUCEApplication::getInstance()->systemRequestedQuit(); | |||
| return 0; | |||
| case WM_QUERYENDSESSION: | |||
| if (JUCEApplication::getInstance() != 0) | |||
| { | |||
| @@ -36,26 +36,26 @@ StringArray::StringArray() throw() | |||
| { | |||
| } | |||
| StringArray::StringArray (const StringArray& other) throw() | |||
| StringArray::StringArray (const StringArray& other) | |||
| : strings (other.strings) | |||
| { | |||
| addArray (other); | |||
| } | |||
| StringArray::StringArray (const juce_wchar** const initialStrings, | |||
| const int numberOfStrings) throw() | |||
| const int numberOfStrings) | |||
| { | |||
| for (int i = 0; i < numberOfStrings; ++i) | |||
| add (initialStrings [i]); | |||
| } | |||
| StringArray::StringArray (const char** const initialStrings, | |||
| const int numberOfStrings) throw() | |||
| const int numberOfStrings) | |||
| { | |||
| for (int i = 0; i < numberOfStrings; ++i) | |||
| add (initialStrings [i]); | |||
| } | |||
| StringArray::StringArray (const juce_wchar** const initialStrings) throw() | |||
| StringArray::StringArray (const juce_wchar** const initialStrings) | |||
| { | |||
| int i = 0; | |||
| @@ -63,7 +63,7 @@ StringArray::StringArray (const juce_wchar** const initialStrings) throw() | |||
| add (initialStrings [i++]); | |||
| } | |||
| StringArray::StringArray (const char** const initialStrings) throw() | |||
| StringArray::StringArray (const char** const initialStrings) | |||
| { | |||
| int i = 0; | |||
| @@ -71,23 +71,17 @@ StringArray::StringArray (const char** const initialStrings) throw() | |||
| add (initialStrings [i++]); | |||
| } | |||
| const StringArray& StringArray::operator= (const StringArray& other) throw() | |||
| const StringArray& StringArray::operator= (const StringArray& other) | |||
| { | |||
| if (this != &other) | |||
| { | |||
| clear(); | |||
| addArray (other); | |||
| } | |||
| strings = other.strings; | |||
| return *this; | |||
| } | |||
| StringArray::~StringArray() throw() | |||
| StringArray::~StringArray() | |||
| { | |||
| clear(); | |||
| } | |||
| bool StringArray::operator== (const StringArray& other) const throw() | |||
| bool StringArray::operator== (const StringArray& other) const | |||
| { | |||
| if (other.size() != size()) | |||
| return false; | |||
| @@ -99,12 +93,12 @@ bool StringArray::operator== (const StringArray& other) const throw() | |||
| return true; | |||
| } | |||
| bool StringArray::operator!= (const StringArray& other) const throw() | |||
| bool StringArray::operator!= (const StringArray& other) const | |||
| { | |||
| return ! operator== (other); | |||
| } | |||
| void StringArray::clear() throw() | |||
| void StringArray::clear() | |||
| { | |||
| strings.clear(); | |||
| } | |||
| @@ -117,27 +111,23 @@ const String& StringArray::operator[] (const int index) const throw() | |||
| return String::empty; | |||
| } | |||
| void StringArray::add (const String& newString) throw() | |||
| void StringArray::add (const String& newString) | |||
| { | |||
| strings.add (newString); | |||
| } | |||
| void StringArray::insert (const int index, | |||
| const String& newString) throw() | |||
| void StringArray::insert (const int index, const String& newString) | |||
| { | |||
| strings.insert (index, newString); | |||
| } | |||
| void StringArray::addIfNotAlreadyThere (const String& newString, | |||
| const bool ignoreCase) throw() | |||
| void StringArray::addIfNotAlreadyThere (const String& newString, const bool ignoreCase) | |||
| { | |||
| if (! contains (newString, ignoreCase)) | |||
| add (newString); | |||
| } | |||
| void StringArray::addArray (const StringArray& otherArray, | |||
| int startIndex, | |||
| int numElementsToAdd) throw() | |||
| void StringArray::addArray (const StringArray& otherArray, int startIndex, int numElementsToAdd) | |||
| { | |||
| if (startIndex < 0) | |||
| { | |||
| @@ -152,14 +142,12 @@ void StringArray::addArray (const StringArray& otherArray, | |||
| strings.add (otherArray.strings.getReference (startIndex++)); | |||
| } | |||
| void StringArray::set (const int index, | |||
| const String& newString) throw() | |||
| void StringArray::set (const int index, const String& newString) | |||
| { | |||
| strings.set (index, newString); | |||
| } | |||
| bool StringArray::contains (const String& stringToLookFor, | |||
| const bool ignoreCase) const throw() | |||
| bool StringArray::contains (const String& stringToLookFor, const bool ignoreCase) const | |||
| { | |||
| if (ignoreCase) | |||
| { | |||
| @@ -177,9 +165,7 @@ bool StringArray::contains (const String& stringToLookFor, | |||
| return false; | |||
| } | |||
| int StringArray::indexOf (const String& stringToLookFor, | |||
| const bool ignoreCase, | |||
| int i) const throw() | |||
| int StringArray::indexOf (const String& stringToLookFor, const bool ignoreCase, int i) const | |||
| { | |||
| if (i < 0) | |||
| i = 0; | |||
| @@ -211,13 +197,13 @@ int StringArray::indexOf (const String& stringToLookFor, | |||
| } | |||
| //============================================================================== | |||
| void StringArray::remove (const int index) throw() | |||
| void StringArray::remove (const int index) | |||
| { | |||
| strings.remove (index); | |||
| } | |||
| void StringArray::removeString (const String& stringToRemove, | |||
| const bool ignoreCase) throw() | |||
| const bool ignoreCase) | |||
| { | |||
| if (ignoreCase) | |||
| { | |||
| @@ -234,7 +220,7 @@ void StringArray::removeString (const String& stringToRemove, | |||
| } | |||
| //============================================================================== | |||
| void StringArray::removeEmptyStrings (const bool removeWhitespaceStrings) throw() | |||
| void StringArray::removeEmptyStrings (const bool removeWhitespaceStrings) | |||
| { | |||
| if (removeWhitespaceStrings) | |||
| { | |||
| @@ -250,7 +236,7 @@ void StringArray::removeEmptyStrings (const bool removeWhitespaceStrings) throw( | |||
| } | |||
| } | |||
| void StringArray::trim() throw() | |||
| void StringArray::trim() | |||
| { | |||
| for (int i = size(); --i >= 0;) | |||
| { | |||
| @@ -272,7 +258,7 @@ public: | |||
| static int compareElements (String& first, String& second) { return first.compareIgnoreCase (second); } | |||
| }; | |||
| void StringArray::sort (const bool ignoreCase) throw() | |||
| void StringArray::sort (const bool ignoreCase) | |||
| { | |||
| if (ignoreCase) | |||
| { | |||
| @@ -293,9 +279,7 @@ void StringArray::move (const int currentIndex, int newIndex) throw() | |||
| //============================================================================== | |||
| const String StringArray::joinIntoString (const String& separator, | |||
| int start, | |||
| int numberToJoin) const throw() | |||
| const String StringArray::joinIntoString (const String& separator, int start, int numberToJoin) const | |||
| { | |||
| const int last = (numberToJoin < 0) ? size() | |||
| : jmin (size(), start + numberToJoin); | |||
| @@ -343,17 +327,14 @@ const String StringArray::joinIntoString (const String& separator, | |||
| return result; | |||
| } | |||
| int StringArray::addTokens (const tchar* const text, | |||
| const bool preserveQuotedStrings) throw() | |||
| int StringArray::addTokens (const tchar* const text, const bool preserveQuotedStrings) | |||
| { | |||
| return addTokens (text, | |||
| T(" \n\r\t"), | |||
| preserveQuotedStrings ? T("\"") : 0); | |||
| } | |||
| int StringArray::addTokens (const tchar* const text, | |||
| const tchar* breakCharacters, | |||
| const tchar* quoteCharacters) throw() | |||
| int StringArray::addTokens (const tchar* const text, const tchar* breakCharacters, const tchar* quoteCharacters) | |||
| { | |||
| int num = 0; | |||
| @@ -437,7 +418,7 @@ int StringArray::addTokens (const tchar* const text, | |||
| return num; | |||
| } | |||
| int StringArray::addLines (const tchar* text) throw() | |||
| int StringArray::addLines (const tchar* text) | |||
| { | |||
| int numLines = 0; | |||
| @@ -484,7 +465,7 @@ int StringArray::addLines (const tchar* text) throw() | |||
| } | |||
| //============================================================================== | |||
| void StringArray::removeDuplicates (const bool ignoreCase) throw() | |||
| void StringArray::removeDuplicates (const bool ignoreCase) | |||
| { | |||
| for (int i = 0; i < size() - 1; ++i) | |||
| { | |||
| @@ -507,7 +488,7 @@ void StringArray::removeDuplicates (const bool ignoreCase) throw() | |||
| void StringArray::appendNumbersToDuplicates (const bool ignoreCase, | |||
| const bool appendNumberToFirstInstance, | |||
| const tchar* const preNumberString, | |||
| const tchar* const postNumberString) throw() | |||
| const tchar* const postNumberString) | |||
| { | |||
| for (int i = 0; i < size() - 1; ++i) | |||
| { | |||
| @@ -535,7 +516,7 @@ void StringArray::appendNumbersToDuplicates (const bool ignoreCase, | |||
| } | |||
| } | |||
| void StringArray::minimiseStorageOverheads() throw() | |||
| void StringArray::minimiseStorageOverheads() | |||
| { | |||
| strings.minimiseStorageOverheads(); | |||
| } | |||
| @@ -50,7 +50,7 @@ public: | |||
| StringArray() throw(); | |||
| /** Creates a copy of another string array */ | |||
| StringArray (const StringArray& other) throw(); | |||
| StringArray (const StringArray& other); | |||
| /** Creates a copy of an array of string literals. | |||
| @@ -59,7 +59,7 @@ public: | |||
| @param numberOfStrings how many items there are in the array | |||
| */ | |||
| StringArray (const juce_wchar** const strings, | |||
| const int numberOfStrings) throw(); | |||
| const int numberOfStrings); | |||
| /** Creates a copy of an array of string literals. | |||
| @@ -68,27 +68,27 @@ public: | |||
| @param numberOfStrings how many items there are in the array | |||
| */ | |||
| StringArray (const char** const strings, | |||
| const int numberOfStrings) throw(); | |||
| const int numberOfStrings); | |||
| /** Creates a copy of a null-terminated array of string literals. | |||
| Each item from the array passed-in is added, until it encounters a null pointer, | |||
| at which point it stops. | |||
| */ | |||
| StringArray (const juce_wchar** const strings) throw(); | |||
| explicit StringArray (const juce_wchar** const strings); | |||
| /** Creates a copy of a null-terminated array of string literals. | |||
| Each item from the array passed-in is added, until it encounters a null pointer, | |||
| at which point it stops. | |||
| */ | |||
| StringArray (const char** const strings) throw(); | |||
| explicit StringArray (const char** const strings); | |||
| /** Destructor. */ | |||
| virtual ~StringArray() throw(); | |||
| ~StringArray(); | |||
| /** Copies the contents of another string array into this one */ | |||
| const StringArray& operator= (const StringArray& other) throw(); | |||
| const StringArray& operator= (const StringArray& other); | |||
| //============================================================================== | |||
| /** Compares two arrays. | |||
| @@ -97,7 +97,7 @@ public: | |||
| @returns true only if the other array contains exactly the same strings in the same order | |||
| */ | |||
| bool operator== (const StringArray& other) const throw(); | |||
| bool operator== (const StringArray& other) const; | |||
| /** Compares two arrays. | |||
| @@ -105,7 +105,7 @@ public: | |||
| @returns false if the other array contains exactly the same strings in the same order | |||
| */ | |||
| bool operator!= (const StringArray& other) const throw(); | |||
| bool operator!= (const StringArray& other) const; | |||
| //============================================================================== | |||
| /** Returns the number of strings in the array */ | |||
| @@ -127,7 +127,7 @@ public: | |||
| @returns true if the string is found inside the array | |||
| */ | |||
| bool contains (const String& stringToLookFor, | |||
| const bool ignoreCase = false) const throw(); | |||
| const bool ignoreCase = false) const; | |||
| /** Searches for a string in the array. | |||
| @@ -141,11 +141,11 @@ public: | |||
| */ | |||
| int indexOf (const String& stringToLookFor, | |||
| const bool ignoreCase = false, | |||
| int startIndex = 0) const throw(); | |||
| int startIndex = 0) const; | |||
| //============================================================================== | |||
| /** Appends a string at the end of the array. */ | |||
| void add (const String& stringToAdd) throw(); | |||
| void add (const String& stringToAdd); | |||
| /** Inserts a string into the array. | |||
| @@ -154,23 +154,20 @@ public: | |||
| If the index is less than zero or greater than the size of the array, | |||
| the new string will be added to the end of the array. | |||
| */ | |||
| void insert (const int index, | |||
| const String& stringToAdd) throw(); | |||
| void insert (const int index, const String& stringToAdd); | |||
| /** Adds a string to the array as long as it's not already in there. | |||
| The search can optionally be case-insensitive. | |||
| */ | |||
| void addIfNotAlreadyThere (const String& stringToAdd, | |||
| const bool ignoreCase = false) throw(); | |||
| void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false); | |||
| /** Replaces one of the strings in the array with another one. | |||
| If the index is higher than the array's size, the new string will be | |||
| added to the end of the array; if it's less than zero nothing happens. | |||
| */ | |||
| void set (const int index, | |||
| const String& newString) throw(); | |||
| void set (const int index, const String& newString); | |||
| /** Appends some strings from another array to the end of this one. | |||
| @@ -181,7 +178,7 @@ public: | |||
| */ | |||
| void addArray (const StringArray& other, | |||
| int startIndex = 0, | |||
| int numElementsToAdd = -1) throw(); | |||
| int numElementsToAdd = -1); | |||
| /** Breaks up a string into tokens and adds them to this array. | |||
| @@ -191,7 +188,7 @@ public: | |||
| @returns the number of tokens added | |||
| */ | |||
| int addTokens (const tchar* const stringToTokenise, | |||
| const bool preserveQuotedStrings) throw(); | |||
| const bool preserveQuotedStrings); | |||
| /** Breaks up a string into tokens and adds them to this array. | |||
| @@ -208,7 +205,7 @@ public: | |||
| */ | |||
| int addTokens (const tchar* const stringToTokenise, | |||
| const tchar* breakCharacters, | |||
| const tchar* quoteCharacters) throw(); | |||
| const tchar* quoteCharacters); | |||
| /** Breaks up a string into lines and adds them to this array. | |||
| @@ -216,17 +213,17 @@ public: | |||
| to the array. Line-break characters are omitted from the strings that are added to | |||
| the array. | |||
| */ | |||
| int addLines (const tchar* stringToBreakUp) throw(); | |||
| int addLines (const tchar* stringToBreakUp); | |||
| //============================================================================== | |||
| /** Removes all elements from the array. */ | |||
| void clear() throw(); | |||
| void clear(); | |||
| /** Removes a string from the array. | |||
| If the index is out-of-range, no action will be taken. | |||
| */ | |||
| void remove (const int index) throw(); | |||
| void remove (const int index); | |||
| /** Finds a string in the array and removes it. | |||
| @@ -234,7 +231,7 @@ public: | |||
| comparison may be case-insensitive depending on the ignoreCase parameter. | |||
| */ | |||
| void removeString (const String& stringToRemove, | |||
| const bool ignoreCase = false) throw(); | |||
| const bool ignoreCase = false); | |||
| /** Removes any duplicated elements from the array. | |||
| @@ -243,14 +240,14 @@ public: | |||
| @param ignoreCase whether to use a case-insensitive comparison | |||
| */ | |||
| void removeDuplicates (const bool ignoreCase) throw(); | |||
| void removeDuplicates (const bool ignoreCase); | |||
| /** Removes empty strings from the array. | |||
| @param removeWhitespaceStrings if true, strings that only contain whitespace | |||
| characters will also be removed | |||
| */ | |||
| void removeEmptyStrings (const bool removeWhitespaceStrings = true) throw(); | |||
| void removeEmptyStrings (const bool removeWhitespaceStrings = true); | |||
| /** Moves one of the strings to a different position. | |||
| @@ -269,7 +266,7 @@ public: | |||
| void move (const int currentIndex, int newIndex) throw(); | |||
| /** Deletes any whitespace characters from the starts and ends of all the strings. */ | |||
| void trim() throw(); | |||
| void trim(); | |||
| /** Adds numbers to the strings in the array, to make each string unique. | |||
| @@ -285,7 +282,7 @@ public: | |||
| void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing, | |||
| const bool appendNumberToFirstInstance, | |||
| const tchar* const preNumberString = defaultPreNumberString, | |||
| const tchar* const postNumberString = defaultPostNumberString) throw(); | |||
| const tchar* const postNumberString = defaultPostNumberString); | |||
| //============================================================================== | |||
| /** Joins the strings in the array together into one string. | |||
| @@ -302,14 +299,14 @@ public: | |||
| */ | |||
| const String joinIntoString (const String& separatorString, | |||
| int startIndex = 0, | |||
| int numberOfElements = -1) const throw(); | |||
| int numberOfElements = -1) const; | |||
| //============================================================================== | |||
| /** Sorts the array into alphabetical order. | |||
| @param ignoreCase if true, the comparisons used will be case-sensitive. | |||
| */ | |||
| void sort (const bool ignoreCase) throw(); | |||
| void sort (const bool ignoreCase); | |||
| //============================================================================== | |||
| /** Reduces the amount of storage being used by the array. | |||
| @@ -318,7 +315,7 @@ public: | |||
| removing elements, they may have quite a lot of unused space allocated. | |||
| This method will reduce the amount of allocated storage to a minimum. | |||
| */ | |||
| void minimiseStorageOverheads() throw(); | |||
| void minimiseStorageOverheads(); | |||
| //============================================================================== | |||