blob: 7aa01d8332dad2bc15b3b294f3e7c3651360b868 (
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
68
69
70
71
72
73
74
75
76
77
|
/**
* Member.h
*
* Base class for properties of a class
*
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
* @copyright 2013, 2014 Copernica BV
*/
/**
* Namespace
*/
namespace Php {
/**
* Class definition
*/
class Member
{
public:
/**
* Constructor
* @param name Name of the member
* @param flags Flag access to a class member (public, protected etc)
*/
Member(const char *name, int flags) : _name(name), _flags(flags) {}
/**
* Destructor
*/
virtual ~Member() {}
/**
* Initialize the member
* @param zend_class_entry
* @param tsrm_ls
*/
void initialize(struct _zend_class_entry *entry TSRMLS_DC)
{
if (_flags == Const) constant(entry TSRMLS_CC);
else declare(entry TSRMLS_CC);
}
protected:
/**
* Internal method to declare the property as constant
* @param zend_class_entry
* @param tsrm_ls
*/
virtual void constant(struct _zend_class_entry *entry TSRMLS_DC) = 0;
/**
* Internal method to declare the property
* @param zend_class_entry
* @param tsrm_ls
*/
virtual void declare(struct _zend_class_entry *entry TSRMLS_DC) = 0;
protected:
/**
* The member name
* @var std::string
*/
std::string _name;
/**
* The member flags
* @var int
*/
int _flags;
};
/**
* End of namespace
*/
}
|