From 777eb276f635c949ccdcf9613ad55d42190cb387 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Mon, 30 Sep 2013 13:49:23 -0700 Subject: Work in progress on adding public and protected properties to classes --- include/class.h | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'include/class.h') diff --git a/include/class.h b/include/class.h index 38398b9..d5d48b4 100644 --- a/include/class.h +++ b/include/class.h @@ -13,7 +13,12 @@ * @author Emiel Bruijntjes * @copyright 2013 Copernica BV */ - + +/** + * Forward declarations + */ +struct _zend_class_entry; + /** * Set up namespace */ @@ -31,16 +36,22 @@ public: */ Class() {} + /** + * Constructor with initializer list to define the properties + * @param members + */ + Class(const std::initializer_list &members) : _members(members) {} + /** * Move constructor * @param that */ - Class(Class &&that) {} + Class(Class &&that) : _members(std::move(that._members)) {} /** * Copy constructor */ - Class(const Class &that) {} + Class(const Class &that) : _members(that._members) {} /** * Destructor @@ -57,7 +68,26 @@ public: return new T(); } + /** + * Initialize the class + * This will declare all members + * @param entry + */ + void initialize(struct _zend_class_entry *entry) + { + // loop through the members + for (auto iter = _members.begin(); iter != _members.end(); iter++) + { + iter->declare(entry); + } + } + protected: + /** + * The initial arguments + * @var vector + */ + std::vector _members; }; -- cgit v1.2.3