summaryrefslogtreecommitdiff
path: root/include/interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/interface.h')
-rw-r--r--include/interface.h46
1 files changed, 42 insertions, 4 deletions
diff --git a/include/interface.h b/include/interface.h
index 7bdb5d6..38f85f3 100644
--- a/include/interface.h
+++ b/include/interface.h
@@ -11,11 +11,49 @@
namespace Php {
/**
- * @todo implementation, should be somehow an extension of a regular
- * class, but without methods to define methods
- *
- * the flag that should be passed to the base it 0x80
+ * Class definition
*/
+class Interface : private ClassBase
+{
+public:
+ /**
+ * Constructor
+ * @param name
+ */
+ Interface(const char *name) : ClassBase(name, 0x80) {}
+
+ /**
+ * Destructor
+ */
+ virtual ~Interface() {}
+
+ /**
+ * Add a - of course abstract - method to the interface
+ * @param name Name of the method
+ * @param arguments Optional description of the arguments
+ */
+ void method(const char *name, const Arguments &arguments = {})
+ {
+ // call base
+ ClassBase::method(name, Abstract | Public, arguments);
+ }
+
+private:
+ /**
+ * Construct a new instance of the object
+ * @return Base
+ */
+ virtual Base* construct() override
+ {
+ // this does not occur for interfaces
+ return nullptr;
+ }
+
+ /**
+ * Namespaces have access to the private base class
+ */
+ friend class Namespace;
+};
/**
* End namespace