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 from
GObject
.
Functions
hex_buffer_util_get_file_size
Utility function to obtain the size of a GFile
.
hex_buffer_util_new
Utility function to create an on object which implements the HexBuffer interface.
Instance methods
hex_buffer_get_byte
Get a single byte at a particular offset within the buffer.
hex_buffer_get_data
Get data of a particular size at a particular offset within the buffer.
hex_buffer_get_payload_size
Get the size of the payload of the buffer, in bytes.
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_read_finish
Obtain the result of a completed file read operation.
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.
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()
.
hex_buffer_write_to_file_finish
Obtain the result of a completed write-to-file operation.
Properties
Hex.Buffer:file
This property is the file (as GFile
) being utilized by the buffer.
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
);
None padding;
}
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.get_byte
Get a single byte at a particular offset within the buffer.
Hex.Buffer.get_data
Get data of a particular size at a particular offset within the buffer.
Hex.Buffer.get_file
Hex.Buffer.get_payload_size
Get the size of the payload of the buffer, in bytes.
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.read_finish
Obtain the result of a completed file read operation.
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.
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()
.
Hex.Buffer.write_to_file_finish
Obtain the result of a completed write-to-file operation.