Implementation the Group support functions as used in the Mediator Pattern. More...

Go to the source code of this file.
Functions | |
| Group * | Group_Create (const char *groupName) |
| Create a new Group object with the specified name. | |
| void | Group_Destroy (Group *group) |
| Release the memory of the specified Group object. After this function returns, the pointer to the Group object is no longer valid. | |
| bool | Group_AddUser (Group *group, const char *userName) |
| Add a user to the specified group. Does nothing if the user is already in the group. | |
| int | Group_FindUser (Group *group, const char *userName) |
| Search the specified group for the specified user. | |
| void | Group_RemoveUser (Group *group, int removeIndex) |
| Remove a user from the specified group. Does nothing if the user is not in the group. | |
| bool | Group_GetAllUsers (Group *group, StringList *users) |
| Retrieve the names of all users in the group. | |
Implementation the Group support functions as used in the Mediator Pattern.
Definition in file Mediator_Group.c.
| bool Group_AddUser | ( | Group * | group, |
| const char * | userName | ||
| ) |
Add a user to the specified group. Does nothing if the user is already in the group.
| group | The Group object to add to. |
| userName | Name of the user to add. |
Definition at line 46 of file Mediator_Group.c.
References StringList_AddString(), and Group::Users.
Referenced by Groups_AddUserGroup().
| Group * Group_Create | ( | const char * | groupName | ) |
Create a new Group object with the specified name.
| groupName | Name of the group. |
Definition at line 14 of file Mediator_Group.c.
References Group::Name, StringList_Initialize(), and Group::Users.
Referenced by Groups_AddGroup().
| void Group_Destroy | ( | Group * | group | ) |
Release the memory of the specified Group object. After this function returns, the pointer to the Group object is no longer valid.
| group | The Group object to free. |
Definition at line 34 of file Mediator_Group.c.
References StringList_Clear(), and Group::Users.
Referenced by GroupList_Clear(), GroupList_RemoveGroup(), and Groups_AddGroup().
| int Group_FindUser | ( | Group * | group, |
| const char * | userName | ||
| ) |
Search the specified group for the specified user.
| group | The Group object to search. |
| userName | The name of the user to find. |
Definition at line 60 of file Mediator_Group.c.
References StringList_Find(), and Group::Users.
Referenced by Groups_GetGroupsWithUser(), Groups_RemoveUserFromAllGroups(), Groups_RemoveUserFromGroup(), and Groups_UserInGroup().
| bool Group_GetAllUsers | ( | Group * | group, |
| StringList * | users | ||
| ) |
Retrieve the names of all users in the group.
| group | The Group object to examine. |
| users | A StringList object to fill in with the names of the users in the list. |
Definition at line 87 of file Mediator_Group.c.
References StringList_AddString(), and Group::Users.
Referenced by Groups_GetAllUsersInGroup().
| void Group_RemoveUser | ( | Group * | group, |
| int | removeIndex | ||
| ) |
Remove a user from the specified group. Does nothing if the user is not in the group.
| group | The Group object to remove from. |
| removeIndex | Index of the user to remove. Call Group_FindUser() to get the index. |
Definition at line 75 of file Mediator_Group.c.
References StringList_Remove(), and Group::Users.
Referenced by Groups_RemoveUserFromAllGroups(), and Groups_RemoveUserFromGroup().