summaryrefslogtreecommitdiff
path: root/include/object.h
diff options
context:
space:
mode:
authorMartijn Otto <martijn.otto@copernica.com>2015-03-26 16:00:10 +0100
committerMartijn Otto <martijn.otto@copernica.com>2015-03-26 16:00:10 +0100
commit7a928e2b19bddf152fd838469cc50805d4132401 (patch)
tree0a6657f4b94c27556b2f218e407f752018540d3b /include/object.h
parentae4fa5f871d937773e9facde87a32784e715e3ae (diff)
Changed default visibility for symbols in the PHP-CPP library to hidden and explicitly exported all symbols available from the public API. Moved the hiddenpointer to the zend implementation directory as it is not meant to be used publicly and not referenced anywhere from the API anyway
Diffstat (limited to 'include/object.h')
-rw-r--r--include/object.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/include/object.h b/include/object.h
index 2eea05b..f8fea74 100644
--- a/include/object.h
+++ b/include/object.h
@@ -12,11 +12,11 @@
* Set up namespace
*/
namespace Php {
-
+
/**
* Class definition
*/
-class Object : public Value
+class PHPCPP_EXPORT Object : public Value
{
public:
/**
@@ -33,40 +33,40 @@ public:
/**
* Constructor to create a new instance of a builtin class
- *
+ *
* You can use this constructor if you have created an instance of your
* own class, but has not assigned it to a variable yet. This happens
* for example for classes that are not constructed from PHP userspace,
* but from your own functions:
- *
+ *
* Php::Value yourFunction()
* {
* return Php::Object("MyClass", new MyClass());
* }
- *
+ *
* When you construct objects like this, the __construct function is not
* going to be called. If you want to construct the object just as if it
* was constructed from PHP user space, do this:
- *
+ *
* Php::Value yourFunction()
* {
* return Php::Object("MyClass");
* }
- *
+ *
* @param name Name of the class to instantiate
* @param base C++ object to wrap
*/
Object(const char *name, Base *base);
-
+
/**
* If you already have the zend_class_entry, you can also pass the
* class_entry structure instead of the class name. This constructor
* works exactly like the Object(name, base) constructor mentioned
* above.
- *
+ *
* Note that if you normally use PHP-CPP, you do not have the class_entry,
* so you probably need to pass the name anyway
- *
+ *
* @param entry The PHP class entry
* @param base C++ object to wrap
*/
@@ -86,17 +86,17 @@ public:
/**
* Constructor to create a new instance
- *
+ *
* Note that it was not possible to create a constructor with signature
* Object(const char *name, Args&&... args) because that overrides the
* Object(const char *name, Base *base) constructor.
- *
+ *
* @param name Name of the class to instantiate
* @param args Optional arguments
*/
template <typename ...Args>
Object(const char *name, Value arg0, Args&&... args) : Value() { if (instantiate(name)) call("__construct", arg0, std::forward<Value>(args)...); }
-
+
/**
* Destructor
*/
@@ -110,7 +110,7 @@ public:
{
// throw exception if things are going wrong
if (type != Type::Object) throw FatalError("Changing type of a fixed object variable");
-
+
// call base
return Value::setType(type);
}
@@ -124,17 +124,17 @@ public:
{
// skip self assignment
if (this == &value) return *this;
-
+
// type must be valid
if (value.type() != Type::Object) throw FatalError("Assigning a non-object to an object variable");
-
+
// call base
Value::operator=(value);
// done
return *this;
}
-
+
/**
* Move assignment operator
* @param value
@@ -144,10 +144,10 @@ public:
{
// skip self assignment
if (this == &value) return *this;
-
+
// type must be valid
if (value.type() != Type::Object) throw FatalError("Moving a non-object to an object variable");
-
+
// call base
Value::operator=(std::move(value));
@@ -158,10 +158,10 @@ 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 bool
*/