summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorToon Schoenmakers <toon.schoenmakers@copernica.com>2014-11-21 13:51:04 +0100
committerToon Schoenmakers <toon.schoenmakers@copernica.com>2014-11-21 13:51:04 +0100
commit2e25bc7e1b9faf89e6057ed7874ef2f4a8c86ca1 (patch)
tree4be1d5481cfa68719245ba670375e263fa8ebadd /include
parentcc5da69ebf5eda704a29c75ef33b0b358370e805 (diff)
Removed move constructor from Object class, because it caused failures when instantiating with a std::string parameter, Php::Object constructors now always first call the base constructor, and the __construct() function is now always called
Diffstat (limited to 'include')
-rw-r--r--include/object.h40
1 files changed, 17 insertions, 23 deletions
diff --git a/include/object.h b/include/object.h
index 124c0b3..29f4110 100644
--- a/include/object.h
+++ b/include/object.h
@@ -25,16 +25,6 @@ public:
Object() : Value(Type::Object) {}
/**
- * Move constructor is passed to the parent
- * @param value
- */
- Object(Value &&value) : Value(std::move(value))
- {
- // throw exception in case of problems
- if (value.type() != Type::Object) throw FatalError("Constructing an object variable by moving a non object");
- }
-
- /**
* Copy constructor is valid if the passed in object is also an object,
* or when it is a string holding a classname
* @param that An other object
@@ -92,17 +82,17 @@ public:
* @param arg8 Optional argument 9
* @param arg9 Optional argument 10
*/
- Object(const char *name) { instantiate(name); call("__construct"); }
- Object(const char *name, Value p0) { instantiate(name); call("__construct", p0); }
- Object(const char *name, Value p0, Value p1) { instantiate(name); call("__construct", p0, p1); }
- Object(const char *name, Value p0, Value p1, Value p2) { instantiate(name); call("__construct", p0, p1, p2); }
- Object(const char *name, Value p0, Value p1, Value p2, Value p3) { instantiate(name); call("__construct", p0, p1, p2, p3); }
- Object(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4) { instantiate(name); call("__construct", p0, p1, p2, p3, p4); }
- Object(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5) { instantiate(name); call("__construct", p0, p1, p2, p3, p4, p5); }
- Object(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6) { instantiate(name); call("__construct", p0, p1, p2, p3, p4, p5, p6); }
- Object(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7) { instantiate(name); call("__construct", p0, p1, p2, p3, p4, p5, p6, p7); }
- Object(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7, Value p8) { instantiate(name); call("__construct", p0, p1, p2, p3, p4, p5, p6, p7, p8); }
- Object(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7, Value p8, Value p9) { instantiate(name); call("__construct", p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); }
+ Object(const char *name) : Value(Type::Object) { if (instantiate(name)) call("__construct"); }
+ Object(const char *name, Value p0) : Value(Type::Object) { if (instantiate(name)) call("__construct", p0); }
+ Object(const char *name, Value p0, Value p1) : Value(Type::Object) { if (instantiate(name)) call("__construct", p0, p1); }
+ Object(const char *name, Value p0, Value p1, Value p2) : Value(Type::Object) { if (instantiate(name)) call("__construct", p0, p1, p2); }
+ Object(const char *name, Value p0, Value p1, Value p2, Value p3) : Value(Type::Object) { if (instantiate(name)) call("__construct", p0, p1, p2, p3); }
+ Object(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4) : Value(Type::Object) { if (instantiate(name)) call("__construct", p0, p1, p2, p3, p4); }
+ Object(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5) : Value(Type::Object) { if (instantiate(name)) call("__construct", p0, p1, p2, p3, p4, p5); }
+ Object(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6) : Value(Type::Object) { if (instantiate(name)) call("__construct", p0, p1, p2, p3, p4, p5, p6); }
+ Object(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7) : Value(Type::Object) { if (instantiate(name)) call("__construct", p0, p1, p2, p3, p4, p5, p6, p7); }
+ Object(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7, Value p8) : Value(Type::Object) { if (instantiate(name)) call("__construct", p0, p1, p2, p3, p4, p5, p6, p7, p8); }
+ Object(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7, Value p8, Value p9) : Value(Type::Object) { if (instantiate(name)) call("__construct", p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); }
/**
* Destructor
@@ -165,10 +155,14 @@ public:
private:
/**
* Helper method to instantiate an object
+ *
+ * This method returns true if there is a __construct() function, and
+ * false otherwise
+ *
* @param name Class name
- * @return zend_class_entry
+ * @return bool
*/
- struct _zend_class_entry *instantiate(const char *name);
+ bool instantiate(const char *name);
};
/**