Qore FixedLengthUtil Module Reference  1.5
FixedLengthReadDataProvider.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* FixedLengthReadDataProvider Copyright 2015 - 2022 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 
26 namespace FixedLengthUtil {
28 
30 class FixedLengthReadDataProvider : public DataProvider::AbstractDataProvider {
31 
32 public:
34  const ProviderInfo = <DataProviderInfo>{
35  "type": "FixedLengthReadDataProvider",
36  "supports_read": True,
37  "has_record": True,
38  "supports_search_expressions": True,
39  "constructor_options": ConstructorOptions,
40  "search_options": GenericRecordSearchOptions,
41  "expressions": AbstractDataProvider::GenericExpressions,
42  };
43 
46  "path": <DataProviderOptionInfo>{
47  "type": AbstractDataProviderType::get(StringType),
48  "desc": "the path to the fixed-length data; mutually exclusive with \"stream\"; resolved with a call "
49  "to FileLocationHandler::getBinaryStreamFromLocation()",
50  },
51  "stream": <DataProviderOptionInfo>{
52  "type": AbstractDataProviderType::get(new Type("InputStream")),
53  "desc": "the input stream for fixed-length data; mutually exclusive with \"path\"",
54  },
55  "spec": <DataProviderOptionInfo>{
56  "type": AbstractDataProviderType::get(AutoHashType),
57  "desc": "the fixed-length record specification hash",
58  "required": True,
59  },
60  "date_format": <DataProviderOptionInfo>{
61  "type": AbstractDataProviderType::get(StringType),
62  "desc": "the default global date format for `date` fields",
63  },
64  "encoding": <DataProviderOptionInfo>{
65  "type": AbstractDataProviderType::get(StringType),
66  "desc": "the encoding for strings",
67  },
68  "eol": <DataProviderOptionInfo>{
69  "type": AbstractDataProviderType::get(StringType),
70  "desc": "the end of line characters",
71  },
72  "ignore_empty": <DataProviderOptionInfo>{
73  "type": AbstractDataProviderType::get(SoftBoolType),
74  "desc": "if `true` then empty lines are ignored",
75  },
76  "number_format": <DataProviderOptionInfo>{
77  "type": AbstractDataProviderType::get(StringType),
78  "desc": "the default global number format for `float` or `number` fields",
79  },
80  "timezone": <DataProviderOptionInfo>{
81  "type": AbstractDataProviderType::get(StringType),
82  "desc": "a string giving a time zone region name or an integer offset in seconds east of UTC",
83  },
84  };
85 
87  const FixedLengthReadOptionList = keys (ConstructorOptions - ("path", "stream", "spec"));
88 
89 protected:
92 
93 public:
94 
96 
102  constructor(string path, hash<auto> spec, __7_ hash<auto> opts);
103 
104 
106 
112  constructor(StringInputStream stream, hash<auto> spec, __7_ hash<auto> opts);
113 
114 
116 
123  constructor(InputStream stream, __7_ string encoding, hash<auto> spec, __7_ hash<auto> opts);
124 
125 
127  constructor(__7_ hash<auto> options);
128 
129 
131  string getName();
132 
133 
135 
138 protected:
139  AbstractDataProviderRecordIterator searchRecordsImpl(__7_ hash<auto> where_cond, __7_ hash<auto> search_options);
140 public:
141 
142 
144 
147  private AbstractDataProviderRecordIterator searchRecordsImpl(__7_ hash<DataProviderExpression> where_cond,
148  *hash<auto> search_options) {
149  return new DefaultRecordIterator(i, where_cond, search_options, getRecordType());
150  }
151 
153 protected:
154  __7_ hash<string, AbstractDataField> getRecordTypeImpl(__7_ hash<auto> search_options);
155 public:
156 
157 
159 protected:
160  hash<DataProviderInfo> getStaticInfoImpl();
161 public:
162 
163 };
164 };
Structured line iterator for abstract data allowing efficient "pipelined" processing.
Definition: FixedLengthAbstractIterator.qc.dox.h:29
Provides a data provider for reading fixed-length files.
Definition: FixedLengthReadDataProvider.qc.dox.h:30
const FixedLengthReadOptionList
iteration option list
Definition: FixedLengthReadDataProvider.qc.dox.h:87
constructor(StringInputStream stream, hash< auto > spec, __7_ hash< auto > opts)
Creates the FixedLengthReadDataProvider with the string input data stream, the record specifications,...
constructor(InputStream stream, __7_ string encoding, hash< auto > spec, __7_ hash< auto > opts)
Creates the FixedLengthReadDataProvider from a binary input data stream, the record specifications,...
constructor(__7_ hash< auto > options)
Creates the object from constructor options.
__7_ hash< string, AbstractDataField > getRecordTypeImpl(__7_ hash< auto > search_options)
Returns the description of the record type, if any.
private AbstractDataProviderRecordIterator searchRecordsImpl(__7_ hash< DataProviderExpression > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
Definition: FixedLengthReadDataProvider.qc.dox.h:147
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
constructor(string path, hash< auto > spec, __7_ hash< auto > opts)
Creates the FixedLengthReadDataProvider with the input data path, the record specifications,...
FixedLengthAbstractIterator i
The iterator object.
Definition: FixedLengthReadDataProvider.qc.dox.h:91
const ConstructorOptions
Constructor options.
Definition: FixedLengthReadDataProvider.qc.dox.h:45
const ProviderInfo
Provider info.
Definition: FixedLengthReadDataProvider.qc.dox.h:34
AbstractDataProviderRecordIterator searchRecordsImpl(__7_ hash< auto > where_cond, __7_ hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
string getName()
Returns the object name.
const True
The FixedLengthUtil namespace contains all the definitions in the FixedLengthUtil module.
Definition: FixedLengthAbstractIterator.qc.dox.h:27