Qore FixedLengthUtil Module Reference 1.5
Loading...
Searching...
No Matches
FixedLengthUtil::FixedLengthAbstractWriter Class Referenceabstract

Structured abstract writer for fixed-length lines. More...

#include <FixedLengthAbstractWriter.qc.dox.h>

Inheritance diagram for FixedLengthUtil::FixedLengthAbstractWriter:
[legend]

Public Member Methods

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. More...
 
 constructor (hash< auto > specs, *hash< auto > opts)
 creates the FixedLengthAbstractWriter object More...
 
string formatLine (hash< auto > line)
 Formats a single line from a hash describing the record type and its contents. More...
 
int linesCount ()
 get processed lines count
 
abstract write (hash< auto > line)
 Renders a single line for a single input record hash to the output. More...
 
abstract write (list< auto > lines)
 iterates the input records and writes rendered versions of all input records to the output More...
 
abstract write (Qore::AbstractIterator lines)
 iterates the input records and writes rendered versions of all input records to the output More...
 
- Public Member Methods inherited from FixedLengthUtil::FixedLengthBase
 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

- Private Attributes inherited from FixedLengthUtil::FixedLengthBase
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.
 

Detailed Description

Structured abstract writer for fixed-length lines.

Member Function Documentation

◆ checkTransition()

bool FixedLengthUtil::FixedLengthAbstractWriter::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.

Parameters
fromType of previous line being processed
toType of the current line being processed

◆ constructor()

FixedLengthUtil::FixedLengthAbstractWriter::constructor ( hash< auto >  specs,
*hash< auto >  opts 
)

creates the FixedLengthAbstractWriter object

Parameters
specsFixed-length line specification; see Specification Hash for more information
optsGlobal options; see Global Options for valid values

◆ formatLine()

string FixedLengthUtil::FixedLengthAbstractWriter::formatLine ( hash< auto >  line)

Formats a single line from a hash describing the record type and its contents.

Parameters
linea hash describing the record to be formatted; the hash must have the following keys:
  • "type": a string giving the record type (must be defined in Specification Hash given in the constructor)
  • "record": a hash giving the input record to be rendered (with keys as defined in the Record Description Hash for the record identified by the type argument)
Exceptions
INVALID-LINE-DATAline argument missing either type or record keys
INVALID-RECORDrecord name (type key in the record hash) not recognized
FIELD-INPUT-ERRORthe input value is too large to render into the output field
RECORD-TRANSITION-ERRORa record transition error occurred; an invalid record sequence was given in the input data

◆ write() [1/3]

abstract FixedLengthUtil::FixedLengthAbstractWriter::write ( hash< auto >  line)
pure virtual

Renders a single line for a single input record hash to the output.

Parameters
lineA hash representing input data to be written to the output; the hash must have the following keys:
  • "type": a string giving the record type (must be defined in Specification Hash given in the constructor)
  • "record": a hash giving the input record to be rendered (with keys as defined in the Record Description Hash for the record identified by the type argument)
Exceptions
INVALID-RECORDrecord name (type key in the record hash) not recognized
FIELD-INPUT-ERRORthe input value is too large to render into the output field
RECORD-TRANSITION-ERRORa record transition error occurred; an invalid record sequence was given in the input data

Implemented in FixedLengthUtil::FixedLengthDataWriter, FixedLengthUtil::FixedLengthFileWriter, and FixedLengthUtil::FixedLengthWriter.

◆ write() [2/3]

abstract FixedLengthUtil::FixedLengthAbstractWriter::write ( list< auto >  lines)
pure virtual

iterates the input records and writes rendered versions of all input records to the output

Parameters
linesA list of input records; each list value must be a hash with the following keys:
  • "type": a string giving the record type (must be defined in Specification Hash given in the constructor)
  • "record": a hash giving the input record to be rendered (with keys as defined in the Record Description Hash for the record identified by the type argument)
Exceptions
INVALID-RECORDrecord name (type key in the record hash) not recognized
FIELD-INPUT-ERRORthe input value is too large to render into the output field
RECORD-TRANSITION-ERRORa record transition error occurred; an invalid record sequence was given in the input data

Implemented in FixedLengthUtil::FixedLengthDataWriter, FixedLengthUtil::FixedLengthFileWriter, and FixedLengthUtil::FixedLengthWriter.

◆ write() [3/3]

abstract FixedLengthUtil::FixedLengthAbstractWriter::write ( Qore::AbstractIterator  lines)
pure virtual

iterates the input records and writes rendered versions of all input records to the output

Parameters
linesAn iterator to stream input records; each iterator value must be a hash with the following keys:
  • "type": a string giving the record type (must be defined in Specification Hash given in the constructor)
  • "record": a hash giving the input record to be rendered (with keys as defined in the Record Description Hash for the record identified by the type argument)
Exceptions
INVALID-RECORDrecord name (type key in the record hash) not recognized
FIELD-INPUT-ERRORthe input value is too large to render into the output field
RECORD-TRANSITION-ERRORa record transition error occurred; an invalid record sequence was given in the input data

Implemented in FixedLengthUtil::FixedLengthDataWriter, FixedLengthUtil::FixedLengthFileWriter, and FixedLengthUtil::FixedLengthWriter.