const char* names[] = {"alpha", "beta", "gamma"}; StringArray* list = new StringList(names,3); // Identical result can be made with this: // StringArray* list = new StringList("alpha\0beta\0gamma\0"); menu->list(list);
Public Member Functions | |
virtual int | children (const Menu *) |
virtual const char * | label (const Menu *, int index) |
void | set (const char *s) |
void | set (const char *const *a) |
void | set (const char *const *a, int n) |
StringArray (const char *s) | |
StringArray (const char *const *a) | |
StringArray (const char *const *a, int n) |
|
Make it return n labels from array. The array and strings are not copied, they should be in static memory! |
|
Make it return labels from array, where the size of the array is determined by the first null pointer in it. The array and strings are not copied, they should be in static memory! If array is null then children is set to zero. |
|
Sets the list to return each substring in the nul-seperated string. The list is terminated by two nul characters. If the string is null then children is set ot zero. Warning: the string is not copied! The current implementation leaks the created array when the StringList is deleted or if set() is called again. This really should be a subclass with a destructor, but I can't figure out a good name for it... |