#include "internal.h"
#include <assert.h>
#include <algorithm>
Go to the source code of this file.
Functions | |
xorn_object_t | xorn_add_object (xorn_revision_t rev, xorn_obtype_t type, void const *data) |
Add a new object to a transient revision. More... | |
int | xorn_set_object_data (xorn_revision_t rev, xorn_object_t ob, xorn_obtype_t type, void const *data) |
Set an object in a transient revision to the given object type and data. More... | |
int | xorn_relocate_object (xorn_revision_t rev, xorn_object_t ob, xorn_object_t attach_to, xorn_object_t insert_before) |
Change the location of an object in the object structure of a transient revision. More... | |
void | xorn_delete_object (xorn_revision_t rev, xorn_object_t ob) |
Delete an object from a transient revision. More... | |
void | xorn_delete_selected_objects (xorn_revision_t rev, xorn_selection_t sel) |
Delete some objects from a transient revision. More... | |
xorn_object_t | xorn_copy_object (xorn_revision_t dest, xorn_revision_t src, xorn_object_t ob) |
Copy an object to a transient revision. More... | |
xorn_selection_t | xorn_copy_objects (xorn_revision_t dest, xorn_revision_t src, xorn_selection_t sel) |
Copy some objects to a transient revision. More... | |
xorn_object_t xorn_add_object | ( | xorn_revision_t | rev, |
xorn_obtype_t | type, | ||
void const * | data | ||
) |
Add a new object to a transient revision.
The object is appended to the end of the object list.
data must point to a data structure matching the object type indicated by type (e.g., if type is xornsch_obtype_net
, then data must point to a xornsch_net
structure). The data structure (including referenced strings) will not be accessed after this function has returned.
NULL
.Example:
xornsch_add_net
etc.) which offer the same functionality but are type-safe. Definition at line 60 of file manipulate.cc.
xorn_object_t xorn_copy_object | ( | xorn_revision_t | dest, |
xorn_revision_t | src, | ||
xorn_object_t | ob | ||
) |
Copy an object to a transient revision.
Any objects attached to ob are copied as well, their copies being attached to the copy of ob, which is appended to the end of the object list.
dest | Destination revision (must be transient) |
src | Source revision (does not need to be transient) |
ob | Object in the source revision which should be copied |
NULL
. Definition at line 392 of file manipulate.cc.
xorn_selection_t xorn_copy_objects | ( | xorn_revision_t | dest, |
xorn_revision_t | src, | ||
xorn_selection_t | sel | ||
) |
Copy some objects to a transient revision.
Any objects attached to the objects are copied as well and attached to the corresponding new object. The copied objects are appended to the end of the object list in an unspecified order.
dest | Destination revision (must be transient) |
src | Source revision (does not need to be transient) |
sel | Objects in the source revision which should be copied |
NULL
.Definition at line 433 of file manipulate.cc.
void xorn_delete_object | ( | xorn_revision_t | rev, |
xorn_object_t | ob | ||
) |
Delete an object from a transient revision.
Any objects attached to ob are deleted as well.
The deleted object(s) stay valid and can later be re-added using xorn_set_object_data or its type-safe equivalents.
If the revision isn't transient or the object doesn't exist in the revision, nothing is changed.
Definition at line 301 of file manipulate.cc.
void xorn_delete_selected_objects | ( | xorn_revision_t | rev, |
xorn_selection_t | sel | ||
) |
Delete some objects from a transient revision.
Any objects attached to a deleted object are deleted as well.
The deleted objects stay valid and can later be re-added using xorn_set_object_data or its type-safe equivalents.
Objects that don't exist in the revision are ignored. If the revision isn't transient, nothing is changed.
Definition at line 328 of file manipulate.cc.
int xorn_relocate_object | ( | xorn_revision_t | rev, |
xorn_object_t | ob, | ||
xorn_object_t | attach_to, | ||
xorn_object_t | insert_before | ||
) |
Change the location of an object in the object structure of a transient revision.
This function performs two distinct operations:
If attach_to is NULL
, the object becomes un-attached. If ob and insert_before are identical and ob is already attached to attach_to, the revision is left unchanged.
rev | Revision to modify (must be transient) |
ob | The object which should be reordered and/or attached (must be xornsch_text if attach_to is not NULL ) |
attach_to | The object to which ob should be attached (must be xornsch_net or xornsch_component, or NULL ) |
insert_before | An object already attached to attach_to before which ob should be inserted, or NULL to append it at the end. |
0
on success. Returns -1
ifNULL
) attach_to or insert_before don't exist in the revision,NULL
andNULL
and not attached to attach_to, orExample:
Definition at line 219 of file manipulate.cc.
int xorn_set_object_data | ( | xorn_revision_t | rev, |
xorn_object_t | ob, | ||
xorn_obtype_t | type, | ||
void const * | data | ||
) |
Set an object in a transient revision to the given object type and data.
If the object does not exist in the revision, it is created and appended to the end of the object list.
rev | Revision to be changed (must be transient) |
ob | An object which has previously been returned by a Xorn function for either this revision, one of its ancestors, or a revision which has a common ancestor with it. |
type | New object type (may be different from previous one, but must be xornsch_obtype_net or xornsch_obtype_component if there are objects attached to ob, and must be xornsch_obtype_text if ob itself is attached to an object) |
data | Pointer to a data structure matching the object type indicated by type (e.g., if type is xornsch_obtype_net , a pointer to a xornsch_net structure). The data structure (including referenced strings) will not be accessed after this function has returned. |
0
if the object has been changed. Returns -1
ifExample:
xornsch_set_net_data
etc.) which offer the same functionality but are type-safe. Definition at line 131 of file manipulate.cc.