[sword-cvs] sword/src/mgr swlocale.cpp,1.11,1.12

sword at www.crosswire.org sword at www.crosswire.org
Sat May 8 09:52:26 MST 2004


Update of /cvs/core/sword/src/mgr
In directory www:/tmp/cvs-serv22182/src/mgr

Modified Files:
	swlocale.cpp 
Log Message:

dglassey: only add recognised books to abbrevs for VerseKey
This means that locales can cover all of OSIS but only the recognised books will be used


Index: swlocale.cpp
===================================================================
RCS file: /cvs/core/sword/src/mgr/swlocale.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- swlocale.cpp	7 May 2004 18:11:24 -0000	1.11
+++ swlocale.cpp	8 May 2004 16:52:24 -0000	1.12
@@ -145,26 +145,33 @@
 	*localeSource += *addFrom.localeSource;
 }
 
+//#define NONNUMERICLOCALETHING 1
 
 const struct abbrev *SWLocale::getBookAbbrevs() {
 	static const char *nullstr = "";
 	if (!bookAbbrevs) {
 		ConfigEntMap::iterator it;
-		int i;
+		int i, j;
 		int size = localeSource->Sections["Book Abbrevs"].size();
 		bookAbbrevs = new struct abbrev[size + 1];
-		for (i = 0, it = localeSource->Sections["Book Abbrevs"].begin(); it != localeSource->Sections["Book Abbrevs"].end(); it++, i++) {
-			bookAbbrevs[i].ab = (*it).first.c_str();
+		for (i = 0, j = 0, it = localeSource->Sections["Book Abbrevs"].begin(); it != localeSource->Sections["Book Abbrevs"].end(); it++, i++) {
 			#ifdef NONNUMERICLOCALETHING
-			bookAbbrevs[i].book = VerseKey::getOSISBookNum((*it).second.c_str());
+			int booknum = VerseKey::getOSISBookNum((*it).second.c_str());
+			if (booknum != -1) {
+				bookAbbrevs[j].ab = (*it).first.c_str();
+				bookAbbrevs[j].book = booknum;
+				j++;
+			}
 			#else
+			bookAbbrevs[i].ab = (*it).first.c_str();
 			bookAbbrevs[i].book = atoi((*it).second.c_str());
+			j++;
 			#endif
 			//printf("SWLocale::getBookAbbrevs %s:%s %d\n",bookAbbrevs[i].ab,
 			//	(*it).second.c_str(), bookAbbrevs[i].book); 
 		}
-		bookAbbrevs[i].ab = nullstr;
-		bookAbbrevs[i].book = -1;
+		bookAbbrevs[j].ab = nullstr;
+		bookAbbrevs[j].book = -1;
 	}
 		
 	return bookAbbrevs;




More information about the sword-cvs mailing list