Declaration of the Memento structure and support functions, Memento_Create() and Memento_Destroy(), as used in the Memento Pattern. More...
Go to the source code of this file.
Classes | |
struct | Memento |
Represents a single memento (snapshot) of the text state before an operation is applied. The operation becomes the name of the memento for display purposes. More... | |
Macros | |
#define | __MEMENTO_MEMENTO_H__ |
Functions | |
Memento * | Memento_Create (const char *text, const char *name) |
Create a new instance of the Memento structure, initialized to the given text and name. | |
void | Memento_Destroy (Memento *memento) |
Destroy an existing instance of the Memento structure. After this function returns, the pointer to the memento is no longer valid. | |
Declaration of the Memento structure and support functions, Memento_Create() and Memento_Destroy(), as used in the Memento Pattern.
Definition in file Memento_Memento.h.
#define __MEMENTO_MEMENTO_H__ |
Definition at line 9 of file Memento_Memento.h.
Memento * Memento_Create | ( | const char * | text, |
const char * | name | ||
) |
Create a new instance of the Memento structure, initialized to the given text and name.
text | The text to assign the memento. This is the snapshot to be remembered. This is duplicated in the Memento object. |
name | The operation name used to on the parent text object. This is duplicated in the Memento object. |
Definition at line 19 of file Memento_Memento.c.
References Memento::name, STRDUP, and Memento::text.
Referenced by Memento_SaveForUndo().
void Memento_Destroy | ( | Memento * | memento | ) |
Destroy an existing instance of the Memento structure. After this function returns, the pointer to the memento is no longer valid.
memento | The Memento object to destroy. |
Definition at line 61 of file Memento_Memento.c.
References Memento::name, and Memento::text.
Referenced by Memento_Undo().