| @@ -160,7 +160,7 @@ public: | |||
| void anotherInstanceStarted (const String& commandLine) override | |||
| { | |||
| openFile (commandLine.unquoted()); | |||
| openFile (File (commandLine.unquoted())); | |||
| } | |||
| static IntrojucerApp& getApp() | |||
| @@ -209,7 +209,7 @@ bool MainWindow::openFile (const File& file) | |||
| bool MainWindow::isInterestedInFileDrag (const StringArray& filenames) | |||
| { | |||
| for (int i = filenames.size(); --i >= 0;) | |||
| if (canOpenFile (filenames[i])) | |||
| if (canOpenFile (File (filenames[i]))) | |||
| return true; | |||
| return false; | |||
| @@ -546,11 +546,13 @@ public: | |||
| /** Adds elements from an array to the end of this array. | |||
| @param elementsToAdd the array of elements to add | |||
| @param elementsToAdd an array of some kind of object from which elements | |||
| can be constructed. | |||
| @param numElementsToAdd how many elements are in this other array | |||
| @see add | |||
| */ | |||
| void addArray (const ElementType* elementsToAdd, int numElementsToAdd) | |||
| template <typename Type> | |||
| void addArray (const Type* elementsToAdd, int numElementsToAdd) | |||
| { | |||
| const ScopedLockType lock (getLock()); | |||
| @@ -566,6 +568,22 @@ public: | |||
| } | |||
| } | |||
| /** Adds elements from a null-terminated array of pointers to the end of this array. | |||
| @param elementsToAdd an array of pointers to some kind of object from which elements | |||
| can be constructed. This array must be terminated by a nullptr | |||
| @see addArray | |||
| */ | |||
| template <typename Type> | |||
| void addNullTerminatedArray (const Type* const* elementsToAdd) | |||
| { | |||
| int num = 0; | |||
| for (const Type* const* e = elementsToAdd; *e != nullptr; ++e) | |||
| ++num; | |||
| addArray (elementsToAdd, num); | |||
| } | |||
| /** 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 | |||
| @@ -205,7 +205,7 @@ File File::getSpecialLocation (const SpecialLocationType type) | |||
| { | |||
| File tmp ("~/Library/Caches/" + juce_getExecutableFile().getFileNameWithoutExtension()); | |||
| tmp.createDirectory(); | |||
| return tmp.getFullPathName(); | |||
| return File (tmp.getFullPathName()); | |||
| } | |||
| #endif | |||
| case userMusicDirectory: resultPath = "~/Music"; break; | |||
| @@ -245,7 +245,7 @@ File File::getSpecialLocation (const SpecialLocationType type) | |||
| buffer.calloc (size + 8); | |||
| _NSGetExecutablePath (buffer.getData(), &size); | |||
| return String::fromUTF8 (buffer, (int) size); | |||
| return File (String::fromUTF8 (buffer, (int) size)); | |||
| } | |||
| default: | |||
| @@ -47,47 +47,29 @@ StringArray::StringArray (const String& firstValue) | |||
| strings.add (firstValue); | |||
| } | |||
| namespace StringArrayHelpers | |||
| { | |||
| template <typename CharType> | |||
| void addArray (Array<String>& dest, const CharType* const* strings) | |||
| { | |||
| if (strings != nullptr) | |||
| while (*strings != nullptr) | |||
| dest.add (*strings++); | |||
| } | |||
| template <typename Type> | |||
| void addArray (Array<String>& dest, const Type* const strings, const int numberOfStrings) | |||
| { | |||
| for (int i = 0; i < numberOfStrings; ++i) | |||
| dest.add (strings [i]); | |||
| } | |||
| } | |||
| StringArray::StringArray (const String* initialStrings, int numberOfStrings) | |||
| { | |||
| StringArrayHelpers::addArray (strings, initialStrings, numberOfStrings); | |||
| strings.addArray (initialStrings, numberOfStrings); | |||
| } | |||
| StringArray::StringArray (const char* const* const initialStrings) | |||
| StringArray::StringArray (const char* const* initialStrings) | |||
| { | |||
| StringArrayHelpers::addArray (strings, initialStrings); | |||
| strings.addNullTerminatedArray (initialStrings); | |||
| } | |||
| StringArray::StringArray (const char* const* const initialStrings, const int numberOfStrings) | |||
| StringArray::StringArray (const char* const* initialStrings, int numberOfStrings) | |||
| { | |||
| StringArrayHelpers::addArray (strings, initialStrings, numberOfStrings); | |||
| strings.addArray (initialStrings, numberOfStrings); | |||
| } | |||
| StringArray::StringArray (const wchar_t* const* const initialStrings) | |||
| StringArray::StringArray (const wchar_t* const* initialStrings) | |||
| { | |||
| StringArrayHelpers::addArray (strings, initialStrings); | |||
| strings.addNullTerminatedArray (initialStrings); | |||
| } | |||
| StringArray::StringArray (const wchar_t* const* const initialStrings, const int numberOfStrings) | |||
| StringArray::StringArray (const wchar_t* const* initialStrings, int numberOfStrings) | |||
| { | |||
| StringArrayHelpers::addArray (strings, initialStrings, numberOfStrings); | |||
| strings.addArray (initialStrings, numberOfStrings); | |||
| } | |||
| StringArray& StringArray::operator= (const StringArray& other) | |||
| @@ -110,14 +92,7 @@ StringArray::~StringArray() | |||
| bool StringArray::operator== (const StringArray& other) const noexcept | |||
| { | |||
| if (other.size() != size()) | |||
| return false; | |||
| for (int i = size(); --i >= 0;) | |||
| if (other.strings.getReference(i) != strings.getReference(i)) | |||
| return false; | |||
| return true; | |||
| return strings == other.strings; | |||
| } | |||
| bool StringArray::operator!= (const StringArray& other) const noexcept | |||
| @@ -150,7 +125,6 @@ const String& StringArray::operator[] (const int index) const noexcept | |||
| String& StringArray::getReference (const int index) noexcept | |||
| { | |||
| jassert (isPositiveAndBelow (index, strings.size())); | |||
| return strings.getReference (index); | |||
| } | |||
| @@ -192,20 +166,7 @@ void StringArray::set (const int index, const String& newString) | |||
| bool StringArray::contains (StringRef stringToLookFor, const bool ignoreCase) const | |||
| { | |||
| if (ignoreCase) | |||
| { | |||
| for (int i = size(); --i >= 0;) | |||
| if (strings.getReference(i).equalsIgnoreCase (stringToLookFor)) | |||
| return true; | |||
| } | |||
| else | |||
| { | |||
| for (int i = size(); --i >= 0;) | |||
| if (stringToLookFor == strings.getReference(i)) | |||
| return true; | |||
| } | |||
| return false; | |||
| return indexOf (stringToLookFor, ignoreCase) >= 0; | |||
| } | |||
| int StringArray::indexOf (StringRef stringToLookFor, const bool ignoreCase, int i) const | |||
| @@ -217,23 +178,15 @@ int StringArray::indexOf (StringRef stringToLookFor, const bool ignoreCase, int | |||
| if (ignoreCase) | |||
| { | |||
| while (i < numElements) | |||
| { | |||
| for (; i < numElements; ++i) | |||
| if (strings.getReference(i).equalsIgnoreCase (stringToLookFor)) | |||
| return i; | |||
| ++i; | |||
| } | |||
| } | |||
| else | |||
| { | |||
| while (i < numElements) | |||
| { | |||
| for (; i < numElements; ++i) | |||
| if (stringToLookFor == strings.getReference (i)) | |||
| return i; | |||
| ++i; | |||
| } | |||
| } | |||
| return -1; | |||
| @@ -453,9 +406,7 @@ void StringArray::removeDuplicates (const bool ignoreCase) | |||
| { | |||
| const String s (strings.getReference(i)); | |||
| int nextIndex = i + 1; | |||
| for (;;) | |||
| for (int nextIndex = i + 1;;) | |||
| { | |||
| nextIndex = indexOf (s, ignoreCase, nextIndex); | |||
| @@ -44,10 +44,10 @@ public: | |||
| StringArray() noexcept; | |||
| /** Creates a copy of another string array */ | |||
| StringArray (const StringArray& other); | |||
| StringArray (const StringArray&); | |||
| #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS | |||
| StringArray (StringArray&& other) noexcept; | |||
| StringArray (StringArray&&) noexcept; | |||
| #endif | |||
| /** Creates an array containing a single string. */ | |||
| @@ -90,27 +90,27 @@ public: | |||
| ~StringArray(); | |||
| /** Copies the contents of another string array into this one */ | |||
| StringArray& operator= (const StringArray& other); | |||
| StringArray& operator= (const StringArray&); | |||
| #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS | |||
| StringArray& operator= (StringArray&& other) noexcept; | |||
| StringArray& operator= (StringArray&&) noexcept; | |||
| #endif | |||
| /** Swaps the contents of this and another StringArray. */ | |||
| void swapWith (StringArray& other) noexcept; | |||
| void swapWith (StringArray&) noexcept; | |||
| //============================================================================== | |||
| /** Compares two arrays. | |||
| Comparisons are case-sensitive. | |||
| @returns true only if the other array contains exactly the same strings in the same order | |||
| */ | |||
| bool operator== (const StringArray& other) const noexcept; | |||
| bool operator== (const StringArray&) const noexcept; | |||
| /** Compares two arrays. | |||
| Comparisons are case-sensitive. | |||
| @returns false if the other array contains exactly the same strings in the same order | |||
| */ | |||
| bool operator!= (const StringArray& other) const noexcept; | |||
| bool operator!= (const StringArray&) const noexcept; | |||
| //============================================================================== | |||
| /** Returns the number of strings in the array */ | |||
| @@ -52,7 +52,7 @@ namespace MouseCursorHelpers | |||
| static void* fromWebKitFile (const char* filename, float hx, float hy) | |||
| { | |||
| FileInputStream fileStream (String ("/System/Library/Frameworks/WebKit.framework/Frameworks/WebCore.framework/Resources/") + filename); | |||
| FileInputStream fileStream (File ("/System/Library/Frameworks/WebKit.framework/Frameworks/WebCore.framework/Resources").getChildFile (filename)); | |||
| BufferedInputStream buf (fileStream, 4096); | |||
| PNGImageFormat pngFormat; | |||
| @@ -119,8 +119,7 @@ public: | |||
| void setResizable (bool shouldBeResizable, | |||
| bool useBottomRightCornerResizer); | |||
| /** True if resizing is enabled. | |||
| /** Returns true if resizing is enabled. | |||
| @see setResizable | |||
| */ | |||
| bool isResizable() const noexcept; | |||
| @@ -141,7 +140,6 @@ public: | |||
| int newMaximumHeight) noexcept; | |||
| /** Returns the bounds constrainer object that this window is using. | |||
| You can access this to change its properties. | |||
| */ | |||
| ComponentBoundsConstrainer* getConstrainer() noexcept { return constrainer; } | |||
| @@ -151,13 +149,12 @@ public: | |||
| A pointer to the object you pass in will be kept, but it won't be deleted | |||
| by this object, so it's the caller's responsiblity to manage it. | |||
| If you pass 0, then no contraints will be placed on the positioning of the window. | |||
| If you pass a nullptr, then no contraints will be placed on the positioning of the window. | |||
| */ | |||
| void setConstrainer (ComponentBoundsConstrainer* newConstrainer); | |||
| /** Calls the window's setBounds method, after first checking these bounds | |||
| with the current constrainer. | |||
| @see setConstrainer | |||
| */ | |||
| void setBoundsConstrained (const Rectangle<int>& bounds); | |||
| @@ -165,7 +162,6 @@ public: | |||
| //============================================================================== | |||
| /** Returns true if the window is currently in full-screen mode. | |||
| @see setFullScreen | |||
| */ | |||
| bool isFullScreen() const; | |||
| @@ -180,7 +176,6 @@ public: | |||
| void setFullScreen (bool shouldBeFullScreen); | |||
| /** Returns true if the window is currently minimised. | |||
| @see setMinimised | |||
| */ | |||
| bool isMinimised() const; | |||
| @@ -345,14 +340,14 @@ protected: | |||
| If you know what you're doing and are sure you really want to add a component, specify | |||
| a base-class method call to Component::addAndMakeVisible(), to side-step this warning. | |||
| */ | |||
| void addChildComponent (Component* child, int zOrder = -1); | |||
| void addChildComponent (Component*, int zOrder = -1); | |||
| /** Overridden to warn people about adding components directly to this component | |||
| instead of using setContentOwned(). | |||
| If you know what you're doing and are sure you really want to add a component, specify | |||
| a base-class method call to Component::addAndMakeVisible(), to side-step this warning. | |||
| */ | |||
| void addAndMakeVisible (Component* child, int zOrder = -1); | |||
| void addAndMakeVisible (Component*, int zOrder = -1); | |||
| #endif | |||
| ScopedPointer <ResizableCornerComponent> resizableCorner; | |||
| @@ -360,7 +355,7 @@ protected: | |||
| private: | |||
| //============================================================================== | |||
| Component::SafePointer <Component> contentComponent; | |||
| Component::SafePointer<Component> contentComponent; | |||
| bool ownsContentComponent, resizeToFitContent, fullscreen; | |||
| ComponentDragger dragger; | |||
| Rectangle<int> lastNonFullScreenPos; | |||