[sword-svn] r1693 - in trunk: include src/mgr src/modules/lexdict/rawld4

scribe at crosswire.org scribe at crosswire.org
Wed Jan 12 03:18:02 MST 2005


Author: scribe
Date: 2005-01-12 03:18:02 -0700 (Wed, 12 Jan 2005)
New Revision: 1693

Modified:
   trunk/include/installmgr.h
   trunk/src/mgr/installmgr.cpp
   trunk/src/modules/lexdict/rawld4/rawld4.cpp
Log:
Added default module detection to installmgr
Fixed a typo from last commit to rawld4

Modified: trunk/include/installmgr.h
===================================================================
--- trunk/include/installmgr.h	2005-01-10 08:50:47 UTC (rev 1692)
+++ trunk/include/installmgr.h	2005-01-12 10:18:02 UTC (rev 1693)
@@ -4,6 +4,7 @@
 #include <defs.h>
 #include <swbuf.h>
 #include <map>
+#include <set>
 #include <ftptrans.h>
 
 SWORD_NAMESPACE_START
@@ -30,11 +31,12 @@
 	void flush();
 };
 
-typedef std::map < SWBuf, InstallSource * >InstallSourceMap;
+typedef std::map<SWBuf, InstallSource *> InstallSourceMap;
 
 class InstallMgr {
 
 protected:
+	std::set<SWBuf> defaultMods;
 	char *privatePath;
 	StatusReporter *statusReporter;
 	bool passive;
@@ -61,6 +63,20 @@
 	virtual bool getCipherCode(const char *modName, SWConfig *config);
 	void setFTPPassive(bool passive) { this->passive = passive; }
 	void terminate() { if (transport) transport->terminate(); }
+
+	/************************************************************************
+	 * isDefaultModule - allows an installation to provide a set of modules
+	 *   in installMgr.conf like:
+	 *     [General]
+	 *     DefaultMod=KJV
+	 *     DefaultMod=StrongsGreek
+	 *     DefaultMod=Personal
+	 *   This method allows a user interface to ask if a module is specified
+	 *   as a default in the above way.  The logic is, if no modules are
+	 *   installed then all default modules should be automatically selected for install
+	 *   to help the user select a basic foundation of useful modules
+	 */
+	bool isDefaultModule(const char *modName);
 };
 
 

Modified: trunk/src/mgr/installmgr.cpp
===================================================================
--- trunk/src/mgr/installmgr.cpp	2005-01-10 08:50:47 UTC (rev 1692)
+++ trunk/src/mgr/installmgr.cpp	2005-01-12 10:18:02 UTC (rev 1693)
@@ -68,9 +68,9 @@
 
 	sources.clear();
 	
-	sourcesSection = installConf->Sections.find("Sources");
 	setFTPPassive(!stricmp((*installConf)["General"]["PassiveFTP"].c_str(), "true"));
 
+	sourcesSection = installConf->Sections.find("Sources");
 	if (sourcesSection != installConf->Sections.end()) {
 		sourceBegin = sourcesSection->second.lower_bound("FTPSource");
 		sourceEnd = sourcesSection->second.upper_bound("FTPSource");
@@ -84,6 +84,18 @@
 			sourceBegin++;
 		}
 	}
+
+	defaultMods.clear();
+	sourcesSection = installConf->Sections.find("General");
+	if (sourcesSection != installConf->Sections.end()) {
+		sourceBegin = sourcesSection->second.lower_bound("DefaultMod");
+		sourceEnd = sourcesSection->second.upper_bound("DefaultMod");
+
+		while (sourceBegin != sourceEnd) {
+			defaultMods.insert(sourceBegin->second.c_str());
+			sourceBegin++;
+		}
+	}
 }
 
 
@@ -449,5 +461,11 @@
 	is->flush();
 }
 
+
+bool InstallMgr::isDefaultModule(const char *modName) {
+	return defaultMods.count(modName);
+}
+
+
 SWORD_NAMESPACE_END
 

Modified: trunk/src/modules/lexdict/rawld4/rawld4.cpp
===================================================================
--- trunk/src/modules/lexdict/rawld4/rawld4.cpp	2005-01-10 08:50:47 UTC (rev 1692)
+++ trunk/src/modules/lexdict/rawld4/rawld4.cpp	2005-01-12 10:18:02 UTC (rev 1693)
@@ -50,7 +50,7 @@
  * ENT: buf -	buffer to check and pad
  */
 
-void RawLD::strongsPad(char *buf)
+void RawLD4::strongsPad(char *buf)
 {
 	char *check;
 	int size = 0;



More information about the sword-cvs mailing list