The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
versetreekey.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * versetreekey.h - class VerseTreeKey: a specialized VerseKey which
4  * obtains its versification system from a module with
5  * a tree structure
6  *
7  * $Id: versetreekey.h 3808 2020-10-02 13:23:34Z scribe $
8  *
9  * Copyright 2006-2013 CrossWire Bible Society (http://www.crosswire.org)
10  * CrossWire Bible Society
11  * P. O. Box 2528
12  * Tempe, AZ 85280-2528
13  *
14  * This program is free software; you can redistribute it and/or modify it
15  * under the terms of the GNU General Public License as published by the
16  * Free Software Foundation version 2.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  * General Public License for more details.
22  *
23  */
24 
25 
26 #ifndef VERSETREEKEY_H
27 #define VERSETREEKEY_H
28 
29 #include <versekey.h>
30 #include <treekey.h>
31 #include <swmacs.h>
32 #include <listkey.h>
33 
34 #include <defs.h>
35 
37 
43 
44 private:
46 // vector<struct sbook> books;
47 
48  void init(TreeKey *treeKey);
49  void syncVerseToTree() const;
51 
52 protected:
53  virtual int getBookFromAbbrev(const char *abbr) const;
54 
55 public:
56 
64  VerseTreeKey(TreeKey *treeKey, const char *ikey = 0);
65 
73  VerseTreeKey(TreeKey *treeKey, const SWKey *ikey);
74 
82  VerseTreeKey(TreeKey *treeKey, const char *min, const char *max);
83 
89  VerseTreeKey(const VerseTreeKey &k);
90 
91 
95  virtual ~VerseTreeKey();
96 
100  virtual SWKey *clone() const;
101 
102  virtual bool isTraversable() const { return true; }
103 
104  virtual TreeKey *getTreeKey();
105  virtual const TreeKey *getTreeKey() const;
106 
107  // TreeKey::PositionChangeListener interface
108  virtual void positionChanged();
109  mutable bool internalPosChange;
110 
111  virtual void decrement(int steps = 1);
112  virtual void increment(int steps = 1);
113 
114  virtual void Normalize(char autocheck = 0);
115 
116  virtual void setPosition(SW_POSITION newpos);
117  virtual long newIndex() const;
118  // OPERATORS --------------------------------------------------------------------
119 
120 
122 
123  virtual SWKey & operator = (const VerseKey & ikey) { copyFrom(ikey); return *this; }
124 // virtual void copyFrom(const VerseTreeKey &ikey);
125 };
126 
128 
129 #endif //VERSETREEKEY_H
virtual void setPosition(SW_POSITION p)=0
#define SWORD_NAMESPACE_START
Definition: defs.h:39
virtual SWKEY_OPERATORS SWKey & operator=(const VerseKey &ikey)
Definition: versekey.h:487
#define SWKEY_OPERATORS
Definition: swkey.h:37
virtual void positionChanged()=0
#define SWDLLEXPORT
Definition: defs.h:171
virtual void increment(int steps=1)=0
long lastGoodOffset
Definition: versetreekey.h:50
virtual SWKey * clone() const
Definition: swkey.cpp:75
SWDEPRECATED void Normalize(char autocheck=0)
Definition: versekey.h:362
virtual int getBookFromAbbrev(const char *abbr) const
Definition: versekey.cpp:396
virtual void copyFrom(const SWKey &ikey)
Definition: swkey.cpp:173
virtual bool isTraversable() const
Definition: versetreekey.h:102
TreeKey * treeKey
Definition: versetreekey.h:45
virtual void decrement(int steps=1)=0
bool internalPosChange
Definition: versetreekey.h:109
#define SWORD_NAMESPACE_END
Definition: defs.h:40
Definition: swkey.h:77
void init()
Definition: treekey.cpp:34