1 #ifndef ZYPP_NG_BASE_ZYPPGLOBAL_H_INCLUDED
2 #define ZYPP_NG_BASE_ZYPPGLOBAL_H_INCLUDED
4 #include <zypp/base/Easy.h>
6 #ifndef EXPORT_EXPERIMENTAL_API
7 #define LIBZYPP_NG_EXPORT
8 #define LIBZYPP_NG_NO_EXPORT
10 #include <zypp-ng_export.h>
14 * \note those macros are inspired by the Qt framework
17 template <typename T> inline T *zyppGetPtrHelper(T *ptr) { return ptr; }
18 template <typename Ptr> inline auto zyppGetPtrHelper(const Ptr &ptr) -> decltype(ptr.operator->()) { return ptr.operator->(); }
19 template <typename Ptr> inline auto zyppGetPtrHelper(Ptr &ptr) -> decltype(ptr.operator->()) { return ptr.operator->(); }
21 #define ZYPP_DECLARE_PRIVATE(Class) \
22 inline Class##Private* d_func() \
23 { return reinterpret_cast<Class##Private *>(zyppGetPtrHelper(d_ptr)); } \
24 inline const Class##Private* d_func() const \
25 { return reinterpret_cast<const Class##Private *>(zyppGetPtrHelper(d_ptr)); } \
26 friend class Class##Private;
28 #define ZYPP_FWD_DECLARE_PRIVATE(Class) \
29 Class##Private* d_func();\
30 const Class##Private* d_func() const; \
31 friend class Class##Private;
33 #define ZYPP_IMPL_PRIVATE(Class) \
34 Class##Private* Class::d_func() \
35 { return reinterpret_cast<Class##Private *>(zyppGetPtrHelper(d_ptr)); } \
36 const Class##Private* Class::d_func() const \
37 { return reinterpret_cast<const Class##Private *>(zyppGetPtrHelper(d_ptr)); }
39 #define ZYPP_DECLARE_PUBLIC(Class) \
40 inline Class* z_func() { return static_cast<Class *>(z_ptr); } \
41 inline const Class* z_func() const { return static_cast<const Class *>(z_ptr); } \
44 #define Z_D() auto const d = d_func()
45 #define Z_Z() auto const z = z_func()