[sword-devel] SWConfig questions

Troy A. Griffitts scribe at crosswire.org
Sat Aug 25 02:56:09 MST 2007


SWConfig uses an stl multimap.  This is similar to a map, but also 
allows duplicates.

We've subclassed multimap and added back many of the nice accessors that 
map provides, like:

SWConfig config("~/.sword/InstallMgr/InstallMgr.conf");

But, like you've pointed out, FTPSource has multiple entries, so you 
can't use the map accessors.  You'll need to use the multimap ones. 
Here is an example:

ConfigEntMap::iterator sourceBegin;
ConfigEntMap::iterator sourceEnd;

sourceBegin = config["Sources"].lower_bound("FTPSource");
sourceEnd = config["Source"].upper_bound("FTPSource");
while (sourceBegin != sourceEnd) {
   // do you stuff here

An example of manipulating InstallMgr.conf directly with SWConfig can be 
seen here:


I think we've since added management functions to the InstallMgr API 
class, but I can't remember.  If we haven't, we should have by now.


Here's the multimap docs.


Hope this helps.


Manfred Bergmann wrote:
> Hi.
> I have some questions for SWConfig. Maybe due to my lack of C++  
> knowledge. :)
> I don't quite understand how, in case of InstallMgr, add, remove and  
> edit an entry to [Sources] section.
> Well, adding works quite good. That can be seen in utilities/ 
> InstallMgr.cpp.
> But I don't get it how to add multiple InstallSource(s) for i.e.  
> "FTPSource".
> Also for removing them and editing one Source.
> Hope someone can help.
> Regards,
> Manfred
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page

More information about the sword-devel mailing list