kword

KWTableFrameSet::TableIterator< VisitStyle > Class Template Reference

#include <KWTableFrameSet.h>

List of all members.


Detailed Description

template<int VisitStyle = VISIT_CELL>
class KWTableFrameSet::TableIterator< VisitStyle >

All the TableIterator templates are the same, except for the pre-increment operator (operator++).

There is a specialised version of this operator method for each iterator type:

VISIT_GRID: This iterator visits each grid position once, ie every location in the m_rowArray rows. When some cells are joined, this iterator will visit those cells more than once.

VISIT_CELL: This iterator visits each cell in the table once, whether or not some of the cells are joined. If you want to visit all the cells fast and perform some read-only operation, this is the one to use.

CHECKED: Also visits each cell once, but has some other benefits. Slower.

Note that all the iterators have restrictions on the state that the table data structures are in before and while they are being used. This includes m_rowArray, the Rows and Cells but not m_colPositions and m_rowPositions, as they are not used during the traversal. The conditions include:

  • ( A ) All positions in m_rowArray must be occupied by a valid cell, ie must not be null.
  • ( B ) The Cell instance variables (m_row, m_rows, etc) must correctly correspond to where the cells are in m_rowArray.
  • ( C ) The m_rows and m_cols instance variables of the table are also correct.
Taken together, these conditions are pretty much equivalent to the validate() function passing. These conditions may not hold in the middle of a method when table data structures are being manipulated.

This table shows what conditions are necessary for each type of iterator:

ABC
TableIterator<VISIT_GRID>xx
TableIterator<VISIT_CELL>xxx
TableIterator<CHECKED> x
MarkedIterator xx

The only iterator that can be used when there are null positions in the table is the checked iterator. Note that both the Checked and Marked Iterators traverse the table twice, once to clear the m_marked members in the cells (done in constructor) and then again to do the actual traversal. Because they use m_marked, only one of these iterators can be used at once.

Don't use these classes directly in code, use the provided typedefs. That makes it easy to do more crazy template stuff later on. :-) Templates are used here rather than inheritance to avoid virtual call overhead.

Definition at line 242 of file KWTableFrameSet.h.


Public Member Functions

 TableIterator (KWTableFrameSet *table)
CelltoFirstCell ()
void goToCell (Cell *)
 operator Cell * () const
Cellcurrent () const
Celloperator-> ()
Celloperator++ ()
template<>
KWTableFrameSet::Celloperator++ ()
template<>
KWTableFrameSet::Celloperator++ ()
template<>
 TableIterator (KWTableFrameSet *table)
template<>
KWTableFrameSet::Celloperator++ ()
template<>
KWTableFrameSet::CelltoFirstCell ()
template<>
KWTableFrameSet::Celloperator++ ()
template<>
KWTableFrameSet::Celloperator++ ()
template<>
KWTableFrameSet::Celloperator++ ()
template<>
 TableIterator (KWTableFrameSet *table)
template<>
KWTableFrameSet::CelltoFirstCell ()

Protected Member Functions

void set_limits (uint left, uint right, uint high, uint low)

Protected Attributes

KWTableFrameSetm_table

Constructor & Destructor Documentation

template<int VisitStyle>
KWTableFrameSet::TableIterator< VisitStyle >::TableIterator ( KWTableFrameSet table  ) 

Parameters:
table The table to iterate over.

The current item is set to the Cell at row 0, column 0

Definition at line 601 of file KWTableFrameSet.h.


The documentation for this class was generated from the following file:
KDE Home | KDE Accessibility Home | Description of Access Keys