InfText.Buffer¶
- Implementations:
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
None
Signals¶
Name |
Short Description |
---|---|
Fields¶
None
Class Details¶
- class InfText.Buffer¶
- Bases:
- Structure:
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 byInfText.Buffer.destroy_iter
() when done using it, orNone
.- Return type:
Creates a
InfText.BufferIter
pointing to the first segment of self. AInfText.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 returnsNone
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 byInfText.Buffer.destroy_iter
() when done using it, orNone
.- Return type:
Creates a
InfText.BufferIter
pointing to the last segment of self. AInfText.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 returnsNone
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
) – AInfText.BufferIter
pointing into self.
Destroys a
InfText.BufferIter
created byInfText.Buffer.create_begin_iter
() orInfText.Buffer.create_end_iter
().
- erase_text(pos, len, user)¶
- Parameters:
pos (
int
) – The position to begin deleting characters from.len (
int
) – The amount of characters to delete.user (
Infinity.User
orNone
) – AInfinity.User
that erases the text, orNone
.
Erases characters from the text buffer.
- get_encoding()¶
- Returns:
The character encoding for self.
- Return type:
Returns the character encoding that the buffer uses. This means that all
InfText.Chunk
return values are encoded in this encoding and allInfText.Chunk
parameters are expected to be encoded in that encoding.
- get_length()¶
- Returns:
The length of self.
- Return type:
Returns the number of characters in self.
- get_slice(pos, len)¶
- Parameters:
- Returns:
- Return type:
Reads len characters, starting at pos, from the buffer, and returns them as a
InfText.Chunk
.
- insert_chunk(pos, chunk, user)¶
- Parameters:
pos (
int
) – A character offset into self.chunk (
InfText.Chunk
) – AInfText.Chunk
.user (
Infinity.User
orNone
) – AInfinity.User
inserting chunk, orNone
.
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.bytes (
int
) – The length (in bytes) of text.len (
int
) – The length (in characters) of text.user (
Infinity.User
orNone
) – AInfinity.User
that has inserted the new text, orNone
.
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
) – AInfText.BufferIter
pointing into self.- Returns:
The user ID of the user that wrote the segment iter points to.
- Return type:
Returns the user ID of the user that has written the segment iter points to.
- iter_get_bytes(iter)¶
- Parameters:
iter (
InfText.BufferIter
) – AInfText.BufferIter
pointing into self.- Returns:
The number of bytes of the segment iter points to.
- Return type:
Returns the length of the segment iter points to, in bytes.
- iter_get_length(iter)¶
- Parameters:
iter (
InfText.BufferIter
) – AInfText.BufferIter
pointing into self.- Returns:
The number of characters of the segment iter points to.
- Return type:
Returns the length of the segment iter points to, in characters.
- iter_get_offset(iter)¶
- Parameters:
iter (
InfText.BufferIter
) – AInfText.BufferIter
pointing into self.- Returns:
The offset of the first character in the segment iter points to.
- Return type:
Returns the offset of the first character in the segment iter points to, in characters.
- iter_get_text(iter)¶
- Parameters:
iter (
InfText.BufferIter
) – AInfText.BufferIter
pointing into self.- Returns:
The text of the segment iter points to. Free with
GLib.free
() when done using it.- Return type:
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
) – AInfText.BufferIter
pointing into self.- Returns:
Whether iter was moved.
- Return type:
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
) – AInfText.BufferIter
pointing into self.- Returns:
Whether iter was moved.
- Return type:
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:
pos (
int
) – The position to begin deleting characters from.chunk (
InfText.Chunk
) – AInfText.Chunk
containing the erased text.user (
Infinity.User
orNone
) – AInfinity.User
that erases the text, orNone
.
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:
pos (
int
) – A character offset into self.chunk (
InfText.Chunk
) – AInfText.Chunk
.user (
Infinity.User
orNone
) – AInfinity.User
inserting chunk, orNone
.
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 byInfText.Buffer.destroy_iter
() when done using it, orNone
.- Return type:
Creates a
InfText.BufferIter
pointing to the first segment of buffer. AInfText.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 returnsNone
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 byInfText.Buffer.destroy_iter
() when done using it, orNone
.- Return type:
Creates a
InfText.BufferIter
pointing to the last segment of buffer. AInfText.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 returnsNone
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
) – AInfText.BufferIter
pointing into buffer.
Destroys a
InfText.BufferIter
created byInfText.Buffer.create_begin_iter
() orInfText.Buffer.create_end_iter
().
- do_erase_text(pos, len, user) virtual¶
- Parameters:
pos (
int
) – The position to begin deleting characters from.len (
int
) – The amount of characters to delete.user (
Infinity.User
orNone
) – AInfinity.User
that erases the text, orNone
.
Erases characters from the text buffer.
- do_get_encoding() virtual¶
- Returns:
The character encoding for buffer.
- Return type:
Returns the character encoding that the buffer uses. This means that all
InfText.Chunk
return values are encoded in this encoding and allInfText.Chunk
parameters are expected to be encoded in that encoding.
- do_get_length() virtual¶
- Returns:
The length of buffer.
- Return type:
Returns the number of characters in buffer.
- do_get_slice(pos, len) virtual¶
- Parameters:
- Returns:
- Return type:
Reads len characters, starting at pos, from the buffer, and returns them as a
InfText.Chunk
.
- do_insert_text(pos, chunk, user) virtual¶
- Parameters:
pos (
int
) –chunk (
InfText.Chunk
) –user (
Infinity.User
) –
- do_iter_get_author(iter) virtual¶
- Parameters:
iter (
InfText.BufferIter
) – AInfText.BufferIter
pointing into buffer.- Returns:
The user ID of the user that wrote the segment iter points to.
- Return type:
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
) – AInfText.BufferIter
pointing into buffer.- Returns:
The number of bytes of the segment iter points to.
- Return type:
Returns the length of the segment iter points to, in bytes.
- do_iter_get_length(iter) virtual¶
- Parameters:
iter (
InfText.BufferIter
) – AInfText.BufferIter
pointing into buffer.- Returns:
The number of characters of the segment iter points to.
- Return type:
Returns the length of the segment iter points to, in characters.
- do_iter_get_offset(iter) virtual¶
- Parameters:
iter (
InfText.BufferIter
) – AInfText.BufferIter
pointing into buffer.- Returns:
The offset of the first character in the segment iter points to.
- Return type:
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
) – AInfText.BufferIter
pointing into buffer.- Returns:
The text of the segment iter points to. Free with
GLib.free
() when done using it.- Return type:
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
) – AInfText.BufferIter
pointing into buffer.- Returns:
Whether iter was moved.
- Return type:
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
) – AInfText.BufferIter
pointing into buffer.- Returns:
Whether iter was moved.
- Return type:
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:
pos (
int
) – The position to begin deleting characters from.chunk (
InfText.Chunk
) – AInfText.Chunk
containing the erased text.user (
Infinity.User
orNone
) – AInfinity.User
that erases the text, orNone
.
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:
pos (
int
) – A character offset into buffer.chunk (
InfText.Chunk
) – AInfText.Chunk
.user (
Infinity.User
orNone
) – AInfinity.User
inserting chunk, orNone
.
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:
- Parameters:
buffer (
InfText.Buffer
) – The object which received the signalobject (
int
) –p0 (
InfText.Chunk
) –p1 (
Infinity.User
) –
- InfText.Buffer.signals.text_inserted(buffer, object, p0, p1)¶
- Signal Name:
text-inserted
- Flags:
- Parameters:
buffer (
InfText.Buffer
) – The object which received the signalobject (
int
) –p0 (
InfText.Chunk
) –p1 (
Infinity.User
) –