51 template <
typename... OtherElements>
55 StringArray (
const std::initializer_list<const char*>& strings);
61 template <
typename Type>
64 addArray (stringArray.
begin(), stringArray.
end());
78 StringArray (
const char*
const* strings,
int numberOfStrings);
85 explicit StringArray (
const char*
const* strings);
91 explicit StringArray (
const wchar_t*
const* strings);
98 StringArray (
const wchar_t*
const* strings,
int numberOfStrings);
104 StringArray& operator= (
const StringArray&);
107 StringArray& operator= (StringArray&&) noexcept;
110 template <
typename Type>
113 addArray (stringArray.
begin(), stringArray.
end());
118 void swapWith (StringArray&) noexcept;
125 bool operator== (
const StringArray&)
const noexcept;
131 bool operator!= (
const StringArray&)
const noexcept;
135 inline int size() const noexcept {
return strings.size(); }
138 inline bool isEmpty() const noexcept {
return size() == 0; }
147 const String& operator[] (
int index)
const noexcept;
153 String& getReference (
int index) noexcept;
163 inline const String*
begin() const noexcept {
return strings.begin(); }
173 inline const String*
end() const noexcept {
return strings.end(); }
182 bool contains (
StringRef stringToLookFor,
183 bool ignoreCase =
false)
const;
196 bool ignoreCase =
false,
197 int startIndex = 0)
const;
201 void add (
String stringToAdd);
210 void insert (
int index,
String stringToAdd);
217 bool addIfNotAlreadyThere (
const String& stringToAdd,
bool ignoreCase =
false);
224 void set (
int index,
String newString);
233 void addArray (
const StringArray& other,
235 int numElementsToAdd = -1);
240 template <
typename Iterator>
243 ensureStorageAllocated (size() + (
int) static_cast<size_t> (end - start));
246 strings.add (*start++);
255 void mergeArray (
const StringArray& other,
256 bool ignoreCase =
false);
265 int addTokens (
StringRef stringToTokenise,
bool preserveQuotedStrings);
281 int addTokens (
StringRef stringToTokenise,
291 int addLines (
StringRef stringToBreakUp);
299 static StringArray fromTokens (
StringRef stringToTokenise,
300 bool preserveQuotedStrings);
315 static StringArray fromTokens (
StringRef stringToTokenise,
325 static StringArray fromLines (
StringRef stringToBreakUp);
339 void remove (
int index);
345 void removeString (
StringRef stringToRemove,
346 bool ignoreCase =
false);
359 void removeRange (
int startIndex,
int numberToRemove);
368 void removeDuplicates (
bool ignoreCase);
374 void removeEmptyStrings (
bool removeWhitespaceStrings =
true);
390 void move (
int currentIndex,
int newIndex) noexcept;
410 void appendNumbersToDuplicates (
bool ignoreCaseWhenComparing,
411 bool appendNumberToFirstInstance,
430 int numberOfElements = -1)
const;
436 void sort (
bool ignoreCase);
451 void ensureStorageAllocated (
int minNumElements);
459 void minimiseStorageOverheads();
467 JUCE_LEAK_DETECTOR (StringArray)
bool isEmpty() const noexcept
const String * begin() const noexcept
String * begin() noexcept
StringArray(const Array< Type > &stringArray)
ElementType * end() noexcept
StringArray(StringRef firstValue, OtherElements... otherValues)
ElementType * begin() noexcept
const String * end() const noexcept
int size() const noexcept
void addArray(Iterator &&start, Iterator &&end)