![]() |
Qore FixedLengthUtil Module Reference 1.6
|
The FixedLengthIterator class allows fixed-length data sources to be iterated on a record basis. The source of the input data is an AbstractLineIterator object or an InputStream. More...
#include <FixedLengthIterator.qc.dox.h>
Public Member Methods | |
constructor (Qore::AbstractLineIterator li, hash< auto > spec, *hash< auto > opts) | |
Creates the FixedLengthIterator in single-type mode with general line iterator to read and an option hash. | |
constructor (Qore::InputStream input, string encoding='UTF-8', hash< auto > spec, *hash< auto > opts) | |
Instantiates the FixedLengthIterator object from an InputStream. | |
constructor (Qore::StringInputStream input, hash< auto > spec, *hash< auto > opts) | |
Instantiates the FixedLengthIterator object from a StringInputStream. | |
![]() | |
bool | checkTransition (*string from, *string to) |
A verification function to be called for each line. This method can be overridden to achieve a begin-to-end validation of the whole input file. | |
constructor (AbstractLineIterator li, hash< auto > spec, *hash< auto > opts) | |
Instantiates the FixedLengthAbstractIterator object. | |
*hash< auto > | getValue () |
Returns the current record as a hash. | |
bool | identifyRecord (list< auto > rec_rule, string input_line) |
Attempts to identify a single record. | |
string | identifyType (string input_line) |
Identify a fixed-length line type using identifyTypeImpl(), that may be overridden if necessary. | |
*string | identifyTypeImpl (string input_line) |
Identify a fixed-length line type, given the raw line string. This method performs a lookup to a precalculated table based on line lengths (see constructor()). In case different criteria are needed, eg. when two line types in a spec have the same length and no unique resolving rule are specified, this method needs to be overridden, and will throw an exception, because the precalculated mapping will be empty. | |
bool | next () |
Moves the current line / record position to the next line / record; returns False if there are no more lines to iterate. | |
auto | transform (auto value, hash< auto > type) |
parses the input value based on global configuration and the current field definition | |
![]() | |
constructor (hash< auto > m_specs, *hash< auto > m_opts) | |
Creates the object from the record specifications. | |
*hash< string, AbstractDataField > | getRecordType () |
Returns the description of the record type, if any. | |
Additional Inherited Members | |
![]() | |
static *hash< auto > | checkOptions (*hash< auto > opts) |
Validate and prepare global fixed-length options. | |
![]() | |
hash | m_resolve_by_length |
hash of type without rule, i.e.potentially conflicting records; key = record length, value = list of no-rule type names | |
![]() | |
const | GlobalOptionMap = ... |
Translates from global options to data provider options. | |
*hash< auto > | m_opts |
Global input or output options. | |
hash< auto > | m_specs |
The record specifications. | |
The FixedLengthIterator class allows fixed-length data sources to be iterated on a record basis. The source of the input data is an AbstractLineIterator object or an InputStream.
FixedLengthUtil::FixedLengthIterator::constructor | ( | Qore::AbstractLineIterator | li, |
hash< auto > | spec, | ||
*hash< auto > | opts | ||
) |
Creates the FixedLengthIterator in single-type mode with general line iterator to read and an option hash.
li | line iterator of fixed-length file to read |
spec | Fixed-length line specification; see Specification Hash for more information |
opts | Global options; see Global Options for more information |
FixedLengthUtil::FixedLengthIterator::constructor | ( | Qore::InputStream | input, |
string | encoding = 'UTF-8' , |
||
hash< auto > | spec, | ||
*hash< auto > | opts | ||
) |
Instantiates the FixedLengthIterator object from an InputStream.
input | The InputStream providing input data to process |
encoding | the encoding of the input stream |
spec | Fixed-length line specification; see Specification Hash for more information |
opts | Global options; see Global Options for valid values |
FixedLengthUtil::FixedLengthIterator::constructor | ( | Qore::StringInputStream | input, |
hash< auto > | spec, | ||
*hash< auto > | opts | ||
) |
Instantiates the FixedLengthIterator object from a StringInputStream.
input | The InputStream providing input data to process |
encoding | the encoding of the input stream |
spec | Fixed-length line specification; see Specification Hash for more information |
opts | Global options; see Global Options for valid values |