Implementation of the Command structure and associated functions as used in the Command Pattern. More...
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "Command_Command.h"
Go to the source code of this file.
Functions | |
Command * | Command_Create_Two_Parameters (const char *commandName, Command_TextObject *receiver, two_parameter_operation operation, const char *arg1, const char *arg2) |
Create a new Command object with the given parameters, creating a command that uses two additional parameters. | |
Command * | Command_Create_No_Parameters (const char *commandName, Command_TextObject *receiver, no_parameter_operation operation) |
Create a new Command object with the given parameters, creating a command that uses no additional parameters. | |
void | Command_Destroy (Command *commandObject) |
Destroy the given command object, releasing it and any associated resources. | |
void | Command_Execute (Command *commandObject) |
Execute the given command on the Command_TextObject it knows about. | |
const char * | Command_ToString (Command *commandObject) |
Convert the given command object to a string representation. | |
Implementation of the Command structure and associated functions as used in the Command Pattern.
Definition in file Command_Command.c.
Command * Command_Create_No_Parameters | ( | const char * | commandName, |
Command_TextObject * | receiver, | ||
no_parameter_operation | operation | ||
) |
Create a new Command object with the given parameters, creating a command that uses no additional parameters.
commandName | The name of the command (for display purposes). |
receiver | The target or receiver of the command operation. |
operation | The function to call to perform the command. |
Definition at line 33 of file Command_Command.c.
References Command::commandName, Command::operation_no_parameters, and Command::receiver.
Referenced by Command_ApplyReverseCommand().
Command * Command_Create_Two_Parameters | ( | const char * | commandName, |
Command_TextObject * | receiver, | ||
two_parameter_operation | operation, | ||
const char * | arg1, | ||
const char * | arg2 | ||
) |
Create a new Command object with the given parameters, creating a command that uses two additional parameters.
commandName | The name of the command (for display purposes). |
receiver | The target or receiver of the command operation. |
operation | The function to call to perform the command. |
arg1 | The first argument to pass to the command function. |
arg2 | The second argument to pass to the command function. |
Definition at line 16 of file Command_Command.c.
References Command::argument1, Command::argument2, Command::commandName, Command::operation_two_parameters, and Command::receiver.
Referenced by Command_ApplyReplaceCommand().
void Command_Destroy | ( | Command * | commandObject | ) |
Destroy the given command object, releasing it and any associated resources.
commandObject | The Command object to be destroyed. After this function returns, the pointer is no longer valid |
Definition at line 48 of file Command_Command.c.
Referenced by Command_Undo().
void Command_Execute | ( | Command * | commandObject | ) |
Execute the given command on the Command_TextObject it knows about.
commandObject | The Command object to be executed. |
Definition at line 56 of file Command_Command.c.
References Command::argument1, Command::argument2, Command::operation_no_parameters, Command::operation_two_parameters, and Command::receiver.
Referenced by Command_Save_And_Execute(), and Command_Undo().
const char * Command_ToString | ( | Command * | commandObject | ) |
Convert the given command object to a string representation.
commandObject | The Command to be rendered as a string. |
Definition at line 74 of file Command_Command.c.
References Command::argument1, Command::argument2, Command::commandName, Command::operation_no_parameters, and Command::operation_two_parameters.
Referenced by Command_ApplyReplaceCommand(), Command_ApplyReverseCommand(), and Command_Undo().