blob: 798cb59b5b22a86a6d4100b2e83db994671b0077 (
plain)
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
|
/**
* CompilerOptions.h
*
* Helper class to temporarily set compiler options
*
* When an object is destructed, it automatically restored the previous compiler settings
*
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
* @copyright 2014 Copernica BV
*/
/**
* Open PHP namespace
*/
namespace Php {
/**
* Class definition
*/
class CompilerOptions
{
private:
/**
* The original compiler options
* @var int
*/
zend_uint _original;
public:
/**
* Constructor
* @param options
*/
CompilerOptions(zend_uint options)
{
// remember the old compiler options before we set temporary compile options
_original = CG(compiler_options);
// we're going to evaluate only once
CG(compiler_options) = options;
}
/**
* Destructor
*/
virtual ~CompilerOptions()
{
// restore original options
CG(compiler_options) = _original;
}
};
/**
* End of namespace
*/
}
|