/* * console app to find Sword modules and get and print information about * them with a verse from the NT * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation version 2. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * */ #include <cstdlib> #include <iostream> #include <swmgr.h> using namespace std; using sword::SWMgr; using sword::ModMap; using sword::SWModule; int main(int argc, char *argv[]) { SWMgr manager; ModMap::iterator it; SWModule *curMod = 0; // pointer to current module found in loop for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) { curMod = (*it).second; cout << curMod->Type() << ": " << curMod->Name() << "\n"; // module name cout << curMod->Description() << "\n"; // module short description cout << "Language is " << curMod->Lang(0) << "\n"; // language if (!strcmp(curMod->Lang(0), "en")) { // only print if language is en if (!strcmp(curMod->Type(), "Biblical Texts")) { //do something with curMod ok to print if bible text curMod->SetKey("jas 1:19"); cout << curMod->Name() << " James 1:19 has: " << (const char *) *curMod << "\n"; } else if (!strcmp(curMod->Type(), "Commentaries")) { curMod->SetKey("jas 1:19"); cout << curMod->Name() << " James 1:19 has: " << (const char *) *curMod << "\n"; //do something with curMod ok to print if commentary } else if (!strcmp(curMod->Type(), "Lexicons / Dictionaries")) { //do something with curMod nothing to do with these //just offered as an example //there might also be "Generic Books" } } } system("PAUSE"); return EXIT_SUCCESS; }