more work on testMenu
This commit is contained in:
22
src/App.cpp
22
src/App.cpp
@@ -20,15 +20,19 @@ App::App(const int& argc, char* argv[]) {
|
||||
App::~App() {
|
||||
|
||||
std::cout << "\nExiting...";
|
||||
for(auto it = modules.begin(); it != modules.end(); it++) {
|
||||
void* handle = (*it)->getHandle();
|
||||
delete *it;
|
||||
dlclose(handle);
|
||||
modules.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void App::run() {
|
||||
std::cout << "\nTesting...\n";
|
||||
|
||||
done = modules.empty();
|
||||
|
||||
// Main loop
|
||||
while (!done) {
|
||||
while (!done && !modules.empty()) {
|
||||
|
||||
for(auto it = modules.begin(); it != modules.end(); it++)
|
||||
(*it)->run();
|
||||
@@ -64,10 +68,22 @@ void App::load(std::string lib) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void App::unload(std::list<Module*>::iterator it) {
|
||||
void* handle = (*it)->getHandle();
|
||||
delete *it;
|
||||
dlclose(handle);
|
||||
modules.erase(it);
|
||||
}
|
||||
|
||||
void App::handleArgs(const int& argc, char* argv[]) {
|
||||
|
||||
int i = 0;
|
||||
|
||||
if(argc == 0) {
|
||||
printHelp();
|
||||
end();
|
||||
}
|
||||
|
||||
while(i < argc) {
|
||||
if(strcmp(argv[i], "-h") == 0) {
|
||||
|
||||
Reference in New Issue
Block a user