Qore Mapper Module Reference  1.4
Mapper::MapperIterator Class Reference

provides a hash iterator based on a mapper object and an iterator input source More...

Inheritance diagram for Mapper::MapperIterator:

Public Member Methods

 constructor (Qore::AbstractIterator i, hash mapv, *hash opts)
 creates the iterator from the arguments passed More...
 
 constructor (Qore::AbstractIterator i, Mapper::Mapper mapv)
 creates the iterator from the arguments passed More...
 
int getCount ()
 returns the internal record count More...
 
hash getValue ()
 returns the current row transformed with the mapper
 
 resetCount ()
 resets the internal record count More...
 
- Public Member Methods inherited from Mapper::AbstractMapperIterator
 constructor (Qore::AbstractIterator iter)
 creates the iterator from the arguments passed More...
 
bool hasBulk ()
 returns True if the iterator supports bulk mode; this method returns False (the default)
 
list< hashmapBulk (int size)
 performs bulk mapping; if the iterator does not support bulk mapping then it is simulated in this method More...
 
bool next ()
 Moves the current position of the iterator to the next element; returns False if there are no more elements.
 
bool valid ()
 returns True if the iterator is currently pointing at a valid element, False if not
 

Private Attributes

Mapper::Mapper mapc
 data mapper
 
- Private Attributes inherited from Mapper::AbstractMapperIterator
Qore::AbstractIterator i
 input iterator; AbstractIterator::getValue() must return a hash
 

Detailed Description

provides a hash iterator based on a mapper object and an iterator input source

Member Function Documentation

◆ constructor() [1/2]

Mapper::MapperIterator::constructor ( Qore::AbstractIterator  i,
hash  mapv,
*hash  opts 
)

creates the iterator from the arguments passed

Parameters
iinput iterator; AbstractIterator::getValue() must return a hash
mapva hash providing field mappings; each hash key is the name of the output field; each value is either True (meaning no translations are done; the data is copied 1:1) or a hash describing the mapping; see Mapper Specification Format for detailed documnentation for this option
optsan optional hash of options for the mapper; see Mapper Options for a description of valid mapper options
Exceptions
MAP-ERRORthe map hash has a logical error (ex: "trunc" key given without "maxlen", invalid map key)

◆ constructor() [2/2]

Mapper::MapperIterator::constructor ( Qore::AbstractIterator  i,
Mapper::Mapper  mapv 
)

creates the iterator from the arguments passed

Parameters
iinput iterator; AbstractIterator::getValue() must return a hash
mapvthe mapper to transform the data

◆ getCount()

int Mapper::MapperIterator::getCount ( )

returns the internal record count

See also
resetCount()

◆ resetCount()

Mapper::MapperIterator::resetCount ( )

resets the internal record count

See also
getCount()