diff options
author | Roberto C. Sanchez <roberto@connexer.com> | 2014-03-29 10:53:52 -0400 |
---|---|---|
committer | Roberto C. Sanchez <roberto@connexer.com> | 2014-03-29 10:53:52 -0400 |
commit | 148bd343f3e7e32d141f66b5b5c9b98b2975b0b3 (patch) | |
tree | 31078963b85110d57310759016e60e8d26ccb1e6 /examples/classes | |
parent | 8c8aa6b07e595cfac56838b5964ab3e96051f1b2 (diff) |
Imported Upstream version 1.5.8
Diffstat (limited to 'examples/classes')
-rw-r--r-- | examples/classes/Makefile | 7 | ||||
-rw-r--r-- | examples/classes/ciphercng.cpp | 43 | ||||
-rw-r--r-- | examples/classes/swmgrex.cpp | 52 |
3 files changed, 0 insertions, 102 deletions
diff --git a/examples/classes/Makefile b/examples/classes/Makefile deleted file mode 100644 index 6b7a96c..0000000 --- a/examples/classes/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -root := ../.. -subdirs := -pre-targets := -bin := yes -targets := swmgrex ciphercng -include ${root}/Makefile.cfg - diff --git a/examples/classes/ciphercng.cpp b/examples/classes/ciphercng.cpp deleted file mode 100644 index 591cd2d..0000000 --- a/examples/classes/ciphercng.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/****************************************************************************** - * - * This example demonstrates how to change the cipher key of a module - * The change is only in effect for this run. This DOES NOT change the - * cipherkey in the module's .conf file. - * - */ - -#include <swmgr.h> - -int main(int argc, char **argv) { - - if (argc != 2) { - fprintf(stderr, "usage: %s <modName>\n", *argv); - exit(-1); - } - - SWMgr manager; // create a default manager that looks in the current directory for mods.conf - ModMap::iterator it; - it = manager.Modules.find(argv[1]); - - if (it == manager.Modules.end()) { - fprintf(stderr, "%s: couldn't find module: %s\n", *argv, argv[1]); - exit(-1); - } - - SWModule *module = (*it).second; - string key; - - cout << "\nPress [CTRL-C] to end\n\n"; - while (true) { - cout << "\nModule text:\n"; - module->setKey("1jn 1:9"); - cout << "[ " << module->KeyText() << " ]\n"; - cout << (const char *)*module; - cout << "\n\nEnter new cipher key: "; - cin >> key; - cout << "\nSetting key to: " << key; - manager.setCipherKey(argv[1], (unsigned char *)key.c_str()); - } - - -} diff --git a/examples/classes/swmgrex.cpp b/examples/classes/swmgrex.cpp deleted file mode 100644 index 5cb10ba..0000000 --- a/examples/classes/swmgrex.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/****************************************************************************** - * 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 : string moduleName - * SECOND: SWModule *module - * - */ - -#include <swmgr.h> - -main() { - SWMgr manager; // create a default manager that looks in the current directory for mods.conf - - cout << "\nInstalled Modules:\n\n"; - - ModMap::iterator modIterator; - -// Loop thru all installed modules and print out information - - for (modIterator = manager.Modules.begin(); modIterator != manager.Modules.end(); modIterator++) { - string modName = (*modIterator).first; // mod.conf section name (stored in module->Name()) - SWModule *module = (*modIterator).second; - - cout << modName << "(" << module->Name() << ") | " << module->Type() << "\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"; - -// Print out the same verse from the second module (less confusing): - - modIterator = manager.Modules.begin(); // get first module - modIterator++; // increment to next module - - SWModule *mod = modIterator->second; - - cout << "\n" << mod->KeyText() << ":\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"; - -} |