Implementation of the Memento structure's support functions, Memento_Create() and Memento_Destroy(), as used in the Memento Pattern. More...
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include "helpers/strdup.h"
#include "Memento_Memento.h"
Go to the source code of this file.
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. | |
Implementation of the Memento structure's support functions, Memento_Create() and Memento_Destroy(), as used in the Memento Pattern.
Definition in file Memento_Memento.c.
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().