sx360::sxIterator Class Reference

#include <sxiterator.h>

Collaboration diagram for sx360::sxIterator:

Collaboration graph
[legend]
List of all members.


Public Member Functions

  sxIterator (sxPunchFile *pf, ByteMap *bmap)
virtual  ~sxIterator ()
int  getCurrentIndex () const
sxRecord first ()
sxRecord last ()
sxRecord next ()
sxRecord previous ()
bool  write ()
sxRecord gotoRecord (size_t i)
sxRecord gotoRecord (sxIndex *idx, size_t i)

Public Attributes

sxEvent recordChangeEvent

sxIterator is responsible for traversing a sxPunchFile and returning sxRecords for reading or writing.  A sxIterator is automatically created when a sxPunchFile is opened in READ or READ_WRITE mode.  It is not generated if the file is opened in CREATE mode, since the class needs to know how many records are present when the file is opened.  sxIterator is not flexible in the regard of adding new records to an existing sxPunchFile.


Constructor & Destructor Documentation

sxIterator::sxIterator ( sxPunchFile pf,


ByteMap bmap  

)


Constructor called by the sxPunchFile when the file is opened in READ_ONLY or READ_WRITE mode.

sxIterator::~sxIterator (
 )  [virtual]

Destructor



Member Function Documentation

int sxIterator::getCurrentIndex (
 )  const

Returns the 0 based index of the current sxRecord.

sxRecord * sxIterator::first (
 ) 

Moves to the first record in the file. Returns NULL if not valid.

sxRecord * sxIterator::last (
 ) 

Moves to the last record in the file. Returns NULL if not valid.

sxRecord * sxIterator::next (
 ) 

Moves to the next record in the file. Returns NULL if not valid.

sxRecord * sxIterator::previous (
 ) 

Moves to the previous record in the file. Returns NULL if not valid.

bool sxIterator::write (
 ) 

Writes the current record to the file only if the file was open in READ_WRITE mode. Returns whether the write was successful.

sxRecord * sxIterator::gotoRecord ( size_t  i  ) 

Moves to the 0 based record specified by i. Returns NULL if not valid.

sxRecord * sxIterator::gotoRecord ( sxIndex idx,


size_t  i  

)


Moves to a record id using an index. Returns an sxRecord if found or NULL if not found.

sxIndex* idx = the index for searching

size_t i = the id of the record that is being searched. This is in contrast to the above implmentation that is the 0 based index of the record being searched.



Member Data Documentation

sxEvent* sx360::sxIterator::recordChangeEvent

Assign a sxEvent to this member to have a custom function executed whenever the sxIterator moves off of the current record.  See the documentation for sxEvent for more detail on usage.



Generated on Tue Nov 27 02:17:33 2007 for sx360 by  doxygen 1.5.2