A class for tokenized reading of lines, that can be attached to open file handles.
There might be other reference to the the file handle.
Construct an AttachedFileReader_t
If the argument echo_lines
is present, then the read lines are
echoed to the unit echo_lines
. If the argument is not present,
the echoing is switched off.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | file_id | |||
integer, | intent(in), | optional | :: | echo_lines | ||
character(len=*), | intent(in), | optional | :: | file_name | ||
integer, | intent(in), | optional | :: | current_line |
Close the file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(FileReader_t), | intent(inout) | :: | this | |||
logical, | intent(in), | optional | :: | delete |
Return if the next line can be read. It is written to the out-argument.
Note that it reads the next logical line, so if there are two lines connected by a line-continuation symbol, the two lines will be read.
If skip_empty
is true, then lines that have no tokens
are automatically skipped and the next logical line is tested.
Note that empty lines includes lines that are not blank, but contain only comments.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(FileReader_t), | intent(inout) | :: | this | |||
type(TokenIterator_t), | intent(out) | :: | tokenized_line | |||
logical, | intent(in) | :: | skip_empty |
Rewind the file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(FileReader_t), | intent(inout) | :: | this |
Set the unit where to echo lines.
If the argument is present, then the read lines are
echoed to the unit echo_lines
. If the argument is not present,
the echoing is switched off.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(FileReader_t), | intent(inout) | :: | this | |||
integer, | intent(in), | optional | :: | echo_lines |
Return the current line (if defined)
This is the line that would be returned, when calling this%raw_nextline()
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(FileReader_t), | intent(in) | :: | this |
Return the file name (if defined)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(FileReader_t), | intent(in) | :: | this |