8#ifndef __COMMAND_CLASSES_H__
9#define __COMMAND_CLASSES_H__
14#include "helpers/formatstring.h"
84 using two_parameter_operation = void (*)(Command_TextObject::shared_ptr_t source, std::string argument1, std::string argument2);
148 Command(Command_TextObject::shared_ptr_t source,
const std::string& commandName,
two_parameter_operation operation,
const std::string& argument1,
const std::string& argument2)
194 std::string output =
"<NO COMMAND>";
Container for a string. Need to use a class that allows the text to be changed while the container (t...
void SetText(std::string value)
Sets the text in this TextObject.
void Reset()
Resets the TextObject to the starting string.
std::string _startingText
std::string Text()
Gets the text in this TextObject.
std::shared_ptr< Command_TextObject > shared_ptr_t
std::string ToString()
Converts the TextObject to a string.
Command_TextObject(std::string text)
Constructs a text object with an initial string.
Represents an operation that can be applied to a TextObject. This class can handle two kinds of opera...
void Execute()
Execute the command on the TextObject.
Command(Command_TextObject::shared_ptr_t source, const std::string &commandName, no_parameter_operation operation)
Constructor for a command that applies an operation to a TextObject but does not take any additional ...
Command_TextObject::shared_ptr_t _receiver
Command(Command_TextObject::shared_ptr_t source, const std::string &commandName, two_parameter_operation operation, const std::string &argument1, const std::string &argument2)
Constructor for a command that applies an operation to a TextObject, where the operation takes two pa...
std::string ToString()
Convert this command to a string representation.
no_parameter_operation _no_parameter_operation
two_parameter_operation _two_parameter_operation
The namespace containing all Design Pattern Examples implemented in C++.
void(*)(Command_TextObject::shared_ptr_t source) no_parameter_operation
Alias for a function type representing an operation applied to a TextObject that uses no additional a...
void(*)(Command_TextObject::shared_ptr_t source, std::string argument1, std::string argument2) two_parameter_operation
Alias for a function type representing an operation applied to a TextObject using two parameters.
std::string formatstring(const char *fmt,...)
Use the given string and arguments to return a buffer containing the formatted string....