A buffer action abstracts the notion of a doable and undoable actions on the buffer. More...
Data Structures | |
struct | buffer_action_funcs |
Struct that holds the function pointers for an implementation of a buffer_action_t. More... | |
Typedefs | |
typedef struct buffer_action | buffer_action_t |
Opaque type for buffer action ADT. | |
Functions | |
int | buffer_action_do (buffer_action_t *action) |
Performs a buffer_action_t. | |
int | buffer_action_undo (buffer_action_t *action) |
Reverts a buffer_action_t. | |
int | buffer_action_private_copy (buffer_action_t *action, data_object_t *dobj) |
Makes a private copy of all the data held by this action that belong to a data object. | |
int | buffer_action_to_event (buffer_action_t *action, struct bless_buffer_event_info *event_info) |
Fills an event info structure describing a buffer_action_t. | |
int | buffer_action_free (buffer_action_t *action) |
Frees a buffer_action_t. | |
Constructor functions | |
| |
int | buffer_action_append_new (buffer_action_t **action, bless_buffer_t *buf, bless_buffer_source_t *src, off_t src_offset, off_t length) |
Creates a new append buffer_action_t. | |
int | buffer_action_insert_new (buffer_action_t **action, bless_buffer_t *buf, off_t offset, bless_buffer_source_t *src, off_t src_offset, off_t length) |
Creates a new insert buffer_action_t. | |
int | buffer_action_delete_new (buffer_action_t **action, bless_buffer_t *buf, off_t offset, off_t length) |
Creates a new delete buffer_action_t. | |
int | buffer_action_multi_new (buffer_action_t **action) |
Creates a new multi buffer_action_t. | |
int | buffer_action_multi_add (buffer_action_t *multi_action, buffer_action_t *new_action) |
Adds a new action to a multi action. | |
Internal functions | |
| |
int | buffer_action_create_impl (buffer_action_t **action, void *impl, struct buffer_action_funcs *funcs) |
Creates a buffer_action_t using a specific implementation. | |
void * | buffer_action_get_impl (buffer_action_t *action) |
Gets the implementation of a buffer_action_t. |
A buffer action abstracts the notion of a doable and undoable actions on the buffer.
There are many kinds of buffer actions (eg append, insert). To create a buffer action one must use the specific constructor function.
int buffer_action_append_new | ( | buffer_action_t ** | action, | |
bless_buffer_t * | buf, | |||
bless_buffer_source_t * | src, | |||
off_t | src_offset, | |||
off_t | length | |||
) |
Creates a new append buffer_action_t.
[out] | action | the created buffer_action_t |
buf | the buffer_t to append data to | |
src | the source to append data from | |
src_offset | the offset of the source to get data from | |
length | the length in bytes of the data to append |
Definition at line 335 of file buffer_action_edit.c.
References buffer_action_create_impl().
Referenced by bless_buffer_append().
int buffer_action_create_impl | ( | buffer_action_t ** | action, | |
void * | impl, | |||
struct buffer_action_funcs * | funcs | |||
) |
Creates a buffer_action_t using a specific implementation.
[out] | action | the created buffer_action_t |
impl | the implementation private data | |
funcs | function pointers to the implementations' functions |
Definition at line 51 of file buffer_action.c.
Referenced by buffer_action_append_new(), buffer_action_delete_new(), buffer_action_insert_new(), and buffer_action_multi_new().
int buffer_action_delete_new | ( | buffer_action_t ** | action, | |
bless_buffer_t * | buf, | |||
off_t | offset, | |||
off_t | length | |||
) |
Creates a new delete buffer_action_t.
[out] | action | the created buffer_action_t |
buf | the buffer_t to delete data from | |
offset | the offset in the buffer_t to delete from | |
length | the length in bytes of the data to delete |
Definition at line 430 of file buffer_action_edit.c.
References buffer_action_create_impl().
Referenced by bless_buffer_delete().
int buffer_action_do | ( | buffer_action_t * | action | ) |
Performs a buffer_action_t.
action | the action to perform |
Definition at line 92 of file buffer_action.c.
Referenced by bless_buffer_append(), bless_buffer_delete(), bless_buffer_insert(), bless_buffer_redo(), and bless_buffer_undo().
int buffer_action_free | ( | buffer_action_t * | action | ) |
Frees a buffer_action_t.
action | the action to perform |
Definition at line 162 of file buffer_action.c.
Referenced by action_list_clear(), actions_make_private_copy(), bless_buffer_append(), bless_buffer_begin_multi_action(), bless_buffer_delete(), bless_buffer_free(), bless_buffer_insert(), and undo_list_enforce_limit().
void* buffer_action_get_impl | ( | buffer_action_t * | action | ) |
Gets the implementation of a buffer_action_t.
action | the buffer_action_t to get the implementation of |
Definition at line 75 of file buffer_action.c.
Referenced by buffer_action_multi_add().
int buffer_action_insert_new | ( | buffer_action_t ** | action, | |
bless_buffer_t * | buf, | |||
off_t | offset, | |||
bless_buffer_source_t * | src, | |||
off_t | src_offset, | |||
off_t | length | |||
) |
Creates a new insert buffer_action_t.
[out] | action | the created buffer_action_t |
buf | the buffer_t to insert data to | |
offset | the offset in the buffer_t to insert to | |
src | the source to append data from | |
src_offset | the offset of the source to get data from | |
length | the length in bytes of the data to append |
Definition at line 383 of file buffer_action_edit.c.
References buffer_action_create_impl().
Referenced by bless_buffer_insert().
int buffer_action_multi_add | ( | buffer_action_t * | multi_action, | |
buffer_action_t * | new_action | |||
) |
Adds a new action to a multi action.
multi_action | the multi action to add an action to | |
new_action | the new action to add |
Definition at line 508 of file buffer_action_edit.c.
References buffer_action_get_impl(), list_insert_before(), and list_tail().
Referenced by bless_buffer_append(), bless_buffer_delete(), and bless_buffer_insert().
int buffer_action_multi_new | ( | buffer_action_t ** | action | ) |
Creates a new multi buffer_action_t.
[out] | action | the created buffer_action_t |
Definition at line 470 of file buffer_action_edit.c.
References buffer_action_create_impl(), and list_new.
Referenced by bless_buffer_begin_multi_action().
int buffer_action_private_copy | ( | buffer_action_t * | action, | |
data_object_t * | dobj | |||
) |
Makes a private copy of all the data held by this action that belong to a data object.
The data object is represented by a supplied data_object_t although the original data may have been accessed using another data_object_t (which of course refers to the same data object as the supplied).
action | the action to perform | |
dobj | the data_object_t the data must belong to |
Definition at line 129 of file buffer_action.c.
Referenced by actions_make_private_copy().
int buffer_action_to_event | ( | buffer_action_t * | action, | |
struct bless_buffer_event_info * | event_info | |||
) |
Fills an event info structure describing a buffer_action_t.
action | the action to describe | |
[out] | event_info | the event info structure to fill in |
Definition at line 145 of file buffer_action.c.
Referenced by bless_buffer_append(), bless_buffer_delete(), bless_buffer_end_multi_action(), bless_buffer_insert(), bless_buffer_redo(), and bless_buffer_undo().
int buffer_action_undo | ( | buffer_action_t * | action | ) |
Reverts a buffer_action_t.
action | the action to perform |
Definition at line 107 of file buffer_action.c.
Referenced by bless_buffer_append(), bless_buffer_delete(), bless_buffer_insert(), bless_buffer_redo(), and bless_buffer_undo().