Design Pattern Examples
Overview of object-oriented design patterns
Command_TextObject.h
Go to the documentation of this file.
1
5
6#pragma once
7#ifndef __COMMAND_TEXTOBJECT_H__
8#define __COMMAND_TEXTOBJECT_H__
9
10#include <stdbool.h>
11
12
18typedef struct Command_TextObject
19{
23 const char* startingText;
24
28 char* text;
29
31
41bool Command_TextObject_Initialize(Command_TextObject* textObject, const char* startingText);
42
49
55
62
69void Command_TextObject_SetText(Command_TextObject* textObject, const char* newText);
70
78const char* Command_TextObject_ToString(Command_TextObject* textObject);
79
80#endif // __COMMAND_TEXTOBJECT_H__
81
const char * Command_TextObject_ToString(Command_TextObject *textObject)
Converts the Command_TextObject to a string (basically, returns the current text from the Command_Tex...
void Command_TextObject_Clear(Command_TextObject *textObject)
Clear the contents of the specified Command_TextObject, releasing any allocated resources associated ...
bool Command_TextObject_Initialize(Command_TextObject *textObject, const char *startingText)
Initialize a Command_TextObject with the specified text.
void Command_TextObject_Reset(Command_TextObject *textObject)
Resets the Command_TextObject to the starting string.
char * Command_TextObject_GetText(Command_TextObject *textObject)
Gets the text in the specified Command_TextObject.
void Command_TextObject_SetText(Command_TextObject *textObject, const char *newText)
Sets the text in the specified Command_TextObject.
Container for a string. Need to use a structure to keep the starting text and the current text togeth...
char * text
The text that can change.
const char * startingText
Starting string text so we can reset the text to a known point.