aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/privatedtor.h
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/tests/libsample/privatedtor.h')
-rw-r--r--sources/shiboken6/tests/libsample/privatedtor.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libsample/privatedtor.h b/sources/shiboken6/tests/libsample/privatedtor.h
new file mode 100644
index 000000000..05f18ea53
--- /dev/null
+++ b/sources/shiboken6/tests/libsample/privatedtor.h
@@ -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
+
+#ifndef PRIVATEDTOR_H
+#define PRIVATEDTOR_H
+
+#include "libsamplemacros.h"
+
+class PrivateDtor
+{
+public:
+ LIBMINIMAL_DISABLE_COPY_MOVE(PrivateDtor)
+
+ inline static PrivateDtor *instance()
+ {
+ static PrivateDtor self;
+ self.m_instantiations++;
+ return &self;
+ }
+
+ inline int instanceCalls()
+ {
+ return m_instantiations;
+ }
+
+protected:
+ inline int protectedInstanceCalls() { return m_instantiations; }
+
+private:
+ int m_instantiations = 0;
+
+ PrivateDtor() noexcept = default;
+ ~PrivateDtor() = default;
+};
+
+#endif // PRIVATEDTOR_H