[sword-devel] Multiple Feature entries from getConfigEntry().

Troy A. Griffitts scribe at crosswire.org
Wed May 15 09:01:14 EDT 2024


Hi David,

Yeah, so a module's config is simply a multimap<SWBuf, SWBuf>.  We 
extend multimap with our own class multimapwithdefault to make it nice 
to work with when there is only one entry so you can still simply say:

  SWBuf x = configEntries["mykey"];

Just like a map works, but if there is more than one entry, for your key 
(which is allowed by multimap) the behavior is undefined.  You'll get 
one of the entries, but not sure which one.

So, for cases when you want to read multiple entries for a key, you'll 
have to use the standard multimap iterators,  something like the following:

     ConfigEntMap::iterator begin = 
module->getConfig().lower_bound("Feature");
     ConfigEntMap::iterator end   = 
module->getConfig().upper_bound("Feature");
     while (begin != end) {
         SWBuf featureValue = begin->second;
         ++begin;
     }

Hope this helps,
Troy


On 5/8/24 16:54, David "Judah's Shadow" Blue wrote:
> While I'm waiting on the issue with searching for Strong's numbers, I'm
> working a little more on the info command for BIBISH. I want to show what
> features modules have, but am not certain how to get more than just the first
> entry.
>
> For instance, the KJV lists
> Feature=NoParagraphs
> Feature=StrongsNumbers
>
> When I call SWModule::getConfigEntry("Feature") all I get back is NoParagraphs.
> Is there a way to also get the StrongsNumbers entry?
>
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page


More information about the sword-devel mailing list