Interface
HexBuffer
Description
interface Hex.Buffer : GObject.Object
HexBuffer
is an interface which can be implemented to act as a buffer
for HexDocument
data. This allows for a HexDocument
to be
manipulated by different backends.
Once a file has been loaded into the buffer, it can be read, written to file, etc.
HexBuffer
makes reference to the “payload,” which is the size of the
substantive data in the buffer, not counting items like padding, a gap,
etc. (all dependent upon the underlying implementation).
Most clients who just want to create an spin up a HexBuffer
object should
look to the hex_buffer_util_new()
utility function as a starting
point, and then manipulate the returned HexBuffer
object with the methods
documented herein.
Prerequisite
In order to implement Buffer, your type must inherit fromGObject
.
Functions
hex_buffer_util_new
Utility function to create an on object which implements the HexBuffer interface.
Instance methods
hex_buffer_read
Read the GFile
, previously set, into the buffer. This method will block
until the operation is complete. For a non-blocking version, use
hex_buffer_read_async()
.
hex_buffer_read_async
Read the GFile
, previously set, into the buffer. This is the non-blocking
version of hex_buffer_read()
.
hex_buffer_set_data
Set data at of the buffer at a particular offset, replacing some, all or none of the existing data in the buffer as desired.
hex_buffer_set_file
Set the GFile
to be utilized by the buffer. Once it has been set,
you can read it into the buffer with hex_buffer_read()
or
hex_buffer_read_async()
.
hex_buffer_write_to_file
Write the buffer to the GFile
specified. This operation will block. For a
non-blocking version, use hex_buffer_write_to_file_async()
.
hex_buffer_write_to_file_async
Write the buffer to the GFile
specified. This is the non-blocking
version of hex_buffer_write_to_file()
.
Interface structure
struct HexBufferInterface {
GTypeInterface parent_iface;
char* (* get_data) (
HexBuffer* self,
gint64 offset,
size_t len
);
char (* get_byte) (
HexBuffer* self,
gint64 offset
);
gboolean (* set_data) (
HexBuffer* self,
gint64 offset,
size_t len,
size_t rep_len,
char* data
);
GFile* (* get_file) (
HexBuffer* self
);
gboolean (* set_file) (
HexBuffer* self,
GFile* file
);
gboolean (* read) (
HexBuffer* self
);
void (* read_async) (
HexBuffer* self,
GCancellable* cancellable,
GAsyncReadyCallback callback,
gpointer user_data
);
gboolean (* read_finish) (
HexBuffer* self,
GAsyncResult* result,
GError** error
);
gboolean (* write_to_file) (
HexBuffer* self,
GFile* file
);
void (* write_to_file_async) (
HexBuffer* self,
GFile* file,
GCancellable* cancellable,
GAsyncReadyCallback callback,
gpointer user_data
);
gboolean (* write_to_file_finish) (
HexBuffer* self,
GAsyncResult* result,
GError** error
);
gint64 (* get_payload_size) (
HexBuffer* self
);
gpointer padding;
}
No description available.
Interface members
parent_iface |
|
No description available. |
|
get_data |
|
No description available. |
|
get_byte |
|
No description available. |
|
set_data |
|
No description available. |
|
get_file |
|
No description available. |
|
set_file |
|
No description available. |
|
read |
|
No description available. |
|
read_async |
|
No description available. |
|
read_finish |
|
No description available. |
|
write_to_file |
|
No description available. |
|
write_to_file_async |
|
No description available. |
|
write_to_file_finish |
|
No description available. |
|
get_payload_size |
|
No description available. |
|
padding |
|
No description available. |
Virtual methods
Hex.Buffer.read
Read the GFile
, previously set, into the buffer. This method will block
until the operation is complete. For a non-blocking version, use
hex_buffer_read_async()
.
Hex.Buffer.read_async
Read the GFile
, previously set, into the buffer. This is the non-blocking
version of hex_buffer_read()
.
Hex.Buffer.set_data
Set data at of the buffer at a particular offset, replacing some, all or none of the existing data in the buffer as desired.
Hex.Buffer.set_file
Set the GFile
to be utilized by the buffer. Once it has been set,
you can read it into the buffer with hex_buffer_read()
or
hex_buffer_read_async()
.
Hex.Buffer.write_to_file
Write the buffer to the GFile
specified. This operation will block. For a
non-blocking version, use hex_buffer_write_to_file_async()
.
Hex.Buffer.write_to_file_async
Write the buffer to the GFile
specified. This is the non-blocking
version of hex_buffer_write_to_file()
.