Design Pattern Examples
Overview of object-oriented design patterns
Mediator_User.h File Reference

Declaration of the User structure and the associated support functions as used in the Mediator Pattern. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  User
 Represents a user with a name. More...
 

Macros

#define __MEDIATOR_USER_H__
 

Functions

UserUser_Create (const char *userName)
 Create a User object with the specified name.
 
void User_Destroy (User *user)
 Destroy the given User object, releasing any associated memory resources. After this function returns, the pointer to the User object is no longer valid.
 

Detailed Description

Declaration of the User structure and the associated support functions as used in the Mediator Pattern.

Definition in file Mediator_User.h.

Macro Definition Documentation

◆ __MEDIATOR_USER_H__

#define __MEDIATOR_USER_H__

Definition at line 8 of file Mediator_User.h.

Function Documentation

◆ User_Create()

User * User_Create ( const char *  userName)

Create a User object with the specified name.

Parameters
userNameName of the user
Returns
Returns a new User object initialized to the given name; returns NULL if there was an out of memory condition.

Definition at line 17 of file Mediator_User.c.

References User::Name, and STRDUP.

Referenced by Users_AddUser().

◆ User_Destroy()

void User_Destroy ( User user)

Destroy the given User object, releasing any associated memory resources. After this function returns, the pointer to the User object is no longer valid.

Parameters
userThe User object to destroy.

Definition at line 41 of file Mediator_User.c.

References User::Name.

Referenced by UserList_Clear(), and UserList_RemoveUser().