summaryrefslogtreecommitdiff
path: root/include/class.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-09-25 05:23:34 -0700
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-09-25 05:23:34 -0700
commit49ac629257835426c311fb7b92b23a9138a9d77b (patch)
treed7f8d6d843206ecdf29b3877a5e7faf7815f3f24 /include/class.h
parent9e1ecc534bace7d00a265a49018c0148a56361ae (diff)
Work in progress on implementing classes
Diffstat (limited to 'include/class.h')
-rw-r--r--include/class.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/include/class.h b/include/class.h
new file mode 100644
index 0000000..38398b9
--- /dev/null
+++ b/include/class.h
@@ -0,0 +1,68 @@
+/**
+ * Class.h
+ *
+ * When a class is registered in the extension, you need this helper class
+ * for that.
+ *
+ * The use of it is simple:
+ *
+ * Extension::add(Class<YourClass>);
+ *
+ * Note that YourClass must extend from Php::Object
+ *
+ * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
+ * @copyright 2013 Copernica BV
+ */
+
+/**
+ * Set up namespace
+ */
+namespace Php {
+
+/**
+ * Class definition of the class
+ */
+template <typename T>
+class Class
+{
+public:
+ /**
+ * Constructor
+ */
+ Class() {}
+
+ /**
+ * Move constructor
+ * @param that
+ */
+ Class(Class &&that) {}
+
+ /**
+ * Copy constructor
+ */
+ Class(const Class &that) {}
+
+ /**
+ * Destructor
+ */
+ virtual ~Class() {}
+
+ /**
+ * Construct an instance
+ * @return Base
+ */
+ Base* construct()
+ {
+ // allocate the object
+ return new T();
+ }
+
+protected:
+
+};
+
+/**
+ * End of namespace
+ */
+}
+