forked from Dushistov/qt_monkey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.hpp
42 lines (37 loc) · 1.18 KB
/
script.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
#pragma once
#include <QtCore/QMetaType>
#include <QtCore/QString>
#include <utility>
namespace qt_monkey_agent
{
namespace Private
{
class Script final
{
public:
Script() = default;
Script(const Script &) = default;
explicit Script(QString code) : code_{std::move(code)} {}
Script(const QString &fileName, int lineNum, QString code)
: fileName_(fileName), lineno_(lineNum), code_(std::move(code))
{
}
~Script() = default;
const QString &code() const { return code_; }
void releaseCode(QString &code) { code = std::move(code_); }
static std::list<Script> splitToExecutableParts(const QString &fileName,
const QString &scriptCode);
// start from 1
int beginLineNum() const { return lineno_; }
const QString &fileName() const { return fileName_; }
bool runAfterAppStart() const { return runAfterStart_; }
void setRunAfterAppStart(bool val) { runAfterStart_ = val; }
private:
QString fileName_;
int lineno_ = 1;
QString code_;
bool runAfterStart_ = false;
};
} // namespace Private
} // namespace qt_monkey_agent
Q_DECLARE_METATYPE(qt_monkey_agent::Private::Script);