51 template <
typename... OtherElements>
53 : strings (firstValue,
std::forward<OtherElements> (otherValues)...) {}
62 template <typename Type>
65 addArray (stringArray.begin(), stringArray.end());
79 StringArray (
const char*
const* strings,
int numberOfStrings);
92 explicit StringArray (
const wchar_t*
const* strings);
99 StringArray (
const wchar_t*
const* strings,
int numberOfStrings);
111 template <typename Type>
114 addArray (stringArray.begin(), stringArray.end());
126 bool operator== (
const StringArray&)
const noexcept;
132 bool operator!= (
const StringArray&)
const noexcept;
136 inline int size() const noexcept {
return strings.size(); }
139 inline bool isEmpty() const noexcept {
return size() == 0; }
148 const String& operator[] (
int index)
const noexcept;
154 String& getReference (
int index)
noexcept;
160 const String& getReference (
int index)
const noexcept;
189 bool contains (
StringRef stringToLookFor,
190 bool ignoreCase =
false)
const;
203 bool ignoreCase =
false,
204 int startIndex = 0)
const;
208 void add (
String stringToAdd);
217 void insert (
int index,
String stringToAdd);
224 bool addIfNotAlreadyThere (
const String& stringToAdd,
bool ignoreCase =
false);
231 void set (
int index,
String newString);
242 int numElementsToAdd = -1);
247 template <
typename Iterator>
250 ensureStorageAllocated (size() + (
int)
static_cast<size_t> (end - start));
253 strings.add (*start++);
263 bool ignoreCase =
false);
272 int addTokens (
StringRef stringToTokenise,
bool preserveQuotedStrings);
288 int addTokens (
StringRef stringToTokenise,
298 int addLines (
StringRef stringToBreakUp);
307 bool preserveQuotedStrings);
352 void removeString (
StringRef stringToRemove,
353 bool ignoreCase =
false);
366 void removeRange (
int startIndex,
int numberToRemove);
375 void removeDuplicates (
bool ignoreCase);
381 void removeEmptyStrings (
bool removeWhitespaceStrings =
true);
397 void move (
int currentIndex,
int newIndex)
noexcept;
417 void appendNumbersToDuplicates (
bool ignoreCaseWhenComparing,
418 bool appendNumberToFirstInstance,
437 int numberOfElements = -1)
const;
443 void sort (
bool ignoreCase);
458 void ensureStorageAllocated (
int minNumElements);
466 void minimiseStorageOverheads();
Holds a resizable array of primitive or copy-by-value objects.
Wraps a pointer to a null-terminated UTF-8 character string, and provides various methods to operate ...
A special array for holding a list of strings.
StringArray(StringRef firstValue, OtherElements &&... otherValues)
Creates an array containing a list of strings.
const String * begin() const noexcept
Returns a pointer to the first String in the array.
Array< String > strings
This is the array holding the actual strings.
void addArray(Iterator &&start, Iterator &&end)
Adds items from a range of start/end iterators of some kind of objects which can be implicitly conver...
~StringArray()=default
Destructor.
int size() const noexcept
Returns the number of strings in the array.
String * end() noexcept
Returns a pointer to the String which follows the last element in the array.
const String * end() const noexcept
Returns a pointer to the String which follows the last element in the array.
bool isEmpty() const noexcept
Returns true if the array is empty, false otherwise.
String * begin() noexcept
Returns a pointer to the first String in the array.
A simple class for holding temporary references to a string literal or String.
CharPointerType begin() const
Returns an iterator pointing at the beginning of the string.
CharPointerType end() const
Returns an iterator pointing at the terminating null of the string.
#define JUCE_LEAK_DETECTOR(OwnerClass)
This macro lets you embed a leak-detecting object inside a class.