diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/abstractclass.h | 38 | ||||
-rw-r--r-- | include/class.h | 14 | ||||
-rw-r--r-- | include/classmodifier.h | 29 | ||||
-rw-r--r-- | include/finalclass.h | 38 | ||||
-rw-r--r-- | include/interface.h | 24 |
5 files changed, 110 insertions, 33 deletions
diff --git a/include/abstractclass.h b/include/abstractclass.h new file mode 100644 index 0000000..3f41ff9 --- /dev/null +++ b/include/abstractclass.h @@ -0,0 +1,38 @@ +/** + * AbstractClass.h + * + * An abstract class can not be instantiated, it can only be extended + * + * @copyright 2014 Copernica BV + * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> + */ + +/** + * Set up namespace + */ +namespace Php { + +/** + * Class definition + */ +template <typename T> +class AbstractClass : public Class<T> +{ +public: + /** + * Constructor + * @param name Name of the class + */ + AbstractClass(const char *name) : Class<T>(name, 0x20) {} + + /** + * Destructor + */ + virtual ~AbstractClass() {} +}; + +/** + * End namespace + */ +} + diff --git a/include/class.h b/include/class.h index ae66277..fe9ea2e 100644 --- a/include/class.h +++ b/include/class.h @@ -12,7 +12,7 @@ * * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> * changed by Valeriy Dmitriev <ufabiz@gmail.com> - * @copyright 2013 Copernica BV + * @copyright 2013, 2014 Copernica BV */ /** @@ -39,11 +39,10 @@ public: * flags are set, a regular public class will be formed. * * @param name Name of the class - * @param flags Optional flags (final, abstract) * * @todo make sure flags are used */ - Class(const char *name, int flags = 0) : ClassBase(name, flags) {} + Class(const char *name) : ClassBase(name) {} /** * Destructor @@ -93,6 +92,14 @@ public: void add(const char *name, bool(T::*method)(), const Arguments &args = {}) { ClassBase::add(name, static_cast<method_callback_2>(method), 0, args); } void add(const char *name, bool(T::*method)(Parameters ¶ms), const Arguments &args = {}) { ClassBase::add(name, static_cast<method_callback_3>(method), 0, args); } +protected: + /** + * Protected constructor + * @param name + * @param flags + */ + Class(const char *name, int flags) : ClassBase(name, flags) {} + private: /** * Construct a new instance of the object @@ -108,7 +115,6 @@ private: * Extensions have access to the private base class */ friend class Extension; - }; /** diff --git a/include/classmodifier.h b/include/classmodifier.h deleted file mode 100644 index 2cebb65..0000000 --- a/include/classmodifier.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * ClassModifier.h - * - * In this file an enumeration type is defined with - * the possible class modifiers. - * - * @author Martijn Otto - * @copyright 2014 Copernica BV - */ - -/** - * Set up namespace - */ -namespace Php { - -/** - * Supported class modifiers - */ -typedef enum _ClassModifier { - regular = 0x00, - abstract = 0x20, - final = 0x40, - interface = 0x80 -} ClassModifier; - -/** - * End of namespace - */ -} diff --git a/include/finalclass.h b/include/finalclass.h new file mode 100644 index 0000000..5c5a1b6 --- /dev/null +++ b/include/finalclass.h @@ -0,0 +1,38 @@ +/** + * FinalClass.h + * + * An final class can not be extended + * + * @copyright 2014 Copernica BV + * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> + */ + +/** + * Set up namespace + */ +namespace Php { + +/** + * Class definition + */ +template <typename T> +class FinalClass : public Class<T> +{ +public: + /** + * Constructor + * @param name Name of the class + */ + FinalClass(const char *name) : Class<T>(name, 0x40) {} + + /** + * Destructor + */ + virtual ~FinalClass() {} +}; + +/** + * End namespace + */ +} + diff --git a/include/interface.h b/include/interface.h new file mode 100644 index 0000000..7bdb5d6 --- /dev/null +++ b/include/interface.h @@ -0,0 +1,24 @@ +/** + * Interface.h + * + * @copyright 2014 Copernica BV + * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> + */ + +/** + * Set up namespace + */ +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 + */ + +/** + * End namespace + */ +} + |