QxOrm  1.2.3
C++ Object Relational Mapping library
QxMacro.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** http://www.qxorm.com/
00004 ** http://sourceforge.net/projects/qxorm/
00005 ** Original file by Lionel Marty
00006 **
00007 ** This file is part of the QxOrm library
00008 **
00009 ** This software is provided 'as-is', without any express or implied
00010 ** warranty. In no event will the authors be held liable for any
00011 ** damages arising from the use of this software.
00012 **
00013 ** GNU Lesser General Public License Usage
00014 ** This file must be used under the terms of the GNU Lesser
00015 ** General Public License version 2.1 as published by the Free Software
00016 ** Foundation and appearing in the file 'license.lgpl.txt' included in the
00017 ** packaging of this file.  Please review the following information to
00018 ** ensure the GNU Lesser General Public License version 2.1 requirements
00019 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00020 **
00021 ** If you have questions regarding the use of this file, please contact :
00022 ** contact@qxorm.com
00023 **
00024 ****************************************************************************/
00025 
00026 #ifndef _QX_MACRO_H_
00027 #define _QX_MACRO_H_
00028 
00029 #ifdef _MSC_VER
00030 #pragma once
00031 #endif
00032 
00040 #include <QxCommon/QxConfig.h>
00041 
00042 #ifndef qAssert
00043 #if _QX_USE_ASSERT
00044 #define qAssert Q_ASSERT
00045 #else // _QX_USE_ASSERT
00046 #define qAssert(x) /* Nothing */
00047 #endif // _QX_USE_ASSERT
00048 #endif // qAssert
00049 
00050 #ifndef QX_PRAGMA
00051 #ifdef __GNUC__
00052 #define QX_PRAGMA(x) _Pragma( #x )
00053 #endif // __GNUC__
00054 #ifdef _MSC_VER
00055 #define QX_PRAGMA(x) __pragma( x )
00056 #endif // _MSC_VER
00057 #ifndef QX_PRAGMA
00058 #define QX_PRAGMA(x) /* Nothing */
00059 #endif // QX_PRAGMA
00060 #endif // QX_PRAGMA
00061 
00062 #ifndef QX_DLL_EXPORT_HELPER
00063 #ifdef Q_OS_WIN
00064 #define QX_DLL_EXPORT_HELPER __declspec(dllexport)
00065 #elif (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
00066 #define QX_DLL_EXPORT_HELPER __attribute__ ((visibility("default")))
00067 #else
00068 #define QX_DLL_EXPORT_HELPER /* Nothing */
00069 #endif // Q_OS_WIN
00070 #endif // QX_DLL_EXPORT_HELPER
00071 
00072 #ifndef QX_DLL_IMPORT_HELPER
00073 #ifdef Q_OS_WIN
00074 #define QX_DLL_IMPORT_HELPER __declspec(dllimport)
00075 #elif (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
00076 #define QX_DLL_IMPORT_HELPER __attribute__ ((visibility("default")))
00077 #else
00078 #define QX_DLL_IMPORT_HELPER /* Nothing */
00079 #endif // Q_OS_WIN
00080 #endif // QX_DLL_IMPORT_HELPER
00081 
00082 #ifdef __GNUC__
00083 #if _QX_USE_GCC_EXPORT_ALL_SYMBOLS
00084 #undef QX_DLL_EXPORT_HELPER
00085 #undef QX_DLL_IMPORT_HELPER
00086 #define QX_DLL_EXPORT_HELPER /* Nothing */
00087 #define QX_DLL_IMPORT_HELPER /* Nothing */
00088 #endif // _QX_USE_GCC_EXPORT_ALL_SYMBOLS
00089 #endif // __GNUC__
00090 
00091 #ifdef _QX_STATIC_BUILD
00092 #undef QX_DLL_EXPORT_HELPER
00093 #undef QX_DLL_IMPORT_HELPER
00094 #define QX_DLL_EXPORT_HELPER /* Nothing */
00095 #define QX_DLL_IMPORT_HELPER /* Nothing */
00096 #endif // _QX_STATIC_BUILD
00097 
00098 #ifndef QX_DLL_INTERNAL_HELPER
00099 #if (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
00100 #define QX_DLL_INTERNAL_HELPER __attribute__ ((visibility("hidden")))
00101 #else
00102 #define QX_DLL_INTERNAL_HELPER /* Nothing */
00103 #endif // (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
00104 #endif // QX_DLL_INTERNAL_HELPER
00105 
00106 #ifndef QX_DLL_EXPORT_TEMPLATE_HELPER
00107 #ifdef _MSC_VER
00108 #define QX_DLL_EXPORT_TEMPLATE_HELPER QX_DLL_EXPORT_HELPER
00109 #else // _MSC_VER
00110 #define QX_DLL_EXPORT_TEMPLATE_HELPER /* Nothing */
00111 #endif // _MSC_VER
00112 #endif // QX_DLL_EXPORT_TEMPLATE_HELPER
00113 
00114 #ifndef QX_DLL_IMPORT_TEMPLATE_HELPER
00115 #ifdef _MSC_VER
00116 #define QX_DLL_IMPORT_TEMPLATE_HELPER QX_DLL_IMPORT_HELPER
00117 #else // _MSC_VER
00118 #define QX_DLL_IMPORT_TEMPLATE_HELPER /* Nothing */
00119 #endif // _MSC_VER
00120 #endif // QX_DLL_IMPORT_TEMPLATE_HELPER
00121 
00122 #ifndef QX_PRAGMA_VISIBILITY_BEGIN
00123 #ifndef Q_OS_WIN
00124 #if (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
00125 #define QX_PRAGMA_VISIBILITY_BEGIN QX_PRAGMA(GCC visibility push( default ))
00126 #endif // (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
00127 #endif // Q_OS_WIN
00128 #ifndef QX_PRAGMA_VISIBILITY_BEGIN
00129 #define QX_PRAGMA_VISIBILITY_BEGIN /* Nothing */
00130 #endif // QX_PRAGMA_VISIBILITY_BEGIN
00131 #endif // QX_PRAGMA_VISIBILITY_BEGIN
00132 
00133 #ifndef QX_PRAGMA_VISIBILITY_END
00134 #ifndef Q_OS_WIN
00135 #if (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
00136 #define QX_PRAGMA_VISIBILITY_END QX_PRAGMA(GCC visibility pop)
00137 #endif // (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
00138 #endif // Q_OS_WIN
00139 #ifndef QX_PRAGMA_VISIBILITY_END
00140 #define QX_PRAGMA_VISIBILITY_END /* Nothing */
00141 #endif // QX_PRAGMA_VISIBILITY_END
00142 #endif // QX_PRAGMA_VISIBILITY_END
00143 
00144 #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
00145 #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
00146 #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
00147 #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
00148 #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
00149 
00150 #define QX_DLL_EXPORT_TEMPLATE_CPP(CL, T) QX_PRAGMA_VISIBILITY_BEGIN template CL QX_DLL_EXPORT_TEMPLATE_HELPER T; QX_PRAGMA_VISIBILITY_END
00151 #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
00152 #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
00153 #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
00154 #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
00155 
00156 #define QX_TEMPLATE_T(T) T<>
00157 #define QX_TEMPLATE_T_P1(T, P1) T< P1 >
00158 #define QX_TEMPLATE_T_P1_P2(T, P1, P2) T< P1, P2 >
00159 #define QX_TEMPLATE_T_P1_P2_P3(T, P1, P2, P3) T< P1, P2, P3 >
00160 #define QX_TEMPLATE_T_U_P1(T, U, P1) T< U< P1 > >
00161 #define QX_TEMPLATE_T_U_P1_P2(T, U, P1, P2) T< U< P1, P2 > >
00162 #define QX_TEMPLATE_T_U_P1_P2_P3(T, U, P1, P2, P3) T< U< P1, P2, P3 > >
00163 
00164 #ifndef QX_DLL_EXPORT
00165 #ifdef _QX_BUILDING_QX_ORM
00166 #define QX_DLL_EXPORT QX_DLL_EXPORT_HELPER
00167 #else // _QX_BUILDING_QX_ORM
00168 #define QX_DLL_EXPORT QX_DLL_IMPORT_HELPER
00169 #endif // _QX_BUILDING_QX_ORM
00170 #endif // QX_DLL_EXPORT
00171 
00172 #ifndef QX_DLL_EXPORT_QX_SINGLETON_HPP
00173 #ifdef _QX_BUILDING_QX_ORM
00174 #define QX_DLL_EXPORT_QX_SINGLETON_HPP(x) /* Nothing */
00175 #else // _QX_BUILDING_QX_ORM
00176 #define QX_DLL_EXPORT_QX_SINGLETON_HPP(x) QX_DLL_EXPORT_TEMPLATE_HPP(class, qx::QxSingleton< x >)
00177 #endif // _QX_BUILDING_QX_ORM
00178 #endif // QX_DLL_EXPORT_QX_SINGLETON_HPP
00179 
00180 #ifndef QX_DLL_EXPORT_QX_SINGLETON_CPP
00181 #ifdef _QX_BUILDING_QX_ORM
00182 #define QX_DLL_EXPORT_QX_SINGLETON_CPP(x) QX_DLL_EXPORT_TEMPLATE_CPP(class, qx::QxSingleton< x >)
00183 #else // _QX_BUILDING_QX_ORM
00184 #define QX_DLL_EXPORT_QX_SINGLETON_CPP(x) /* Nothing */
00185 #endif // _QX_BUILDING_QX_ORM
00186 #endif // QX_DLL_EXPORT_QX_SINGLETON_CPP
00187 
00188 #ifndef QX_DLL_EXPORT_INLINE_FCT
00189 #ifdef _MSC_VER
00190 #define QX_DLL_EXPORT_INLINE_FCT QX_DLL_EXPORT
00191 #else // _MSC_VER
00192 #define QX_DLL_EXPORT_INLINE_FCT /* Nothing */
00193 #endif // _MSC_VER
00194 #endif // QX_DLL_EXPORT_INLINE_FCT
00195 
00196 #ifdef __GNUC__
00197 #define QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE inline
00198 #else
00199 #define QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE /* Nothing */
00200 #endif // __GNUC__
00201 
00202 #ifdef _MSC_VER
00203 #define QX_STRNCPY strncpy_s
00204 #define QX_VSPRINTF vsprintf_s
00205 #else // _MSC_VER
00206 #define QX_STRNCPY strncpy
00207 #define QX_VSPRINTF vsprintf
00208 #endif // _MSC_VER
00209 
00210 #endif // _QX_MACRO_H_