aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libother/smartptrtester.cpp
blob: 1c6496b1a73031f13d338fc65e5b76d044dd86ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "smartptrtester.h"

SharedPtr<Str> SmartPtrTester::createSharedPtrStr(const char *what)
{
    return {new Str(what)};
}

std::string SmartPtrTester::valueOfSharedPtrStr(const SharedPtr<Str> &str)
{
    return str->cstring();
}

SharedPtr<Integer> SmartPtrTester::createSharedPtrInteger(int v)
{
    auto i = SharedPtr<Integer>(new Integer);
    i->m_int = v;
    return i;
}

int SmartPtrTester::valueOfSharedPtrInteger(const SharedPtr<Integer> &v)
{
    return v->m_int;
}

void SmartPtrTester::fiddleInt(const SharedPtr<int> &) // no binding, should not cause errors
{
}