File indexing completed on 2024-12-01 08:17:20
0001 // clang-format off 0002 /***************************************************************************** 0003 0004 SPDX-FileCopyrightText: Copyright © 2010 Pavel Karelin (hkarel), <hkarel@yandex.ru> 0005 SPDX-License-Identifier: MIT 0006 --- 0007 0008 This header defines macros of general purpose. 0009 0010 *****************************************************************************/ 0011 // clang-format on 0012 0013 #ifndef DEFMAC_H 0014 #define DEFMAC_H 0015 0016 #pragma once 0017 0018 #define DISABLE_DEFAULT_CONSTRUCT( ClassName ) \ 0019 ClassName () = delete; \ 0020 ClassName ( ClassName && ) = delete; \ 0021 ClassName ( const ClassName & ) = delete; 0022 0023 #define DISABLE_DEFAULT_COPY( ClassName ) \ 0024 ClassName ( ClassName && ) = delete; \ 0025 ClassName ( const ClassName & ) = delete; \ 0026 ClassName & operator = ( ClassName && ) = delete; \ 0027 ClassName & operator = ( const ClassName & ) = delete; 0028 0029 #define DISABLE_DEFAULT_FUNC( ClassName ) \ 0030 ClassName () = delete; \ 0031 ClassName ( ClassName && ) = delete; \ 0032 ClassName ( const ClassName & ) = delete; \ 0033 ClassName & operator = ( ClassName && ) = delete; \ 0034 ClassName & operator = ( const ClassName & ) = delete; 0035 0036 #ifndef NDEBUG 0037 #define QCONNECT_ASSERT(COND_) assert(COND_) 0038 #else 0039 #define QCONNECT_ASSERT(COND_) COND_ 0040 #endif 0041 0042 /** 0043 The chk_connect macro is used to check result returned by the function 0044 QObject::connect() in debug mode, it looks like on assert() function. 0045 However, in the release mode, unlike assert() function, test expression 0046 is not removed. 0047 */ 0048 0049 #define chk_connect(SOURCE_, SIGNAL_, DEST_, SLOT_) \ 0050 QCONNECT_ASSERT(QObject::connect(SOURCE_, SIGNAL_, DEST_, SLOT_)); 0051 0052 #define chk_connect_unique(SOURCE_, SIGNAL_, DEST_, SLOT_, CONNECT_TYPE_) \ 0053 QCONNECT_ASSERT(QObject::connect(SOURCE_, SIGNAL_, DEST_, SLOT_, CONNECT_TYPE_ | Qt::UniqueConnection)); 0054 0055 0056 #define chk_connect_custom(SOURCE_, SIGNAL_, DEST_, SLOT_, CONNECT_TYPE_) \ 0057 QCONNECT_ASSERT(QObject::connect(SOURCE_, SIGNAL_, DEST_, SLOT_, CONNECT_TYPE_)); 0058 0059 #define chk_connect_a(SOURCE_, SIGNAL_, DEST_, SLOT_) \ 0060 QCONNECT_ASSERT(QObject::connect(SOURCE_, SIGNAL_, DEST_, SLOT_, \ 0061 Qt::ConnectionType(Qt::AutoConnection | Qt::UniqueConnection))); 0062 0063 #define chk_connect_d(SOURCE_, SIGNAL_, DEST_, SLOT_) \ 0064 QCONNECT_ASSERT(QObject::connect(SOURCE_, SIGNAL_, DEST_, SLOT_, \ 0065 Qt::ConnectionType(Qt::DirectConnection | Qt::UniqueConnection))); 0066 0067 #define chk_connect_q(SOURCE_, SIGNAL_, DEST_, SLOT_) \ 0068 QCONNECT_ASSERT(QObject::connect(SOURCE_, SIGNAL_, DEST_, SLOT_, \ 0069 Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection))); 0070 0071 #define chk_connect_bq(SOURCE_, SIGNAL_, DEST_, SLOT_) \ 0072 QCONNECT_ASSERT(QObject::connect(SOURCE_, SIGNAL_, DEST_, SLOT_, \ 0073 Qt::ConnectionType(Qt::BlockingQueuedConnection | Qt::UniqueConnection))); 0074 0075 #if defined(__MINGW32__) || defined(__MINGW64__) 0076 #define MINGW 0077 #endif 0078 0079 #endif /* DEFMAC_H */