summaryrefslogtreecommitdiff
path: root/src/memberinfo.h
blob: 935ad23a6bf629dafa5fc32a69041cc2676c2242 (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
78
79
80
81
82
83
84
85
86
/**
 *  MemberInfo.h
 *
 *  Base class for the implementation of class members
 *
 *  @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
 *  @copyright 2013 Copernica BV
 */

/**
 *  Set up namespace
 */
namespace Php {

/**
 *  Class definition
 */
class MemberInfo
{
private:
    /**
     *  Number of references
     *  @var int
     */
    int _refcount;

public:
    /**
     *  Constructor
     */
    MemberInfo() : _refcount(1) {}

    /**
     *  Virtual destructor
     */
    virtual ~MemberInfo() {}

    /**
     *  Retrieve refcount
     *  @return int
     */
    int refcount() { return _refcount; }

    /**
     *  Refcount after making a change
     *  @param  change
     *  @return integer
     */
    int refcount(int change) { return _refcount += change; }

    /**
     *  Is this a property member
     *  @return bool
     */
    virtual bool isProperty() { return false; }

    /**
     *  Is this a method member
     *  @return bool
     */
    virtual bool isMethod() { return false; }

    /**
     *  Virtual method to declare the property
     *  @param  entry       Class entry
     *  @param  name        Name of the member
     *  @param  size        Size of the name
     *  @param  flags       Additional flags
     */
    virtual void declare(struct _zend_class_entry *entry, const char *name, int size, int flags) {};

    /**
     *  Fill a function entry object
     *  @param  entry       Function entry
     *  @param  classname   Name of the class
     *  @param  flags       Is this a public method?
     */
    virtual void fill(struct _zend_function_entry *entry, const char *classname, int flags) {};
};

/**
 *  End of namespace
 */
}