dbCursor Class Template Reference

#include <cursor.h>

Inheritance diagram for dbCursor:

dbAnyCursor dbL2List

List of all members.


Detailed Description

template<class T>
class dbCursor< T >

Cursor template parameterized by table class.

Public Member Functions

 dbCursor (dbCursorType type=dbCursorViewOnly)
 Cursor constructor.
 dbCursor (dbDatabase *aDb, dbCursorType type=dbCursorViewOnly)
 Cursor constructor with explicit specification of database.
T * get ()
 Get pointer to the current record.
T * next ()
 Get next record.
T * prev ()
 Get previous record.
T * first ()
 Get pointer to the first record.
T * last ()
 Get pointer to the last record.
int seek (dbReference< T > const &ref)
 Position cursor on the record with the specified OID.
T * operator-> ()
 Overloaded operator for accessing components of the current record.
T * at (dbReference< T > const &ref)
 Select record by reference.
void toArray (dbArray< dbReference< T > > &arr) const
 Convert selection to array of reference.
dbReference< T > currentId () const
 Get current object idenitifer.
bool isInSelection (dbReference< T > &ref)
 Check if record with specified OID is in selection.
T * nextAvailable ()
 Method nextAvailable allows to iterate through the records in uniform way even when some records are removed.

Protected Attributes

record

Private Member Functions

dbCursor< T > operator= (dbCursor< T > const &src)

Constructor & Destructor Documentation

dbCursor ( dbCursorType  type = dbCursorViewOnly  )  [inline]

Cursor constructor.

Parameters:
type cursor type (dbCursorViewOnly by default)

dbCursor ( dbDatabase aDb,
dbCursorType  type = dbCursorViewOnly 
) [inline]

Cursor constructor with explicit specification of database.

This cursor should be used for unassigned tables.

Parameters:
aDb database in which table lookup is performed
type cursor type (dbCursorViewOnly by default)


Member Function Documentation

dbCursor<T> operator= ( dbCursor< T > const &  src  )  [inline, private]

T* get (  )  [inline]

Get pointer to the current record.

Returns:
pointer to the current record or NULL if there is no current record

T* next (  )  [inline]

Get next record.

Returns:
pointer to the next record or NULL if there is no next record

T* prev (  )  [inline]

Get previous record.

Returns:
pointer to the previous record or NULL if there is no previous record

T* first (  )  [inline]

Get pointer to the first record.

Returns:
pointer to the first record or NULL if no records were selected

T* last (  )  [inline]

Get pointer to the last record.

Returns:
pointer to the last record or NULL if no records were selected

int seek ( dbReference< T > const &  ref  )  [inline]

Position cursor on the record with the specified OID.

Parameters:
ref reference to the object
Returns:
poistion of the record in the selection or -1 if record with such OID is not in selection

T* operator-> (  )  [inline]

Overloaded operator for accessing components of the current record.

Returns:
pointer to the current record

T* at ( dbReference< T > const &  ref  )  [inline]

Select record by reference.

Parameters:
ref reference to the record
Returns:
pointer to the referenced record

void toArray ( dbArray< dbReference< T > > &  arr  )  const [inline]

Convert selection to array of reference.

Parameters:
arr [OUT] array of refeences in which references to selected recrods will be placed

dbReference<T> currentId (  )  const [inline]

Get current object idenitifer.

Returns:
reference to the current record

bool isInSelection ( dbReference< T > &  ref  )  [inline]

Check if record with specified OID is in selection.

Returns:
true if record with such OID was selected

T* nextAvailable (  )  [inline]

Method nextAvailable allows to iterate through the records in uniform way even when some records are removed.

For example:

 if (cursor.select(q) > 0) {
     do {
         if (x) {
             cursor.remove();
         } else {
             cursor.update();
         }
     } while (cursor.nextAvaiable());
  }
Returns:
pointer to the current record


Member Data Documentation

T record [protected]

Reimplemented from dbAnyCursor.


Online Library Docs

sipXecs home page

Version 4.2.1-018930 2010-07-31T01:13:23 build16 abuild