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(); | ||||
| 
 | ||||
|         // only applicable to read and edit modes
 | ||||
|         // moves the cursor to the right of the read section
 | ||||
|         ErrorOr<uint8_t> readByte(); | ||||
|         ErrorOr<std::vector<uint8_t>> read(uint64_t bytes); | ||||
|         // @SodaFountain (or whoever ends up implementing this):
 | ||||
|  | @ -57,20 +58,24 @@ class File { | |||
|         // only applicable to write, modify, append, and edit modes
 | ||||
|         // in modify and edit modes, overwrite whatever is at the
 | ||||
|         // cursor position if there is anything there
 | ||||
|         // moves the cursor to the right of the written section
 | ||||
|         ErrorOrVoid writeByte(uint8_t byte); | ||||
|         ErrorOrVoid write(std::vector<uint8_t> data); | ||||
|         ErrorOrVoid writeString(tiny_utf8::string string); | ||||
| 
 | ||||
|         // only applicable to modify and edit modes
 | ||||
|         // 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 insert(std::vector<uint8_t> data); | ||||
|         ErrorOrVoid insertString(tiny_utf8::string string); | ||||
| 
 | ||||
|         // only applicable to edit mode
 | ||||
|         // return the cut section, remove cut section from file
 | ||||
|         ErrorOr<std::vector<uint8_t>> cut(uint64_t start, uint64_t end); | ||||
|         ErrorOr<tiny_utf8::string> cutString(uint64_t start, uint64_t end); | ||||
|         // moves the cursor to the right of where it happened
 | ||||
|         ErrorOr<uint8_t> cutByte(); | ||||
|         ErrorOr<std::vector<uint8_t>> cut(uint64_t length); | ||||
|         ErrorOr<tiny_utf8::string> cutString(uint64_t length); | ||||
| 
 | ||||
|         // modes:
 | ||||
|         //  r (read)
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 BodgeMaster
						BodgeMaster