make App easily subclassable
This commit is contained in:
51
example_apps/MinimalApp/MinimalApp.h
Normal file
51
example_apps/MinimalApp/MinimalApp.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#ifndef APP_H
|
||||
#define APP_H
|
||||
|
||||
#include "pch.hpp"
|
||||
#include "utils/Module/Module.h"
|
||||
|
||||
namespace Archimedes {
|
||||
|
||||
class App {
|
||||
|
||||
private:
|
||||
static App* instance;
|
||||
|
||||
bool done = false;
|
||||
|
||||
std::list<Module*> modules;
|
||||
std::list<Module*> toClose;
|
||||
std::list<std::string> toOpen;
|
||||
|
||||
bool load(std::string, std::list<std::string>);
|
||||
void unload(std::list<Module*>::iterator);
|
||||
|
||||
void handleArgs(const int&, char*[]);
|
||||
|
||||
void printHelp();
|
||||
|
||||
std::list<std::string> getBlacklist() {
|
||||
std::list<std::string> l;
|
||||
for(Module* m : modules)
|
||||
l.push_back(m->getName());
|
||||
return l;
|
||||
}
|
||||
|
||||
public:
|
||||
App(const int&, char*[]);
|
||||
~App();
|
||||
|
||||
static App& Get() { return *instance; }
|
||||
|
||||
void run();
|
||||
|
||||
void stopModule(std::list<Module*>::iterator);
|
||||
|
||||
void startModule(std::string);
|
||||
|
||||
void end() { done = true; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user