summaryrefslogtreecommitdiff
path: root/include/member.h
blob: 4a9a7542cfcc0e8f28d57ac4a8f6b0cee2620890 (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
/**
 *  Member.h
 *
 *  Base class for elements of a class
 *
 *  @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
 *  @copyright 2013 Copernica BV
 */

/**
 *  Forward declarations
 */
struct _zend_class_entry;

/**
 *  Namespace
 */
namespace Php {

/**
 *  Class definition
 */
class Member
{
public:
    /**
     *  Constructor
     *  @param  name        Name of the member
     *  @param  pub         Is this a public property (otherwise it is protected)
     *  @param  value       The value to add
     */
    Member(const char *name, bool pub, const Value &value) : 
        _name(name), _public(pub), _value(value) {}

    /**
     *  Destructor
     */
    virtual ~Member() {}
    
    /**
     *  Internal method to declare the property
     *  @var zend_class_entry
     */
    void declare(struct _zend_class_entry *entry);
    

private:
    /**
     *  Name of the member
     *  @var string
     */
    std::string _name;
    
    /**
     *  Is this a public property
     *  @var bool
     */
    bool _public;
    
    /**
     *  The default value
     *  @var Value
     */
    Value _value;

};
    
/**
 *  End of namespace
 */
}