Utilities used by tsv-utils applications. InputFieldReordering, BufferedOututRange, and a several others.
Utilities in this file:
Copyright (c) 2015-2019, eBay Software Foundation Initially written by Jon Degenhardt
No.allowFieldNumZero parameter controls whether zero is a valid field. This is used by makeFieldListOptionHander and parseFieldList.
No.convertToZeroBasedIndex parameter controls whether field numbers are converted to zero-based indices by makeFieldListOptionHander and parseFieldList.
Flag used by the InputFieldReordering template.
No.newlineWasRemoved is a template parameter to throwIfWindowsNewlineOnUnix. A Yes value indicates the Unix newline was already removed, as might be done via std.File.byLine or similar mechanism.
InputFieldReordering - Move select fields from an input line to an output array, reordering along the way.
bufferedByLine is a performance enhancement over std.stdio.File.byLine. It works by reading a large buffer from the input stream rather than just a single line.
getTsvFieldValue extracts the value of a single field from a delimited text string.
joinAppend performs a join operation on an input range, appending the results to an output range.
makeFieldListOptionHandler creates a std.getopt option hander for processing field lists entered on the command line. A field list is as defined by parseFieldList.
parseFieldList lazily generates a range of fields numbers from a 'field-list' string.
throwIfWindowsLineNewlineOnUnix is used to throw an exception if a Windows/DOS line ending is found on a build compiled for a Unix platform. This is used by the TSV Utilities to detect Window/DOS line endings and terminate processing with an error message to the user.
BufferedOutputRange is a performance enhancement over writing directly to an output stream. It holds a File open for write or an OutputRange. Ouput is accumulated in an internal buffer and written to the output stream as a block.