summaryrefslogtreecommitdiff
path: root/include/member.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/member.h')
-rw-r--r--include/member.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/include/member.h b/include/member.h
new file mode 100644
index 0000000..4a9a754
--- /dev/null
+++ b/include/member.h
@@ -0,0 +1,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
+ */
+}
+