aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsmart/stdsharedptrtestbench.h
blob: 9d4c207b57fc223e9dad24b944b9932aa7744276 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef STDSHAREDPTRTESTBENCH_H
#define STDSHAREDPTRTESTBENCH_H

#include "libsmartmacros.h"

#include <memory>
#include <string>

class Integer;

class LIB_SMART_API StdSharedPtrTestBench
{
public:
    StdSharedPtrTestBench();
    ~StdSharedPtrTestBench();

    static std::shared_ptr<Integer> createInteger(int v = 42);
    static std::shared_ptr<Integer> createNullInteger();
    static void printInteger(const std::shared_ptr<Integer> &);

    static std::shared_ptr<int> createInt(int v = 42);
    static std::shared_ptr<int> createNullInt();
    static void printInt(const std::shared_ptr<int> &);

    static std::shared_ptr<double> createDouble(double v = 42);
    static std::shared_ptr<double> createNullDouble();
    static void printDouble(const std::shared_ptr<double> &);

    static std::shared_ptr<std::string> createString(const char *text);
    static std::shared_ptr<std::string> createNullString();
    static void printString(const std::shared_ptr<std::string> &);
};

class LIB_SMART_API StdSharedPtrVirtualMethodTester
{
public:
    StdSharedPtrVirtualMethodTester();
    virtual ~StdSharedPtrVirtualMethodTester();

    std::shared_ptr<Integer> callModifyInteger(const std::shared_ptr<Integer> &p);

protected:
    virtual std::shared_ptr<Integer> doModifyInteger(std::shared_ptr<Integer> p);
};

#endif // STDSHAREDPTRTESTBENCH_H