[sword-devel] SWConfig questions
Troy A. Griffitts
scribe at crosswire.org
Sat Aug 25 02:56:09 MST 2007
Manfred,
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");
config["General"]["PassiveFTP"]="true";
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
sourceBegin++;
}
An example of manipulating InstallMgr.conf directly with SWConfig can be
seen here:
http://svn.crosswire.org/biblecs/trunk/apps/InstallMgr/RemoteMntFrm.cpp
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.
http://svn.crosswire.org/sword/trunk/src/mgr/installmgr.cpp
Here's the multimap docs.
http://www.sgi.com/tech/stl/Multimap.html
Hope this helps.
-Troy.
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