Starts reading _file_data. _short_name and _full_path only label the messages the handler reports.
The text is not copied, so it must outlive the reading; deinit does not free it.
start_from_memory :: (
handler: *Text_File_Handler,
_short_name: string,
_full_path: string,
_file_data: string,
loc := #caller_location
)
Anything the handler held before is released and failed is cleared. With do_version_number set
the first line that is not a comment or blank is read as a header [n]; if it is missing or is not
a non-negative number, failed is set and an error is logged.
Parameters
- handler: *Text_File_Handler
- _short_name: string
- _full_path: string
- _file_data: string
- loc := #caller_location
handler: Text_File_Handler;
start_from_memory(*handler, "config", "config", "[2]\nname jai\n");
defer deinit(*handler);
assert(!handler.failed && handler.version == 2);
line, found := consume_next_line(*handler);
assert(found && line == "name jai");