QxOrm 1.4.9
C++ Object Relational Mapping library
Loading...
Searching...
No Matches
QxMacro.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** https://www.qxorm.com/
4** Copyright (C) 2013 Lionel Marty (contact@qxorm.com)
5**
6** This file is part of the QxOrm library
7**
8** This software is provided 'as-is', without any express or implied
9** warranty. In no event will the authors be held liable for any
10** damages arising from the use of this software
11**
12** Commercial Usage
13** Licensees holding valid commercial QxOrm licenses may use this file in
14** accordance with the commercial license agreement provided with the
15** Software or, alternatively, in accordance with the terms contained in
16** a written agreement between you and Lionel Marty
17**
18** GNU General Public License Usage
19** Alternatively, this file may be used under the terms of the GNU
20** General Public License version 3.0 as published by the Free Software
21** Foundation and appearing in the file 'license.gpl3.txt' included in the
22** packaging of this file. Please review the following information to
23** ensure the GNU General Public License version 3.0 requirements will be
24** met : http://www.gnu.org/copyleft/gpl.html
25**
26** If you are unsure which license is appropriate for your use, or
27** if you have questions regarding the use of this file, please contact :
28** contact@qxorm.com
29**
30****************************************************************************/
31
32#ifndef _QX_MACRO_H_
33#define _QX_MACRO_H_
34
35#ifdef _MSC_VER
36#pragma once
37#endif
38
46#include <QxCommon/QxConfig.h>
47
48#ifndef qAssert
49#if _QX_USE_ASSERT
50#define qAssert Q_ASSERT
51#else // _QX_USE_ASSERT
52#define qAssert(x) /* Nothing */
53#endif // _QX_USE_ASSERT
54#endif // qAssert
55
56#ifndef qAssertMsg
57#if _QX_USE_ASSERT
58#define qAssertMsg(test, where, what) Q_ASSERT_X(test, where, what)
59#else // _QX_USE_ASSERT
60#define qAssertMsg(test, where, what) /* Nothing */
61#endif // _QX_USE_ASSERT
62#endif // qAssertMsg
63
64#ifndef QX_PRAGMA
65#ifdef __GNUC__
66#define QX_PRAGMA(x) _Pragma( #x )
67#endif // __GNUC__
68#ifdef _MSC_VER
69#define QX_PRAGMA(x) __pragma( x )
70#endif // _MSC_VER
71#ifndef QX_PRAGMA
72#define QX_PRAGMA(x) /* Nothing */
73#endif // QX_PRAGMA
74#endif // QX_PRAGMA
75
76#ifndef QX_DLL_EXPORT_HELPER
77#ifdef Q_OS_WIN
78#define QX_DLL_EXPORT_HELPER __declspec(dllexport)
79#elif (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
80#define QX_DLL_EXPORT_HELPER __attribute__ ((visibility("default")))
81#else
82#define QX_DLL_EXPORT_HELPER /* Nothing */
83#endif // Q_OS_WIN
84#endif // QX_DLL_EXPORT_HELPER
85
86#ifndef QX_DLL_IMPORT_HELPER
87#ifdef Q_OS_WIN
88#define QX_DLL_IMPORT_HELPER __declspec(dllimport)
89#elif (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
90#define QX_DLL_IMPORT_HELPER __attribute__ ((visibility("default")))
91#else
92#define QX_DLL_IMPORT_HELPER /* Nothing */
93#endif // Q_OS_WIN
94#endif // QX_DLL_IMPORT_HELPER
95
96#ifdef __GNUC__
97#if _QX_USE_GCC_EXPORT_ALL_SYMBOLS
98#undef QX_DLL_EXPORT_HELPER
99#undef QX_DLL_IMPORT_HELPER
100#define QX_DLL_EXPORT_HELPER /* Nothing */
101#define QX_DLL_IMPORT_HELPER /* Nothing */
102#endif // _QX_USE_GCC_EXPORT_ALL_SYMBOLS
103#endif // __GNUC__
104
105#ifdef _QX_STATIC_BUILD
106#undef QX_DLL_EXPORT_HELPER
107#undef QX_DLL_IMPORT_HELPER
108#define QX_DLL_EXPORT_HELPER /* Nothing */
109#define QX_DLL_IMPORT_HELPER /* Nothing */
110#endif // _QX_STATIC_BUILD
111
112#ifndef QX_DLL_INTERNAL_HELPER
113#if (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
114#define QX_DLL_INTERNAL_HELPER __attribute__ ((visibility("hidden")))
115#else
116#define QX_DLL_INTERNAL_HELPER /* Nothing */
117#endif // (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
118#endif // QX_DLL_INTERNAL_HELPER
119
120#ifndef QX_DLL_EXPORT_TEMPLATE_HELPER
121#ifdef _MSC_VER
122#define QX_DLL_EXPORT_TEMPLATE_HELPER QX_DLL_EXPORT_HELPER
123#else // _MSC_VER
124#define QX_DLL_EXPORT_TEMPLATE_HELPER /* Nothing */
125#endif // _MSC_VER
126#endif // QX_DLL_EXPORT_TEMPLATE_HELPER
127
128#ifndef QX_DLL_IMPORT_TEMPLATE_HELPER
129#ifdef _MSC_VER
130#define QX_DLL_IMPORT_TEMPLATE_HELPER QX_DLL_IMPORT_HELPER
131#else // _MSC_VER
132#define QX_DLL_IMPORT_TEMPLATE_HELPER /* Nothing */
133#endif // _MSC_VER
134#endif // QX_DLL_IMPORT_TEMPLATE_HELPER
135
136#ifndef QX_PRAGMA_VISIBILITY_BEGIN
137#ifndef Q_OS_WIN
138#if (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
139#define QX_PRAGMA_VISIBILITY_BEGIN QX_PRAGMA(GCC visibility push( default ))
140#endif // (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
141#endif // Q_OS_WIN
142#ifndef QX_PRAGMA_VISIBILITY_BEGIN
143#define QX_PRAGMA_VISIBILITY_BEGIN /* Nothing */
144#endif // QX_PRAGMA_VISIBILITY_BEGIN
145#endif // QX_PRAGMA_VISIBILITY_BEGIN
146
147#ifndef QX_PRAGMA_VISIBILITY_END
148#ifndef Q_OS_WIN
149#if (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
150#define QX_PRAGMA_VISIBILITY_END QX_PRAGMA(GCC visibility pop)
151#endif // (_QX_USE_GCC_VISIBILITY && (__GNUC__ >= 4))
152#endif // Q_OS_WIN
153#ifndef QX_PRAGMA_VISIBILITY_END
154#define QX_PRAGMA_VISIBILITY_END /* Nothing */
155#endif // QX_PRAGMA_VISIBILITY_END
156#endif // QX_PRAGMA_VISIBILITY_END
157
158#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
159#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
160#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
161#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
162#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
163
164#define QX_DLL_EXPORT_TEMPLATE_CPP(CL, T) QX_PRAGMA_VISIBILITY_BEGIN template CL QX_DLL_EXPORT_TEMPLATE_HELPER T; QX_PRAGMA_VISIBILITY_END
165#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
166#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
167#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
168#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
169
170#define QX_TEMPLATE_T(T) T<>
171#define QX_TEMPLATE_T_P1(T, P1) T< P1 >
172#define QX_TEMPLATE_T_P1_P2(T, P1, P2) T< P1, P2 >
173#define QX_TEMPLATE_T_P1_P2_P3(T, P1, P2, P3) T< P1, P2, P3 >
174#define QX_TEMPLATE_T_U_P1(T, U, P1) T< U< P1 > >
175#define QX_TEMPLATE_T_U_P1_P2(T, U, P1, P2) T< U< P1, P2 > >
176#define QX_TEMPLATE_T_U_P1_P2_P3(T, U, P1, P2, P3) T< U< P1, P2, P3 > >
177
178#ifndef QX_DLL_EXPORT
179#ifdef _QX_BUILDING_QX_ORM
180#define QX_DLL_EXPORT QX_DLL_EXPORT_HELPER
181#else // _QX_BUILDING_QX_ORM
182#define QX_DLL_EXPORT QX_DLL_IMPORT_HELPER
183#endif // _QX_BUILDING_QX_ORM
184#endif // QX_DLL_EXPORT
185
186#ifndef QX_DLL_EXPORT_QX_SINGLETON_HPP
187#ifdef _QX_BUILDING_QX_ORM
188#define QX_DLL_EXPORT_QX_SINGLETON_HPP(x) /* Nothing */
189#else // _QX_BUILDING_QX_ORM
190#define QX_DLL_EXPORT_QX_SINGLETON_HPP(x) QX_DLL_EXPORT_TEMPLATE_HPP(class, qx::QxSingleton< x >)
191#endif // _QX_BUILDING_QX_ORM
192#endif // QX_DLL_EXPORT_QX_SINGLETON_HPP
193
194#ifndef QX_DLL_EXPORT_QX_SINGLETON_CPP
195#ifdef _QX_BUILDING_QX_ORM
196#define QX_DLL_EXPORT_QX_SINGLETON_CPP(x) QX_DLL_EXPORT_TEMPLATE_CPP(class, qx::QxSingleton< x >)
197#else // _QX_BUILDING_QX_ORM
198#define QX_DLL_EXPORT_QX_SINGLETON_CPP(x) /* Nothing */
199#endif // _QX_BUILDING_QX_ORM
200#endif // QX_DLL_EXPORT_QX_SINGLETON_CPP
201
202#ifndef QX_DLL_EXPORT_INLINE_FCT
203#ifdef _MSC_VER
204#define QX_DLL_EXPORT_INLINE_FCT QX_DLL_EXPORT
205#else // _MSC_VER
206#define QX_DLL_EXPORT_INLINE_FCT /* Nothing */
207#endif // _MSC_VER
208#endif // QX_DLL_EXPORT_INLINE_FCT
209
210#ifdef __GNUC__
211#define QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE inline
212#elif (defined(_MSC_VER) && (_MSC_VER >= 1920)) // MSVC 2019
213#define QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE inline
214#else
215#define QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE /* Nothing */
216#endif // __GNUC__
217
218#ifdef _MSC_VER
219#define QX_STRNCPY strncpy_s
220#define QX_VSPRINTF vsprintf_s
221#else // _MSC_VER
222#define QX_STRNCPY strncpy
223#define QX_VSPRINTF vsprintf
224#endif // _MSC_VER
225
226#ifdef _QX_MODE_RELEASE
227#ifndef NDEBUG
228#define NDEBUG
229#endif // NDEBUG
230#endif // _QX_MODE_RELEASE
231
232// From file <boost/serialization/force_include.hpp> (written by Robert Ramey)
233#if ! defined(_WIN32) && ! defined(_WIN64)
234# if defined(__GNUC__) && (__GNUC__ >= 3)
235# define QX_USED __attribute__ ((__used__))
236# elif defined(__IBMCPP__) && (__IBMCPP__ >= 1110)
237# define QX_USED __attribute__ ((__used__))
238# elif defined(__INTEL_COMPILER)
239# define QX_USED __attribute__ ((__used__))
240# endif
241#endif // ! defined(_WIN32) && ! defined(_WIN64)
242
243#ifndef QX_USED
244#define QX_USED /* Nothing */
245#endif // QX_USED
246
247#ifdef QT_NO_OPENSSL
248#ifndef QT_NO_SSL
249#define QT_NO_SSL /* Nothing */
250#endif // QT_NO_SSL
251#endif // QT_NO_OPENSSL
252
253#ifndef Q_DECL_OVERRIDE
254#define Q_DECL_OVERRIDE /* Nothing */
255#endif // Q_DECL_OVERRIDE
256
257#ifndef Q_DECL_FINAL
258#define Q_DECL_FINAL /* Nothing */
259#endif // Q_DECL_FINAL
260
261#ifndef Q_DECL_HIDDEN
262#define Q_DECL_HIDDEN /* Nothing */
263#endif // Q_DECL_HIDDEN
264
265#ifndef Q_DECL_NOEXCEPT
266#define Q_DECL_NOEXCEPT /* Nothing */
267#endif // Q_DECL_NOEXCEPT
268
269#ifndef Q_NULLPTR
270#define Q_NULLPTR NULL
271#endif // Q_NULLPTR
272
273// From 'QtCore' directory, 'qtversionchecks.h' file
274#ifndef QT_VERSION_CHECK
275#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
276#endif // QT_VERSION_CHECK
277
278#endif // _QX_MACRO_H_
List of parameters to compile and build QxOrm library.