1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-30 02:50:05 +00:00

Minor code clean-ups.

This commit is contained in:
Julian Storer 2010-03-20 21:41:24 +00:00
parent 97e9095933
commit af2137ecaa
11 changed files with 261 additions and 359 deletions

View file

@ -29,12 +29,6 @@
#include "juce_String.h"
#include "../containers/juce_Array.h"
#ifndef DOXYGEN
// (used in StringArray::appendNumbersToDuplicates)
static const tchar* const defaultPreNumberString = JUCE_T(" (");
static const tchar* const defaultPostNumberString = JUCE_T(")");
#endif
//==============================================================================
/**
@ -58,8 +52,7 @@ public:
treated as empty strings
@param numberOfStrings how many items there are in the array
*/
StringArray (const juce_wchar** const strings,
const int numberOfStrings);
StringArray (const juce_wchar** strings, int numberOfStrings);
/** Creates a copy of an array of string literals.
@ -67,22 +60,21 @@ public:
treated as empty strings
@param numberOfStrings how many items there are in the array
*/
StringArray (const char** const strings,
const int numberOfStrings);
StringArray (const char** strings, 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.
*/
explicit StringArray (const juce_wchar** const strings);
explicit StringArray (const juce_wchar** 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.
*/
explicit StringArray (const char** const strings);
explicit StringArray (const char** strings);
/** Destructor. */
~StringArray();
@ -127,7 +119,7 @@ public:
@returns true if the string is found inside the array
*/
bool contains (const String& stringToLookFor,
const bool ignoreCase = false) const;
bool ignoreCase = false) const;
/** Searches for a string in the array.
@ -140,7 +132,7 @@ public:
or -1 if it isn't found.
*/
int indexOf (const String& stringToLookFor,
const bool ignoreCase = false,
bool ignoreCase = false,
int startIndex = 0) const;
//==============================================================================
@ -154,20 +146,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);
void insert (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);
void addIfNotAlreadyThere (const String& stringToAdd, 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);
void set (int index, const String& newString);
/** Appends some strings from another array to the end of this one.
@ -188,7 +180,7 @@ public:
@returns the number of tokens added
*/
int addTokens (const String& stringToTokenise,
const bool preserveQuotedStrings);
bool preserveQuotedStrings);
/** Breaks up a string into tokens and adds them to this array.
@ -223,7 +215,7 @@ public:
If the index is out-of-range, no action will be taken.
*/
void remove (const int index);
void remove (int index);
/** Finds a string in the array and removes it.
@ -231,7 +223,7 @@ public:
comparison may be case-insensitive depending on the ignoreCase parameter.
*/
void removeString (const String& stringToRemove,
const bool ignoreCase = false);
bool ignoreCase = false);
/** Removes any duplicated elements from the array.
@ -240,14 +232,14 @@ public:
@param ignoreCase whether to use a case-insensitive comparison
*/
void removeDuplicates (const bool ignoreCase);
void removeDuplicates (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);
void removeEmptyStrings (bool removeWhitespaceStrings = true);
/** Moves one of the strings to a different position.
@ -263,7 +255,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 (int currentIndex, int newIndex) throw();
/** Deletes any whitespace characters from the starts and ends of all the strings. */
void trim();
@ -279,10 +271,10 @@ public:
@param preNumberString when adding a number, this string is added before the number
@param postNumberString this string is appended after any numbers that are added
*/
void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
const bool appendNumberToFirstInstance,
const tchar* const preNumberString = defaultPreNumberString,
const tchar* const postNumberString = defaultPostNumberString);
void appendNumbersToDuplicates (bool ignoreCaseWhenComparing,
bool appendNumberToFirstInstance,
const juce_wchar* preNumberString = JUCE_T(" ("),
const juce_wchar* postNumberString = JUCE_T(")"));
//==============================================================================
/** Joins the strings in the array together into one string.
@ -306,7 +298,7 @@ public:
@param ignoreCase if true, the comparisons used will be case-sensitive.
*/
void sort (const bool ignoreCase);
void sort (bool ignoreCase);
//==============================================================================
/** Reduces the amount of storage being used by the array.