Design Pattern Examples
Overview of object-oriented design patterns
Mediator_Users.h
Go to the documentation of this file.
1
5
6
#pragma once
7
#ifndef __MEDIATOR_USERS_H__
8
#define __MEDIATOR_USERS_H__
9
10
#include "helpers/stringlist.h"
11
12
#include "
Mediator_User.h
"
13
18
typedef
enum
19
{
20
UserErrorCode_No_Error
= 0,
21
UserErrorCode_Null_Argument
= 1,
22
UserErrorCode_User_Does_Not_Exist
= 2,
23
UserErrorCode_No_Memory
= 3,
24
}
UserErrorCode
;
25
26
//-----------------------------------------------------------------------------
27
31
void
Users_Clear
(
void
);
32
43
UserErrorCode
Users_AddUser
(
const
char
* userName);
44
54
UserErrorCode
Users_RemoveUser
(
const
char
* userName);
55
62
User
*
Users_FindUser
(
const
char
* userName);
63
74
UserErrorCode
Users_GetAllUsers
(
StringList
* userNames);
75
76
#endif
// __MEDIATOR_USERS_H__
Mediator_User.h
Declaration of the User structure and the associated support functions as used in the Mediator Patter...
Users_Clear
void Users_Clear(void)
Release all memory associated with the list of users.
Definition:
Mediator_Users.c:19
Users_FindUser
User * Users_FindUser(const char *userName)
Find a user from the list of users given the user's name.
Definition:
Mediator_Users.c:71
Users_RemoveUser
UserErrorCode Users_RemoveUser(const char *userName)
Remove a user from the list of users.
Definition:
Mediator_Users.c:50
Users_GetAllUsers
UserErrorCode Users_GetAllUsers(StringList *userNames)
Retrieve a list of all users.
Definition:
Mediator_Users.c:91
UserErrorCode
UserErrorCode
Represents error codes that can be returned from the User functions used in the Mediator Pattern.
Definition:
Mediator_Users.h:19
UserErrorCode_No_Error
@ UserErrorCode_No_Error
Indicates success.
Definition:
Mediator_Users.h:20
UserErrorCode_User_Does_Not_Exist
@ UserErrorCode_User_Does_Not_Exist
Indicates the user does not exist.
Definition:
Mediator_Users.h:22
UserErrorCode_No_Memory
@ UserErrorCode_No_Memory
Indicates an out of memory condition.
Definition:
Mediator_Users.h:23
UserErrorCode_Null_Argument
@ UserErrorCode_Null_Argument
Indicates an argument is NULL.
Definition:
Mediator_Users.h:21
Users_AddUser
UserErrorCode Users_AddUser(const char *userName)
Add a user to the list of users.
Definition:
Mediator_Users.c:27
StringList
std::vector< std::string > StringList
Typedef for a vector of std::string.
Definition:
lusplus/helpers/stringlist.h:16
User
Represents a user with a name.
Definition:
Mediator_User.h:14
c
Mediator_Users.h
Generated on Tue Aug 29 2023 19:47:44 for Design Pattern Examples by
1.9.6