summaryrefslogtreecommitdiff
path: root/include/base.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-04 18:21:58 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-04 18:21:58 +0100
commitc028e8f932cc4206ab8446409693fba8dfe18ffb (patch)
tree4ffe8a5d77888cff291eb7dd412bbd03e51c6f29 /include/base.h
parent200952ad4004f6ee5527598622505adbe84df8af (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.h115
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;
+
};