[sword-cvs] sword/include versekey2.h,1.3,1.4 swlocale.h,1.13,1.14 osisbook.h,1.3,1.4

sword@www.crosswire.org sword@www.crosswire.org
Mon, 12 Apr 2004 06:49:14 -0700


Update of /cvs/core/sword/include
In directory www:/tmp/cvs-serv31683/include

Modified Files:
	versekey2.h swlocale.h osisbook.h 
Log Message:

dglassey: further work on VerseKey2 and mods to allow the splitlib option


Index: versekey2.h
===================================================================
RCS file: /cvs/core/sword/include/versekey2.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- versekey2.h	10 Apr 2004 22:07:03 -0000	1.3
+++ versekey2.h	12 Apr 2004 13:49:12 -0000	1.4
@@ -1,5 +1,5 @@
 /******************************************************************************
- *	versekey.h - code for class 'versekey'- a standard Biblical verse key
+ *	versekey2.h - code for class 'versekey'- a standard Biblical verse key
  *
  * $Id$
  *
@@ -49,7 +49,7 @@
 };
 
 
-struct sbook
+struct sbook2
 {
 	/**Name of book
 	*/
@@ -67,7 +67,7 @@
 	//const bkref *versemax;
 };
 
-struct abbrev
+struct abbrev2
 {
 	const char *ab;
 	int book;
@@ -78,10 +78,10 @@
 class SWLocale;
 
 /**
- * Class VerseKey
+ * Class VerseKey2
  * The SWKey implementation used for verse based modules like Bibles or commentaries.
  */
-class SWDLLEXPORT VerseKey:public SWKey {
+class SWDLLEXPORT VerseKey2:public SWKey {
 	class LocaleCache {
 	public:
 		char *name;
@@ -100,7 +100,7 @@
 	static bkref *offsets[2];
 	//static int offsize[2][2];
 	static int offsize[2];
-	/** number of instantiated VerseKey objects or derivitives 
+	/** number of instantiated VerseKey2 objects or derivitives 
 	*/
 	static int instance;
 /*	static struct sbook otbooks[];
@@ -111,13 +111,13 @@
 	static long ntcps[];
 	static int vm[];
 */
-	static struct sbook osisbooks[];
+	static struct sbook2 osisbooks[];
 	static bkref kjvbks[];
 	static bkref kjvcps[];
 	static LocaleCache *localeCache;
 	ListKey internalListKey;
 
-	const struct abbrev *abbrevs;
+	const struct abbrev2 *abbrevs;
 	char *locale;
 	int abbrevsCnt;
 	/** The Testament: 0 - Old; 1 - New
@@ -141,7 +141,7 @@
 	/** initialize and allocate books array
 	*/
 	void initstatics();
-	/** initializes this VerseKey()
+	/** initializes this VerseKey2()
 	*/
 	void init();
 	/** Refresh keytext based on testament|book|chapter|verse
@@ -162,85 +162,85 @@
 	* @return the index into the array that is less than but closest to value
 	*/
 	int findindex(bkref *array, int size, long value);
-	mutable VerseKey *lowerBound, *upperBound;
+	mutable VerseKey2 *lowerBound, *upperBound;
 
 	static const char builtin_BMAX;
 	//static struct sbook *builtin_books[2];
-	static struct sbook *builtin_books;
-	static const struct abbrev builtin_abbrevs[];
+	static struct sbook2 *builtin_books;
+	static const struct abbrev2 builtin_abbrevs[];
 	const char *BMAX;
-	struct sbook **books;
+	struct sbook2 **books;
 public:
 	//static const char builtin_BMAX[2];
 
 	/**
-	* VerseKey Constructor - initializes Instance of VerseKey
+	* VerseKey2 Constructor - initializes Instance of VerseKey2
 	*
 	* @param ikey text key (will take various forms of 'BOOK CH:VS'.
 	* See parse() for more detailed information)
 	*/
-	VerseKey(const char *ikey = 0);
+	VerseKey2(const char *ikey = 0);
 	
 	/**
-	* VerseKey Constructor - initializes instance of VerseKey
+	* VerseKey2 Constructor - initializes instance of VerseKey2
 	*
 	* @param ikey base key (will take various forms of 'BOOK CH:VS'.
 	*	See parse() for more detailed information)
 	*/	
-	VerseKey(const SWKey * ikey);
+	VerseKey2(const SWKey * ikey);
 	
-	/** VerseKey Constructor - initializes instance of VerseKey
+	/** VerseKey2 Constructor - initializes instance of VerseKey2
 	* with boundariess - see also LowerBound()
 	* and UpperBound()
-	* @param min the lower boundary of the new	VerseKey
-	* @param max the upper boundary of the new	VerseKey
+	* @param min the lower boundary of the new	VerseKey2
+	* @param max the upper boundary of the new	VerseKey2
 	*/	
-	VerseKey(const char *min, const char *max);
+	VerseKey2(const char *min, const char *max);
 	
-	/**	VerseKey Copy Constructor - will create a new	VerseKey
+	/**	VerseKey2 Copy Constructor - will create a new	VerseKey2
 	* based on an existing one
 	*
-	* @param k the	VerseKey to copy from
+	* @param k the	VerseKey2 to copy from
 	*/
-	VerseKey(const VerseKey &k);
+	VerseKey2(const VerseKey2 &k);
 	
-	/**	VerseKey Destructor
-	* Cleans up an instance of VerseKey
+	/**	VerseKey2 Destructor
+	* Cleans up an instance of VerseKey2
 	*/
-	virtual ~ VerseKey();
+	virtual ~ VerseKey2();
 
-	/** sets the lower boundary for this	VerseKey
+	/** sets the lower boundary for this	VerseKey2
 	* and returns the new boundary
 	*
-	* @param lb the new lower boundary for this	VerseKey
+	* @param lb the new lower boundary for this	VerseKey2
 	* @return the lower boundary the key was set to
 	*/
-	//VerseKey & LowerBound(const char *lb);
-	VerseKey & LowerBound(const VerseKey & ikey);
+	//VerseKey2 & LowerBound(const char *lb);
+	VerseKey2 & LowerBound(const VerseKey2 & ikey);
 	
-	/** sets the upper boundary for this	VerseKey
+	/** sets the upper boundary for this	VerseKey2
 	* and returns the new boundary
-	* @param ub the new upper boundary for this	VerseKey
+	* @param ub the new upper boundary for this	VerseKey2
 	* @return the upper boundary the key was set to
 	*/
-	//VerseKey & UpperBound(const char *ub);
-	VerseKey & UpperBound(const VerseKey & ikey);
+	//VerseKey2 & UpperBound(const char *ub);
+	VerseKey2 & UpperBound(const VerseKey2 & ikey);
 	
-	/** gets the lower boundary of this	VerseKey
-	* @return the lower boundary of this	VerseKey
+	/** gets the lower boundary of this	VerseKey2
+	* @return the lower boundary of this	VerseKey2
 	*/
-	VerseKey & LowerBound() const;
+	VerseKey2 & LowerBound() const;
 	
-	/** gets the upper boundary of this	VerseKey
-	* @return the upper boundary of this	VerseKey
+	/** gets the upper boundary of this	VerseKey2
+	* @return the upper boundary of this	VerseKey2
 	*/
-	VerseKey & UpperBound() const;
+	VerseKey2 & UpperBound() const;
 	
-	/** clears the boundaries of this	VerseKey
+	/** clears the boundaries of this	VerseKey2
 	*/
 	void ClearBounds();
 	
-	/** Creates a new	SWKey based on the current	VerseKey
+	/** Creates a new	SWKey based on the current	VerseKey2
 	* see also the Copy Constructor
 	*/
 	virtual SWKey *clone() const;
@@ -253,9 +253,9 @@
 	virtual void setText(const char *ikey) { SWKey::setText(ikey); parse (); }
 	virtual void copyFrom(const SWKey & ikey);
 	
-	/** Equates this VerseKey to another VerseKey
+	/** Equates this VerseKey2 to another VerseKey2
 	*/
-	virtual void copyFrom(const VerseKey & ikey);
+	virtual void copyFrom(const VerseKey2 & ikey);
 	
 	/** Positions this key
 	*
@@ -349,7 +349,7 @@
 	*/
 	virtual void Normalize(char autocheck = 0);
 	
-	/** Sets/gets flag that tells VerseKey to
+	/** Sets/gets flag that tells VerseKey2 to
 	* automatically normalize itself when modified
 	*
 	* @param iautonorm value which to set autonorm
@@ -359,7 +359,7 @@
 	*/
 	virtual char AutoNormalize(char iautonorm = MAXPOS (char));
 	
-	/** Sets/gets flag that tells VerseKey to include
+	/** Sets/gets flag that tells VerseKey2 to include
 	* chapter/book/testament/module headings
 	*
 	* @param iheadings value which to set headings
@@ -397,23 +397,23 @@
 	/** Compares another	SWKey object
 	*
 	* @param ikey key to compare with this one
-	* @return >0 if this	VerseKey is greater than compare	SWKey,
-	* <0 if this	VerseKey is smaller than compare	SWKey,
+	* @return >0 if this	VerseKey2 is greater than compare	SWKey,
+	* <0 if this	VerseKey2 is smaller than compare	SWKey,
 	* 0 if the keys are the same
 	*/
 	virtual int compare(const SWKey & ikey);
 	
-	/** Compares another	VerseKey object
+	/** Compares another	VerseKey2 object
 	*
 	* @param ikey key to compare with this one
-	* @return >0 if this	VerseKey is greater than compare	VerseKey,
-	* <0 if this	VerseKey is smaller than compare	VerseKey,
+	* @return >0 if this	VerseKey2 is greater than compare	VerseKey2,
+	* <0 if this	VerseKey2 is smaller than compare	VerseKey2,
 	* 0 if the keys are the same
 	*/
-	virtual int _compare(const VerseKey & ikey);
+	virtual int _compare(const VerseKey2 & ikey);
 	
-	virtual void setBookAbbrevs(const struct abbrev *bookAbbrevs, unsigned int size = 0 /* default determine size */ );
-	virtual void setBooks(const char *iBMAX, struct sbook **ibooks);
+	virtual void setBookAbbrevs(const struct abbrev2 *bookAbbrevs, unsigned int size = 0 /* default determine size */ );
+	virtual void setBooks(const char *iBMAX, struct sbook2 **ibooks);
 	virtual void setLocale(const char *name);
 	virtual const char *getLocale() const { return locale; }
 
@@ -424,8 +424,14 @@
 
 	SWKEY_OPERATORS
 
-	virtual SWKey & operator = (const VerseKey & ikey) { copyFrom(ikey); return *this; }
+	virtual SWKey & operator = (const VerseKey2 & ikey) { copyFrom(ikey); return *this; }
 };
+
+#ifdef VK2
+typedef VerseKey2 VerseKey;
+typedef sbook2 sbook;
+typedef abbrev2 abbrev;
+#endif
 
 SWORD_NAMESPACE_END
 #endif

Index: swlocale.h
===================================================================
RCS file: /cvs/core/sword/include/swlocale.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- swlocale.h	9 Apr 2004 17:41:47 -0000	1.13
+++ swlocale.h	12 Apr 2004 13:49:12 -0000	1.14
@@ -26,7 +26,11 @@
 #include <map>
 
 #include <swconfig.h>
+
 #include <versekey.h>
+#ifdef SPLITLIB
+#include <versekey2.h>
+#endif
 
 #include <defs.h>
 
@@ -49,6 +53,10 @@
 	struct abbrev *bookAbbrevs;
 	char *BMAX;
 	struct sbook **books;
+	#ifdef SPLITLIB
+	struct sbook2 **books2;
+	char *BMAX2;
+	#endif
 
 public:
 	SWLocale(const char *ifilename);
@@ -72,6 +80,9 @@
 	virtual void getBooks(char **iBMAX, struct sbook ***ibooks, VerseKey *vk);
 	#else
 	virtual void getBooks(char **iBMAX, struct sbook ***ibooks);
+	#endif
+	#ifdef SPLITLIB
+	virtual void getBooks2(char **iBMAX, struct sbook2 ***ibooks, VerseKey2 *vk);
 	#endif
 };
 

Index: osisbook.h
===================================================================
RCS file: /cvs/core/sword/include/osisbook.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- osisbook.h	10 Apr 2004 22:07:03 -0000	1.3
+++ osisbook.h	12 Apr 2004 13:49:12 -0000	1.4
@@ -1,5 +1,5 @@
 /******************************************************************************
- * osisbook.h - Canonical text information to be included by VerseKey.cpp
+ * osisbook.h - Canonical text information to be included by VerseKey2.cpp
  *
  * $Id$
  *
@@ -34,7 +34,7 @@
 #define NOTINREFSYS -1
 #define BUILTINABBREVCNT 195
  
-struct sbook VerseKey::osisbooks[] = {
+struct sbook2 VerseKey2::osisbooks[] = {
 //Old Testament
 {"Old Testament", "OT"},//0
 {"Genesis", "Gen"},
@@ -150,8 +150,8 @@
 };
 
 
-const struct abbrev
-  VerseKey::builtin_abbrevs[] = {
+const struct abbrev2
+  VerseKey2::builtin_abbrevs[] = {
   {"1 C", 46},			//   1 Corinthians
   {"1 CHRONICLES", 13},		//   1 Chronicles
   {"1 CORINTHIANS", 47},	//   1 Corinthians
@@ -353,7 +353,7 @@
 
 /* includes all osis books - use the locale osis.conf instead
 const struct abbrev
-  VerseKey::builtin_abbrevs[] = {
+  VerseKey2::builtin_abbrevs[] = {
   {"1 C", 46},			//   1 Corinthians
   {"1 CHRONICLES", 13},		//   1 Chronicles
   {"1 CORINTHIANS", 47},	//   1 Corinthians
@@ -638,7 +638,7 @@
 /* These are for commentaries */
 
 struct bkref
-  VerseKey::kjvbks[] = {
+  VerseKey2::kjvbks[] = {
 //Header
 {0, TESTAMENT_HEADING},//0
 	//Old Testament
@@ -764,7 +764,7 @@
 };
 
 struct bkref
-  VerseKey::kjvcps[] = {
+  VerseKey2::kjvcps[] = {
 {1, 0}, // OT Header
 {2, 0}, // Genesis:0
 {3, 31}, // Genesis:1
@@ -2025,7 +2025,7 @@
 };
 
 int
-  VerseKey::offsize[2] =
-  { NTBOOKS+OTBOOKS+2, sizeof (VerseKey::kjvcps) / sizeof(bkref)
+  VerseKey2::offsize[2] =
+  { NTBOOKS+OTBOOKS+2, sizeof (VerseKey2::kjvcps) / sizeof(bkref)
 };