Declaration of the GroupList structure and the associated support functions as used in the Mediator Pattern. More...
Go to the source code of this file.
Classes | |
struct | GroupList |
Represents a list of groups. Call GroupList_Initialize() to start and GroupList_Clear() to release all resources and restore to empty state. More... | |
Macros | |
#define | __MEDIATOR_GROUPLIST_H__ |
Functions | |
void | GroupList_Initialize (GroupList *groupList) |
Initialize the given GroupList object for initial use. | |
void | GroupList_Clear (GroupList *groupList) |
Clear the given GroupList object to release all associated resources. | |
bool | GroupList_AddGroup (GroupList *groupList, Group *group) |
Add the specified Group object to the specified GroupList object. The list takes ownership of the Group object and is responsible for releasing the memory associated with the Group object. | |
int | GroupList_FindGroup (GroupList *groupList, const char *groupName) |
Search the given GroupList object for the specified group by name and return the index of the group if found. | |
void | GroupList_RemoveGroup (GroupList *groupList, int removeIndex) |
Remove the group at the specified index in the given GroupList object. | |
Declaration of the GroupList structure and the associated support functions as used in the Mediator Pattern.
Definition in file Mediator_GroupList.h.
#define __MEDIATOR_GROUPLIST_H__ |
Definition at line 8 of file Mediator_GroupList.h.
Add the specified Group object to the specified GroupList object. The list takes ownership of the Group object and is responsible for releasing the memory associated with the Group object.
groupList | The GroupList object to which to add the group. |
group | The Group object to add to the list. |
Definition at line 42 of file Mediator_GroupList.c.
References GroupList::allocated_count, GroupList::groups, and GroupList::groups_count.
Referenced by Groups_AddGroup().
void GroupList_Clear | ( | GroupList * | groupList | ) |
Clear the given GroupList object to release all associated resources.
After this function returns, the object is an empty list ready to be used again.
groupList | The GroupList object to clear. |
Definition at line 26 of file Mediator_GroupList.c.
References Group_Destroy(), GroupList_Initialize(), GroupList::groups, and GroupList::groups_count.
Referenced by Groups_Clear().
int GroupList_FindGroup | ( | GroupList * | groupList, |
const char * | groupName | ||
) |
Search the given GroupList object for the specified group by name and return the index of the group if found.
groupList | The GroupList object to search. |
groupName | The name of the group to look for. This is a case- sensitive search. |
Definition at line 78 of file Mediator_GroupList.c.
References GroupList::groups, GroupList::groups_count, and Group::Name.
Referenced by Groups_AddGroup(), Groups_AddUserGroup(), Groups_FindGroup(), Groups_GetAllUsersInGroup(), Groups_RemoveGroup(), Groups_RemoveUserFromGroup(), and Groups_UserInGroup().
void GroupList_Initialize | ( | GroupList * | groupList | ) |
Initialize the given GroupList object for initial use.
groupList | The GroupList object to initialize. |
Definition at line 13 of file Mediator_GroupList.c.
References GroupList::allocated_count, GroupList::groups, and GroupList::groups_count.
Referenced by GroupList_Clear().
void GroupList_RemoveGroup | ( | GroupList * | groupList, |
int | removeIndex | ||
) |
Remove the group at the specified index in the given GroupList object.
Since this changes the list of groups, all index values after the given index are no longer valid.
groupList | The GroupList object to remove from. |
removeIndex | Index of the group to remove. Use GroupList_FindGroup() to get this index. |
Definition at line 100 of file Mediator_GroupList.c.
References GroupList::allocated_count, Group_Destroy(), GroupList::groups, and GroupList::groups_count.
Referenced by Groups_RemoveGroup().