36 :
strings (std::move (other.strings))
52 strings.addArray (initialStrings, numberOfStrings);
57 strings.addNullTerminatedArray (initialStrings);
62 strings.addArray (initialStrings, numberOfStrings);
67 strings.addNullTerminatedArray (initialStrings);
72 strings.addArray (initialStrings, numberOfStrings);
88 strings = std::move (other.strings);
94 return strings == other.strings;
99 return ! operator== (other);
104 strings.swapWith (other.strings);
120 return strings.getReference (index);
128 return strings.getReference (index);
133 return strings.getReference (index);
140 strings.add (std::move (newString));
147 strings.insert (index, std::move (newString));
152 if (
contains (newString, ignoreCase))
169 if (numElementsToAdd < 0 || startIndex + numElementsToAdd > otherArray.
size())
170 numElementsToAdd = otherArray.
size() - startIndex;
172 while (--numElementsToAdd >= 0)
180 for (
auto&
s : otherArray)
186 strings.set (index, std::move (newString));
191 return indexOf (stringToLookFor, ignoreCase) >= 0;
199 auto numElements =
size();
203 for (;
i < numElements; ++
i)
204 if (
strings.getReference(
i).equalsIgnoreCase (stringToLookFor))
209 for (;
i < numElements; ++
i)
210 if (stringToLookFor ==
strings.getReference (
i))
219 strings.move (currentIndex, newIndex);
232 for (
int i =
size(); --
i >= 0;)
233 if (
strings.getReference(
i).equalsIgnoreCase (stringToRemove))
238 for (
int i =
size(); --
i >= 0;)
239 if (stringToRemove ==
strings.getReference (
i))
246 strings.removeRange (startIndex, numberToRemove);
252 if (removeWhitespaceStrings)
254 for (
int i =
size(); --
i >= 0;)
255 if (!
strings.getReference(
i).containsNonWhitespaceChars())
260 for (
int i =
size(); --
i >= 0;)
261 if (
strings.getReference(
i).isEmpty())
277 [] (
const String&
a,
const String&
b) { return a.compareIgnoreCase (b) < 0; });
285 [] (
const String&
a,
const String&
b) { return a.compareNatural (b) < 0; });
291 auto last = (numberToJoin < 0) ?
size()
300 if (
start == last - 1)
303 auto separatorBytes = separator.
text.sizeInBytes() -
sizeof (String::CharPointerType::CharType);
304 auto bytesNeeded = (size_t) (last -
start - 1) * separatorBytes;
307 bytesNeeded +=
strings.getReference(
i).getCharPointer().sizeInBytes() -
sizeof (String::CharPointerType::CharType);
310 result.preallocateBytes (bytesNeeded);
312 auto dest =
result.getCharPointer();
319 dest.writeAll (
s.getCharPointer());
322 dest.writeAll (separator.
text);
331 return addTokens (
text,
" \n\r\t", preserveQuotedStrings ?
"\"" :
"");
338 if (
text.isNotEmpty())
340 for (
auto t =
text.text;;)
343 breakCharacters.
text,
344 quoteCharacters.
text);
348 if (tokenEnd.isEmpty())
366 for (
auto startOfLine =
text;;)
368 auto endOfLine =
text;
370 switch (
text.getAndAdvance())
374 case '\r':
if (*
text ==
'\n') ++
text;
break;
390 s.addTokens (stringToTokenise, preserveQuotedStrings);
399 s.addTokens (stringToTokenise, breakCharacters, quoteCharacters);
406 s.addLines (stringToBreakUp);
413 for (
int i = 0;
i <
size() - 1; ++
i)
417 for (
int nextIndex =
i + 1;;)
419 nextIndex =
indexOf (
s, ignoreCase, nextIndex);
430 bool appendNumberToFirstInstance,
440 for (
int i = 0;
i <
size() - 1; ++
i)
443 auto nextIndex =
indexOf (
s, ignoreCase,
i + 1);
450 if (appendNumberToFirstInstance)
455 while (nextIndex >= 0)
457 set (nextIndex, (*
this)[nextIndex] +
String (preNumberString) +
String (++number) +
String (postNumberString));
458 nextIndex =
indexOf (original, ignoreCase, nextIndex + 1);
466 strings.ensureStorageAllocated (minNumElements);
471 strings.minimiseStorageOverheads();
Type jmin(const Type a, const Type b)
Definition MathsFunctions.h:60
#define noexcept
Definition DistrhoDefines.h:72
uint8_t a
Definition Spc_Cpu.h:141
void set(int index, const String &newString)
Definition StringArray.cpp:147
bool operator!=(const StringArray &) const noexcept
Definition StringArray.cpp:74
void clear()
Definition StringArray.cpp:84
bool add(const String &stringToAdd)
Definition StringArray.cpp:108
void trim()
Definition StringArray.cpp:224
bool contains(StringRef stringToLookFor, bool ignoreCase=false) const
Definition StringArray.cpp:152
bool insert(int index, const String &stringToAdd)
Definition StringArray.cpp:113
void sortNatural()
Definition StringArray.cpp:263
static StringArray fromTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Definition StringArray.cpp:369
String joinIntoString(StringRef separatorString, int startIndex=0, int numberOfElements=-1) const
Definition StringArray.cpp:270
int addTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Definition StringArray.cpp:311
bool addIfNotAlreadyThere(const String &stringToAdd, bool ignoreCase=false)
Definition StringArray.cpp:118
void minimiseStorageOverheads()
Definition StringArray.cpp:455
void sort(bool ignoreCase)
Definition StringArray.cpp:249
void removeDuplicates(bool ignoreCase)
Definition StringArray.cpp:393
bool operator==(const StringArray &) const noexcept
Definition StringArray.cpp:69
void clearQuick()
Definition StringArray.cpp:89
static StringArray fromLines(StringRef stringToBreakUp)
Definition StringArray.cpp:385
void ensureStorageAllocated(int minNumElements)
Definition StringArray.cpp:450
const String & operator[](int index) const noexcept
Definition StringArray.cpp:94
String & getReference(int index) noexcept
Definition StringArray.cpp:103
int addLines(StringRef stringToBreakUp)
Definition StringArray.cpp:340
StringArray & operator=(const StringArray &)
Definition StringArray.cpp:59
void remove(int index)
Definition StringArray.cpp:181
void removeEmptyStrings(bool removeWhitespaceStrings=true)
Definition StringArray.cpp:208
void mergeArray(const StringArray &other, bool ignoreCase=false)
Definition StringArray.cpp:141
void appendNumbersToDuplicates(bool ignoreCaseWhenComparing, bool appendNumberToFirstInstance, CharPointer_UTF8 preNumberString=CharPointer_UTF8(nullptr), CharPointer_UTF8 postNumberString=CharPointer_UTF8(nullptr))
Definition StringArray.cpp:411
void swapWith(StringArray &) noexcept
Definition StringArray.cpp:79
void removeRange(int startIndex, int numberToRemove)
Definition StringArray.cpp:202
StringArray() noexcept
Definition StringArray.cpp:30
void removeString(StringRef stringToRemove, bool ignoreCase=false)
Definition StringArray.cpp:186
int indexOf(StringRef stringToLookFor, bool ignoreCase=false, int startIndex=0) const
Definition StringArray.cpp:157
void addArray(const StringArray &other, int startIndex=0, int numElementsToAdd=-1)
Definition StringArray.cpp:126
Definition juce_Array.h:56
Definition juce_CharPointer_UTF8.h:35
CharType * getAddress() const noexcept
Definition juce_CharPointer_UTF8.h:67
static Type findEndOfToken(Type text, BreakType breakCharacters, Type quoteCharacters)
Definition juce_CharacterFunctions.h:828
int indexOf(StringRef stringToLookFor, bool ignoreCase=false, int startIndex=0) const
Definition juce_StringArray.cpp:194
bool contains(StringRef stringToLookFor, bool ignoreCase=false) const
Definition juce_StringArray.cpp:189
Array< String > strings
Definition juce_StringArray.h:471
StringArray() noexcept
Definition juce_StringArray.cpp:26
void move(int currentIndex, int newIndex) noexcept
Definition juce_StringArray.cpp:217
int size() const noexcept
Definition juce_StringArray.h:136
void add(String stringToAdd)
Definition juce_StringArray.cpp:136
bool addIfNotAlreadyThere(const String &stringToAdd, bool ignoreCase=false)
Definition juce_StringArray.cpp:150
void set(int index, String newString)
Definition juce_StringArray.cpp:184
int addTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Definition juce_StringArray.cpp:329
Definition juce_String.h:53
Definition juce_StringRef.h:62
String::CharPointerType text
Definition juce_StringRef.h:130
struct huft * t
Definition inflate.c:943
register unsigned i
Definition inflate.c:1575
unsigned s
Definition inflate.c:1555
virtual ASIOError start()=0
Definition carla_juce.cpp:31
bool isPositiveAndBelow(Type1 valueToTest, Type2 upperLimit) noexcept
Definition juce_MathsFunctions.h:279
const char * text
Definition swell-functions.h:167
int result
Definition process.c:1455