S_New4/programManager.h
2019-08-16 13:32:13 +02:00

64 lines
1.4 KiB
C++

#ifndef MANAGEPROGRAM_H
#define MANAGEPROGRAM_H
#include "pageManager.h"
#include "parameterManager.h"
#include "accountManager.h"
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include <pthread.h>
struct ka
{
ka(unsigned id) : id(id) {}
~ka() { std::cout << "Deskrtuktor" << std::endl; }
unsigned id;
pthread_t thread;
std::string nameInUrl, returnValue;
int staffel, folge, exitState;
Settings * settings;
AccountManager * accountManager;
PageManager * pageManager;
void * setState(int state) {
this->exitState = state;
return nullptr;
}
void setData(int staffel, int folge) { this->staffel = staffel; this->folge = folge; }
};
class ProgramManager
{
public:
ProgramManager();
~ProgramManager();
int start(Settings *setting);
int listDir(std::string &list, std::string path, int maxDepth);
private:
int defaultModus(Settings * settings);
int directLinkModus(Settings * settings);
int searchModus(Settings * settings);
int infoModus(Settings * settings);
PageManager pageManager;
std::vector<ka*> threadList;
unsigned nextThread;
int convertLink(std::string redirectLink, AccountManager *accountManager, Settings * settings, int Staffel = -1, int Folge = -1, std::string allLinks = "NOT_EMPTY");
int searchModus_update(Settings * settings);
int waitForThreads();
};
#endif // MANAGEPROGRAM_H