summaryrefslogtreecommitdiff
path: root/src/memberinfo.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-10-14 02:46:52 -0700
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-10-14 02:46:52 -0700
commit53272534a76a9d8cbee4ee887e1f360c4a99728b (patch)
tree54206aca1cfa1461ba365b05e5848f2843be91b9 /src/memberinfo.h
parent777eb276f635c949ccdcf9613ad55d42190cb387 (diff)
The initial class properties can now only be scalar values, just like in PHP
Diffstat (limited to 'src/memberinfo.h')
-rw-r--r--src/memberinfo.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/memberinfo.h b/src/memberinfo.h
new file mode 100644
index 0000000..e0cfbd8
--- /dev/null
+++ b/src/memberinfo.h
@@ -0,0 +1,66 @@
+/**
+ * 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; }
+
+ /**
+ * 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)=0;
+};
+
+/**
+ * End of namespace
+ */
+}
+
+