Merge pull request #52 from QuasarApp/task_29

Create main class Worker
This commit is contained in:
Igor loschinin 2021-05-13 22:42:23 +03:00 committed by GitHub
commit 28a72f47d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 4 deletions

View File

@ -26,5 +26,10 @@ int main(int argc, char *argv[]) {
return 0;
}
bool runProc = worker.run();
if (!runProc) {
return 1;
}
return 0;
}

View File

@ -6,18 +6,37 @@
//#
#include "config.h"
#include "configparser.h"
#include "signer.h"
#include "worker.h"
#include <quasarapp.h>
namespace CopyrighFixer {
Worker::Worker() {
Worker::Worker() {
_conf = new Config;
_confParser = new ConfigParser;
_subscriber = new Signer;
}
Worker::~Worker() {
delete _conf;
delete _confParser;
delete _subscriber;
}
bool Worker::run() {
return false;
if (!_confParser->parseOptions(*_conf)) {
return false;
}
if (!_subscriber->checkSign(*_conf)) {
return false;
}
return true;
}
void Worker::printHelp() const {

View File

@ -10,6 +10,10 @@
#include "CopyrighFixer_global.h"
class ConfigParser;
class Signer;
class Config;
namespace CopyrighFixer {
@ -17,13 +21,14 @@ namespace CopyrighFixer {
* @brief The Worker class will be control all work process.
*/
class CopyrighFixer_EXPORT Worker {
public:
Worker();
~Worker();
/**
* @brief run It is main method for control of all parsing process.
* @return Returns false if the program terminates with an error.
*/
bool run();
@ -32,6 +37,10 @@ public:
*/
void printHelp() const;
protected:
Config *_conf = nullptr;
ConfigParser *_confParser = nullptr;
Signer *_subscriber = nullptr;
};