binaryEditor/binaryEditor.h
2025-09-19 20:36:01 -04:00

48 lines
960 B
C

#ifndef BINARYEDITOR
#define BINARYEDITOR
typedef enum{
BUF_IN,
BUF_OUT
} Buffer;
/**
Allows setting the input and output buffers for the binary editor.
*/
void setBuffer(Buffer buffer, void *data);
/**
Allows the changing of the read/write position in the given buffer.
position is specified in bits.
*/
void seekBuffer(Buffer buffer, unsigned int position);
/**
Returns what the current offset of a buffer is, in bits.
It gives the index of the next bit to be read/written
*/
unsigned int getBufferOffset(Buffer buffer);
/**
Returns the next bit from the read buffer.
*/
char readBit();
/**
Returns the next 8 bits from the read buffer.
This is equivalent to calling readBit() 8 times.
*/
char readByte();
/**
This writes a single bit to the output buffer
*/
void writeBit(unsigned char bit);
/**
This writes one byte to the output buffer.
This is equivalent to calling writeBit() 8 times.
*/
void writeByte(unsigned char byte);
#endif