-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathscript.h
More file actions
82 lines (70 loc) · 1.24 KB
/
script.h
File metadata and controls
82 lines (70 loc) · 1.24 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
* Script.h
*
* Class that is used to parse and evaluate a script.
*
* @copyright 2015 - 2025 Copernica B.V.
*/
/**
* Include guard
*/
#pragma once
/**
* Dependencies
*/
#include "core.h"
/**
* Start namespace
*/
namespace JS {
/**
* Class definition
*/
class Script
{
private:
/**
* Shared pointer to the actual core data
* @var std::shared_ptr<Core>
*/
std::shared_ptr<Core> _core;
/**
* The compiled script
* @var v8::Global<v8::Script>
*/
v8::Global<v8::Script> _script;
public:
/**
* Constructor
* @param script
* @throws Php::Exception
*/
Script(const char *script);
/**
* Constructor
* @param core
* @param script
* @throws Php::Exception
*/
Script(const std::shared_ptr<Core> &core, const char *script);
/**
* No copying allowed
* @param that the object we cannot copy
*/
Script(const Script &that) = delete;
/**
* Destructor
*/
virtual ~Script() = default;
/**
* Execute the script
* @param timeout
* @return Php::Value
* @throws Php::Exception
*/
Php::Value execute(time_t timeout);
};
/**
* End namespace
*/
}