Design Pattern Examples
Overview of object-oriented design patterns
c/Command_Exercise.h File Reference

Declaration of the Command_Exercise() function as used in the Command Pattern. More...

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

Go to the source code of this file.

Macros

#define __COMMAND_EXERCISE_H__
 

Functions

void Command_Exercise (void)
 Example of using the Command Pattern.
 

Detailed Description

Declaration of the Command_Exercise() function as used in the Command Pattern.

Definition in file c/Command_Exercise.h.

Macro Definition Documentation

◆ __COMMAND_EXERCISE_H__

#define __COMMAND_EXERCISE_H__

Definition at line 9 of file c/Command_Exercise.h.

Function Documentation

◆ Command_Exercise()

void Command_Exercise ( void  )

Example of using the Command Pattern.

The Command pattern is used to encapsulate an operation or command associated with an object so that the command can be applied to the object at a later time.

In this exercise, an undo list is implemented using Commands that associate commands defined in this file with a text object. The commands are applied to the text object in succession then effectively undone.

Definition at line 185 of file Command_Exercise.c.

References Command_ApplyReplaceCommand(), Command_ApplyReverseCommand(), Command_TextObject_Clear(), Command_TextObject_Initialize(), Command_TextObject_ToString(), and Command_Undo().