[sword-svn] r3497 - in trunk: bindings include src/mgr tests utilities

scribe at crosswire.org scribe at crosswire.org
Wed Nov 1 03:35:38 MST 2017


Author: scribe
Date: 2017-11-01 03:35:38 -0700 (Wed, 01 Nov 2017)
New Revision: 3497

Modified:
   trunk/bindings/flatapi.cpp
   trunk/include/swconfig.h
   trunk/src/mgr/installmgr.cpp
   trunk/src/mgr/localemgr.cpp
   trunk/src/mgr/swconfig.cpp
   trunk/src/mgr/swlocale.cpp
   trunk/src/mgr/swmgr.cpp
   trunk/tests/configtest.cpp
   trunk/utilities/installmgr.cpp
Log:
normalized camelcase in swconfig, toward 2.0

Modified: trunk/bindings/flatapi.cpp
===================================================================
--- trunk/bindings/flatapi.cpp	2017-09-11 11:41:08 UTC (rev 3496)
+++ trunk/bindings/flatapi.cpp	2017-11-01 10:35:38 UTC (rev 3497)
@@ -956,7 +956,7 @@
 		FileMgr::createParent(modsd.c_str());
 		SWConfig config(modsd.c_str());
 		config["Globals"]["HiAndroid"] = "weeee";
-		config.Save();
+		config.save();
 	}
 	return (SWHANDLE) new HandleSWMgr(new WebMgr(confPath.c_str()));
 }
@@ -1283,7 +1283,7 @@
 
 		SWConfig config(confPath.c_str());
 		config["General"]["PassiveFTP"] = "true";
-		config.Save();
+		config.save();
 	}
 	HandleInstMgr *hinstmgr = new HandleInstMgr();
 	hinstmgr->statusReporter.init(statusReporter);

Modified: trunk/include/swconfig.h
===================================================================
--- trunk/include/swconfig.h	2017-09-11 11:41:08 UTC (rev 3496)
+++ trunk/include/swconfig.h	2017-11-01 10:35:38 UTC (rev 3497)
@@ -39,51 +39,106 @@
 *
 */
 class SWDLLEXPORT SWConfig {
-private:
-	char getline(int fd, SWBuf &line);
 public:
-	/** The filename used by this SWConfig object
-	*
-	*/
-	SWBuf filename;
 	/** Map of available sections
 	* The map of available sections.
 	*/
-	SectionMap Sections;
 
 	/** Constructor of SWConfig
-	* @param ifilename The file, which should be used for this config.
-	*/
-	SWConfig(const char *ifilename);
+	 * @param fileName The storage path for this config.
+	 */
+	SWConfig(const char *fileName);
 	SWConfig();
 	virtual ~SWConfig();
 
-	/** Load from disk
-	* Load the content from disk.
-	*/
-	virtual void Load();
+	/** Get the section map for the config
+	 */
+	virtual SectionMap &getSections();
+	const SectionMap &getSections() const { return const_cast<SWConfig *>(this)->getSections(); }
 
-	/** Save to disk
-	* Save the content of this config object to disk.
-	*/
-	virtual void Save();
+	/** Load the content from datastore
+	 */
+	virtual void load();
 
-	/** Merges the values of addFrom
-	* @param addFrom The config which values should be merged to this config object. Already existing values will be overwritten.
-	*/
+	/** Save the content of this config object to the datastore
+	 */
+	virtual void save() const;
+
+	/** Merges into this config the values from addFrom
+	 * @param addFrom The config which values should be merged to this config object. Already existing values will be overwritten.
+	 */
 	virtual void augment(SWConfig &addFrom);
-	virtual SWConfig & operator +=(SWConfig &addFrom) { augment(addFrom); return *this; }
 
-	/** Get a section
-	* This is an easy way to get and store config values.
-	* The following will work:\n
-	*
-	* @code
-	* SWConfig config("/home/user/.setttings");
-	* config["Colors"]["Background"] = "red";
-	* @endcode
-	*/
-	virtual ConfigEntMap & operator [](const char *section);
-	};
+	/** Get a specified section from config, creating the section if needed
+	 * There is no const version of this method because it returns a ConfigEntMap reference, creating the requested section if it doesn't exist.
+	 * @param section section name to retrieve
+	 */
+	ConfigEntMap &getSection(const char *section) { return getSections()[section]; }
+
+
+	/** This operator provides a conventient syntax to get and store config values
+	 *
+	 * config[section][key] = value;
+	 * value = config[section][key];
+	 *
+	 * The following will work:\n
+	 *
+	 * @code
+	 * SWConfig config("/home/user/.settings");
+	 * config["Colors"]["Background"] = "red";
+	 * @endcode
+	 */
+	ConfigEntMap &operator [](const char *section) { return getSection(section); }
+
+	/** shorthand operator for augment
+	 */
+	SWConfig &operator +=(SWConfig &addFrom) { augment(addFrom); return *this; }
+
+	/** get a value from a [section] key=value
+	 * @param section  the section name containing the key
+	 * @param key      the key to which the value is associated
+	 * @return         the value associated with the key in the provided section
+	 */
+	SWBuf getValue(const char *section, const char *key) {
+		return (*this)[section][key];
+	}
+
+	/** set a value for a specified key in a [section]
+	 * @param section  the section name to contain the key
+	 * @param key      the key to which to associate the value
+	 * @param value    the value to associated with the key
+	 */
+	void setValue(const char *section, const char *key, const char *value) {
+		(*this)[section][key] = value;
+	}
+
+	/** The storage path used by this SWConfig object
+	 */
+	SWBuf getFileName() const;
+
+
+	// ****** Deprecated methods for removal in 2.0
+
+	/**
+	 * @deprecated Use getSections() instead.
+	 */
+	SWDEPRECATED SectionMap Sections;
+
+	/**
+	 * @deprecated Use getFileName() instead.
+	 */
+	SWDEPRECATED SWBuf filename;
+
+	/**
+	 * @deprecated Use load() instead.
+	 */
+	SWDEPRECATED void Load() { load(); }
+
+	/**
+	 * @deprecated Use save() instead.
+	 */
+	SWDEPRECATED void Save() { save(); }
+
+};
 SWORD_NAMESPACE_END
 #endif

Modified: trunk/src/mgr/installmgr.cpp
===================================================================
--- trunk/src/mgr/installmgr.cpp	2017-09-11 11:41:08 UTC (rev 3496)
+++ trunk/src/mgr/installmgr.cpp	2017-11-01 10:35:38 UTC (rev 3497)
@@ -149,11 +149,11 @@
 	setFTPPassive(stricmp((*installConf)["General"]["PassiveFTP"].c_str(), "false") != 0);
 	setUnverifiedPeerAllowed(stricmp((*installConf)["General"]["UnverifiedPeerAllowed"].c_str(), "false") != 0);
 
-	SectionMap::iterator confSection = installConf->Sections.find("Sources");
+	SectionMap::iterator confSection = installConf->getSections().find("Sources");
 	ConfigEntMap::iterator sourceBegin;
 	ConfigEntMap::iterator sourceEnd;
 
-	if (confSection != installConf->Sections.end()) {
+	if (confSection != installConf->getSections().end()) {
 
 		sourceBegin = confSection->second.lower_bound("FTPSource");
 		sourceEnd = confSection->second.upper_bound("FTPSource");
@@ -207,8 +207,8 @@
 	}
 
 	defaultMods.clear();
-	confSection = installConf->Sections.find("General");
-	if (confSection != installConf->Sections.end()) {
+	confSection = installConf->getSections().find("General");
+	if (confSection != installConf->getSections().end()) {
 		sourceBegin = confSection->second.lower_bound("DefaultMod");
 		sourceEnd = confSection->second.upper_bound("DefaultMod");
 
@@ -222,17 +222,17 @@
 
 void InstallMgr::saveInstallConf() {
 
-	installConf->Sections["Sources"].clear();
+	installConf->getSection("Sources").clear();
 
 	for (InstallSourceMap::iterator it = sources.begin(); it != sources.end(); ++it) {
 		if (it->second) {
-			installConf->Sections["Sources"].insert(ConfigEntMap::value_type(it->second->type + "Source", it->second->getConfEnt().c_str()));
+			installConf->getSection("Sources").insert(ConfigEntMap::value_type(it->second->type + "Source", it->second->getConfEnt().c_str()));
 		}
 	}
 	(*installConf)["General"]["PassiveFTP"] = (isFTPPassive()) ? "true" : "false";
 	(*installConf)["General"]["UnverifiedPeerAllowed"] = (isUnverifiedPeerAllowed()) ? "true" : "false";
 
-	installConf->Save();
+	installConf->save();
 }
 
 
@@ -247,9 +247,9 @@
 	// save our own copy, cuz when we remove the module from the SWMgr
 	// it's likely we'll free the memory passed to us in moduleName
 	SWBuf modName = moduleName;
-	module = manager->config->Sections.find(modName);
+	module = manager->config->getSections().find(modName);
 
-	if (module != manager->config->Sections.end()) {
+	if (module != manager->config->getSections().end()) {
 		// to be sure all files are closed
 		// this does not remove the .conf information from SWMgr
 		manager->deleteModule(modName);
@@ -289,7 +289,7 @@
 						modFile += "/";
 						modFile += ent->d_name;
 						SWConfig *config = new SWConfig(modFile.c_str());
-						if (config->Sections.find(modName) != config->Sections.end()) {
+						if (config->getSections().find(modName) != config->getSections().end()) {
 							delete config;
 							FileMgr::removeFile(modFile.c_str());
 						}
@@ -427,9 +427,9 @@
 
 	SWMgr mgr(sourceDir.c_str());
 	
-	module = mgr.config->Sections.find(modName);
+	module = mgr.config->getSections().find(modName);
 
-	if (module != mgr.config->Sections.end()) {
+	if (module != mgr.config->getSections().end()) {
 	
 		entry = module->second.find("CipherKey");
 		if (entry != module->second.end())
@@ -529,7 +529,7 @@
 						modFile = confDir;
 						modFile += ent->d_name;
 						SWConfig *config = new SWConfig(modFile.c_str());
-						if (config->Sections.find(modName) != config->Sections.end()) {
+						if (config->getSections().find(modName) != config->getSections().end()) {
 							SWBuf targetFile = destMgr->configPath; //"./mods.d/";
 							removeTrailingSlash(targetFile);
 							targetFile += "/";
@@ -542,7 +542,7 @@
 									aborted = true;
 								}
 								else {
-									config->Save();
+									config->save();
 									retVal = FileMgr::copyFile(modFile.c_str(), targetFile.c_str());
 								}
 							}
@@ -668,8 +668,8 @@
 	int errorCode = remoteCopy(&is, masterRepoList, masterRepoListPath.c_str(), false);
 	if (!errorCode) { //sucessfully downloaded the repo list
 		SWConfig masterList(masterRepoListPath);
-		SectionMap::iterator sections = masterList.Sections.find("Repos");
-		if (sections != masterList.Sections.end()) {
+		SectionMap::iterator sections = masterList.getSections().find("Repos");
+		if (sections != masterList.getSections().end()) {
 			for (ConfigEntMap::iterator actions = sections->second.begin(); actions != sections->second.end(); actions++) {
 				// Search through our current sources and see if we have a matching UID
 				InstallSourceMap::iterator it;

Modified: trunk/src/mgr/localemgr.cpp
===================================================================
--- trunk/src/mgr/localemgr.cpp	2017-09-11 11:41:08 UTC (rev 3496)
+++ trunk/src/mgr/localemgr.cpp	2017-11-01 10:35:38 UTC (rev 3497)
@@ -85,7 +85,7 @@
 		SWLog::getSystemLog()->logDebug("LOOKING UP LOCALE DIRECTORY...");
 		SWMgr::findConfig(&configType, &prefixPath, &configPath, &augPaths, &sysConf);
 		if (sysConf) {
-			if ((entry = sysConf->Sections["Install"].find("LocalePath")) != sysConf->Sections["Install"].end()) {
+			if ((entry = sysConf->getSection("Install").find("LocalePath")) != sysConf->getSection("Install").end()) {
 				configType = 9;	// our own
 				stdstr(&prefixPath, (char *)entry->second.c_str());
 				SWLog::getSystemLog()->logDebug("LocalePath provided in sysConfig.");

Modified: trunk/src/mgr/swconfig.cpp
===================================================================
--- trunk/src/mgr/swconfig.cpp	2017-09-11 11:41:08 UTC (rev 3496)
+++ trunk/src/mgr/swconfig.cpp	2017-11-01 10:35:38 UTC (rev 3497)
@@ -29,14 +29,18 @@
 
 SWORD_NAMESPACE_START
 
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
 
 SWConfig::SWConfig() {
 }
 
 
-SWConfig::SWConfig(const char * ifilename) {
+SWConfig::SWConfig(const char *ifilename) {
 	filename = ifilename;
-	Load();
+	load();
 }
 
 
@@ -44,10 +48,14 @@
 }
 
 
-void SWConfig::Load() {
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
 
-	if (!filename.size()) return;	// assert we have a filename
+void SWConfig::load() {
 
+	if (!getFileName().size()) return;	// assert we have a filename
+
 	FileDesc *cfile;
 	char *buf, *data;
 	SWBuf line;
@@ -55,9 +63,9 @@
 	SWBuf sectname;
 	bool first = true;
 	
-	Sections.erase(Sections.begin(), Sections.end());
+	getSections().erase(getSections().begin(), getSections().end());
 	
-	cfile = FileMgr::getSystemFileMgr()->open(filename.c_str(), FileMgr::RDONLY);
+	cfile = FileMgr::getSystemFileMgr()->open(getFileName().c_str(), FileMgr::RDONLY);
 	if (cfile->getFd() > 0) {
 		bool goodLine = FileMgr::getLine(cfile, line);
 
@@ -76,7 +84,7 @@
 				strcpy(buf, line.c_str());
 				if (*strstrip(buf) == '[') {
 					if (!first)
-						Sections.insert(SectionMap::value_type(sectname, cursect));
+						getSections().insert(SectionMap::value_type(sectname, cursect));
 					else first = false;
 					
 					cursect.erase(cursect.begin(), cursect.end());
@@ -97,27 +105,27 @@
 			goodLine = FileMgr::getLine(cfile, line);
 		}
 		if (!first)
-			Sections.insert(SectionMap::value_type(sectname, cursect));
+			getSections().insert(SectionMap::value_type(sectname, cursect));
 
 		FileMgr::getSystemFileMgr()->close(cfile);
 	}
 }
 
 
-void SWConfig::Save() {
+void SWConfig::save() const {
 
-	if (!filename.size()) return;	// assert we have a filename
+	if (!getFileName().size()) return;	// assert we have a filename
 
 	FileDesc *cfile;
 	SWBuf buf;
-	SectionMap::iterator sit;
-	ConfigEntMap::iterator entry;
+	SectionMap::const_iterator sit;
+	ConfigEntMap::const_iterator entry;
 	SWBuf sectname;
 	
-	cfile = FileMgr::getSystemFileMgr()->open(filename.c_str(), FileMgr::RDWR|FileMgr::CREAT|FileMgr::TRUNC);
+	cfile = FileMgr::getSystemFileMgr()->open(getFileName().c_str(), FileMgr::RDWR|FileMgr::CREAT|FileMgr::TRUNC);
 	if (cfile->getFd() > 0) {
 		
-		for (sit = Sections.begin(); sit != Sections.end(); sit++) {
+		for (sit = getSections().begin(); sit != getSections().end(); sit++) {
 			buf =  "\n[";
 			buf += (*sit).first.c_str();
 			buf += "]\n";
@@ -142,32 +150,45 @@
 	SectionMap::iterator section;
 	ConfigEntMap::iterator entry, start, end;
 
-	for (section = addFrom.Sections.begin(); section != addFrom.Sections.end(); section++) {
+	for (section = addFrom.getSections().begin(); section != addFrom.getSections().end(); section++) {
 		for (entry = (*section).second.begin(); entry != (*section).second.end(); entry++) {
-			start = Sections[section->first].lower_bound(entry->first);
-			end   = Sections[section->first].upper_bound(entry->first);
+			start = getSections()[section->first].lower_bound(entry->first);
+			end   = getSections()[section->first].upper_bound(entry->first);
 			if (start != end) {
 				if (((++start) != end)
-						|| ((++(addFrom.Sections[section->first].lower_bound(entry->first))) != addFrom.Sections[section->first].upper_bound(entry->first))) {
+						|| ((++(addFrom.getSections()[section->first].lower_bound(entry->first))) != addFrom.getSections()[section->first].upper_bound(entry->first))) {
 					for (--start; start != end; start++) {
 						if (!strcmp(start->second.c_str(), entry->second.c_str()))
 							break;
 					}
 					if (start == end)
-						Sections[(*section).first].insert(ConfigEntMap::value_type((*entry).first, (*entry).second));
+						getSections()[(*section).first].insert(ConfigEntMap::value_type((*entry).first, (*entry).second));
 				}
-				else	Sections[section->first][entry->first.c_str()] = entry->second.c_str();
+				else	getSections()[section->first][entry->first.c_str()] = entry->second.c_str();
 			}		
-			else	Sections[section->first][entry->first.c_str()] = entry->second.c_str();
+			else	getSections()[section->first][entry->first.c_str()] = entry->second.c_str();
 		}
 	}
 }
 
 
-ConfigEntMap & SWConfig::operator [] (const char *section) {
-    return Sections[section];
-}
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
 
+// TODO: use deprecated public 'Sections' property for now until we remove deprecation
+// and store in private property
+SectionMap &SWConfig::getSections() { return Sections; }
 
+// TODO: use deprecated public 'filename' property for now until we remove deprecation
+// and store in private property
+	
+SWBuf SWConfig::getFileName() const { return filename; }
+
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
+
 SWORD_NAMESPACE_END
 

Modified: trunk/src/mgr/swlocale.cpp
===================================================================
--- trunk/src/mgr/swlocale.cpp	2017-09-11 11:41:08 UTC (rev 3496)
+++ trunk/src/mgr/swlocale.cpp	2017-11-01 10:35:38 UTC (rev 3497)
@@ -69,16 +69,16 @@
 		for (abbrevsCnt = 0; builtin_abbrevs[abbrevsCnt].osis[0]; abbrevsCnt++);
 	}
 
-	confEntry = localeSource->Sections["Meta"].find("Name");
-	if (confEntry != localeSource->Sections["Meta"].end())
+	confEntry = localeSource->getSection("Meta").find("Name");
+	if (confEntry != localeSource->getSection("Meta").end())
 		stdstr(&name, (*confEntry).second.c_str());
 	
-	confEntry = localeSource->Sections["Meta"].find("Description");
-	if (confEntry != localeSource->Sections["Meta"].end())
+	confEntry = localeSource->getSection("Meta").find("Description");
+	if (confEntry != localeSource->getSection("Meta").end())
 		stdstr(&description, (*confEntry).second.c_str());
 
-	confEntry = localeSource->Sections["Meta"].find("Encoding"); //Either empty (==Latin1) or UTF-8
-	if (confEntry != localeSource->Sections["Meta"].end())
+	confEntry = localeSource->getSection("Meta").find("Encoding"); //Either empty (==Latin1) or UTF-8
+	if (confEntry != localeSource->getSection("Meta").end())
 		stdstr(&encoding, (*confEntry).second.c_str());
 }
 
@@ -110,8 +110,8 @@
 
 	if (entry == p->lookupTable.end()) {
 		ConfigEntMap::iterator confEntry;
-		confEntry = localeSource->Sections["Text"].find(text);
-		if (confEntry == localeSource->Sections["Text"].end())
+		confEntry = localeSource->getSection("Text").find(text);
+		if (confEntry == localeSource->getSection("Text").end())
 			p->lookupTable.insert(LookupMap::value_type(text, text));
 		else {//valid value found
 			/*
@@ -169,8 +169,8 @@
 		for (int j = 0; builtin_abbrevs[j].osis[0]; j++) {
 			p->mergedAbbrevs[builtin_abbrevs[j].ab] = builtin_abbrevs[j].osis;
 		}
-		ConfigEntMap::iterator it = localeSource->Sections["Book Abbrevs"].begin();
-		ConfigEntMap::iterator end = localeSource->Sections["Book Abbrevs"].end();
+		ConfigEntMap::iterator it = localeSource->getSection("Book Abbrevs").begin();
+		ConfigEntMap::iterator end = localeSource->getSection("Book Abbrevs").end();
 		for (; it != end; it++) {
 			p->mergedAbbrevs[it->first.c_str()] = it->second.c_str();
 		}

Modified: trunk/src/mgr/swmgr.cpp
===================================================================
--- trunk/src/mgr/swmgr.cpp	2017-09-11 11:41:08 UTC (rev 3496)
+++ trunk/src/mgr/swmgr.cpp	2017-11-01 10:35:38 UTC (rev 3497)
@@ -447,7 +447,7 @@
 			SWLog::getSystemLog()->logDebug("Overriding any systemwide or ~/.sword/ sword.conf with one found in current directory.");
 			sysConfPath = "./sword.conf";
 			sysConf = new SWConfig(sysConfPath);
-			if ((entry = sysConf->Sections["Install"].find("DataPath")) != sysConf->Sections["Install"].end()) {
+			if ((entry = sysConf->getSection("Install").find("DataPath")) != sysConf->getSection("Install").end()) {
 				sysConfDataPath = (*entry).second;
 			}
 			if (providedSysConf) {
@@ -559,7 +559,7 @@
 	}
 
 	if (sysConf) {
-		if ((entry = sysConf->Sections["Install"].find("DataPath")) != sysConf->Sections["Install"].end()) {
+		if ((entry = sysConf->getSection("Install").find("DataPath")) != sysConf->getSection("Install").end()) {
 			sysConfDataPath = (*entry).second;
 		}
 		if (sysConfDataPath.size()) {
@@ -594,8 +594,8 @@
 	if (sysConf) {
 		if (augPaths) {
 			augPaths->clear();
-			entry     = sysConf->Sections["Install"].lower_bound("AugmentPath");
-			lastEntry = sysConf->Sections["Install"].upper_bound("AugmentPath");
+			entry     = sysConf->getSection("Install").lower_bound("AugmentPath");
+			lastEntry = sysConf->getSection("Install").upper_bound("AugmentPath");
 			for (;entry != lastEntry; entry++) {
 				path = entry->second;
 				if ((entry->second.c_str()[strlen(entry->second.c_str())-1] != '\\') && (entry->second.c_str()[strlen(entry->second.c_str())-1] != '/'))
@@ -762,8 +762,8 @@
 			// fix config's Section names to rename modules which are available more than once
 			// find out which sections are in both config objects
 			// inserting all configs first is not good because that overwrites old keys and new modules would share the same config
-			for (SectionMap::iterator it = config->Sections.begin(); it != config->Sections.end();) {
-				if (saveConfig->Sections.find( (*it).first ) != saveConfig->Sections.end()) { //if the new section is already present rename it
+			for (SectionMap::iterator it = config->getSections().begin(); it != config->getSections().end();) {
+				if (saveConfig->getSections().find((*it).first) != saveConfig->getSections().end()) { //if the new section is already present rename it
 					ConfigEntMap entMap((*it).second);
 					
 					SWBuf name;
@@ -771,11 +771,11 @@
 					do { //module name already used?
 						name.setFormatted("%s_%d", (*it).first.c_str(), i);
 						i++;
-					} while (config->Sections.find(name) != config->Sections.end());
+					} while (config->getSections().find(name) != config->getSections().end());
 					
-					config->Sections.insert(SectionMap::value_type(name, entMap) );
+					config->getSections().insert(SectionMap::value_type(name, entMap) );
 					SectionMap::iterator toErase = it++;
-					config->Sections.erase(toErase);
+					config->getSections().erase(toErase);
 				}
 				else ++it;
 			}
@@ -827,7 +827,7 @@
 
 		DeleteMods();
 
-		for (Sectloop = config->Sections.lower_bound("Globals"), Sectend = config->Sections.upper_bound("Globals"); Sectloop != Sectend; Sectloop++) {		// scan thru all 'Globals' sections
+		for (Sectloop = config->getSections().lower_bound("Globals"), Sectend = config->getSections().upper_bound("Globals"); Sectloop != Sectend; Sectloop++) {		// scan thru all 'Globals' sections
 			for (Entryloop = (*Sectloop).second.lower_bound("AutoInstall"), Entryend = (*Sectloop).second.upper_bound("AutoInstall"); Entryloop != Entryend; Entryloop++)	// scan thru all AutoInstall entries
 				InstallScan((*Entryloop).second.c_str());		// Scan AutoInstall entry directory for new modules and install
 		}		
@@ -836,7 +836,7 @@
 			config = myconfig = 0;
 			loadConfigDir(configPath);
 		}
-		else	config->Load();
+		else	config->load();
 
 		CreateMods(mgrModeMultiMod);
 
@@ -1290,7 +1290,7 @@
 	ConfigEntMap::iterator entry;
 	SWModule *newmod;
 	SWBuf driver, misc1;
-	for (it = config->Sections.begin(); it != config->Sections.end(); it++) {
+	for (it = config->getSections().begin(); it != config->getSections().end(); it++) {
 		ConfigEntMap &section = (*it).second;
 		newmod = 0;
 		
@@ -1390,7 +1390,7 @@
 					// mods.conf
 					else {
 						if (!conffd) {
-							conffd = FileMgr::getSystemFileMgr()->open(config->filename.c_str(), FileMgr::WRONLY|FileMgr::APPEND);
+							conffd = FileMgr::getSystemFileMgr()->open(config->getFileName().c_str(), FileMgr::WRONLY|FileMgr::APPEND);
 							if (conffd > 0)
 								conffd->seek(0L, SEEK_END);
 							else {

Modified: trunk/tests/configtest.cpp
===================================================================
--- trunk/tests/configtest.cpp	2017-09-11 11:41:08 UTC (rev 3496)
+++ trunk/tests/configtest.cpp	2017-11-01 10:35:38 UTC (rev 3497)
@@ -31,7 +31,7 @@
     config["Section1"]["Entry1"] = "Value1";
     config["Section1"]["Entry2"] = "oops";
     config["Section1"]["Entry2"] = "Value2";
-    config.Save();
+    config.save();
     SWConfig config2("./test1.conf");
     std::cout << "Should be Value2: " << config2["Section1"]["Entry2"] << std::endl;
     return 0;

Modified: trunk/utilities/installmgr.cpp
===================================================================
--- trunk/utilities/installmgr.cpp	2017-09-11 11:41:08 UTC (rev 3496)
+++ trunk/utilities/installmgr.cpp	2017-11-01 10:35:38 UTC (rev 3497)
@@ -194,7 +194,7 @@
 	if (enableRemote) {
 		config["Sources"]["FTPSource"] = is.getConfEnt();
 	}
-	config.Save();
+	config.save();
 }
 
 




More information about the sword-cvs mailing list