diff options
Diffstat (limited to 'sources/shiboken6/tests/libsample/onlycopy.cpp')
-rw-r--r-- | sources/shiboken6/tests/libsample/onlycopy.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libsample/onlycopy.cpp b/sources/shiboken6/tests/libsample/onlycopy.cpp new file mode 100644 index 000000000..981ea88a4 --- /dev/null +++ b/sources/shiboken6/tests/libsample/onlycopy.cpp @@ -0,0 +1,36 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "onlycopy.h" + +class OnlyCopyPrivate +{ +public: + explicit OnlyCopyPrivate(int v = 0) : value(v) {} + + int value; +}; + +OnlyCopy::OnlyCopy(int value) : d(std::make_shared<OnlyCopyPrivate>(value)) +{ +} + +OnlyCopy::~OnlyCopy() = default; + +int OnlyCopy::value() const +{ + return d->value; +} + +OnlyCopy FriendOfOnlyCopy::createOnlyCopy(int value) +{ + return OnlyCopy(value); +} + +std::list<OnlyCopy> FriendOfOnlyCopy::createListOfOnlyCopy(int quantity) +{ + std::list<OnlyCopy> list; + for (int i = 0; i < quantity; ++i) + list.push_back(createOnlyCopy(i)); + return list; +} |