[sword-devel] How to detect books available in a given module ?

Pierre Amadio amadio.pierre at gmail.com
Tue May 15 06:47:16 MST 2018


Hello.

I am trying to  be able to detect wich books are available in a given
module.
I do not experience a consistent behaviour with all modules, and I am
wondering if there is a bug somewhere, or if my expectations are wrong.

I was expecting the SWModule Error() method to be a good way to detect
an unknown verse once the versekey was set, by example like this:

    SWMgr library(new MarkupFilterMgr(FMT_PLAIN));
    SWModule * target;

    const char *moduleName="KJV";
    const char *keyName="Genesis 1:1";

    target = library.getModule(moduleName);
    target->setKey(keyName);
    char e=target->Error();

    if(e) {
        //There is an error,no such book in this module.
        printf("Error: %c \n", target->Error());
        std::cout<< "Error:"<<target->Error()<<"\n";
    } else {
        std::cout << target->getKeyText() << "\n";
        std::cout << target->renderText();
    }

Things works like expected if i use "OSHB" as a module and "Mark 1:1" as
keyName: there is an error and i can realise this module does not
contain the book of Mark. However, when dealing with some greek module
such as MorphGNT or Nestle1904 and using "Genesis 1:1" as keyName, there
is no error detected although those modules do not contains the book of
genesis.

Any idea what i may be doing wrong and how to detect wich modules gives
wich book ?



More information about the sword-devel mailing list