Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

listkey.h

00001 /******************************************************************************
00002  * listkey.h    - code for base class 'listkey'.  listkey is the basis for all
00003  *                              types of keys for indexing into modules
00004  *                              (e.g. verse, word,
00005  *                              place, etc.)
00006  *
00007  * $Id: listkey_8h-source.html,v 1.4 2002/01/22 14:20:28 jansorg Exp $
00008  *
00009  * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
00010  *      CrossWire Bible Society
00011  *      P. O. Box 2528
00012  *      Tempe, AZ  85280-2528
00013  *
00014  * This program is free software; you can redistribute it and/or modify it
00015  * under the terms of the GNU General Public License as published by the
00016  * Free Software Foundation version 2.
00017  *
00018  * This program is distributed in the hope that it will be useful, but
00019  * WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021  * General Public License for more details.
00022  *
00023  */
00024 
00025 #ifndef SWLSTKEY_H
00026 #define SWLSTKEY_H
00027 
00028 #include <swkey.h>
00029 
00030 #include <defs.h>
00031 
00036 class SWDLLEXPORT ListKey : public SWKey {
00037 
00038   static SWClass classdef;
00039   void init ();
00040 protected:
00041   int arraypos;
00042   int arraymax;
00043   int arraycnt;
00044   SWKey **array;
00045 public:
00050         ListKey (const char *ikey = 0);
00051         ListKey (ListKey const &k);
00054         virtual ~ ListKey ();
00055 
00056         virtual SWKey *clone () const;
00059         virtual void ClearList ();
00063         virtual int Count ();
00066         virtual void Remove ();
00072         virtual char SetToElement (int ielement, SW_POSITION = TOP);
00078         virtual SWKey *GetElement (int pos = -1);
00082         ListKey & operator << (const SWKey &ikey) { add(ikey); return *this; }
00083         virtual void add(const SWKey &ikey);
00084 
00089         virtual void copyFrom(const ListKey & ikey);
00090         virtual void copyFrom(const SWKey & ikey) { SWKey::copyFrom(ikey); }
00091 
00097         virtual void setPosition(SW_POSITION);
00100         virtual void decrement(int step);
00103         virtual void increment(int step);
00104 
00105         virtual char Traversable () { return 1; }
00106         virtual long Index () const { return arraypos; }
00107 
00112         virtual long Index (long index) { SetToElement (index); return Index (); }
00113 
00114         SWKEY_OPERATORS
00115         ListKey & operator =(const ListKey &key) { copyFrom(key); return *this; }
00116 };
00117 
00118 
00119 #endif

Generated at Tue Jan 22 14:52:48 2002 for The Sword Project by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001