KChart

KChartGlobal.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 /** \file KChartGlobal.h
9 \brief Contains KChart macros.
10 
11 Contains KChart macros. */
12 
13 #ifndef __KCHARTGLOBAL_H__
14 #define __KCHARTGLOBAL_H__
15 
16 #include <qglobal.h>
17 
18 #include "kchart_export.h"
19 
20 #ifndef KDAB_SET_OBJECT_NAME
21 template <typename T>
22 inline T & __kdab__dereference_for_methodcall( T & o ) {
23  return o;
24 }
25 
26 template <typename T>
27 inline T & __kdab__dereference_for_methodcall( T * o ) {
28  return *o;
29 }
30 
31 #define KDAB_SET_OBJECT_NAME( x ) __kdab__dereference_for_methodcall( x ).setObjectName( QLatin1String( #x ) )
32 #endif
33 
34 #define KCHART_DECLARE_PRIVATE_DERIVED( X ) \
35 public: \
36  class Private; \
37 protected: \
38  inline Private * d_func(); \
39  inline const Private * d_func() const; \
40  explicit inline X( Private * ); \
41 private: \
42  void init();
43 
44 #define KCHART_DECLARE_PRIVATE_DERIVED_PARENT( X, ParentType ) \
45 public: \
46  class Private; \
47 protected: \
48  inline Private * d_func(); \
49  inline const Private * d_func() const; \
50  explicit inline X( Private *, ParentType ); \
51 private: \
52  void init();
53 
54 #define KCHART_DECLARE_PRIVATE_DERIVED_QWIDGET( X ) \
55  KCHART_DECLARE_PRIVATE_DERIVED_PARENT( X, QWidget* )
56 
57 #define KCHART_DECLARE_PRIVATE_BASE_VALUE( X ) \
58 public: \
59  inline void swap( X & other ) { qSwap( _d, other._d ); } \
60 protected: \
61  class Private; \
62  Private * d_func() { return _d; } \
63  const Private * d_func() const { return _d; } \
64 private: \
65  void init(); \
66  Private * _d;
67 
68 #define KCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC( X ) \
69 public: \
70  class Private; \
71 protected: \
72  Private * d_func() { return _d; } \
73  const Private * d_func() const { return _d; } \
74  explicit inline X( Private * ); \
75 private: \
76  void init(); \
77  Private * _d;
78 
79 #define KCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( X ) \
80 public: \
81  class Private; \
82 protected: \
83  Private * d_func() { return _d; } \
84  const Private * d_func() const { return _d; } \
85  explicit inline X( Private *, QWidget* ); \
86 private: \
87  void init(); \
88  Private * _d;
89 
90 #define KCHART_DERIVED_PRIVATE_FOOTER( CLASS, PARENT ) \
91 inline CLASS::CLASS( Private * p ) \
92  : PARENT( p ) { init(); } \
93 inline CLASS::Private * CLASS::d_func() \
94 { return static_cast<Private*>( PARENT::d_func() ); } \
95 inline const CLASS::Private * CLASS::d_func() const \
96 { return static_cast<const Private*>( PARENT::d_func() ); }
97 
98 
99 #define KCHART_DECLARE_DERIVED_DIAGRAM( X, PLANE ) \
100 public: \
101  class Private; \
102 protected: \
103  inline Private * d_func(); \
104  inline const Private * d_func() const; \
105  explicit inline X( Private * ); \
106  explicit inline X( Private *, QWidget *, PLANE * ); \
107 private: \
108  void init();
109 
110 #define KCHART_IMPL_DERIVED_DIAGRAM( CLASS, PARENT, PLANE ) \
111 inline CLASS::CLASS( Private * p ) \
112  : PARENT( p ) { init(); } \
113 inline CLASS::CLASS( \
114  Private * p, QWidget* parent, PLANE * plane ) \
115  : PARENT( p, parent, plane ) { init(); } \
116 inline CLASS::Private * CLASS::d_func() \
117  { return static_cast<Private *>( PARENT::d_func() ); } \
118 inline const CLASS::Private * CLASS::d_func() const \
119  { return static_cast<const Private *>( PARENT::d_func() ); }
120 
121 
122 #define KCHART_IMPL_DERIVED_PLANE( CLASS, BASEPLANE ) \
123 inline CLASS::CLASS( Private * p, Chart* parent ) \
124  : BASEPLANE( p, parent ) { init(); } \
125 inline CLASS::Private * CLASS::d_func() \
126  { return static_cast<Private *>( BASEPLANE::d_func() ); } \
127 inline const CLASS::Private * CLASS::d_func() const \
128  { return static_cast<const Private *>( BASEPLANE::d_func() ); }
129 
130 
131 #include <QtAlgorithms> // qSwap
132 #ifndef QT_NO_STL
133 #include <algorithm>
134 #define KCHART_DECLARE_SWAP_SPECIALISATION( X ) \
135 QT_BEGIN_NAMESPACE \
136  template <> inline void qSwap<X>( X & lhs, X & rhs ) \
137  { lhs.swap( rhs ); } \
138 QT_END_NAMESPACE \
139  namespace std { \
140  template <> inline void swap<X>( X & lhs, X & rhs ) \
141  { lhs.swap( rhs ); } \
142  }
143 #else
144 #define KCHART_DECLARE_SWAP_SPECIALISATION( X ) \
145 QT_BEGIN_NAMESPACE \
146  template <> inline void qSwap<X>( X & lhs, X & rhs ) \
147  { lhs.swap( rhs ); } \
148 QT_END_NAMESPACE
149 #endif
150 
151 #define KCHART_DECLARE_SWAP_SPECIALISATION_DERIVED( X ) \
152  KCHART_DECLARE_SWAP_SPECIALISATION( X )
153 
154 #define KCHART_DECLARE_SWAP_BASE( X ) \
155 protected: \
156  void doSwap( X& other ) \
157  { qSwap( _d, other._d); }
158 
159 #define KCHART_DECLARE_SWAP_DERIVED( X ) \
160  void swap( X& other ) { doSwap( other ); }
161 
162 #if defined(Q_OS_WIN) && defined(QT_DLL)
163 #if defined(_MSC_VER) && _MSC_VER >= 1300
164 // workaround http://support.microsoft.com/default.aspx?scid=kb;en-us;309801
165 #include <QPointF>
166 #include <QVector>
167 template class Q_DECL_IMPORT QVector<QPointF>;
168 #endif
169 #endif
170 
171 #include <Qt>
172 
173 /**
174  \namespace KChart
175  \brief Global namespace
176  */
177 namespace KChart {
178 
179 enum DisplayRoles {
180  DatasetPenRole = 0x0A79EF95,
181  DatasetBrushRole,
182  DataValueLabelAttributesRole,
183  ThreeDAttributesRole,
184  LineAttributesRole,
185  ThreeDLineAttributesRole,
186  BarAttributesRole,
187  StockBarAttributesRole,
188  ThreeDBarAttributesRole,
189  PieAttributesRole,
190  ThreeDPieAttributesRole,
191  DataHiddenRole,
192  ValueTrackerAttributesRole,
193  CommentRole
194 };
195 }
196 
197 #endif // __KCHARTGLOBAL_H__
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Jul 1 2022 05:09:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.