QxOrm
1.5.0
C++ Object Relational Mapping library
|
00001 /**************************************************************************** 00002 ** 00003 ** https://www.qxorm.com/ 00004 ** Copyright (C) 2013 Lionel Marty (contact@qxorm.com) 00005 ** 00006 ** This file is part of the QxOrm library 00007 ** 00008 ** This software is provided 'as-is', without any express or implied 00009 ** warranty. In no event will the authors be held liable for any 00010 ** damages arising from the use of this software 00011 ** 00012 ** Commercial Usage 00013 ** Licensees holding valid commercial QxOrm licenses may use this file in 00014 ** accordance with the commercial license agreement provided with the 00015 ** Software or, alternatively, in accordance with the terms contained in 00016 ** a written agreement between you and Lionel Marty 00017 ** 00018 ** GNU General Public License Usage 00019 ** Alternatively, this file may be used under the terms of the GNU 00020 ** General Public License version 3.0 as published by the Free Software 00021 ** Foundation and appearing in the file 'license.gpl3.txt' included in the 00022 ** packaging of this file. Please review the following information to 00023 ** ensure the GNU General Public License version 3.0 requirements will be 00024 ** met : http://www.gnu.org/copyleft/gpl.html 00025 ** 00026 ** If you are unsure which license is appropriate for your use, or 00027 ** if you have questions regarding the use of this file, please contact : 00028 ** contact@qxorm.com 00029 ** 00030 ****************************************************************************/ 00031 00032 #ifndef _QX_MACRO_H_ 00033 #define _QX_MACRO_H_ 00034 00035 #ifdef _MSC_VER 00036 #pragma once 00037 #endif 00038 00046 #include <QxCommon/QxConfig.h> 00047 00048 #ifndef qAssert 00049 #if _QX_USE_ASSERT 00050 #define qAssert Q_ASSERT 00051 #else // _QX_USE_ASSERT 00052 #define qAssert(x) /* Nothing */ 00053 #endif // _QX_USE_ASSERT 00054 #endif // qAssert 00055 00056 #ifndef qAssertMsg 00057 #if _QX_USE_ASSERT 00058 #define qAssertMsg(test, where, what) Q_ASSERT_X(test, where, what) 00059 #else // _QX_USE_ASSERT 00060 #define qAssertMsg(test, where, what) /* Nothing */ 00061 #endif // _QX_USE_ASSERT 00062 #endif // qAssertMsg 00063 00064 #ifndef QX_PRAGMA 00065 #ifdef __GNUC__ 00066 #define QX_PRAGMA(x) _Pragma( #x ) 00067 #endif // __GNUC__ 00068 #ifdef _MSC_VER 00069 #define QX_PRAGMA(x) __pragma( x ) 00070 #endif // _MSC_VER 00071 #ifndef QX_PRAGMA 00072 #define QX_PRAGMA(x) /* Nothing */ 00073 #endif // QX_PRAGMA 00074 #endif // QX_PRAGMA 00075 00076 #ifndef QX_DLL_EXPORT_HELPER 00077 #ifdef Q_OS_WIN 00078 #define QX_DLL_EXPORT_HELPER __declspec(dllexport) 00079 #elif (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00080 #define QX_DLL_EXPORT_HELPER __attribute__ ((visibility("default"))) 00081 #else 00082 #define QX_DLL_EXPORT_HELPER /* Nothing */ 00083 #endif // Q_OS_WIN 00084 #endif // QX_DLL_EXPORT_HELPER 00085 00086 #ifndef QX_DLL_IMPORT_HELPER 00087 #ifdef Q_OS_WIN 00088 #define QX_DLL_IMPORT_HELPER __declspec(dllimport) 00089 #elif (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00090 #define QX_DLL_IMPORT_HELPER __attribute__ ((visibility("default"))) 00091 #else 00092 #define QX_DLL_IMPORT_HELPER /* Nothing */ 00093 #endif // Q_OS_WIN 00094 #endif // QX_DLL_IMPORT_HELPER 00095 00096 #ifdef __GNUC__ 00097 #if _QX_USE_GCC_EXPORT_ALL_SYMBOLS 00098 #undef QX_DLL_EXPORT_HELPER 00099 #undef QX_DLL_IMPORT_HELPER 00100 #define QX_DLL_EXPORT_HELPER /* Nothing */ 00101 #define QX_DLL_IMPORT_HELPER /* Nothing */ 00102 #endif // _QX_USE_GCC_EXPORT_ALL_SYMBOLS 00103 #endif // __GNUC__ 00104 00105 #ifdef _QX_STATIC_BUILD 00106 #undef QX_DLL_EXPORT_HELPER 00107 #undef QX_DLL_IMPORT_HELPER 00108 #define QX_DLL_EXPORT_HELPER /* Nothing */ 00109 #define QX_DLL_IMPORT_HELPER /* Nothing */ 00110 #endif // _QX_STATIC_BUILD 00111 00112 #ifndef QX_DLL_INTERNAL_HELPER 00113 #if (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00114 #define QX_DLL_INTERNAL_HELPER __attribute__ ((visibility("hidden"))) 00115 #else 00116 #define QX_DLL_INTERNAL_HELPER /* Nothing */ 00117 #endif // (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00118 #endif // QX_DLL_INTERNAL_HELPER 00119 00120 #ifndef QX_DLL_EXPORT_TEMPLATE_HELPER 00121 #ifdef _MSC_VER 00122 #define QX_DLL_EXPORT_TEMPLATE_HELPER QX_DLL_EXPORT_HELPER 00123 #else // _MSC_VER 00124 #define QX_DLL_EXPORT_TEMPLATE_HELPER /* Nothing */ 00125 #endif // _MSC_VER 00126 #endif // QX_DLL_EXPORT_TEMPLATE_HELPER 00127 00128 #ifndef QX_DLL_IMPORT_TEMPLATE_HELPER 00129 #ifdef _MSC_VER 00130 #define QX_DLL_IMPORT_TEMPLATE_HELPER QX_DLL_IMPORT_HELPER 00131 #else // _MSC_VER 00132 #define QX_DLL_IMPORT_TEMPLATE_HELPER /* Nothing */ 00133 #endif // _MSC_VER 00134 #endif // QX_DLL_IMPORT_TEMPLATE_HELPER 00135 00136 #ifndef QX_PRAGMA_VISIBILITY_BEGIN 00137 #ifndef Q_OS_WIN 00138 #if (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00139 #define QX_PRAGMA_VISIBILITY_BEGIN QX_PRAGMA(GCC visibility push( default )) 00140 #endif // (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00141 #endif // Q_OS_WIN 00142 #ifndef QX_PRAGMA_VISIBILITY_BEGIN 00143 #define QX_PRAGMA_VISIBILITY_BEGIN /* Nothing */ 00144 #endif // QX_PRAGMA_VISIBILITY_BEGIN 00145 #endif // QX_PRAGMA_VISIBILITY_BEGIN 00146 00147 #ifndef QX_PRAGMA_VISIBILITY_END 00148 #ifndef Q_OS_WIN 00149 #if (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00150 #define QX_PRAGMA_VISIBILITY_END QX_PRAGMA(GCC visibility pop) 00151 #endif // (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00152 #endif // Q_OS_WIN 00153 #ifndef QX_PRAGMA_VISIBILITY_END 00154 #define QX_PRAGMA_VISIBILITY_END /* Nothing */ 00155 #endif // QX_PRAGMA_VISIBILITY_END 00156 #endif // QX_PRAGMA_VISIBILITY_END 00157 00158 #define QX_DLL_EXPORT_TEMPLATE_HPP(CL, T) QX_PRAGMA_VISIBILITY_BEGIN extern template CL QX_DLL_IMPORT_TEMPLATE_HELPER T; QX_PRAGMA_VISIBILITY_END 00159 #define QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(CL, T, P1) QX_PRAGMA_VISIBILITY_BEGIN extern template CL QX_DLL_IMPORT_TEMPLATE_HELPER T< P1 >; QX_PRAGMA_VISIBILITY_END 00160 #define QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(CL, T, U, P1) QX_PRAGMA_VISIBILITY_BEGIN extern template CL QX_DLL_IMPORT_TEMPLATE_HELPER T< U< P1 > >; QX_PRAGMA_VISIBILITY_END 00161 #define QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(CL, T, P1, P2) QX_PRAGMA_VISIBILITY_BEGIN extern template CL QX_DLL_IMPORT_TEMPLATE_HELPER T< P1, P2 >; QX_PRAGMA_VISIBILITY_END 00162 #define QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(CL, T, U, P1, P2) QX_PRAGMA_VISIBILITY_BEGIN extern template CL QX_DLL_IMPORT_TEMPLATE_HELPER T< U< P1, P2 > >; QX_PRAGMA_VISIBILITY_END 00163 00164 #define QX_DLL_EXPORT_TEMPLATE_CPP(CL, T) QX_PRAGMA_VISIBILITY_BEGIN template CL QX_DLL_EXPORT_TEMPLATE_HELPER T; QX_PRAGMA_VISIBILITY_END 00165 #define QX_DLL_EXPORT_TEMPLATE_T_P1_CPP(CL, T, P1) QX_PRAGMA_VISIBILITY_BEGIN template CL QX_DLL_EXPORT_TEMPLATE_HELPER T< P1 >; QX_PRAGMA_VISIBILITY_END 00166 #define QX_DLL_EXPORT_TEMPLATE_T_U_P1_CPP(CL, T, U, P1) QX_PRAGMA_VISIBILITY_BEGIN template CL QX_DLL_EXPORT_TEMPLATE_HELPER T< U< P1 > >; QX_PRAGMA_VISIBILITY_END 00167 #define QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(CL, T, P1, P2) QX_PRAGMA_VISIBILITY_BEGIN template CL QX_DLL_EXPORT_TEMPLATE_HELPER T< P1, P2 >; QX_PRAGMA_VISIBILITY_END 00168 #define QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(CL, T, U, P1, P2) QX_PRAGMA_VISIBILITY_BEGIN template CL QX_DLL_EXPORT_TEMPLATE_HELPER T< U< P1, P2 > >; QX_PRAGMA_VISIBILITY_END 00169 00170 #define QX_TEMPLATE_T(T) T<> 00171 #define QX_TEMPLATE_T_P1(T, P1) T< P1 > 00172 #define QX_TEMPLATE_T_P1_P2(T, P1, P2) T< P1, P2 > 00173 #define QX_TEMPLATE_T_P1_P2_P3(T, P1, P2, P3) T< P1, P2, P3 > 00174 #define QX_TEMPLATE_T_U_P1(T, U, P1) T< U< P1 > > 00175 #define QX_TEMPLATE_T_U_P1_P2(T, U, P1, P2) T< U< P1, P2 > > 00176 #define QX_TEMPLATE_T_U_P1_P2_P3(T, U, P1, P2, P3) T< U< P1, P2, P3 > > 00177 00178 #ifndef QX_DLL_EXPORT 00179 #ifdef _QX_BUILDING_QX_ORM 00180 #define QX_DLL_EXPORT QX_DLL_EXPORT_HELPER 00181 #else // _QX_BUILDING_QX_ORM 00182 #define QX_DLL_EXPORT QX_DLL_IMPORT_HELPER 00183 #endif // _QX_BUILDING_QX_ORM 00184 #endif // QX_DLL_EXPORT 00185 00186 #ifndef QX_DLL_EXPORT_QX_SINGLETON_HPP 00187 #ifdef _QX_BUILDING_QX_ORM 00188 #define QX_DLL_EXPORT_QX_SINGLETON_HPP(x) /* Nothing */ 00189 #else // _QX_BUILDING_QX_ORM 00190 #define QX_DLL_EXPORT_QX_SINGLETON_HPP(x) QX_DLL_EXPORT_TEMPLATE_HPP(class, qx::QxSingleton< x >) 00191 #endif // _QX_BUILDING_QX_ORM 00192 #endif // QX_DLL_EXPORT_QX_SINGLETON_HPP 00193 00194 #ifndef QX_DLL_EXPORT_QX_SINGLETON_CPP 00195 #ifdef _QX_BUILDING_QX_ORM 00196 #define QX_DLL_EXPORT_QX_SINGLETON_CPP(x) QX_DLL_EXPORT_TEMPLATE_CPP(class, qx::QxSingleton< x >) 00197 #else // _QX_BUILDING_QX_ORM 00198 #define QX_DLL_EXPORT_QX_SINGLETON_CPP(x) /* Nothing */ 00199 #endif // _QX_BUILDING_QX_ORM 00200 #endif // QX_DLL_EXPORT_QX_SINGLETON_CPP 00201 00202 #ifndef QX_DLL_EXPORT_INLINE_FCT 00203 #ifdef _MSC_VER 00204 #define QX_DLL_EXPORT_INLINE_FCT QX_DLL_EXPORT 00205 #else // _MSC_VER 00206 #define QX_DLL_EXPORT_INLINE_FCT /* Nothing */ 00207 #endif // _MSC_VER 00208 #endif // QX_DLL_EXPORT_INLINE_FCT 00209 00210 #ifdef __GNUC__ 00211 #define QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE inline 00212 #elif (defined(_MSC_VER) && (_MSC_VER >= 1920)) // MSVC 2019 00213 #define QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE inline 00214 #else 00215 #define QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE /* Nothing */ 00216 #endif // __GNUC__ 00217 00218 #ifdef _MSC_VER 00219 #define QX_STRNCPY strncpy_s 00220 #define QX_VSPRINTF vsprintf_s 00221 #else // _MSC_VER 00222 #define QX_STRNCPY strncpy 00223 #define QX_VSPRINTF vsprintf 00224 #endif // _MSC_VER 00225 00226 #ifdef _QX_MODE_RELEASE 00227 #ifndef NDEBUG 00228 #define NDEBUG 00229 #endif // NDEBUG 00230 #endif // _QX_MODE_RELEASE 00231 00232 // From file <boost/serialization/force_include.hpp> (written by Robert Ramey) 00233 #if ! defined(_WIN32) && ! defined(_WIN64) 00234 # if defined(__GNUC__) && (__GNUC__ >= 3) 00235 # define QX_USED __attribute__ ((__used__)) 00236 # elif defined(__IBMCPP__) && (__IBMCPP__ >= 1110) 00237 # define QX_USED __attribute__ ((__used__)) 00238 # elif defined(__INTEL_COMPILER) 00239 # define QX_USED __attribute__ ((__used__)) 00240 # endif 00241 #endif // ! defined(_WIN32) && ! defined(_WIN64) 00242 00243 #ifndef QX_USED 00244 #define QX_USED /* Nothing */ 00245 #endif // QX_USED 00246 00247 #ifdef QT_NO_OPENSSL 00248 #ifndef QT_NO_SSL 00249 #define QT_NO_SSL /* Nothing */ 00250 #endif // QT_NO_SSL 00251 #endif // QT_NO_OPENSSL 00252 00253 #ifndef Q_DECL_OVERRIDE 00254 #define Q_DECL_OVERRIDE /* Nothing */ 00255 #endif // Q_DECL_OVERRIDE 00256 00257 #ifndef Q_DECL_FINAL 00258 #define Q_DECL_FINAL /* Nothing */ 00259 #endif // Q_DECL_FINAL 00260 00261 #ifndef Q_DECL_HIDDEN 00262 #define Q_DECL_HIDDEN /* Nothing */ 00263 #endif // Q_DECL_HIDDEN 00264 00265 #ifndef Q_DECL_NOEXCEPT 00266 #define Q_DECL_NOEXCEPT /* Nothing */ 00267 #endif // Q_DECL_NOEXCEPT 00268 00269 #ifndef Q_NULLPTR 00270 #define Q_NULLPTR NULL 00271 #endif // Q_NULLPTR 00272 00273 // From 'QtCore' directory, 'qtversionchecks.h' file 00274 #ifndef QT_VERSION_CHECK 00275 #define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) 00276 #endif // QT_VERSION_CHECK 00277 00278 #endif // _QX_MACRO_H_