Solid
Go to the documentation of this file.
21 #ifndef SOLID_SOLIDDEFS_P_H
22 #define SOLID_SOLIDDEFS_P_H
24 #include <QtCore/QObject>
26 #define return_SOLID_CALL(Type, Object, Default, Method) \
27 Type t = qobject_cast<Type>(Object); \
39 #define SOLID_CALL(Type, Object, Method) \
40 Type t = qobject_cast<Type>(Object); \
72 # define SOLID_GLOBAL_STATIC_STRUCT_NAME(NAME) _solid_##NAME##__LINE__
74 # define SOLID_GLOBAL_STATIC_STRUCT_NAME(NAME)
77 #define SOLID_GLOBAL_STATIC(TYPE, NAME) SOLID_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ())
79 #define SOLID_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
80 static QBasicAtomicPointer<TYPE > _solid_static_##NAME = Q_BASIC_ATOMIC_INITIALIZER(0);\
81 static bool _solid_static_##NAME##_destroyed; \
82 static struct SOLID_GLOBAL_STATIC_STRUCT_NAME(NAME) \
86 return _solid_static_##NAME##_destroyed; \
88 inline operator TYPE*() \
90 return operator->(); \
92 inline TYPE *operator->() \
94 if (!_solid_static_##NAME) { \
95 if (isDestroyed()) { \
96 qFatal("Fatal Error: Accessed global static '%s *%s()' after destruction. " \
97 "Defined at %s:%d", #TYPE, #NAME, __FILE__, __LINE__); \
99 TYPE *x = new TYPE ARGS; \
100 if (!_solid_static_##NAME.testAndSetOrdered(0, x) \
101 && _solid_static_##NAME != x ) { \
104 static Solid::CleanUpGlobalStatic cleanUpObject = { destroy }; \
107 return _solid_static_##NAME; \
109 inline TYPE &operator*() \
111 return *operator->(); \
113 static void destroy() \
115 _solid_static_##NAME##_destroyed = true; \
116 TYPE *x = _solid_static_##NAME; \
117 _solid_static_##NAME = 0; \
void(* CleanUpFunction)()
Solid::CleanUpFunction func
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:26 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.