blob: 9b5d4f210912de875835b3699015ab2e2288914d (
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
58
59
60
61
62
63
64
65
66
67
|
/**
* FloatMember.h
*
* Implementation for a property that is initially set to a boolean value
*
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
* @copyright 2013, 2014 Copernica BV
*/
/**
* Set up namespace
*/
namespace Php {
/**
* Class definition
*/
class FloatMember : public Member
{
private:
/**
* The value
* @var double
*/
double _value;
public:
/**
* Constructor
* @param name
* @param value
* @param flags
*/
FloatMember(const char *name, double value, int flags) : Member(name, flags), _value(value) {}
/**
* Destructor
*/
virtual ~FloatMember() {}
/**
* Virtual method to declare class constant
* @param entry Class entry
* @param tsrm_ls
*/
virtual void constant(struct _zend_class_entry *entry TSRMLS_DC) override
{
zend_declare_class_constant_double(entry, _name.c_str(), _name.size(), _value TSRMLS_CC);
}
/**
* Virtual method to declare the property
* @param entry Class entry'
* @param tsrm_ls
*/
virtual void declare(struct _zend_class_entry *entry TSRMLS_DC) override
{
// converstion to char* necessary for php 5.3
zend_declare_property_double(entry, (char *)_name.c_str(), _name.size(), _value, _flags TSRMLS_CC);
}
};
/**
* End of namespace
*/
}
|