Re: getKeyText() doesn't always return keys.

"David \"Judah's Shadow\" Blue" <[email protected]>
Newsgroups gmane.comp.literature.sword.devel
Message-ID <1937435.ps9fEDaoq0@brooks>
On Monday, March 25, 2024 4:06:19 PM EDT David "Judah's Shadow" Blue wrote:
> On Monday, March 25, 2024 1:52:40 PM EDT David "Judah's Shadow" Blue wrote:
> > I've noticed a problem with lexicons not always getting a value from
> > getKeyText(). It's intermittent, and I can't quite nail down why I would
> > be
> > getting empty strings when I call it sometimes.
> 
> Investigating further, it appears to happen on the first usage of
> getKeyText() but only for lexicon based modules, bibles and commentaries
> show keytext correctly.

In further weirdness, I sometimes get what I have entered previously as the 
key. Here's an example function I use to retrieve a lexicon entry.

std::string Lexicon::getEntry(std::string entry) {
    std::string lexEntry;
    sword::SWModule *module;

    std::transform(entry.begin(), entry.end(), entry.begin(),
                   [](unsigned char c) {return std::toupper(c);});

    
    module = this->swordLibrary->getModule(this->lexiDict.c_str());
    module->setKeyText(entry.c_str());
    
    lexEntry = module->getKeyText();
    lexEntry += " ";
    lexEntry += module->stripText();

    return lexEntry;
}

I am uncertain what I could be doing wrong here.


_______________________________________________
sword-devel mailing list: [email protected]
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.