1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added a constructor to StringArray.

This commit is contained in:
jules 2013-03-26 11:33:09 +00:00
parent 2a6a6651b2
commit a9e026e062
2 changed files with 13 additions and 2 deletions

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);

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