Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
qxtglobal.h
Go to the documentation of this file.
1/****************************************************************************
2 **
3 ** Copyright (C) Qxt Foundation. Some rights reserved.
4 **
5 ** This file is part of the QxtCore module of the Qxt library.
6 **
7 ** This library is free software; you can redistribute it and/or modify it
8 ** under the terms of the Common Public License, version 1.0, as published
9 ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 ** version 2.1, as published by the Free Software Foundation.
11 **
12 ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 ** FITNESS FOR A PARTICULAR PURPOSE.
16 **
17 ** You should have received a copy of the CPL and the LGPL along with this
18 ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 ** included with the source distribution for more information.
20 ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 **
22 ** <http://libqxt.org> <foundation@libqxt.org>
23 **
24 ****************************************************************************/
25
26#ifndef QXTGLOBAL_H
27#define QXTGLOBAL_H
28
29#include <QtGlobal>
30
31#define QXT_VERSION 0x000602
32#define QXT_VERSION_STR "0.6.2"
33#define QXT_STATIC
34
35//--------------------------global macros------------------------------
36
37#ifndef QXT_NO_MACROS
38
39#endif // QXT_NO_MACROS
40
41//--------------------------export macros------------------------------
42
43#define QXT_DLLEXPORT DO_NOT_USE_THIS_ANYMORE
44
45#if !defined(QXT_STATIC)
46# if defined(BUILD_QXT_CORE)
47# define QXT_CORE_EXPORT Q_DECL_EXPORT
48# else
49# define QXT_CORE_EXPORT Q_DECL_IMPORT
50# endif
51#else
52# define QXT_CORE_EXPORT
53#endif // BUILD_QXT_CORE
54
55#if !defined(QXT_STATIC)
56# if defined(BUILD_QXT_GUI)
57# define QXT_GUI_EXPORT Q_DECL_EXPORT
58# else
59# define QXT_GUI_EXPORT Q_DECL_IMPORT
60# endif
61#else
62# define QXT_GUI_EXPORT
63#endif // BUILD_QXT_GUI
64
65#if !defined(QXT_STATIC)
66# if defined(BUILD_QXT_NETWORK)
67# define QXT_NETWORK_EXPORT Q_DECL_EXPORT
68# else
69# define QXT_NETWORK_EXPORT Q_DECL_IMPORT
70# endif
71#else
72# define QXT_NETWORK_EXPORT
73#endif // BUILD_QXT_NETWORK
74
75#if !defined(QXT_STATIC)
76# if defined(BUILD_QXT_SQL)
77# define QXT_SQL_EXPORT Q_DECL_EXPORT
78# else
79# define QXT_SQL_EXPORT Q_DECL_IMPORT
80# endif
81#else
82# define QXT_SQL_EXPORT
83#endif // BUILD_QXT_SQL
84
85#if !defined(QXT_STATIC)
86# if defined(BUILD_QXT_WEB)
87# define QXT_WEB_EXPORT Q_DECL_EXPORT
88# else
89# define QXT_WEB_EXPORT Q_DECL_IMPORT
90# endif
91#else
92# define QXT_WEB_EXPORT
93#endif // BUILD_QXT_WEB
94
95#if !defined(QXT_STATIC)
96# if defined(BUILD_QXT_BERKELEY)
97# define QXT_BERKELEY_EXPORT Q_DECL_EXPORT
98# else
99# define QXT_BERKELEY_EXPORT Q_DECL_IMPORT
100# endif
101#else
102# define QXT_BERKELEY_EXPORT
103#endif // BUILD_QXT_BERKELEY
104
105#if !defined(QXT_STATIC)
106# if defined(BUILD_QXT_ZEROCONF)
107# define QXT_ZEROCONF_EXPORT Q_DECL_EXPORT
108# else
109# define QXT_ZEROCONF_EXPORT Q_DECL_IMPORT
110# endif
111#else
112# define QXT_ZEROCONF_EXPORT
113#endif // QXT_ZEROCONF_EXPORT
114
115#if defined BUILD_QXT_CORE || defined BUILD_QXT_GUI || defined BUILD_QXT_SQL || defined BUILD_QXT_NETWORK || defined BUILD_QXT_WEB || defined BUILD_QXT_BERKELEY || defined BUILD_QXT_ZEROCONF
116# define BUILD_QXT
117#endif
118
120
121#ifndef QT_BEGIN_NAMESPACE
122#define QT_BEGIN_NAMESPACE
123#endif
124
125#ifndef QT_END_NAMESPACE
126#define QT_END_NAMESPACE
127#endif
128
129#ifndef QT_FORWARD_DECLARE_CLASS
130#define QT_FORWARD_DECLARE_CLASS(Class) class Class;
131#endif
132
133/****************************************************************************
134** This file is derived from code bearing the following notice:
135** The sole author of this file, Adam Higerd, has explicitly disclaimed all
136** copyright interest and protection for the content within. This file has
137** been placed in the public domain according to United States copyright
138** statute and case law. In jurisdictions where this public domain dedication
139** is not legally recognized, anyone who receives a copy of this file is
140** permitted to use, modify, duplicate, and redistribute this file, in whole
141** or in part, with no restrictions or conditions. In these jurisdictions,
142** this file shall be copyright (C) 2006-2008 by Adam Higerd.
143****************************************************************************/
144
145#define QXT_DECLARE_PRIVATE(PUB) friend class PUB##Private; QxtPrivateInterface<PUB, PUB##Private> qxt_d;
146#define QXT_DECLARE_PUBLIC(PUB) friend class PUB;
147#define QXT_INIT_PRIVATE(PUB) qxt_d.setPublic(this);
148#define QXT_D(PUB) PUB##Private& d = qxt_d()
149#define QXT_P(PUB) PUB& p = qxt_p()
150
151template <typename PUB>
153{
154public:
155 virtual ~QxtPrivate()
156 {}
157 inline void QXT_setPublic(PUB* pub)
158 {
159 qxt_p_ptr = pub;
160 }
161
162protected:
163 inline PUB& qxt_p()
164 {
165 return *qxt_p_ptr;
166 }
167 inline const PUB& qxt_p() const
168 {
169 return *qxt_p_ptr;
170 }
171
172private:
174};
175
176template <typename PUB, typename PVT>
178{
179 friend class QxtPrivate<PUB>;
180public:
182 {
183 pvt = new PVT;
184 }
186 {
187 delete pvt;
188 }
189
190 inline void setPublic(PUB* pub)
191 {
192 pvt->QXT_setPublic(pub);
193 }
194 inline PVT& operator()()
195 {
196 return *static_cast<PVT*>(pvt);
197 }
198 inline const PVT& operator()() const
199 {
200 return *static_cast<PVT*>(pvt);
201 }
202private:
206};
207
208#endif // QXT_GLOBAL
~QxtPrivateInterface()
Definition qxtglobal.h:185
void setPublic(PUB *pub)
Definition qxtglobal.h:190
QxtPrivateInterface & operator=(const QxtPrivateInterface &)
Definition qxtglobal.h:204
QxtPrivateInterface(const QxtPrivateInterface &)
Definition qxtglobal.h:203
const PVT & operator()() const
Definition qxtglobal.h:198
PVT & operator()()
Definition qxtglobal.h:194
QxtPrivate< PUB > * pvt
Definition qxtglobal.h:205
QxtPrivateInterface()
Definition qxtglobal.h:181
Definition qxtglobal.h:153
PUB & qxt_p()
Definition qxtglobal.h:163
void QXT_setPublic(PUB *pub)
Definition qxtglobal.h:157
virtual ~QxtPrivate()
Definition qxtglobal.h:155
PUB * qxt_p_ptr
Definition qxtglobal.h:173
const PUB & qxt_p() const
Definition qxtglobal.h:167
#define QXT_CORE_EXPORT
Definition qxtglobal.h:52
QXT_CORE_EXPORT const char * qxtVersion()