lib/file: Clarify what the functions do, take cursor position into account for cut functions and add missing cut function
parent
ab1164557d
commit
a9759e3bc2
|
@ -45,6 +45,7 @@ class File {
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
// only applicable to read and edit modes
|
// only applicable to read and edit modes
|
||||||
|
// moves the cursor to the right of the read section
|
||||||
ErrorOr<uint8_t> readByte();
|
ErrorOr<uint8_t> readByte();
|
||||||
ErrorOr<std::vector<uint8_t>> read(uint64_t bytes);
|
ErrorOr<std::vector<uint8_t>> read(uint64_t bytes);
|
||||||
// @SodaFountain (or whoever ends up implementing this):
|
// @SodaFountain (or whoever ends up implementing this):
|
||||||
|
@ -57,20 +58,24 @@ class File {
|
||||||
// only applicable to write, modify, append, and edit modes
|
// only applicable to write, modify, append, and edit modes
|
||||||
// in modify and edit modes, overwrite whatever is at the
|
// in modify and edit modes, overwrite whatever is at the
|
||||||
// cursor position if there is anything there
|
// cursor position if there is anything there
|
||||||
|
// moves the cursor to the right of the written section
|
||||||
ErrorOrVoid writeByte(uint8_t byte);
|
ErrorOrVoid writeByte(uint8_t byte);
|
||||||
ErrorOrVoid write(std::vector<uint8_t> data);
|
ErrorOrVoid write(std::vector<uint8_t> data);
|
||||||
ErrorOrVoid writeString(tiny_utf8::string string);
|
ErrorOrVoid writeString(tiny_utf8::string string);
|
||||||
|
|
||||||
// only applicable to modify and edit modes
|
// only applicable to modify and edit modes
|
||||||
// insert at cursor position and move other contents to the right
|
// insert at cursor position and move other contents to the right
|
||||||
|
// moves the cursor to the right of the inserted section
|
||||||
ErrorOrVoid insertByte(uint8_t byte);
|
ErrorOrVoid insertByte(uint8_t byte);
|
||||||
ErrorOrVoid insert(std::vector<uint8_t> data);
|
ErrorOrVoid insert(std::vector<uint8_t> data);
|
||||||
ErrorOrVoid insertString(tiny_utf8::string string);
|
ErrorOrVoid insertString(tiny_utf8::string string);
|
||||||
|
|
||||||
// only applicable to edit mode
|
// only applicable to edit mode
|
||||||
// return the cut section, remove cut section from file
|
// return the cut section, remove cut section from file
|
||||||
ErrorOr<std::vector<uint8_t>> cut(uint64_t start, uint64_t end);
|
// moves the cursor to the right of where it happened
|
||||||
ErrorOr<tiny_utf8::string> cutString(uint64_t start, uint64_t end);
|
ErrorOr<uint8_t> cutByte();
|
||||||
|
ErrorOr<std::vector<uint8_t>> cut(uint64_t length);
|
||||||
|
ErrorOr<tiny_utf8::string> cutString(uint64_t length);
|
||||||
|
|
||||||
// modes:
|
// modes:
|
||||||
// r (read)
|
// r (read)
|
||||||
|
|
Loading…
Reference in New Issue