openshot-audio  0.1.2
juce_StringArray.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the juce_core module of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission to use, copy, modify, and/or distribute this software for any purpose with
8  or without fee is hereby granted, provided that the above copyright notice and this
9  permission notice appear in all copies.
10 
11  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
12  TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
13  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
15  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 
18  ------------------------------------------------------------------------------
19 
20  NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
21  All other JUCE modules are covered by a dual GPL/commercial license, so if you are
22  using any other modules, be sure to check that you also comply with their license.
23 
24  For more details, visit www.juce.com
25 
26  ==============================================================================
27 */
28 
29 #ifndef JUCE_STRINGARRAY_H_INCLUDED
30 #define JUCE_STRINGARRAY_H_INCLUDED
31 
32 
33 //==============================================================================
40 {
41 public:
42  //==============================================================================
45 
47  StringArray (const StringArray&);
48 
49  #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
51  #endif
52 
54  explicit StringArray (const String& firstValue);
55 
60  StringArray (const String* strings, int numberOfStrings);
61 
67  StringArray (const char* const* strings, int numberOfStrings);
68 
74  explicit StringArray (const char* const* strings);
75 
80  explicit StringArray (const wchar_t* const* strings);
81 
87  StringArray (const wchar_t* const* strings, int numberOfStrings);
88 
89  #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS
90  StringArray (const std::initializer_list<const char*>& strings);
91  #endif
92 
94  ~StringArray();
95 
97  StringArray& operator= (const StringArray&);
98 
99  #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
100  StringArray& operator= (StringArray&&) noexcept;
101  #endif
102 
104  void swapWith (StringArray&) noexcept;
105 
106  //==============================================================================
111  bool operator== (const StringArray&) const noexcept;
112 
117  bool operator!= (const StringArray&) const noexcept;
118 
119  //==============================================================================
121  inline int size() const noexcept { return strings.size(); };
122 
130  const String& operator[] (int index) const noexcept;
131 
136  String& getReference (int index) noexcept;
137 
141  inline String* begin() const noexcept { return strings.begin(); }
142 
146  inline String* end() const noexcept { return strings.end(); }
147 
154  bool contains (StringRef stringToLookFor,
155  bool ignoreCase = false) const;
156 
167  int indexOf (StringRef stringToLookFor,
168  bool ignoreCase = false,
169  int startIndex = 0) const;
170 
171  //==============================================================================
173  void add (const String& stringToAdd);
174 
175  #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
176 
177  void add (String&& stringToAdd);
178  #endif
179 
187  void insert (int index, const String& stringToAdd);
188 
192  void addIfNotAlreadyThere (const String& stringToAdd, bool ignoreCase = false);
193 
199  void set (int index, const String& newString);
200 
208  void addArray (const StringArray& other,
209  int startIndex = 0,
210  int numElementsToAdd = -1);
211 
219  int addTokens (StringRef stringToTokenise, bool preserveQuotedStrings);
220 
235  int addTokens (StringRef stringToTokenise,
236  StringRef breakCharacters,
237  StringRef quoteCharacters);
238 
245  int addLines (StringRef stringToBreakUp);
246 
253  static StringArray fromTokens (StringRef stringToTokenise,
254  bool preserveQuotedStrings);
255 
269  static StringArray fromTokens (StringRef stringToTokenise,
270  StringRef breakCharacters,
271  StringRef quoteCharacters);
272 
279  static StringArray fromLines (StringRef stringToBreakUp);
280 
281  //==============================================================================
283  void clear();
284 
288  void clearQuick();
289 
293  void remove (int index);
294 
299  void removeString (StringRef stringToRemove,
300  bool ignoreCase = false);
301 
313  void removeRange (int startIndex, int numberToRemove);
314 
322  void removeDuplicates (bool ignoreCase);
323 
328  void removeEmptyStrings (bool removeWhitespaceStrings = true);
329 
344  void move (int currentIndex, int newIndex) noexcept;
345 
347  void trim();
348 
364  void appendNumbersToDuplicates (bool ignoreCaseWhenComparing,
365  bool appendNumberToFirstInstance,
366  CharPointer_UTF8 preNumberString = CharPointer_UTF8 (nullptr),
367  CharPointer_UTF8 postNumberString = CharPointer_UTF8 (nullptr));
368 
369  //==============================================================================
382  String joinIntoString (StringRef separatorString,
383  int startIndex = 0,
384  int numberOfElements = -1) const;
385 
386  //==============================================================================
390  void sort (bool ignoreCase);
391 
396  void sortNatural();
397 
398  //==============================================================================
405  void ensureStorageAllocated (int minNumElements);
406 
413  void minimiseStorageOverheads();
414 
419 
420 private:
422 };
423 
424 
425 #endif // JUCE_STRINGARRAY_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_CharPointer_UTF8.h:38
String * begin() const noexcept
Definition: juce_StringArray.h:141
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
#define const
String * end() const noexcept
Definition: juce_StringArray.h:146
int size() const noexcept
Definition: juce_StringArray.h:121
Definition: juce_StringArray.h:39
bool operator==(const var &v1, const var &v2) noexcept
Definition: juce_Variant.cpp:565
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141
bool operator!=(const var &v1, const var &v2) noexcept
Definition: juce_Variant.cpp:566
Array< String > strings
Definition: juce_StringArray.h:418
Definition: juce_StringRef.h:65