Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

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.1 2003/02/28 21:21:44 mgruner 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 
00032 SWORD_NAMESPACE_START
00033 
00038 class SWDLLEXPORT ListKey : public SWKey {
00039 
00040   static SWClass classdef;
00041   void init ();
00042 protected:
00043   int arraypos;
00044   int arraymax;
00045   int arraycnt;
00046   SWKey **array;
00047 public:
00052         ListKey (const char *ikey = 0);
00053         ListKey (ListKey const &k);
00056         virtual ~ ListKey ();
00057 
00058         virtual SWKey *clone () const;
00061         virtual void ClearList ();
00065         virtual int Count ();
00068         virtual void Remove ();
00074         virtual char SetToElement (int ielement, SW_POSITION = TOP);
00080         virtual SWKey *GetElement (int pos = -1);
00084         ListKey & operator << (const SWKey &ikey) { add(ikey); return *this; }
00085         virtual void add(const SWKey &ikey);
00086 
00091         virtual void copyFrom(const ListKey & ikey);
00092         virtual void copyFrom(const SWKey & ikey) { SWKey::copyFrom(ikey); }
00093 
00099         virtual void setPosition(SW_POSITION pos);
00102         virtual void decrement(int step);
00105         virtual void increment(int step);
00106 
00107         virtual char Traversable () { return 1; }
00108         virtual long Index () const { return arraypos; }
00109         virtual const char *getRangeText() const;
00110 
00115         virtual long Index (long index) { SetToElement (index); return Index (); }
00116         virtual const char *getText() const;
00117         virtual void setText(const char *ikey);
00118 
00119         SWKEY_OPERATORS
00120         ListKey & operator =(const ListKey &key) { copyFrom(key); return *this; }
00121 };
00122 
00123 SWORD_NAMESPACE_END
00124 #endif

Generated on Fri Feb 28 22:01:38 2003 for The Sword Project by doxygen1.3-rc3