![]() |
QxOrm
1.2.7
C++ Object Relational Mapping library
|
00001 /**************************************************************************** 00002 ** 00003 ** http://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 QX_PRAGMA 00057 #ifdef __GNUC__ 00058 #define QX_PRAGMA(x) _Pragma( #x ) 00059 #endif // __GNUC__ 00060 #ifdef _MSC_VER 00061 #define QX_PRAGMA(x) __pragma( x ) 00062 #endif // _MSC_VER 00063 #ifndef QX_PRAGMA 00064 #define QX_PRAGMA(x) /* Nothing */ 00065 #endif // QX_PRAGMA 00066 #endif // QX_PRAGMA 00067 00068 #ifndef QX_DLL_EXPORT_HELPER 00069 #ifdef Q_OS_WIN 00070 #define QX_DLL_EXPORT_HELPER __declspec(dllexport) 00071 #elif (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00072 #define QX_DLL_EXPORT_HELPER __attribute__ ((visibility("default"))) 00073 #else 00074 #define QX_DLL_EXPORT_HELPER /* Nothing */ 00075 #endif // Q_OS_WIN 00076 #endif // QX_DLL_EXPORT_HELPER 00077 00078 #ifndef QX_DLL_IMPORT_HELPER 00079 #ifdef Q_OS_WIN 00080 #define QX_DLL_IMPORT_HELPER __declspec(dllimport) 00081 #elif (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00082 #define QX_DLL_IMPORT_HELPER __attribute__ ((visibility("default"))) 00083 #else 00084 #define QX_DLL_IMPORT_HELPER /* Nothing */ 00085 #endif // Q_OS_WIN 00086 #endif // QX_DLL_IMPORT_HELPER 00087 00088 #ifdef __GNUC__ 00089 #if _QX_USE_GCC_EXPORT_ALL_SYMBOLS 00090 #undef QX_DLL_EXPORT_HELPER 00091 #undef QX_DLL_IMPORT_HELPER 00092 #define QX_DLL_EXPORT_HELPER /* Nothing */ 00093 #define QX_DLL_IMPORT_HELPER /* Nothing */ 00094 #endif // _QX_USE_GCC_EXPORT_ALL_SYMBOLS 00095 #endif // __GNUC__ 00096 00097 #ifdef _QX_STATIC_BUILD 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_STATIC_BUILD 00103 00104 #ifndef QX_DLL_INTERNAL_HELPER 00105 #if (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00106 #define QX_DLL_INTERNAL_HELPER __attribute__ ((visibility("hidden"))) 00107 #else 00108 #define QX_DLL_INTERNAL_HELPER /* Nothing */ 00109 #endif // (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00110 #endif // QX_DLL_INTERNAL_HELPER 00111 00112 #ifndef QX_DLL_EXPORT_TEMPLATE_HELPER 00113 #ifdef _MSC_VER 00114 #define QX_DLL_EXPORT_TEMPLATE_HELPER QX_DLL_EXPORT_HELPER 00115 #else // _MSC_VER 00116 #define QX_DLL_EXPORT_TEMPLATE_HELPER /* Nothing */ 00117 #endif // _MSC_VER 00118 #endif // QX_DLL_EXPORT_TEMPLATE_HELPER 00119 00120 #ifndef QX_DLL_IMPORT_TEMPLATE_HELPER 00121 #ifdef _MSC_VER 00122 #define QX_DLL_IMPORT_TEMPLATE_HELPER QX_DLL_IMPORT_HELPER 00123 #else // _MSC_VER 00124 #define QX_DLL_IMPORT_TEMPLATE_HELPER /* Nothing */ 00125 #endif // _MSC_VER 00126 #endif // QX_DLL_IMPORT_TEMPLATE_HELPER 00127 00128 #ifndef QX_PRAGMA_VISIBILITY_BEGIN 00129 #ifndef Q_OS_WIN 00130 #if (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00131 #define QX_PRAGMA_VISIBILITY_BEGIN QX_PRAGMA(GCC visibility push( default )) 00132 #endif // (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00133 #endif // Q_OS_WIN 00134 #ifndef QX_PRAGMA_VISIBILITY_BEGIN 00135 #define QX_PRAGMA_VISIBILITY_BEGIN /* Nothing */ 00136 #endif // QX_PRAGMA_VISIBILITY_BEGIN 00137 #endif // QX_PRAGMA_VISIBILITY_BEGIN 00138 00139 #ifndef QX_PRAGMA_VISIBILITY_END 00140 #ifndef Q_OS_WIN 00141 #if (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00142 #define QX_PRAGMA_VISIBILITY_END QX_PRAGMA(GCC visibility pop) 00143 #endif // (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4)) 00144 #endif // Q_OS_WIN 00145 #ifndef QX_PRAGMA_VISIBILITY_END 00146 #define QX_PRAGMA_VISIBILITY_END /* Nothing */ 00147 #endif // QX_PRAGMA_VISIBILITY_END 00148 #endif // QX_PRAGMA_VISIBILITY_END 00149 00150 #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 00151 #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 00152 #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 00153 #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 00154 #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 00155 00156 #define QX_DLL_EXPORT_TEMPLATE_CPP(CL, T) QX_PRAGMA_VISIBILITY_BEGIN template CL QX_DLL_EXPORT_TEMPLATE_HELPER T; QX_PRAGMA_VISIBILITY_END 00157 #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 00158 #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 00159 #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 00160 #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 00161 00162 #define QX_TEMPLATE_T(T) T<> 00163 #define QX_TEMPLATE_T_P1(T, P1) T< P1 > 00164 #define QX_TEMPLATE_T_P1_P2(T, P1, P2) T< P1, P2 > 00165 #define QX_TEMPLATE_T_P1_P2_P3(T, P1, P2, P3) T< P1, P2, P3 > 00166 #define QX_TEMPLATE_T_U_P1(T, U, P1) T< U< P1 > > 00167 #define QX_TEMPLATE_T_U_P1_P2(T, U, P1, P2) T< U< P1, P2 > > 00168 #define QX_TEMPLATE_T_U_P1_P2_P3(T, U, P1, P2, P3) T< U< P1, P2, P3 > > 00169 00170 #ifndef QX_DLL_EXPORT 00171 #ifdef _QX_BUILDING_QX_ORM 00172 #define QX_DLL_EXPORT QX_DLL_EXPORT_HELPER 00173 #else // _QX_BUILDING_QX_ORM 00174 #define QX_DLL_EXPORT QX_DLL_IMPORT_HELPER 00175 #endif // _QX_BUILDING_QX_ORM 00176 #endif // QX_DLL_EXPORT 00177 00178 #ifndef QX_DLL_EXPORT_QX_SINGLETON_HPP 00179 #ifdef _QX_BUILDING_QX_ORM 00180 #define QX_DLL_EXPORT_QX_SINGLETON_HPP(x) /* Nothing */ 00181 #else // _QX_BUILDING_QX_ORM 00182 #define QX_DLL_EXPORT_QX_SINGLETON_HPP(x) QX_DLL_EXPORT_TEMPLATE_HPP(class, qx::QxSingleton< x >) 00183 #endif // _QX_BUILDING_QX_ORM 00184 #endif // QX_DLL_EXPORT_QX_SINGLETON_HPP 00185 00186 #ifndef QX_DLL_EXPORT_QX_SINGLETON_CPP 00187 #ifdef _QX_BUILDING_QX_ORM 00188 #define QX_DLL_EXPORT_QX_SINGLETON_CPP(x) QX_DLL_EXPORT_TEMPLATE_CPP(class, qx::QxSingleton< x >) 00189 #else // _QX_BUILDING_QX_ORM 00190 #define QX_DLL_EXPORT_QX_SINGLETON_CPP(x) /* Nothing */ 00191 #endif // _QX_BUILDING_QX_ORM 00192 #endif // QX_DLL_EXPORT_QX_SINGLETON_CPP 00193 00194 #ifndef QX_DLL_EXPORT_INLINE_FCT 00195 #ifdef _MSC_VER 00196 #define QX_DLL_EXPORT_INLINE_FCT QX_DLL_EXPORT 00197 #else // _MSC_VER 00198 #define QX_DLL_EXPORT_INLINE_FCT /* Nothing */ 00199 #endif // _MSC_VER 00200 #endif // QX_DLL_EXPORT_INLINE_FCT 00201 00202 #ifdef __GNUC__ 00203 #define QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE inline 00204 #else 00205 #define QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE /* Nothing */ 00206 #endif // __GNUC__ 00207 00208 #ifdef _MSC_VER 00209 #define QX_STRNCPY strncpy_s 00210 #define QX_VSPRINTF vsprintf_s 00211 #else // _MSC_VER 00212 #define QX_STRNCPY strncpy 00213 #define QX_VSPRINTF vsprintf 00214 #endif // _MSC_VER 00215 00216 #ifdef _QX_MODE_RELEASE 00217 #ifndef NDEBUG 00218 #define NDEBUG 00219 #endif // NDEBUG 00220 #endif // _QX_MODE_RELEASE 00221 00222 #endif // _QX_MACRO_H_