| Qore FixedLengthUtil Module Reference 1.6

Loading...
Searching...
No Matches
FixedLengthAbstractIterator.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* FixedLengthAbstractIterator Copyright 2015 - 2024 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
25
27 namespace FixedLengthUtil {
29 class FixedLengthAbstractIterator : public FixedLengthBase, public Qore::AbstractIterator {
30
31 public:
32 protected:
33 // rules keyed by field length then by record name
34 hash<string, hash<string, list<hash<auto>>>> m_resolve_by_rule;
35 // all rules; keyed by record name
36 hash<string, list<hash<auto>>> m_resolve_by_rule_all;
37 string m_state;
39 hash m_resolve_by_length;
40 AbstractLineIterator lineIterator;
41
42 public:
43
45
52 constructor(AbstractLineIterator li, hash<auto> spec, *hash<auto> opts) ;
53
54
55 bool valid();
56
57
59
64 bool next();
65
66
67 string getLine();
68
69
71
80 *hash<auto> getValue();
81
82
83 int index();
84
85
87 auto transform(auto value, hash<auto> type);
88
89
91
94 protected:
95 static *hash<auto> checkOptions(*hash<auto> opts);
96 public:
97
98
100
107 string identifyType(string input_line);
108
109
111
119 *string identifyTypeImpl(string input_line);
120
121
123 bool identifyRecord(list<auto> rec_rule, string input_line);
124
125
127
131 bool checkTransition(*string from, *string to);
132
133};
134};
FixedLengthUtil::FixedLengthAbstractIterator
Structured line iterator for abstract data allowing efficient "pipelined" processing.
Definition FixedLengthAbstractIterator.qc.dox.h:29
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::identifyType
string identifyType(string input_line)
Identify a fixed-length line type using identifyTypeImpl(), that may be overridden if necessary.
FixedLengthUtil::FixedLengthAbstractIterator::constructor
constructor(AbstractLineIterator li, hash< auto > spec, *hash< auto > opts)
Instantiates the FixedLengthAbstractIterator object.
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::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,...
Definition FixedLengthAbstractIterator.qc.dox.h:39
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::identifyRecord
bool identifyRecord(list< auto > rec_rule, string input_line)
Attempts to identify a single record.
FixedLengthUtil::FixedLengthAbstractIterator::checkOptions
static *hash< auto > checkOptions(*hash< auto > opts)
Validate and prepare global fixed-length options.
FixedLengthUtil::FixedLengthAbstractIterator::getValue
*hash< auto > getValue()
Returns the current record as a hash.
FixedLengthUtil::FixedLengthBase
Base class for fixed-length readers and writers.
Definition FixedLengthBase.qc.dox.h:29
Qore::AbstractIterator
FixedLengthUtil
The FixedLengthUtil namespace contains all the definitions in the FixedLengthUtil module.
Definition FixedLengthAbstractIterator.qc.dox.h:27