Loading...
Searching...
No Matches
FixedLengthReadDataProvider.qc.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
/* FixedLengthReadDataProvider Copyright 2015 - 2022 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 FixedLengthReadDataProvider : public DataProvider::AbstractDataProvider {
public:
const ProviderInfo = <DataProviderInfo>{
"type": "FixedLengthReadDataProvider",
"supports_read": True,
"has_record": True,
"supports_search_expressions": True,
"constructor_options": ConstructorOptions,
"search_options": GenericRecordSearchOptions,
"expressions": AbstractDataProvider::GenericExpressions,
};
const ConstructorOptions = {
"path": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "the path to the fixed-length data; mutually exclusive with \"stream\"; resolved with a call "
"to FileLocationHandler::getBinaryStreamFromLocation()",
},
"stream": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(new Type("InputStream")),
"desc": "the input stream for fixed-length data; mutually exclusive with \"path\"",
},
"spec": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(AutoHashType),
"desc": "the fixed-length record specification hash",
"required": True,
},
"date_format": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "the default global date format for `date` fields",
},
"encoding": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "the encoding for strings",
},
"eol": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "the end of line characters",
},
"ignore_empty": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(SoftBoolType),
"desc": "if `true` then empty lines are ignored",
},
"number_format": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "the default global number format for `float` or `number` fields",
},
"timezone": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "a string giving a time zone region name or an integer offset in seconds east of UTC",
},
};
const FixedLengthReadOptionList = keys (ConstructorOptions - ("path", "stream", "spec"));
protected:
FixedLengthAbstractIterator i;
public:
constructor(string path, hash<auto> spec, *hash<auto> opts);
constructor(StringInputStream stream, hash<auto> spec, *hash<auto> opts);
constructor(InputStream stream, *string encoding, hash<auto> spec, *hash<auto> opts);
constructor(*hash<auto> options);
string getName();
protected:
AbstractDataProviderRecordIterator searchRecordsImpl(*hash<auto> where_cond, *hash<auto> search_options);
public:
private AbstractDataProviderRecordIterator searchRecordsImpl(*hash<DataProviderExpression> where_cond,
*hash<auto> search_options) {
return new DefaultRecordIterator(i, where_cond, search_options, getRecordType());
}
protected:
*hash<string, AbstractDataField> getRecordTypeImpl(*hash<auto> search_options);
public:
protected:
hash<DataProviderInfo> getStaticInfoImpl();
public:
};
};
FixedLengthUtil::FixedLengthAbstractIterator
Structured line iterator for abstract data allowing efficient "pipelined" processing.
Definition: FixedLengthAbstractIterator.qc.dox.h:29
FixedLengthUtil::FixedLengthReadDataProvider
Provides a data provider for reading fixed-length files.
Definition: FixedLengthReadDataProvider.qc.dox.h:30
FixedLengthUtil::FixedLengthReadDataProvider::FixedLengthReadOptionList
const FixedLengthReadOptionList
iteration option list
Definition: FixedLengthReadDataProvider.qc.dox.h:87
FixedLengthUtil::FixedLengthReadDataProvider::constructor
constructor(StringInputStream stream, hash< auto > spec, *hash< auto > opts)
Creates the FixedLengthReadDataProvider with the string input data stream, the record specifications,...
FixedLengthUtil::FixedLengthReadDataProvider::constructor
constructor(InputStream stream, *string encoding, hash< auto > spec, *hash< auto > opts)
Creates the FixedLengthReadDataProvider from a binary input data stream, the record specifications,...
FixedLengthUtil::FixedLengthReadDataProvider::constructor
constructor(*hash< auto > options)
Creates the object from constructor options.
FixedLengthUtil::FixedLengthReadDataProvider::getRecordTypeImpl
*hash< string, AbstractDataField > getRecordTypeImpl(*hash< auto > search_options)
Returns the description of the record type, if any.
FixedLengthUtil::FixedLengthReadDataProvider::searchRecordsImpl
private AbstractDataProviderRecordIterator searchRecordsImpl(*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
FixedLengthUtil::FixedLengthReadDataProvider::getStaticInfoImpl
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
FixedLengthUtil::FixedLengthReadDataProvider::constructor
constructor(string path, hash< auto > spec, *hash< auto > opts)
Creates the FixedLengthReadDataProvider with the input data path, the record specifications,...
FixedLengthUtil::FixedLengthReadDataProvider::i
FixedLengthAbstractIterator i
The iterator object.
Definition: FixedLengthReadDataProvider.qc.dox.h:91
FixedLengthUtil::FixedLengthReadDataProvider::ConstructorOptions
const ConstructorOptions
Constructor options.
Definition: FixedLengthReadDataProvider.qc.dox.h:45
FixedLengthUtil::FixedLengthReadDataProvider::ProviderInfo
const ProviderInfo
Provider info.
Definition: FixedLengthReadDataProvider.qc.dox.h:34
FixedLengthUtil::FixedLengthReadDataProvider::searchRecordsImpl
AbstractDataProviderRecordIterator searchRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
FixedLengthUtil::FixedLengthReadDataProvider::getName
string getName()
Returns the object name.
FixedLengthUtil
The FixedLengthUtil namespace contains all the definitions in the FixedLengthUtil module.
Definition: FixedLengthAbstractIterator.qc.dox.h:27