Design Pattern Examples
Overview of object-oriented design patterns
Mediator_Group.h
Go to the documentation of this file.
1
5
6#pragma once
7#ifndef __MEDIATOR_GROUP_H__
8#define __MEDIATOR_GROUP_H__
9
10#include "helpers/stringlist.h"
11
12
17typedef struct
18{
22 const char* Name;
23
28} Group;
29
30//-----------------------------------------------------------------------------
31
39Group* Group_Create(const char* groupName);
40
46void Group_Destroy(Group* group);
47
56bool Group_AddUser(Group* group, const char* userName);
57
65int Group_FindUser(Group* group, const char* userName);
66
74void Group_RemoveUser(Group* group, int removeIndex);
75
84bool Group_GetAllUsers(Group* group, StringList* users);
85
86#endif // __MEDIATOR_GROUP_H__
87
void Group_Destroy(Group *group)
Release the memory of the specified Group object. After this function returns, the pointer to the Gro...
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_AddUser(Group *group, const char *userName)
Add a user to the specified group. Does nothing if the user is already in the group.
Group * Group_Create(const char *groupName)
Create a new Group object with the specified name.
bool Group_GetAllUsers(Group *group, StringList *users)
Retrieve the names of all users in the group.
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.
StringList Users
The list of users in this group.
const char * Name
Name of this group.