Guys,

I have created a first patch for a method getBibliography

It checks whether a module has a entry "Bibliography" in the conf file
and if not creates a rudimentary one in Bibtex format and returns that.

Please tell me what you think of this.

Peter
Index: src/modules/swmodule.cpp
===================================================================
--- src/modules/swmodule.cpp	(revision 2625)
+++ src/modules/swmodule.cpp	(working copy)
@@ -962,7 +962,17 @@
 	return (it != config->end()) ? it->second.c_str() : 0;
 }
 
+const char *SWModule::getBibliography() const{
+	if (const char *c= getConfigEntry("Bibliography")) {
+		return c;
+		}
+	else {	 
+		SWBuf retValBuf = SWBuf("@Book {") + (SWBuf) modname + SWBuf(", Title = \"") + (SWBuf) moddesc + SWBuf("\", Publisher = \"CrossWire Bible Society\"}");
+		return retValBuf.c_str();
+	}
+}
 
+
 void SWModule::setConfig(ConfigEntMap *config) {
 	this->config = config;
 }
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision 2625)
+++ tests/Makefile.am	(working copy)
@@ -7,7 +7,7 @@
 
 SUBDIRS = cppunit
 
-noinst_PROGRAMS = utf8norm ciphertest keytest mgrtest parsekey versekeytest vtreekeytest versemgrtest listtest casttest \
+noinst_PROGRAMS = utf8norm ciphertest keytest mgrtest parsekey versekeytest vtreekeytest versemgrtest listtest casttest bibliography\
 modtest compnone complzss localetest introtest indextest configtest keycast \
 romantest testblocks filtertest rawldidxtest lextest swaptest \
  swbuftest xmltest webiftest striptest
@@ -66,8 +66,8 @@
 webiftest_SOURCES = webiftest.cpp
 striptest_SOURCES = striptest.cpp
 xmltest_SOURCES = xmltest.cpp
+bibliography_SOURCES = bibliography.cpp
 
-
 EXTRA_DIST = 
 include bcppmake/Makefile.am
 include testsuite/Makefile.am
Index: include/swmodule.h
===================================================================
--- include/swmodule.h	(revision 2625)
+++ include/swmodule.h	(working copy)
@@ -178,6 +178,7 @@
 	virtual void setConfig(ConfigEntMap *config);
 	virtual const ConfigEntMap &getConfig() const { return *config; }
 	virtual const char *getConfigEntry(const char *key) const;
+	virtual const char *getBibliography() const;
 
 	/**
 	 * @return The size of the text entry for the module's current key position.
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Reply via email to