Design Pattern Examples
Overview of object-oriented design patterns
Mediator_Groups.h
Go to the documentation of this file.
1
5
6#pragma once
7#ifndef __MEDIATOR_GROUPS_H__
8#define __MEDIATOR_GROUPS_H__
9
10#include "helpers/stringlist.h"
11
12#include "Mediator_Group.h"
13
18typedef enum
19{
25
26//-----------------------------------------------------------------------------
27
31void Groups_Clear(void);
32
43GroupErrorCode Groups_AddGroup(const char* groupName);
44
54GroupErrorCode Groups_RemoveGroup(const char* groupName);
55
62Group* Groups_FindGroup(const char* groupName);
63
71bool Groups_UserInGroup(const char* userName, const char* groupName);
72
84GroupErrorCode Groups_AddUserGroup(const char* userName, const char* groupName);
85
96GroupErrorCode Groups_RemoveUserFromGroup(const char* userName, const char* groupName);
97
107
108
119
130GroupErrorCode Groups_GetAllUsersInGroup(const char* groupName, StringList* users);
131
143GroupErrorCode Groups_GetGroupsWithUser(const char* userName, StringList* groups);
144
145#endif // __MEDIATOR_GROUPS_H__
Declaration of the Group structure and the associated support functions as used in the Mediator Patte...
Group * Groups_FindGroup(const char *groupName)
Find a group from the list of groups given the group's name.
GroupErrorCode Groups_GetAllUsersInGroup(const char *groupName, StringList *users)
Retrieve a list of all users in the specified group.
GroupErrorCode Groups_GetGroupsWithUser(const char *userName, StringList *groups)
Retrieve a list of all groups that contains the given user.
GroupErrorCode Groups_RemoveUserFromAllGroups(const char *userName)
Remove the specified user from all groups.
GroupErrorCode Groups_AddUserGroup(const char *userName, const char *groupName)
Add the specified user to the specified group. If the user is already in the group,...
GroupErrorCode Groups_RemoveGroup(const char *groupName)
Remove a group from the list of groups.
GroupErrorCode
Represents error codes that can be returned from the Group functions used in the Mediator Pattern.
@ GroupErrorCode_No_Memory
Indicates an out of memory condition.
@ GroupErrorCode_No_Error
Indicates success.
@ GroupErrorCode_Null_Argument
Indicates an argument is NULL.
@ GroupErrorCode_Group_Does_Not_Exist
Indicates the group does not exist.
void Groups_Clear(void)
Release all memory associated with list of groups.
GroupErrorCode Groups_GetAllGroups(StringList *groups)
Retrieve a list of all group names.
GroupErrorCode Groups_RemoveUserFromGroup(const char *userName, const char *groupName)
Remove the specified user from the specified group. If the user is not in the group,...
bool Groups_UserInGroup(const char *userName, const char *groupName)
Determine if the specified user is in this group. This is a case- sensitive search.
GroupErrorCode Groups_AddGroup(const char *groupName)
Add a group to the list of groups.
std::vector< std::string > StringList
Typedef for a vector of std::string.
Represents a single group. A group has a name and zero or more users. Users are tracked by name.