Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtconfigmacros.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QTCONFIGMACROS_H
5#define QTCONFIGMACROS_H
6
7#if 0
8# pragma qt_sync_stop_processing
9#endif
10
11#include <QtCore/qtconfiginclude.h>
12#include <QtCore/qtdeprecationdefinitions.h>
13#include <QtCore/qtversionchecks.h>
14
15#include <assert.h>
16
17/*
18 The Qt modules' export macros.
19 The options are:
20 - defined(QT_STATIC): Qt was built or is being built in static mode
21 - defined(QT_SHARED): Qt was built or is being built in shared/dynamic mode
22 If neither was defined, then QT_SHARED is implied. If Qt was compiled in static
23 mode, QT_STATIC is defined in qconfig.h. In shared mode, QT_STATIC is implied
24 for the bootstrapped tools.
25*/
26
27#ifdef QT_BOOTSTRAPPED
28# ifdef QT_SHARED
29# error "QT_SHARED and QT_BOOTSTRAPPED together don't make sense. Please fix the build"
30# elif !defined(QT_STATIC)
31# define QT_STATIC
32# endif
33#endif
34
35#if defined(QT_SHARED) || !defined(QT_STATIC)
36# ifdef QT_STATIC
37# error "Both QT_SHARED and QT_STATIC defined, please make up your mind"
38# endif
39# ifndef QT_SHARED
40# define QT_SHARED
41# endif
42#endif
43
44/*
45 No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols
46 for Qt's internal unit tests. If you want slower loading times and more
47 symbols that can vanish from version to version, feel free to define QT_BUILD_INTERNAL.
48
49 \note After adding Q_AUTOTEST_EXPORT to a method, you'll need to wrap any unittests
50 that will use that method in "#ifdef QT_BUILD_INTERNAL".
51*/
52#if defined(QT_BUILD_INTERNAL) && defined(QT_BUILDING_QT) && defined(QT_SHARED)
53# define Q_AUTOTEST_EXPORT Q_DECL_EXPORT
54#elif defined(QT_BUILD_INTERNAL) && defined(QT_SHARED)
55# define Q_AUTOTEST_EXPORT Q_DECL_IMPORT
56#else
57# define Q_AUTOTEST_EXPORT
58#endif
59
60/*
61 The QT_CONFIG macro implements a safe compile time check for features of Qt.
62 Features can be in three states:
63 0 or undefined: This will lead to a compile error when testing for it
64 -1: The feature is not available
65 1: The feature is available
66*/
67#define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1)
68#define QT_REQUIRE_CONFIG(feature) static_assert(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not available.")
69
70/* moc compats (signals/slots) */
71#ifndef QT_MOC_COMPAT
72# define QT_MOC_COMPAT
73#else
74# undef QT_MOC_COMPAT
75# define QT_MOC_COMPAT
76#endif
77
78/*
79 Debugging and error handling
80*/
81
82#if !defined(QT_NO_DEBUG) && !defined(QT_DEBUG)
83# define QT_DEBUG
84#endif
85
86// valid for both C and C++
87#define QT_MANGLE_NAMESPACE0(x) x
88#define QT_MANGLE_NAMESPACE1(a, b) a##_##b
89#define QT_MANGLE_NAMESPACE2(a, b) QT_MANGLE_NAMESPACE1(a,b)
90#if !defined(QT_NAMESPACE) || defined(Q_MOC_RUN) /* user namespace */
91# define QT_MANGLE_NAMESPACE(name) name
92#else
93# define QT_MANGLE_NAMESPACE(name) QT_MANGLE_NAMESPACE2(
94 QT_MANGLE_NAMESPACE0(name), QT_MANGLE_NAMESPACE0(QT_NAMESPACE))
95#endif
96
97#ifdef __cplusplus
98
99#if !defined(QT_NAMESPACE) || defined(Q_MOC_RUN) /* user namespace */
100
101# define QT_PREPEND_NAMESPACE(name) ::name
102# define QT_USE_NAMESPACE
103# define QT_BEGIN_NAMESPACE
104# define QT_END_NAMESPACE
105# define QT_BEGIN_INCLUDE_NAMESPACE
106# define QT_END_INCLUDE_NAMESPACE
107# define QT_FORWARD_DECLARE_CLASS(name) class name;
108# define QT_FORWARD_DECLARE_STRUCT(name) struct name;
109
110#elif defined(QT_INLINE_NAMESPACE) /* user inline namespace FIXME in Qt 7: Default */
111
112# define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name
113# define QT_USE_NAMESPACE
114# define QT_BEGIN_NAMESPACE inline namespace QT_NAMESPACE {
115# define QT_END_NAMESPACE }
116# define QT_BEGIN_INCLUDE_NAMESPACE }
117# define QT_END_INCLUDE_NAMESPACE inline namespace QT_NAMESPACE {
118# define QT_FORWARD_DECLARE_CLASS(name) QT_BEGIN_NAMESPACE
119 class name; QT_END_NAMESPACE
120
121# define QT_FORWARD_DECLARE_STRUCT(name) QT_BEGIN_NAMESPACE
122 struct name; QT_END_NAMESPACE
123
124inline namespace QT_NAMESPACE {}
125
126#else /* user namespace */
127
128# define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name
129# define QT_USE_NAMESPACE using namespace ::QT_NAMESPACE;
130# define QT_BEGIN_NAMESPACE namespace QT_NAMESPACE {
131# define QT_END_NAMESPACE }
132# define QT_BEGIN_INCLUDE_NAMESPACE }
133# define QT_END_INCLUDE_NAMESPACE namespace QT_NAMESPACE {
134# define QT_FORWARD_DECLARE_CLASS(name)
135 QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE
136 using QT_PREPEND_NAMESPACE(name);
137
138# define QT_FORWARD_DECLARE_STRUCT(name)
139 QT_BEGIN_NAMESPACE struct name; QT_END_NAMESPACE
140 using QT_PREPEND_NAMESPACE(name);
141
142namespace QT_NAMESPACE {}
143
144# ifndef QT_BOOTSTRAPPED
145# ifndef QT_NO_USING_NAMESPACE
146 /*
147 This expands to a "using QT_NAMESPACE" also in _header files_.
148 It is the only way the feature can be used without too much
149 pain, but if people _really_ do not want it they can add
150 QT_NO_USING_NAMESPACE to their build configuration.
151 */
152 QT_USE_NAMESPACE
153# endif
154# endif
155
156#endif /* user namespace */
157
158#else /* __cplusplus */
159
160# define QT_BEGIN_NAMESPACE
161# define QT_END_NAMESPACE
162# define QT_USE_NAMESPACE
163# define QT_BEGIN_INCLUDE_NAMESPACE
164# define QT_END_INCLUDE_NAMESPACE
165
166#endif /* __cplusplus */
167
168/* ### Qt 6.9 (or later): remove *_MOC_* macros (moc does not need them since 6.5) */
169#ifndef QT_BEGIN_MOC_NAMESPACE
170# define QT_BEGIN_MOC_NAMESPACE QT_USE_NAMESPACE
171#endif
172#ifndef QT_END_MOC_NAMESPACE
173# define QT_END_MOC_NAMESPACE
174#endif
175
176/*
177 Strict mode
178*/
179#ifdef QT_ENABLE_STRICT_MODE_UP_TO
180#ifndef QT_DISABLE_DEPRECATED_UP_TO
181# define QT_DISABLE_DEPRECATED_UP_TO QT_ENABLE_STRICT_MODE_UP_TO
182#endif
183
184#if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 0, 0)
185# ifndef QT_NO_FOREACH
186# define QT_NO_FOREACH
187# endif
188# ifndef QT_NO_CAST_TO_ASCII
189# define QT_NO_CAST_TO_ASCII
190# endif
191# ifndef QT_NO_CAST_FROM_BYTEARRAY
192# define QT_NO_CAST_FROM_BYTEARRAY
193# endif
194# ifndef QT_NO_URL_CAST_FROM_STRING
195# define QT_NO_URL_CAST_FROM_STRING
196# endif
197# ifndef QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
198# define QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
199# endif
200# ifndef QT_NO_JAVA_STYLE_ITERATORS
201# define QT_NO_JAVA_STYLE_ITERATORS
202# endif
203#endif // 6.0.0
204
205#if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 6, 0)
206# ifndef QT_NO_QEXCHANGE
207# define QT_NO_QEXCHANGE
208# endif
209#endif // 6.6.0
210
211#if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 7, 0)
212# ifndef QT_NO_CONTEXTLESS_CONNECT
213# define QT_NO_CONTEXTLESS_CONNECT
214# endif
215#endif // 6.7.0
216
217#if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 8, 0)
218# ifndef QT_NO_QASCONST
219# define QT_NO_QASCONST
220# endif
221# if !defined(QT_USE_NODISCARD_FILE_OPEN) && !defined(QT_NO_USE_NODISCARD_FILE_OPEN)
222# define QT_USE_NODISCARD_FILE_OPEN
223# endif
224#endif // 6.8.0
225
226#if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 9, 0)
227# ifndef QT_NO_QSNPRINTF
228# define QT_NO_QSNPRINTF
229# endif
230#endif // 6.9.0
231#endif // QT_ENABLE_STRICT_MODE_UP_TO
232
233#endif /* QTCONFIGMACROS_H */
Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureVideoDataOutput)
bool isActive() const override
void setCaptureSession(QPlatformMediaCaptureSession *) override
void onActiveChanged(bool active) override
int cameraPixelFormatScore(QVideoFrameFormat::PixelFormat pixelFmt, QVideoFrameFormat::ColorRange colorRange) const override
void onCameraDeviceChanged(const QCameraDevice &device) override
bool tryApplyCameraFormat(const QCameraFormat &) override
QVideoFrameFormat frameFormat() const override
std::optional< int > ffmpegHWPixelFormat() const override
Q_FORWARD_DECLARE_OBJC_CLASS(QAVFSampleBufferDelegate)
Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureDeviceInput)
Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureDeviceRotationCoordinator)
Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureSession)
Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureDevice)
#define QT_SHARED
#define QT_USE_NAMESPACE
#define QT_MANGLE_NAMESPACE1(a, b)
#define QT_BEGIN_NAMESPACE
#define QT_END_NAMESPACE