Design Pattern Examples
Overview of object-oriented design patterns
Command Struct Reference

Represents an operation that can be applied to a Command_TextObject. Can hold one of two kinds of operations, one that takes no additional parameters and one that takes two additional string parameters. More...

#include <Command_Command.h>

Collaboration diagram for Command:
Collaboration graph

Public Attributes

Command_TextObjectreceiver
 The receiver of the command.
 
const char * commandName
 Easy-to-read command name.
 
two_parameter_operation operation_two_parameters
 Two parameter operation to apply to the receiver.
 
no_parameter_operation operation_no_parameters
 No parameter operation to apply to the receiver.
 
const char * argument1
 The first argument to a two parameter operation.
 
const char * argument2
 The second argument to a two parameter operation.
 

Detailed Description

Represents an operation that can be applied to a Command_TextObject. Can hold one of two kinds of operations, one that takes no additional parameters and one that takes two additional string parameters.

In C, this is implemented with function pointers that implement the actual operations. Each command can have only one of two function pointers set at a time; this is handled in the Command_Create_Two_Parameters() and Command_Create_No_Parameters() functions.

Definition at line 44 of file Command_Command.h.

Member Data Documentation

◆ argument1

const char* argument1

The first argument to a two parameter operation.

Definition at line 50 of file Command_Command.h.

Referenced by Command_Create_Two_Parameters(), Command_Execute(), and Command_ToString().

◆ argument2

const char* argument2

The second argument to a two parameter operation.

Definition at line 51 of file Command_Command.h.

Referenced by Command_Create_Two_Parameters(), Command_Execute(), and Command_ToString().

◆ commandName

const char* commandName

Easy-to-read command name.

Definition at line 47 of file Command_Command.h.

Referenced by Command_Create_No_Parameters(), Command_Create_Two_Parameters(), and Command_ToString().

◆ operation_no_parameters

no_parameter_operation operation_no_parameters

No parameter operation to apply to the receiver.

Definition at line 49 of file Command_Command.h.

Referenced by Command_Create_No_Parameters(), Command_Execute(), and Command_ToString().

◆ operation_two_parameters

two_parameter_operation operation_two_parameters

Two parameter operation to apply to the receiver.

Definition at line 48 of file Command_Command.h.

Referenced by Command_Create_Two_Parameters(), Command_Execute(), and Command_ToString().

◆ receiver

Command_TextObject* receiver

The receiver of the command.

Definition at line 46 of file Command_Command.h.

Referenced by Command_Create_No_Parameters(), Command_Create_Two_Parameters(), and Command_Execute().


The documentation for this struct was generated from the following file: