FixedLengthAbstractIterator.qc.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
/* FixedLengthAbstractIterator Copyright 2015 - 2019 Qore Technologies, s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
namespace FixedLengthUtil {
class FixedLengthAbstractIterator : public FixedLengthBase,public Qore::AbstractIterator {
public:
protected:
// rules keyed by field length then by record name
hash<string, hash<string, list<hash<auto>>>> m_resolve_by_rule;
// all rules; keyed by record name
hash<string, list<hash<auto>>> m_resolve_by_rule_all;
string m_state;
hash m_resolve_by_length;
AbstractLineIterator lineIterator;
public:
constructor(AbstractLineIterator li, hash<auto> spec, *hash<auto> opts)
;
bool valid();
bool next();
string getLine();
*hash<auto> getValue();
int index();
auto transform(auto value, hash<auto> type);
protected:
static *hash<auto> checkOptions(*hash<auto> opts);
public:
string identifyType(string input_line);
*string identifyTypeImpl(string input_line);
bool identifyRecord(list<auto> rec_rule, string input_line);
bool checkTransition(*string from, *string to);
};
};
FixedLengthUtil::FixedLengthAbstractIterator
Structured line iterator for abstract data allowing efficient "pipelined" processing.
Definition: FixedLengthAbstractIterator.qc.dox.h:29
FixedLengthUtil::FixedLengthBase
Base class for fixed-length readers and writers.
Definition: FixedLengthBase.qc.dox.h:29
FixedLengthUtil::FixedLengthAbstractIterator::transform
auto transform(auto value, hash< auto > type)
parses the input value based on global configuration and the current field definition ...
FixedLengthUtil::FixedLengthAbstractIterator::checkOptions
static *hash< auto > checkOptions(*hash< auto > opts)
Validate and prepare global fixed-length options.
FixedLengthUtil::FixedLengthAbstractIterator::identifyType
string identifyType(string input_line)
Identify a fixed-length line type using identifyTypeImpl(), that may be overridden if necessary...
FixedLengthUtil::FixedLengthAbstractIterator::checkTransition
bool checkTransition(*string from, *string to)
A verification function to be called for each line. This method can be overridden to achieve a begin-...
FixedLengthUtil::FixedLengthAbstractIterator::identifyTypeImpl
*string identifyTypeImpl(string input_line)
Identify a fixed-length line type, given the raw line string. This method performs a lookup to a prec...
FixedLengthUtil::FixedLengthAbstractIterator::identifyRecord
bool identifyRecord(list< auto > rec_rule, string input_line)
Attempts to identify a single record.
FixedLengthUtil::FixedLengthAbstractIterator::next
bool next()
Moves the current line / record position to the next line / record; returns False if there are no mor...
FixedLengthUtil::FixedLengthAbstractIterator::m_resolve_by_length
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
Definition: FixedLengthAbstractIterator.qc.dox.h:39
FixedLengthUtil::FixedLengthAbstractIterator::getValue
*hash< auto > getValue()
Returns the current record as a hash.
FixedLengthUtil
The FixedLengthUtil namespace contains all the definitions in the FixedLengthUtil module...
Definition: FixedLengthAbstractIterator.qc.dox.h:27
FixedLengthUtil::FixedLengthAbstractIterator::constructor
constructor(AbstractLineIterator li, hash< auto > spec, *hash< auto > opts)
Instantiates the FixedLengthAbstractIterator object.
type
string type(auto arg)
hash
hash< auto > hash(object obj)
Qore::AbstractIterator