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 /src/floatmember.h | |
parent | 6072701319a3bf085bbc354c3e3dae9b7d021be0 (diff) |
implemented properties
Diffstat (limited to 'src/floatmember.h')
-rw-r--r-- | src/floatmember.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/floatmember.h b/src/floatmember.h new file mode 100644 index 0000000..8136fc2 --- /dev/null +++ b/src/floatmember.h @@ -0,0 +1,65 @@ +/** + * FloatMember.h + * + * Implementation for a property that is initially set to a boolean value + * + * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> + * @copyright 2013, 2014 Copernica BV + */ + +/** + * Set up namespace + */ +namespace Php { + +/** + * Class definition + */ +class FloatMember : public Member +{ +private: + /** + * The value + * @var double + */ + double _value; + +public: + /** + * Constructor + * @param name + * @param value + * @param flags + */ + FloatMember(const char *name, double value, int flags) : Member(name, flags), _value(value) {} + + /** + * Destructor + */ + virtual ~FloatMember() {} + + /** + * Virtual method to declare class constant + * @param entry Class entry + */ + virtual void constant(struct _zend_class_entry *entry) override + { + zend_declare_class_constant_double(entry, _name.c_str(), _name.size(), _value); + } + + /** + * Virtual method to declare the property + * @param entry Class entry + */ + virtual void declare(struct _zend_class_entry *entry) override + { + // converstion to char* necessary for php 5.3 + zend_declare_property_double(entry, (char *)_name.c_str(), _name.size(), _value, _flags); + } +}; + +/** + * End of namespace + */ +} + |