326 const FieldAttrs = (
"type",
"format",
"timezone",
"code",
"header");
335 string number_format;
344 bool headerReorder =
True;
349 constructor (
string n_errname);
362 checkType(
string fld_errs,
string key,
string value);
369 hash getSpec(*
hash fields,
string fld_errs,
int C_OPTx);
671 "compat_force_empty_string": C_OPT1|C_OPT2,
672 "date_format": C_OPT1|C_OPT2,
673 "date-format": C_OPT1|C_OPT2,
674 "encoding": C_OPT1|C_OPT2,
675 "eol": C_OPT1|C_OPT2,
676 "extended_record": C_OPT2,
678 "header-lines": C_OPT1|C_OPT2,
679 "header_lines": C_OPT1|C_OPT2,
680 "header-names": C_OPT1|C_OPT2,
681 "header_names": C_OPT1|C_OPT2,
682 "header_reorder": C_OPT1|C_OPT2,
684 "ignore-empty": C_OPT1|C_OPT2,
685 "ignore_empty": C_OPT1|C_OPT2,
686 "ignore-whitespace": C_OPT1|C_OPT2,
687 "ignore_whitespace": C_OPT1|C_OPT2,
688 "number_format": C_OPT1|C_OPT2,
689 "quote": C_OPT1|C_OPT2,
690 "separator": C_OPT1|C_OPT2,
691 "timezone": C_OPT1|C_OPT2,
692 "tolwr": C_OPT1|C_OPT2,
693 "verify-columns": C_OPT1|C_OPT2,
694 "verify_columns": C_OPT1|C_OPT2,
698 string separator =
",";
704 softint headerLines = 0;
707 bool headerNames =
False;
710 bool ignoreEmptyLines =
True;
713 bool ignoreWhitespace =
True;
719 bool checkElementCounts =
False;
722 bool extendedRecord =
False;
725 bool compat_force_empty_string =
False;
734 hash m_resolve_by_rule;
737 hash m_resolve_by_count;
740 hash m_resolve_by_idx;
743 bool fakeHeaderNames;
746 AbstractLineIterator lineIterator;
757 constructor(AbstractLineIterator li, *
hash opts);
767 constructor(AbstractLineIterator li,
hash spec,
hash opts);
773 processCommonOptions(*
hash opts,
int C_OPTx);
780 processSpec(
hash spec);
787 prepareFieldsFromHeaders(*
list headers);
811 auto memberGate(
string name);
843 hash getRecord(
bool extended);
874 auto getRecordList();
885 string getSeparator();
953 auto handleType(
hash fh, *
string val);
960 list getLineAndSplit();
972 string identifyType(
list rec);
985 *
string identifyTypeImpl(
list rec);
1046 auto memberGate(
string name);
1073 constructor(
string path, *
hash opts) ;
1081 constructor(
string path,
hash spec,
hash opts) ;
1085 auto memberGate(
string name);
1089 string getEncoding();
1093 string getFileName();
1097 hash<Qore::StatInfo>
hstat();
1123 constructor(
string data, *
hash opts) ;
1131 constructor(
string data,
hash spec,
hash opts) ;
1134 auto memberGate(
string name);
1255 "block": C_OPT1|C_OPT2,
1257 "date_format": C_OPT1|C_OPT2,
1258 "date-format": C_OPT1|C_OPT2,
1259 "encoding": C_OPT1|C_OPT2,
1260 "eol": C_OPT1|C_OPT2,
1263 "header_reorder": C_OPT1,
1264 "info_log": C_OPT1|C_OPT2,
1265 "number_format": C_OPT1|C_OPT2,
1266 "optimal_quotes": C_OPT1|C_OPT2,
1267 "optimal-quotes": C_OPT1|C_OPT2,
1268 "quote": C_OPT1|C_OPT2,
1269 "quote_escape": C_OPT1|C_OPT2,
1270 "separator": C_OPT1|C_OPT2,
1271 "verify_columns": C_OPT1|C_OPT2,
1272 "verify-columns": C_OPT1|C_OPT2,
1273 "write_headers": C_OPT1|C_OPT2,
1274 "write-headers": C_OPT1|C_OPT2,
1281 string separator =
",";
1284 string quote =
"\"";
1287 string m_quoteEscapeChar =
"\\";
1328 constructor(
string n_errname, *
hash n_opts);
1340 constructor(
string n_errname,
hash spec,
hash n_opts);
1346 processCommonOptions(*
hash n_opts,
int C_OPTx);
1370 writeLine(
list values);
1379 writeLine(
hash values);
1389 writeLine(
string type,
list values);
1399 writeLine(
string type,
hash values);
1438 abstract writeRawLine(
list values);
1449 string prepareRawLine(
list values);
1455 string prepareRawLineIntern(
list values);
1495 writeRawLine(
list values);
1523 constructor(
string path, *
hash opts) ;
1536 constructor(
string path,
hash spec,
hash opts) ;
1541 openFile(
string path);
1547 writeRawLine(
list values);
1572 constructor(*
hash opts) ;
1582 constructor(
hash spec,
hash opts) ;
1593 writeRawLine(
list values);
1620 string write(
list l);
1624 string getContent();
hash m_out_by_name
mapping output field by name
Definition: CsvUtil.qm.dox.h:1314
the AbstractCsvIterator class is an abstract base class that allows abstract CSV data to be iterated ...
Definition: CsvUtil.qm.dox.h:665
Qore::File file
the file to write
Definition: CsvUtil.qm.dox.h:1510
hash m_out_by_idx
mapping output field by index
Definition: CsvUtil.qm.dox.h:1317
*code info_log
a closure/call reference for informational logging when using write(SQLStatement) ...
Definition: CsvUtil.qm.dox.h:1311
*hash< StatInfo > hstat(string path)
The CsvFileIterator class allows CSV files to be iterated on a record basis.
Definition: CsvUtil.qm.dox.h:1058
int index(softstring str, softstring substr, softint pos=0)
The CsvStringWriter class for in-memory string CSV creation.
Definition: CsvUtil.qm.dox.h:1557
csvutil_set_global_compat_force_empty_string(softbool val)
sets the global_compat_force_empty_string variable to force "*string" fields with no value to ret...
The AbstractCsvWriter class provides a parent for all CSV writers.
Definition: CsvUtil.qm.dox.h:1249
string baseTemplate
base template for value format
Definition: CsvUtil.qm.dox.h:1302
const EOL_MACINTOSH
Old (pre-OSX) Macintosh end of line character sequence.
Definition: CsvUtil.qm.dox.h:404
const CSV_TYPE_UNKNOWN
Record type when non matching any type.
Definition: CsvUtil.qm.dox.h:410
const EOL_UNIX
Unix end of line character sequence (for new OS X too)
Definition: CsvUtil.qm.dox.h:400
StreamWriter output
the output stream for the CSV data
Definition: CsvUtil.qm.dox.h:1467
The CsvWriter class for safe CSV data creation.
Definition: CsvUtil.qm.dox.h:1462
The CsvIterator class allows CSV sources to be iterated on a record basis. The source of the input da...
Definition: CsvUtil.qm.dox.h:1003
const EOL_WIN
MS DOS/Windows end of line character sequence.
Definition: CsvUtil.qm.dox.h:402
The CsvDataIterator class allows arbitrary CSV string data to be iterated on a record basis...
Definition: CsvUtil.qm.dox.h:1113
string m_file_path
the path of the file being iterated
Definition: CsvUtil.qm.dox.h:1063
string encoding
output file character encoding
Definition: CsvUtil.qm.dox.h:1278
the CsvUtil namespace contains all the objects in the CsvUtil module
Definition: CsvUtil.qm.dox.h:398
bool global_compat_force_empty_string
global option to force "*string" fields with no value to return an empty string when parsing rath...
The CsvFileWriter class for safe CSV file creation.
Definition: CsvUtil.qm.dox.h:1505
const CSV_TYPE_SINGLE
Record type when multi-type is disabled.
Definition: CsvUtil.qm.dox.h:412