-
-
Notifications
You must be signed in to change notification settings - Fork 128
/
Core.hpp
68 lines (59 loc) · 1.71 KB
/
Core.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* Copyright (C) 2019 Ashar Khan <ashar786khan@gmail.com>
*
* This file is part of CPEditor.
*
* CPEditor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* I will not be responsible if CPEditor behaves in unexpected way and
* causes your ratings to go down and or loose any important contest.
*
* Believe Software is "Software" and it isn't not immune to bugs.
*
*/
#ifndef CORE_CP_EDITOR_HPP
#define CORE_CP_EDITOR_HPP
#include <BaseFiles.hpp>
#include <MessageLogger.hpp>
#include <QCodeEditor>
#include <QFile>
#include <QProcess>
namespace Core
{
class Compiler : public QObject, private Core::Base::Files
{
Q_OBJECT
public:
Compiler(QString compileCpp, QString compileJava, int index, MessageLogger *log);
void compile(QCodeEditor *editor, QString lang = "Cpp");
void syncToBuffer(QCodeEditor *editor);
void updateCommandCpp(QString newCommand);
void updateCommandJava(QString newCommand);
void updateLanguage(QString newLang);
static bool check(QString command);
~Compiler();
signals:
void compilationFinished(bool okay);
void compilationError();
void compilationStarted();
private slots:
void finished(int, QProcess::ExitStatus);
void errorOccurred(QProcess::ProcessError);
void started();
private:
QString runCommandJava, runCommandCpp;
QProcess *compilationProcess = nullptr;
QFile *file, *pyFile, *javaFile;
MessageLogger *log;
};
enum Verdict
{
ACCEPTED,
WRONG_ANSWER,
UNKNOWN,
};
} // namespace Core
#endif // CORE_CP_EDITOR_HPP