Qore CsvUtil Module Reference 1.2

- Main Page
- Related Pages
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Groups Pages
Public Member Functions | Private Attributes | List of all members
CsvUtil::CsvDataIterator Class Reference

the CsvDataIterator class allows arbitrary CSV string data to be iterated on a record basis More...

Inheritance diagram for CsvUtil::CsvDataIterator:
[legend]

## Public Member Functions
| constructor (string data, *hash opts)
| creates the CsvDataIterator with the input data and optionally an option hash More...
private string | getLineValueImpl ()
| Returns the current line trimmed of the EOL character(s)
private int | lineNumberImpl ()
| Returns the current line number; returns 0 if not pointing at any data.
private bool | nextLineImpl ()
| Moves the current line / record position to the next line / record; returns False if there are no more lines to iterate.
bool | valid ()
| returns True if the iterator is currently pointing at a valid element, False if not More...
Public Member Functions inherited from CsvUtil::CsvAbstractIterator
| constructor (*hash opts)
| creates the CsvAbstractIterator with an option hash More...
private *string | getDataName ()
| Returns the name of the input data.
*list | getHeaders ()
| returns the current column headers or NOTHING if no headers have been detected or saved yet More...
string | getQuote ()
| returns the current quote string More...
hash | getRecord ()
| returns the current record as a hash More...
list | getRecordList ()
| returns the current record as a list More...
string | getSeparator ()
| returns the current separator string More...
hash | getValue ()
| returns the current record as a hash More...
int | index ()
| returns the row index being iterated, which does not necessarily correspond to the line number when there are header rows and blank lines are skipped More...
int | lineNumber ()
| returns the current iterator line number in the file (the first line is line 1) or 0 if not pointing at a valid element More...
any | memberGate (string name)
| returns the given column value for the current row More...
bool | next ()
| Moves the current line / record position to the next line / record; returns False if there are no more lines to iterate. More...
private list | parseLine ()
| parses a line in the file and returns a processed list of the fields

## Private Attributes
string | data
| input data
*string | eol
| EOL marker.
*string | line
| current line
int | lineno = 0
| current line number
int | pos = 0
| current byte pos
bool | valid = False
| valid flag

## Additional Inherited Members
Private Member Functions inherited from CsvHelper
private | setFields ()
| sets field description list

## Detailed Description

the CsvDataIterator class allows arbitrary CSV string data to be iterated on a record basis

See Also
  - CsvAbstractIterator Constructor Option Hash Overview
  - Option Field Types
  - Option Field Hash

## Member Function Documentation

CsvUtil::CsvDataIterator::constructor | ( | string | data,
|  | *hash | opts
| ) |  |

creates the CsvDataIterator with the input data and optionally an option hash

Parameters

  data | the input data to iterate
  opts | a hash of optional options; see CsvAbstractIterator Constructor Option Hash Overview for more information

Exceptions

  CSVABSTRACTITERATOR-ERROR | invalid or unknown option; invalid data type for option; `"header-names"` is True and `"header-lines"` is 0 or `"headers"` is also present; unknown field type

bool CsvUtil::CsvDataIterator::valid | ( |  | ) |

returns True if the iterator is currently pointing at a valid element, False if not

Example:
  if ($i.valid())
  printf("current value: %y\n", $i.getValue());

Returns
  True if the iterator is currently pointing at a valid element, False if not