diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-04 18:21:58 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-04 18:21:58 +0100 |
commit | c028e8f932cc4206ab8446409693fba8dfe18ffb (patch) | |
tree | 4ffe8a5d77888cff291eb7dd412bbd03e51c6f29 /include/base.h | |
parent | 200952ad4004f6ee5527598622505adbe84df8af (diff) |
Php::Value and Php::Object classes can now be used to wrap around Php::Base objects
Diffstat (limited to 'include/base.h')
-rw-r--r-- | include/base.h | 115 |
1 files changed, 66 insertions, 49 deletions
diff --git a/include/base.h b/include/base.h index 46f5678..b027d5a 100644 --- a/include/base.h +++ b/include/base.h @@ -11,6 +11,11 @@ namespace Php { /** + * Forward declarations + */ +class MixedObject; + +/** * Class definition */ class Base @@ -22,109 +27,121 @@ protected: Base() {} public: - - // @todo should we delete the copy and move operators because we do not - // allow the CPP code to make copies of itself? - - /** * Virtual destructor */ virtual ~Base() {} /** - * Convert the object to a Php::Value object (how it is used externally) - * @return Object - */ -// Object value(); - - /** - * Convert the object to a Php::Value object (how it is used externally) - * @return Object - */ -// Object value() const; - - /** * Get access to a property by name using the [] operator * @param string * @return HashMember */ -// HashMember<std::string> operator[](const char *name) -// { -// return value()[name]; -// } + HashMember<std::string> operator[](const char *name) + { + return Value(this)[name]; + } /** * Alternative way to access a property using the [] operator * @param string * @return HashMember */ -// HashMember<std::string> operator[](const std::string &name) -// { -// return value()[name]; -// } + HashMember<std::string> operator[](const std::string &name) + { + return Value(this)[name]; + } /** * Retrieve a property by name * @param string * @return HashMember */ -// HashMember<std::string> property(const char *name) -// { -// return value()[name]; -// } + HashMember<std::string> property(const char *name) + { + return Value(this)[name]; + } /** * Retrieve a property by name * @param string * @return HashMember */ -// HashMember<std::string> property(const std::string &name) -// { -// return value()[name]; -// } + HashMember<std::string> property(const std::string &name) + { + return Value(this)[name]; + } /** * Get access to a property by name using the [] operator * @param string * @return Value */ -// Value operator[](const char *name) const -// { -// return value()[name]; -// } + Value operator[](const char *name) const + { + return Value(this)[name]; + } /** * Alternative way to access a property using the [] operator * @param string * @return Value */ -// Value operator[](const std::string &name) const -// { -// return value()[name]; -// } + Value operator[](const std::string &name) const + { + return Value(this)[name]; + } /** * Retrieve a property by name * @param string * @return Value */ -// Value property(const char *name) const -// { -// return value()[name]; -// } + Value property(const char *name) const + { + return Value(this)[name]; + } /** * Retrieve a property by name * @param string * @return Value */ -// Value property(const std::string &name) const -// { -// return value()[name]; -// } + Value property(const std::string &name) const + { + return Value(this)[name]; + } private: + /** + * Store the object in the zend object cache + * @param entry + * @return MixedObject + */ + MixedObject *store(struct _zend_class_entry *entry); + + /** + * Retrieve the handle + * @return int + */ + int handle() const + { + return _handle; + } + + /** + * The handle in the zend object cache + * @var int + */ + int _handle = 0; + + /** + * Friends that have access to the private members + */ + friend class Value; + friend class Object; + friend class ClassBase; + }; |