InputSource

InputSource is a class of objects produced by iterating over an InputSourceRange.

An InputSource object provides access to the open file currently the front element of an InputSourceRange. The main methods application code is likely to need are:

  • file() - Returns the File object. The file will be open for reading as long InputSource instance is the front element of the InputSourceRange it came from.
  • header(KeepTerminator keepTerminator = No.keepTerminator) - Returns the header line from the file. An empty string is returned if InputSource range was created with readHeader=false.
  • name() - The name of the input source. The name returned is intended for user error messages. For files, this is the filepath that was passed to InputSourceRange. For standard input, it is "Standard Input".

An InputSource is a reference object, so the copies will retain the state of the InputSourceRange front element. In particular, all copies will have the open state of the front element of the InputSourceRange.

This class is not intended for use outside the context of an InputSourceRange.

Members

Functions

file
File file()

file returns the File object held by the InputSource.

header
string header(KeepTerminator keepTerminator)

header returns the header line from the input file.

isHeaderEmpty
bool isHeaderEmpty()

isHeaderEmpty returns true if there is no data for a header, including the terminator.

isOpen
bool isOpen()

isOpen returns true if the input source is open for reading, false otherwise.

isReadHeaderEnabled
bool isReadHeaderEnabled()

isReadHeaderEnabled returns true if the header line is being read.

isStdin
bool isStdin()

isStdin returns true if the input source is Standard Input, false otherwise.

name
string name()

name returns a user friendly name representing the input source.

Meta