diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-02-28 15:17:53 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-02-28 15:17:53 +0100 |
commit | 7cf89f18d766368dd4a14d35e4e144107ad7be36 (patch) | |
tree | 0bd4e449cbfddc928c25aaa1abac8b44c028c8e2 /include/class.h | |
parent | 6072701319a3bf085bbc354c3e3dae9b7d021be0 (diff) |
implemented properties
Diffstat (limited to 'include/class.h')
-rw-r--r-- | include/class.h | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/include/class.h b/include/class.h index fe9ea2e..ad0e1a7 100644 --- a/include/class.h +++ b/include/class.h @@ -50,25 +50,6 @@ public: virtual ~Class() {} /** - * Add a property to the class - * - * Every instance of this class will have this property. The property - * can be Php::Public, Php::Protected or Php::Private (altough setting - * private properties is odd as the implementation of the class is in CPP, - * so why use private properties while the whole implementation is already - * hidden) - * - * @param name Name of the property - * @param property Actual property value - * @param flags Optional flags - */ -// void add(const char *name, const Property &property, int flags = Php::Public) -// { -// // @todo something with the flags -// _properties[name] = property; -// } - - /** * Add a method to the class * * The method will be accessible as one of the class methods in your PHP @@ -91,6 +72,22 @@ public: void add(const char *name, void(T::*method)(Parameters ¶ms), const Arguments &args = {}) { ClassBase::add(name, static_cast<method_callback_1>(method), 0, args); } 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); } + + /** + * Add a property to the class + * + * Every instance of this class will have this property. The property + * can be Php::Public, Php::Protected or Php::Private (altough setting + * private properties is odd as the implementation of the class is in CPP, + * so why use private properties while the whole implementation is already + * hidden) + * + * @param name Name of the property + * @param value Actual property value + * @param flags Optional flags + */ + template <typename TYPE> + void add(const char *name, const Type &value, int flags = Php::Public) { ClassBase::add(name, value, flags); } protected: /** |