Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qconstructormacros.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QCONSTRUCTORMACROS_H
6#define QCONSTRUCTORMACROS_H
7
8#if 0
9#pragma qt_class(QtConstructorMacros)
10#pragma qt_sync_stop_processing
11#endif
12
13#if defined(__cplusplus)
14
15#ifndef Q_CONSTRUCTOR_FUNCTION
16# define Q_CONSTRUCTOR_FUNCTION0(AFUNC)
17 namespace {
18 static const struct AFUNC ## _ctor_class_ {
19 inline AFUNC ## _ctor_class_() { AFUNC(); }
20 } AFUNC ## _ctor_instance_;
21 }
22
23# define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC)
24#endif
25
26#ifndef Q_DESTRUCTOR_FUNCTION
27# define Q_DESTRUCTOR_FUNCTION0(AFUNC)
28 namespace {
29 static const struct AFUNC ## _dtor_class_ {
30 inline AFUNC ## _dtor_class_() { }
31 inline ~ AFUNC ## _dtor_class_() { AFUNC(); }
32 } AFUNC ## _dtor_instance_;
33 }
34# define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC)
35#endif
36
37#endif // __cplusplus
38
39#endif // QCONSTRUCTORMACROS_H