summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/forcedvalue.h10
-rw-r--r--include/object.h26
-rw-r--r--include/value.h24
3 files changed, 44 insertions, 16 deletions
diff --git a/include/forcedvalue.h b/include/forcedvalue.h
index 67c339e..4fc2fcc 100644
--- a/include/forcedvalue.h
+++ b/include/forcedvalue.h
@@ -46,6 +46,16 @@ public:
// type must be valid
if (value.type() != TYPE) throw Php::Exception("Assiging a wrong value type to a forced typed variable");
}
+
+ /**
+ * Move constructor from a value object
+ * @param value
+ */
+ ForcedValue(Value &&value) : Value(std::move(value))
+ {
+ // type must be valid
+ if (value.type() != TYPE) throw Php::Exception("Assiging a wrong value type to a forced typed variable");
+ }
/**
* Wrap object around zval
diff --git a/include/object.h b/include/object.h
index f104478..e2c424f 100644
--- a/include/object.h
+++ b/include/object.h
@@ -21,14 +21,15 @@ class Object : public ForcedValue<Type::Object>
public:
/**
* Constructor for an empty stdClass object
- *
- * @todo check if this indeed leads to a stdClass instance
*/
Object() : ForcedValue<Type::Object>() {}
/**
- * @todo copy constructor, move constructor
+ * Copy and move constructors are passed on to the base class
+ * @param that An other object
*/
+ Object(const Value &value) : ForcedValue<Type::Object>(value) {}
+ Object(Value &&value) : ForcedValue<Type::Object>(std::move(value)) {}
/**
* Constructor to create a new instance
@@ -48,12 +49,29 @@ public:
* @param arg8 Optional argument 9
* @param arg9 Optional argument 10
*/
- Object(const char *name);
+ 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); }
/**
* Destructor
*/
virtual ~Object() {}
+
+private:
+ /**
+ * Helper method to instantiate an object
+ * @param name Class name
+ */
+ void instantiate(const char *name);
};
diff --git a/include/value.h b/include/value.h
index 0ebb2d5..8af95a5 100644
--- a/include/value.h
+++ b/include/value.h
@@ -594,17 +594,17 @@ public:
* @param name Name of the function
* @return Value
*/
- Value call(const std::string &name);
- Value call(const std::string &name, Value p0);
- Value call(const std::string &name, Value p0, Value p1);
- Value call(const std::string &name, Value p0, Value p1, Value p2);
- Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3);
- Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3, Value p4);
- Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5);
- Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6);
- Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7);
- Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7, Value p8);
- Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7, Value p8, Value p9);
+ Value call(const char *name);
+ Value call(const char *name, Value p0);
+ Value call(const char *name, Value p0, Value p1);
+ Value call(const char *name, Value p0, Value p1, Value p2);
+ Value call(const char *name, Value p0, Value p1, Value p2, Value p3);
+ Value call(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4);
+ Value call(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5);
+ Value call(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6);
+ Value call(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7);
+ Value call(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7, Value p8);
+ Value call(const char *name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7, Value p8, Value p9);
/**
* Retrieve the original implementation
@@ -651,7 +651,7 @@ private:
* @param argv The parameters
* @return Value
*/
- Value exec(const std::string &name, int argc, struct _zval_struct ***params);
+ Value exec(const char *name, int argc, struct _zval_struct ***params);
protected:
/**