aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/tests/libsample/onlycopy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/tests/libsample/onlycopy.cpp')
-rw-r--r--sources/shiboken2/tests/libsample/onlycopy.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/sources/shiboken2/tests/libsample/onlycopy.cpp b/sources/shiboken2/tests/libsample/onlycopy.cpp
index 75bf23b5c..cfc7c9d99 100644
--- a/sources/shiboken2/tests/libsample/onlycopy.cpp
+++ b/sources/shiboken2/tests/libsample/onlycopy.cpp
@@ -28,18 +28,44 @@
#include "onlycopy.h"
-OnlyCopy::OnlyCopy(const OnlyCopy& other)
+class OnlyCopyPrivate
+{
+public:
+ explicit OnlyCopyPrivate(int v = 0) : value(v) {}
+
+ int value;
+};
+
+OnlyCopy::OnlyCopy(int value) : d(new OnlyCopyPrivate(value))
+{
+
+}
+
+OnlyCopy::OnlyCopy(OnlyCopyPrivate *dIn) : d(dIn)
+{
+}
+
+OnlyCopy::~OnlyCopy()
+{
+ delete d;
+}
+
+OnlyCopy::OnlyCopy(const OnlyCopy& other) : d(new OnlyCopyPrivate(other.value()))
{
- m_value = other.m_value;
}
OnlyCopy&
OnlyCopy::operator=(const OnlyCopy& other)
{
- m_value = other.m_value;
+ d->value = other.d->value;
return *this;
}
+int OnlyCopy::value() const
+{
+ return d->value;
+}
+
OnlyCopy
FriendOfOnlyCopy::createOnlyCopy(int value)
{