Browse Source

Added a constructor to StringArray.

tags/2021-05-28
jules 13 years ago
parent
commit
a9e026e062
2 changed files with 13 additions and 2 deletions
  1. +7
    -2
      modules/juce_core/text/juce_StringArray.cpp
  2. +6
    -0
      modules/juce_core/text/juce_StringArray.h

+ 7
- 2
modules/juce_core/text/juce_StringArray.cpp View File

@@ -55,14 +55,19 @@ namespace StringArrayHelpers
dest.add (*strings++);
}
template <typename CharType>
void addArray (Array<String>& dest, const CharType* const* const strings, const int numberOfStrings)
template <typename Type>
void addArray (Array<String>& dest, const Type* const strings, const int numberOfStrings)
{
for (int i = 0; i < numberOfStrings; ++i)
dest.add (strings [i]);
}
}
StringArray::StringArray (const String* initialStrings, int numberOfStrings)
{
StringArrayHelpers::addArray (strings, initialStrings, numberOfStrings);
}
StringArray::StringArray (const char* const* const initialStrings)
{
StringArrayHelpers::addArray (strings, initialStrings);


+ 6
- 0
modules/juce_core/text/juce_StringArray.h View File

@@ -53,6 +53,12 @@ public:
/** Creates an array containing a single string. */
explicit StringArray (const String& firstValue);
/** Creates an array from a raw array of strings.
@param strings an array of strings to add
@param numberOfStrings how many items there are in the array
*/
StringArray (const String* strings, int numberOfStrings);
/** Creates a copy of an array of string literals.
@param strings an array of strings to add. Null pointers in the array will be
treated as empty strings


Loading…
Cancel
Save