diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-09-30 13:49:23 -0700 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-09-30 13:49:23 -0700 |
commit | 777eb276f635c949ccdcf9613ad55d42190cb387 (patch) | |
tree | f5451ae464a37414412d122ff6a283f713638dfa /include/class.h | |
parent | ecfca6b1197658afb85fffd6f6ac9e92311a4b07 (diff) |
Work in progress on adding public and protected properties to classes
Diffstat (limited to 'include/class.h')
-rw-r--r-- | include/class.h | 36 |
1 files changed, 33 insertions, 3 deletions
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 <emiel.bruijntjes@copernica.com> * @copyright 2013 Copernica BV */ - + +/** + * Forward declarations + */ +struct _zend_class_entry; + /** * Set up namespace */ @@ -32,15 +37,21 @@ public: Class() {} /** + * Constructor with initializer list to define the properties + * @param members + */ + Class(const std::initializer_list<Member> &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<Member> _members; }; |