diff options
Diffstat (limited to 'examples/classes/swmgrex.cpp')
-rw-r--r-- | examples/classes/swmgrex.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/examples/classes/swmgrex.cpp b/examples/classes/swmgrex.cpp index 9978a7b..7fc9f73 100644 --- a/examples/classes/swmgrex.cpp +++ b/examples/classes/swmgrex.cpp @@ -1,19 +1,18 @@ /****************************************************************************** - * Class SWMgr manages installed modules for a frontend. - * SWMgr reads a mods.conf file to discover its information. - * It then instantiates the correct decendent of SWModule for each - * module entry in mods.conf - * The developer may use this class to query what modules are installed - * and to retrieve an (SWModule *) for any one of these modules * - * SWMgr makes its modules available as an STL Map. - * The Map definition is typedef'ed as ModMap - * ModMap consists of: FIRST : SWBuf moduleName - * SECOND: SWModule *module + * swmgrex.cpp - Class SWMgr manages installed modules for a frontend. + * The developer may use this class to query what modules + * are installed and to retrieve an (SWModule *) for any + * one of these modules * - * $Id: swmgrex.cpp 2327 2009-04-22 11:42:33Z scribe $ + * SWMgr makes its modules available as an STL Map. + * The Map definition is typedef'ed as ModMap + * ModMap consists of: FIRST : SWBuf moduleName + * SECOND: SWModule *module * - * Copyright 1998-2009 CrossWire Bible Society (http://www.crosswire.org) + * $Id: swmgrex.cpp 2980 2013-09-14 21:51:47Z scribe $ + * + * Copyright 1998-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -34,10 +33,13 @@ #include <swmgr.h> #include <swmodule.h> + using namespace sword; using namespace std; -main() { + +int main(int argc, char **argv) { + SWMgr manager; // create a default manager that looks in the current directory for mods.conf cout << "\nInstalled Modules:\n\n"; @@ -50,14 +52,14 @@ main() { SWBuf modName = (*modIterator).first; // mod.conf section name (stored in module->Name()) SWModule *module = (*modIterator).second; - cout << modName << "(" << module->Name() << ") | " << module->Type() << "\n"; + cout << modName << "(" << module->getName() << ") | " << module->getType() << "\n"; } // Print out a verse from the first module: - cout << "\n" << manager.Modules.begin()->second->KeyText() << ":\n"; - cout << (const char *)(*manager.Modules.begin()->second); - cout << " (" << manager.Modules.begin()->second->Name() << ")\n"; + cout << "\n" << manager.Modules.begin()->second->getKeyText() << ":\n"; + cout << manager.Modules.begin()->second->renderText(); + cout << " (" << manager.Modules.begin()->second->getName() << ")\n"; // Print out the same verse from the second module (less confusing): @@ -66,9 +68,11 @@ main() { SWModule *mod = modIterator->second; - cout << "\n" << mod->KeyText() << ":\n"; + cout << "\n" << mod->getKeyText() << ":\n"; // cout << (const char *)(*mod); // we could do this, the same as above - mod->Display(); // instead of casting mod to const char * to get its contents, we'll call the default display method that writes to stdout; - cout << " (" << mod->Name() << ")\n\n"; + mod->display(); // instead of casting mod to const char * to get its contents, we'll call the default display method that writes to stdout; + cout << " (" << mod->getName() << ")\n\n"; + + return 0; } |