Buffer Action

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.

Detailed Description

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.


Function Documentation

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.

Parameters:
[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
Returns:
the operation error code

Definition at line 335 of file buffer_action_edit.c.

References buffer_action_create_impl().

Referenced by bless_buffer_append().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
[out] action the created buffer_action_t
impl the implementation private data
funcs function pointers to the implementations' functions
Returns:
the operation status code

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().

Here is the caller graph for this function:

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.

Parameters:
[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
Returns:
the operation error code

Definition at line 430 of file buffer_action_edit.c.

References buffer_action_create_impl().

Referenced by bless_buffer_delete().

Here is the call graph for this function:

Here is the caller graph for this function:

int buffer_action_do ( buffer_action_t action  ) 

Performs a buffer_action_t.

Parameters:
action the action to perform
Returns:
the operation error code

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().

Here is the caller graph for this function:

int buffer_action_free ( buffer_action_t action  ) 

Frees a buffer_action_t.

Parameters:
action the action to perform
Returns:
the operation error code

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().

Here is the caller graph for this function:

void* buffer_action_get_impl ( buffer_action_t action  ) 

Gets the implementation of a buffer_action_t.

Parameters:
action the buffer_action_t to get the implementation of
Returns:
the implementation

Definition at line 75 of file buffer_action.c.

Referenced by buffer_action_multi_add().

Here is the caller graph for this function:

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.

Parameters:
[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
Returns:
the operation error code

Definition at line 383 of file buffer_action_edit.c.

References buffer_action_create_impl().

Referenced by bless_buffer_insert().

Here is the call graph for this function:

Here is the caller graph for this function:

int buffer_action_multi_add ( buffer_action_t multi_action,
buffer_action_t new_action 
)

Adds a new action to a multi action.

Parameters:
multi_action the multi action to add an action to
new_action the new action to add
Returns:
the operation error code

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().

Here is the call graph for this function:

Here is the caller graph for this function:

int buffer_action_multi_new ( buffer_action_t **  action  ) 

Creates a new multi buffer_action_t.

Parameters:
[out] action the created buffer_action_t
Returns:
the operation error code

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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).

Parameters:
action the action to perform
dobj the data_object_t the data must belong to
Returns:
the operation error code

Definition at line 129 of file buffer_action.c.

Referenced by actions_make_private_copy().

Here is the caller graph for this function:

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.

Parameters:
action the action to describe
[out] event_info the event info structure to fill in
Returns:
the operation error code

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().

Here is the caller graph for this function:

int buffer_action_undo ( buffer_action_t action  ) 

Reverts a buffer_action_t.

Parameters:
action the action to perform
Returns:
the operation error code

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().

Here is the caller graph for this function:


Generated on Sun Nov 15 15:27:55 2009 for libbls by  doxygen 1.6.1