Implementation of the supporting functions for the ConstStringList to work with a list of constant strings. More...

Go to the source code of this file.
Functions | |
| void | ConstStringList_Initialize (ConstStringList *stringList) |
| Initialize the given string list. | |
| void | ConstStringList_Clear (ConstStringList *stringList) |
| Clear the specified string list. The strings in the list are left alone, but the list itself is deleted. The string list can then be used to add new strings. | |
| bool | ConstStringList_AddString (ConstStringList *stringList, const char *string) |
| Add a string to the given string list. | |
| bool | ConstStringList_AddStrings (ConstStringList *stringList, const char **strings, size_t numStrings) |
| Add an array of strings to the given string list. | |
| void | ConstStringList_Remove (ConstStringList *stringList, int removeIndex) |
| Remove the specified string from the given string list. | |
| int | ConstStringList_Find (ConstStringList *stringList, const char *string) |
| Search the given string list for the given string. If found, return the index of the found string. | |
| bool | ConstStringList_AreListsEqual (ConstStringList *left, ConstStringList *right) |
| Compare two strings lists to determine if they have the same contents. | |
Implementation of the supporting functions for the ConstStringList to work with a list of constant strings.
Definition in file conststringlist.c.
| bool ConstStringList_AddString | ( | ConstStringList * | stringList, |
| const char * | string | ||
| ) |
Add a string to the given string list.
| stringList | A pointer to a ConstStringList representing the list of strings. |
| string | The string to add to the list. The string is added as is to the list, so its lifetime must be at least as long as the ConstStringList object. |
Definition at line 45 of file conststringlist.c.
References _ConstStringList::allocated_count, _ConstStringList::strings, and _ConstStringList::strings_count.
Referenced by Shop_PickupOrder(), Shop_PlaceOrder(), and Visitor_Exercise().
| bool ConstStringList_AddStrings | ( | ConstStringList * | stringList, |
| const char ** | strings, | ||
| size_t | numStrings | ||
| ) |
Add an array of strings to the given string list.
| stringList | A pointer to a ConstStringList representing the list of strings. |
| strings | Pointer to an array of constant strings to add to the list. The pointers to the strings are copied into the list. |
| numStrings | Number of strings in the strings parameter to add. |
Definition at line 82 of file conststringlist.c.
References _ConstStringList::allocated_count, _ConstStringList::strings, and _ConstStringList::strings_count.
Referenced by MapOfStrings_AddArray(), and Shop_PlaceOrder().
| bool ConstStringList_AreListsEqual | ( | ConstStringList * | left, |
| ConstStringList * | right | ||
| ) |
Compare two strings lists to determine if they have the same contents.
| left | A pointer to the first ConstStringList representing a list of strings to compare. |
| right | A pointer to the second ConstStringList representing a list of strings to compare. |
Definition at line 163 of file conststringlist.c.
References ConstStringList_Find(), _ConstStringList::strings, and _ConstStringList::strings_count.
Referenced by Shop_PlaceOrder().
| void ConstStringList_Clear | ( | ConstStringList * | stringList | ) |
Clear the specified string list. The strings in the list are left alone, but the list itself is deleted. The string list can then be used to add new strings.
| stringList | The ConstStringList to clear. |
Definition at line 28 of file conststringlist.c.
References ConstStringList_Initialize(), _ConstStringList::strings, and _ConstStringList::strings_count.
Referenced by MapOfStrings_Clear(), OrderVisitor_Clear(), Shop_PickupOrder(), and Shop_PlaceOrder().
| int ConstStringList_Find | ( | ConstStringList * | stringList, |
| const char * | string | ||
| ) |
Search the given string list for the given string. If found, return the index of the found string.
| stringList | A pointer to a ConstStringList representing the list of string to search. |
| string | The string to search for. |
Definition at line 141 of file conststringlist.c.
References _ConstStringList::strings, and _ConstStringList::strings_count.
Referenced by ConstStringList_AreListsEqual().
| void ConstStringList_Initialize | ( | ConstStringList * | stringList | ) |
Initialize the given string list.
| stringList | Pointer to a ConstStringList structure that is to be initialized. Cannot be NULL |
Definition at line 15 of file conststringlist.c.
References _ConstStringList::allocated_count, _ConstStringList::strings, and _ConstStringList::strings_count.
Referenced by ConstStringList_Clear(), OrderVisitor_Initialize(), and Shop_PickupOrder().
| void ConstStringList_Remove | ( | ConstStringList * | stringList, |
| int | removeIndex | ||
| ) |
Remove the specified string from the given string list.
| stringList | A pointer to a ConstStringList representing the list of strings. |
| removeIndex | Index of the string to remove from the list. Call ConstStringList_Find() to get the index. |
Definition at line 123 of file conststringlist.c.
References _ConstStringList::allocated_count, _ConstStringList::strings, and _ConstStringList::strings_count.