aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/privatector.h
blob: 3b38414f8b598d515d42171fece9d83a024e1dfc (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef PRIVATECTOR_H
#define PRIVATECTOR_H

#include "libsamplemacros.h"

class PrivateCtor
{
public:
    inline static PrivateCtor *instance()
    {
        static PrivateCtor self;
        self.m_instantiations++;
        return &self;
    }

    inline int instanceCalls()
    {
        return m_instantiations;
    }

private:
    int m_instantiations = 0;

    PrivateCtor() = default;
};

class DeletedDefaultCtor
{
public:
    DeletedDefaultCtor() = delete;

    DeletedDefaultCtor(const DeletedDefaultCtor &) = default;
    DeletedDefaultCtor(DeletedDefaultCtor &&) = default;
    DeletedDefaultCtor &operator=(const DeletedDefaultCtor &) = default;
    DeletedDefaultCtor &operator=(DeletedDefaultCtor &&) = default;
    ~DeletedDefaultCtor() = default;
};

#endif // PRIVATECTOR_H