InfText.Buffer

g GObject.GInterface GObject.GInterface InfText.Buffer InfText.Buffer GObject.GInterface->InfText.Buffer

Implementations:

InfText.DefaultBuffer, InfText.FixlineBuffer

Methods

create_begin_iter ()

create_end_iter ()

destroy_iter (iter)

erase_text (pos, len, user)

get_encoding ()

get_length ()

get_slice (pos, len)

insert_chunk (pos, chunk, user)

insert_text (pos, text, bytes, len, user)

iter_get_author (iter)

iter_get_bytes (iter)

iter_get_length (iter)

iter_get_offset (iter)

iter_get_text (iter)

iter_next (iter)

iter_prev (iter)

text_erased (pos, chunk, user)

text_inserted (pos, chunk, user)

Virtual Methods

do_create_begin_iter ()

do_create_end_iter ()

do_destroy_iter (iter)

do_erase_text (pos, len, user)

do_get_encoding ()

do_get_length ()

do_get_slice (pos, len)

do_insert_text (pos, chunk, user)

do_iter_get_author (iter)

do_iter_get_bytes (iter)

do_iter_get_length (iter)

do_iter_get_offset (iter)

do_iter_get_text (iter)

do_iter_next (iter)

do_iter_prev (iter)

do_text_erased (pos, chunk, user)

do_text_inserted (pos, chunk, user)

Properties

None

Signals

Name

Short Description

text-erased

text-inserted

Fields

None

Class Details

class InfText.Buffer
Bases:

GObject.GInterface

Structure:

InfText.BufferInterface

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

create_begin_iter()
Returns:

A InfText.BufferIter to be freed by InfText.Buffer.destroy_iter() when done using it, or None.

Return type:

InfText.BufferIter or None

Creates a InfText.BufferIter pointing to the first segment of self. A InfText.BufferIter is used to traverse the buffer contents in steps of so-called segments each of which is written by the same user. The function returns None if there are no segments (i.e. the buffer is empty).

The iterator stays valid as long as the buffer remains unmodified and must be freed with InfText.Buffer.destroy_iter() before.

create_end_iter()
Returns:

A InfText.BufferIter to be freed by InfText.Buffer.destroy_iter() when done using it, or None.

Return type:

InfText.BufferIter or None

Creates a InfText.BufferIter pointing to the last segment of self. A InfText.BufferIter is used to traverse the buffer contents in steps of so-called segments each of which is written by the same user. The function returns None if there are no segments (i.e. the buffer is empty).

The iterator stays valid as long as the buffer remains unmodified and must be freed with InfText.Buffer.destroy_iter() before.

destroy_iter(iter)
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into self.

Destroys a InfText.BufferIter created by InfText.Buffer.create_begin_iter() or InfText.Buffer.create_end_iter().

erase_text(pos, len, user)
Parameters:

Erases characters from the text buffer.

get_encoding()
Returns:

The character encoding for self.

Return type:

str

Returns the character encoding that the buffer uses. This means that all InfText.Chunk return values are encoded in this encoding and all InfText.Chunk parameters are expected to be encoded in that encoding.

get_length()
Returns:

The length of self.

Return type:

int

Returns the number of characters in self.

get_slice(pos, len)
Parameters:
  • pos (int) – Character offset of where to start extracting.

  • len (int) – Number of characters to extract.

Returns:

A InfText.Chunk.

Return type:

InfText.Chunk

Reads len characters, starting at pos, from the buffer, and returns them as a InfText.Chunk.

insert_chunk(pos, chunk, user)
Parameters:

Inserts a InfText.Chunk into self. user must not necessarily be the author of chunk (chunk may even consist of multiple segments). This happens when undoing a delete operation that erased another user’s text.

insert_text(pos, text, bytes, len, user)
Parameters:
  • pos (int) – A character offset into self. text (type=guint8*) (array length=bytes) (transfer none): A pointer to the text to insert.

  • text (object or None) –

  • bytes (int) – The length (in bytes) of text.

  • len (int) – The length (in characters) of text.

  • user (Infinity.User or None) – A Infinity.User that has inserted the new text, or None.

Inserts text into self as written by author. text must be encoded in the character encoding of the buffer, see InfText.Buffer.get_encoding().

iter_get_author(iter)
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into self.

Returns:

The user ID of the user that wrote the segment iter points to.

Return type:

int

Returns the user ID of the user that has written the segment iter points to.

iter_get_bytes(iter)
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into self.

Returns:

The number of bytes of the segment iter points to.

Return type:

int

Returns the length of the segment iter points to, in bytes.

iter_get_length(iter)
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into self.

Returns:

The number of characters of the segment iter points to.

Return type:

int

Returns the length of the segment iter points to, in characters.

iter_get_offset(iter)
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into self.

Returns:

The offset of the first character in the segment iter points to.

Return type:

int

Returns the offset of the first character in the segment iter points to, in characters.

iter_get_text(iter)
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into self.

Returns:

The text of the segment iter points to. Free with GLib.free() when done using it.

Return type:

object or None

Returns the text of the segment iter points to. It is encoded in self's encoding (see InfText.Buffer.get_encoding()).

iter_next(iter)
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into self.

Returns:

Whether iter was moved.

Return type:

bool

Moves iter to point to the next segment in the buffer. If iter already points to the last segment, iter is left unmodified and the function returns False.

iter_prev(iter)
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into self.

Returns:

Whether iter was moved.

Return type:

bool

Moves iter to point to the previous segment in the buffer. If iter already points to the first segment, iter is left unmodified and the function returns False.

text_erased(pos, chunk, user)
Parameters:

Emits the InfText.Buffer ::text-erased signal. This is meant to be used by interface implementations in their erase_text function, or when text was erased by other means.

text_inserted(pos, chunk, user)
Parameters:

Emits the InfText.Buffer ::text-inserted signal. This is meant to be used by interface implementations in their insert_text function, or when text was inserted by other means.

do_create_begin_iter() virtual
Returns:

A InfText.BufferIter to be freed by InfText.Buffer.destroy_iter() when done using it, or None.

Return type:

InfText.BufferIter or None

Creates a InfText.BufferIter pointing to the first segment of buffer. A InfText.BufferIter is used to traverse the buffer contents in steps of so-called segments each of which is written by the same user. The function returns None if there are no segments (i.e. the buffer is empty).

The iterator stays valid as long as the buffer remains unmodified and must be freed with InfText.Buffer.destroy_iter() before.

do_create_end_iter() virtual
Returns:

A InfText.BufferIter to be freed by InfText.Buffer.destroy_iter() when done using it, or None.

Return type:

InfText.BufferIter or None

Creates a InfText.BufferIter pointing to the last segment of buffer. A InfText.BufferIter is used to traverse the buffer contents in steps of so-called segments each of which is written by the same user. The function returns None if there are no segments (i.e. the buffer is empty).

The iterator stays valid as long as the buffer remains unmodified and must be freed with InfText.Buffer.destroy_iter() before.

do_destroy_iter(iter) virtual
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into buffer.

Destroys a InfText.BufferIter created by InfText.Buffer.create_begin_iter() or InfText.Buffer.create_end_iter().

do_erase_text(pos, len, user) virtual
Parameters:

Erases characters from the text buffer.

do_get_encoding() virtual
Returns:

The character encoding for buffer.

Return type:

str

Returns the character encoding that the buffer uses. This means that all InfText.Chunk return values are encoded in this encoding and all InfText.Chunk parameters are expected to be encoded in that encoding.

do_get_length() virtual
Returns:

The length of buffer.

Return type:

int

Returns the number of characters in buffer.

do_get_slice(pos, len) virtual
Parameters:
  • pos (int) – Character offset of where to start extracting.

  • len (int) – Number of characters to extract.

Returns:

A InfText.Chunk.

Return type:

InfText.Chunk

Reads len characters, starting at pos, from the buffer, and returns them as a InfText.Chunk.

do_insert_text(pos, chunk, user) virtual
Parameters:
do_iter_get_author(iter) virtual
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into buffer.

Returns:

The user ID of the user that wrote the segment iter points to.

Return type:

int

Returns the user ID of the user that has written the segment iter points to.

do_iter_get_bytes(iter) virtual
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into buffer.

Returns:

The number of bytes of the segment iter points to.

Return type:

int

Returns the length of the segment iter points to, in bytes.

do_iter_get_length(iter) virtual
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into buffer.

Returns:

The number of characters of the segment iter points to.

Return type:

int

Returns the length of the segment iter points to, in characters.

do_iter_get_offset(iter) virtual
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into buffer.

Returns:

The offset of the first character in the segment iter points to.

Return type:

int

Returns the offset of the first character in the segment iter points to, in characters.

do_iter_get_text(iter) virtual
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into buffer.

Returns:

The text of the segment iter points to. Free with GLib.free() when done using it.

Return type:

object or None

Returns the text of the segment iter points to. It is encoded in buffer's encoding (see InfText.Buffer.get_encoding()).

do_iter_next(iter) virtual
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into buffer.

Returns:

Whether iter was moved.

Return type:

bool

Moves iter to point to the next segment in the buffer. If iter already points to the last segment, iter is left unmodified and the function returns False.

do_iter_prev(iter) virtual
Parameters:

iter (InfText.BufferIter) – A InfText.BufferIter pointing into buffer.

Returns:

Whether iter was moved.

Return type:

bool

Moves iter to point to the previous segment in the buffer. If iter already points to the first segment, iter is left unmodified and the function returns False.

do_text_erased(pos, chunk, user) virtual
Parameters:

Emits the InfText.Buffer ::text-erased signal. This is meant to be used by interface implementations in their erase_text function, or when text was erased by other means.

do_text_inserted(pos, chunk, user) virtual
Parameters:

Emits the InfText.Buffer ::text-inserted signal. This is meant to be used by interface implementations in their insert_text function, or when text was inserted by other means.

Signal Details

InfText.Buffer.signals.text_erased(buffer, object, p0, p1)
Signal Name:

text-erased

Flags:

RUN_FIRST

Parameters:
InfText.Buffer.signals.text_inserted(buffer, object, p0, p1)
Signal Name:

text-inserted

Flags:

RUN_FIRST

Parameters: