/******************************************************************************
   @header BDBCursor
   BDB

  @availability OS X, GNUstep
  @copyright (C) 2004, 2005, 2006 Oliver Langer
 
  Author: Oliver Langer

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

  <pre>
  -------------------------------------------------------------------------
  Modification history

  28.12.2004 ola     initial version
  22.08.2006 ola     license changed
  -------------------------------------------------------------------------
  </pre>
******************************************************************************/

#if !defined(__BDBCURSOR_H)
#define __BDBCURSOR_H

#include <Foundation/Foundation.h>
#include <db.h>
#include <BDB/BDBObject.h>
#include <BDB/BDBCursorConfig.h>
#include <BDB/BDBOperationStatus.h>
#include <BDB/BDBDatabaseEntryData.h>
#include <BDB/BDBLockMode.h>

@interface BDBCursor : BDBObject {
@private
  DBC *cursor;
  BDBCursorConfig *config;
}

- initWithCursor: (DBC *) aCursor config: (BDBCursorConfig *) aConfig;
- (void) dealloc;

/**
 * @method firstWithKey
 * @abstract get first entry
 * @discussion get the first entry matching the given key
 * @result operation status
 */
- (BDBOperationStatus) firstWithKey: (BDBDatabaseEntryData *) aKey
  value: (BDBDatabaseEntryData *) aValue lockMode: (BDBLockMode *) aLockMode;
  
  
/**
 * @method lastWithKey
 * @abstract get the last entry
 * @discussion get the last entry matching the given key
 * @result operation status
 */
- (BDBOperationStatus) lastWithKey: (BDBDatabaseEntryData *) aKey
  value: (BDBDatabaseEntryData *) aValue lockMode: (BDBLockMode *) aLockMode;
  

/**
 * @method nextWithKey
 * @abstract get next available entry matching the key
 * @discussion get the next entry matching the given key
 * @result operation status
 */
- (BDBOperationStatus) nextWithKey: (BDBDatabaseEntryData *) aKey
  value: (BDBDatabaseEntryData *) aValue lockMode: (BDBLockMode *) aLockMode;
  
/**
 * @method previousWithKey
 * @abstract get the previous available entry matching the key
 * @discussion get the previous entry matching the given key
 * @result operation status
 */
- (BDBOperationStatus) previousWithKey: (BDBDatabaseEntryData *) aKey
  value: (BDBDatabaseEntryData *) aValue lockMode: (BDBLockMode *) aLockMode;
@end

#endif
