InfTextDeleteOperation: libinftext-0.7 Reference Manual

## InfTextDeleteOperation InfTextDeleteOperation — Interface for an operation erasing text |

## Stability Level

Unstable, unless otherwise indicated

## Functions

guint | inf_text_delete_operation_get_position ()
guint | inf_text_delete_operation_get_length ()
gboolean | inf_text_delete_operation_need_concurrency_id ()
InfAdoptedOperation * | inf_text_delete_operation_transform_insert ()
InfAdoptedOperation * | inf_text_delete_operation_transform_delete ()

## Types and Values

| InfTextDeleteOperation
struct | InfTextDeleteOperationInterface

## Object Hierarchy

        GInterface
        ╰── InfTextDeleteOperation

## Prerequisites

InfTextDeleteOperation requires InfAdoptedOperation and GObject.

## Known Implementations

InfTextDeleteOperation is implemented by InfTextDefaultDeleteOperation and InfTextRemoteDeleteOperation.

## Includes

    #include <libinftext/inf-text-delete-operation.h>

## Description

InfTextDeleteOperation is an interface for an operation removing text from the document. It implements the transformation logic for transformation against other delete operations or insert operations.

This interface does not make any assumption on what kind of text is removed, it works only with character offsets and lengths. This information is enough to perform transformation of this operation or other operations against this operation. Whether the actual operation only knows about the offsets, too, or actually knows the text that is being erased (and if so, in what representation), is up to the implementation.

## Functions

### inf_text_delete_operation_get_position ()

    guint
    inf_text_delete_operation_get_position
                                   (InfTextDeleteOperation *operation);

Returns the position at which `operation` starts to delete dext.

#### Parameters

operation | A InfTextDeleteOperation. |

#### Returns

The position of `operation` .

### inf_text_delete_operation_get_length ()

    guint
    inf_text_delete_operation_get_length (InfTextDeleteOperation *operation);

Returns the number of characters deleted by `operation` .

#### Parameters

operation | A InfTextDeleteOperation. |

#### Returns

The length of `operation` .

### inf_text_delete_operation_need_concurrency_id ()

    gboolean
    inf_text_delete_operation_need_concurrency_id
                                   (InfTextDeleteOperation *op,
                                    InfAdoptedOperation *against);

Returns whether transforming `op` against `against` requires a concurrency ID (see `inf_adopted_operation_need_concurrency_id()` for further information).

#### Parameters

op | A InfTextDeleteOperation. |
against | Another InfAdoptedOperation. |

#### Returns

Whether transforming `op` against `against` requires a concurrency ID.

### inf_text_delete_operation_transform_insert ()

    InfAdoptedOperation *
    inf_text_delete_operation_transform_insert
                                   (InfTextDeleteOperation *operation,
                                    InfTextInsertOperation *against);

Returns a new operation that includes the effect of `against` into `operation` .

#### Parameters

operation | A InfTextDeleteOperation. |
against | A InfTextInsertOperation. |

#### Returns

A new InfAdoptedOperation.

[transfer full]

### inf_text_delete_operation_transform_delete ()

    InfAdoptedOperation *
    inf_text_delete_operation_transform_delete
                                   (InfTextDeleteOperation *operation,
                                    InfTextDeleteOperation *against);

Returns a new operation that includes the effect of `against` into `operation` .

#### Parameters

operation | A InfTextDeleteOperation. |
against | Another InfTextDeleteOperation. |

#### Returns

A new InfAdoptedOperation.

[transfer full]

## Types and Values

### InfTextDeleteOperation

    typedef struct _InfTextDeleteOperation InfTextDeleteOperation;

InfTextDeleteOperation is an opaque data type. You should only access it via the public API functions.

### struct InfTextDeleteOperationInterface

    struct InfTextDeleteOperationInterface {
      /* Virtual table */
      guint(*get_position)(InfTextDeleteOperation* operation);

      guint(*get_length)(InfTextDeleteOperation* operation);

      InfTextDeleteOperation*(*transform_position)(InfTextDeleteOperation* op,
                                                   guint position);

      InfTextDeleteOperation*(*transform_overlap)(InfTextDeleteOperation* op,
                                                  InfTextDeleteOperation* other,
                                                  guint position,
                                                  guint begin,
                                                  guint other_begin,
                                                  guint length);

      InfAdoptedSplitOperation*(*transform_split)(InfTextDeleteOperation* op,
                                                  guint split_pos,
                                                  guint split_length);
    };

This structure contains virtual methods of the InfTextDeleteOperation interface.

#### Members

`get_position` () | Virtual function to retrieve the start position of the delete operation. |
`get_length` () | Virtual function to retrieve the end position of the number of characters removed by the delete operation. |
`transform_position` () | Virtual function to transform the operation such that the start position of the operation changes. |
`transform_overlap` () | Virtual function to transform the operation against another delete operation with overlapping regions. |
`transform_split` () | Virtual function to transform the operation against an insert operation such that this operation needs to be split in two. |

## See Also

InfTextInsertOperation