1/****************************************************************************
2 * Copyright (C) 2013-2016 Woboq GmbH
3 * Olivier Goffart <contact at woboq.com>
4 * https://woboq.com/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20static const char Injected[] = R"-(
21#if defined(Q_MOC_OUTPUT_REVISION) || defined(Q_MOC_RUN)
22
23#ifdef QT_ANNOTATE_CLASS
24#undef QT_ANNOTATE_CLASS
25#endif
26#ifdef QT_ANNOTATE_CLASS2
27#undef QT_ANNOTATE_CLASS2
28#endif
29
30#ifdef Q_COMPILER_VARIADIC_MACROS
31#define QT_ANNOTATE_CLASS(type, ...) \
32 __extension__ _Static_assert(sizeof (#__VA_ARGS__), #type);
33#else
34#define QT_ANNOTATE_CLASS(type, anotation) \
35 __extension__ _Static_assert(sizeof (#anotation), #type);
36#endif
37#define QT_ANNOTATE_CLASS2(type, a1, a2) \
38 __extension__ _Static_assert(sizeof (#a1, #a2), #type);
39
40
41
42#ifndef QT_NO_META_MACROS
43# if defined(QT_NO_KEYWORDS)
44# define QT_NO_EMIT
45# else
46# ifndef QT_NO_SIGNALS_SLOTS_KEYWORDS
47# undef slots
48# define slots Q_SLOTS
49# undef signals
50# define signals Q_SIGNALS
51# endif
52# endif
53
54# undef Q_SLOTS
55# define Q_SLOTS Q_SLOT
56# undef Q_SIGNALS
57# define Q_SIGNALS public Q_SIGNAL
58# undef Q_PRIVATE_SLOT
59# define Q_PRIVATE_SLOT(d, signature) QT_ANNOTATE_CLASS2(qt_private_slot, d, signature)
60
61
62#undef Q_CLASSINFO
63#undef Q_PLUGIN_METADATA
64#undef Q_INTERFACES
65#undef Q_PROPERTY
66#undef Q_PRIVATE_PROPERTY
67#undef Q_REVISION
68#undef Q_ENUMS
69#undef Q_FLAGS
70#undef Q_SCRIPTABLE
71#undef Q_INVOKABLE
72#undef Q_SIGNAL
73#undef Q_SLOT
74#undef Q_ENUM
75#undef Q_FLAG
76
77#define Q_CLASSINFO(name, value) __extension__ _Static_assert(sizeof (name, value), "qt_classinfo");
78#define Q_PLUGIN_METADATA(x) QT_ANNOTATE_CLASS(qt_plugin_metadata, x)
79#define Q_INTERFACES(x) QT_ANNOTATE_CLASS(qt_interfaces, x)
80#ifdef Q_COMPILER_VARIADIC_MACROS
81#define Q_PROPERTY(...) QT_ANNOTATE_CLASS(qt_property, __VA_ARGS__)
82#else
83#define Q_PROPERTY(text) QT_ANNOTATE_CLASS(qt_property, text)
84#endif
85#define Q_PRIVATE_PROPERTY(d, text) QT_ANNOTATE_CLASS2(qt_private_property, d, text)
86
87#define Q_REVISION(v) __attribute__((annotate("qt_revision:" QT_STRINGIFY2(v))))
88#define Q_ENUMS(x) QT_ANNOTATE_CLASS(qt_enums, x)
89#define Q_FLAGS(x) QT_ANNOTATE_CLASS(qt_flags, x)
90#define Q_ENUM_IMPL(ENUM) \
91 friend Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return &staticMetaObject; } \
92 friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
93#define Q_ENUM(x) Q_ENUMS(x) Q_ENUM_IMPL(x)
94#define Q_FLAG(x) Q_FLAGS(x) Q_ENUM_IMPL(x)
95#define Q_SCRIPTABLE __attribute__((annotate("qt_scriptable")))
96#define Q_INVOKABLE __attribute__((annotate("qt_invokable")))
97#define Q_SIGNAL __attribute__((annotate("qt_signal")))
98#define Q_SLOT __attribute__((annotate("qt_slot")))
99#endif // QT_NO_META_MACROS
100
101
102#undef QT_TR_FUNCTIONS
103#ifndef QT_NO_TRANSLATION
104#define QT_TR_FUNCTIONS \
105 static inline QString tr(const char *s, const char *c = Q_NULLPTR, int n = -1) \
106 { return staticMetaObject.tr(s, c, n); } \
107 QT_DEPRECATED static inline QString trUtf8(const char *s, const char *c = Q_NULLPTR, int n = -1) \
108 { return staticMetaObject.tr(s, c, n); } \
109 QT_ANNOTATE_CLASS(qt_qobject, "")
110#else
111#define QT_TR_FUNCTIONS \
112 QT_ANNOTATE_CLASS(qt_qobject, "")
113#endif
114
115#undef Q_GADGET
116#define Q_GADGET \
117public: \
118 static const QMetaObject staticMetaObject; \
119 void qt_check_for_QGADGET_macro(); \
120 typedef void QtGadgetHelper; \
121private: \
122 Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
123 QT_ANNOTATE_CLASS(qt_qgadget, "")
124
125//for qnamespace.h because Q_MOC_RUN is defined
126#if defined(Q_MOC_RUN)
127#undef Q_OBJECT
128#define Q_OBJECT QT_ANNOTATE_CLASS(qt_qobject, "")
129#undef Q_ENUM_IMPL
130#define Q_ENUM_IMPL(ENUM)
131#endif
132
133#undef Q_OBJECT_FAKE
134#define Q_OBJECT_FAKE Q_OBJECT QT_ANNOTATE_CLASS(qt_fake, "")
135
136#undef QT_MOC_COMPAT
137#define QT_MOC_COMPAT __attribute__((annotate("qt_moc_compat")))
138
139//for qnamespace.h again
140#ifndef Q_DECLARE_FLAGS
141#define Q_DECLARE_FLAGS(Flags, Enum) typedef QFlags<Enum> Flags;
142#endif
143
144#endif
145)-";
146