31 : strings (
other.strings)
36 : strings (std::move (
other.strings))
41 : strings (std::move (
other))
88 strings = std::move (
other.strings);
98 return strings ==
other.strings;
123 if (isPositiveAndBelow (index, strings.size()))
132 return strings.getReference (index);
231 for (
int i =
size(); --i >= 0;)
237 for (
int i =
size(); --i >= 0;)
253 for (
int i =
size(); --i >= 0;)
259 for (
int i =
size(); --i >= 0;)
276 [] (
const String&
a,
const String&
b) { return a.compareIgnoreCase (b) < 0; });
284 [] (
const String&
a,
const String&
b) { return a.compareNatural (b) < 0; });
299 if (start == last - 1)
305 for (
int i = start; i < last; ++i)
318 dest.writeAll (
s.getCharPointer());
339 for (
auto t = text.
text;;)
361 bool finished = text.
isEmpty();
369 switch (text.getAndAdvance())
371 case 0: finished =
true;
break;
373 case '\r':
if (*text ==
'\n') ++text;
break;
412 for (
int i = 0; i <
size() - 1; ++i)
416 for (
int nextIndex = i + 1;;)
418 nextIndex =
indexOf (
s, ignoreCase, nextIndex);
439 for (
int i = 0; i <
size() - 1; ++i)
442 auto nextIndex =
indexOf (
s, ignoreCase, i + 1);
454 while (nextIndex >= 0)
Holds a resizable array of primitive or copy-by-value objects.
void swapWith(OtherArrayType &otherArray) noexcept
This swaps the contents of this array with those of another array.
void addNullTerminatedArray(const Type *const *elementsToAdd)
Adds elements from a null-terminated array of pointers to the end of this array.
bool isEmpty() const noexcept
Returns true if the array is empty, false otherwise.
void ensureStorageAllocated(int minNumElements)
Increases the array's internal storage to hold a minimum number of elements.
void addArray(const Type *elementsToAdd, int numElementsToAdd)
Adds elements from an array to the end of this array.
void clearQuick()
Removes all elements from the array without freeing the array's allocated storage.
int size() const noexcept
Returns the current number of elements in the array.
void removeRange(int startIndex, int numberToRemove)
Removes a range of elements from the array.
ElementType * begin() const noexcept
Returns a pointer to the first element in the array.
void remove(int indexToRemove)
Removes an element from the array.
void insert(int indexToInsertAt, ParameterType newElement)
Inserts a new element into the array at a given position.
void add(const ElementType &newElement)
Appends a new element at the end of the array.
ElementType & getReference(int index) const noexcept
Returns a direct reference to one of the elements in the array, without checking the index passed in.
void set(int indexToChange, ParameterType newValue)
Replaces an element with a new value.
void clear()
Removes all elements from the array.
void move(int currentIndex, int newIndex) noexcept
Moves one of the values to a different position.
void minimiseStorageOverheads()
Reduces the amount of storage being used by the array.
ElementType * end() const noexcept
Returns a pointer to the element which follows the last element in the array.
Wraps a pointer to a null-terminated UTF-8 character string, and provides various methods to operate ...
static Type findEndOfToken(Type text, BreakType breakCharacters, Type quoteCharacters)
Returns a pointer to the first character in the string which is found in the breakCharacters string.
A special array for holding a list of strings.
bool operator==(const StringArray &) const noexcept
Compares two arrays.
String joinIntoString(StringRef separatorString, int startIndex=0, int numberOfElements=-1) const
Joins the strings in the array together into one string.
void appendNumbersToDuplicates(bool ignoreCaseWhenComparing, bool appendNumberToFirstInstance, CharPointer_UTF8 preNumberString=CharPointer_UTF8(nullptr), CharPointer_UTF8 postNumberString=CharPointer_UTF8(nullptr))
Adds numbers to the strings in the array, to make each string unique.
String & getReference(int index) noexcept
Returns a reference to one of the strings in the array.
void removeEmptyStrings(bool removeWhitespaceStrings=true)
Removes empty strings from the array.
void addArray(const StringArray &other, int startIndex=0, int numElementsToAdd=-1)
Appends some strings from another array to the end of this one.
int indexOf(StringRef stringToLookFor, bool ignoreCase=false, int startIndex=0) const
Searches for a string in the array.
void sortNatural()
Sorts the array using extra language-aware rules to do a better job of comparing words containing spa...
bool contains(StringRef stringToLookFor, bool ignoreCase=false) const
Searches for a string in the array.
void removeDuplicates(bool ignoreCase)
Removes any duplicated elements from the array.
static StringArray fromTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Returns an array containing the tokens in a given string.
void insert(int index, String stringToAdd)
Inserts a string into the array.
static StringArray fromLines(StringRef stringToBreakUp)
Returns an array containing the lines in a given string.
void minimiseStorageOverheads()
Reduces the amount of storage being used by the array.
void clear()
Removes all elements from the array.
Array< String > strings
This is the array holding the actual strings.
StringArray() noexcept
Creates an empty string array.
const String & operator[](int index) const noexcept
Returns one of the strings from the array.
void removeString(StringRef stringToRemove, bool ignoreCase=false)
Finds a string in the array and removes it.
void sort(bool ignoreCase)
Sorts the array into alphabetical order.
void move(int currentIndex, int newIndex) noexcept
Moves one of the strings to a different position.
void swapWith(StringArray &) noexcept
Swaps the contents of this and another StringArray.
int size() const noexcept
Returns the number of strings in the array.
bool operator!=(const StringArray &) const noexcept
Compares two arrays.
void trim()
Deletes any whitespace characters from the starts and ends of all the strings.
void add(String stringToAdd)
Appends a string at the end of the array.
int addLines(StringRef stringToBreakUp)
Breaks up a string into lines and adds them to this array.
void clearQuick()
Removes all elements from the array without freeing the array's allocated storage.
void mergeArray(const StringArray &other, bool ignoreCase=false)
Merges the strings from another array into this one.
bool addIfNotAlreadyThere(const String &stringToAdd, bool ignoreCase=false)
Adds a string to the array as long as it's not already in there.
void removeRange(int startIndex, int numberToRemove)
Removes a range of elements from the array.
StringArray & operator=(const StringArray &)
Copies the contents of another string array into this one.
~StringArray()
Destructor.
void set(int index, String newString)
Replaces one of the strings in the array with another one.
void remove(int index)
Removes a string from the array.
void ensureStorageAllocated(int minNumElements)
Increases the array's internal storage to hold a minimum number of elements.
int addTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Breaks up a string into tokens and adds them to this array.
A simple class for holding temporary references to a string literal or String.
bool isNotEmpty() const noexcept
Returns true if the string is not empty.
String::CharPointerType text
The text that is referenced.
CharPointerType getCharPointer() const noexcept
Returns the character pointer currently being used to store this string.
void preallocateBytes(size_t numBytesNeeded)
Increases the string's internally allocated storage.