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
11Contains 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
21template <typename T>
22inline T & __kdab__dereference_for_methodcall( T & o ) {
23 return o;
24}
25
26template <typename T>
27inline 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 ) \
35public: \
36 class Private; \
37protected: \
38 inline Private * d_func(); \
39 inline const Private * d_func() const; \
40 explicit inline X( Private * ); \
41private: \
42 void init();
43
44#define KCHART_DECLARE_PRIVATE_DERIVED_PARENT( X, ParentType ) \
45public: \
46 class Private; \
47protected: \
48 inline Private * d_func(); \
49 inline const Private * d_func() const; \
50 explicit inline X( Private *, ParentType ); \
51private: \
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 ) \
58public: \
59 inline void swap( X & other ) { qSwap( _d, other._d ); } \
60protected: \
61 class Private; \
62 Private * d_func() { return _d; } \
63 const Private * d_func() const { return _d; } \
64private: \
65 void init(); \
66 Private * _d;
67
68#define KCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC( X ) \
69public: \
70 class Private; \
71protected: \
72 Private * d_func() { return _d; } \
73 const Private * d_func() const { return _d; } \
74 explicit inline X( Private * ); \
75private: \
76 void init(); \
77 Private * _d;
78
79#define KCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( X ) \
80public: \
81 class Private; \
82protected: \
83 Private * d_func() { return _d; } \
84 const Private * d_func() const { return _d; } \
85 explicit inline X( Private *, QWidget* ); \
86private: \
87 void init(); \
88 Private * _d;
89
90#define KCHART_DERIVED_PRIVATE_FOOTER( CLASS, PARENT ) \
91inline CLASS::CLASS( Private * p ) \
92 : PARENT( p ) { init(); } \
93inline CLASS::Private * CLASS::d_func() \
94{ return static_cast<Private*>( PARENT::d_func() ); } \
95inline 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 ) \
100public: \
101 class Private; \
102protected: \
103 inline Private * d_func(); \
104 inline const Private * d_func() const; \
105 explicit inline X( Private * ); \
106 explicit inline X( Private *, QWidget *, PLANE * ); \
107private: \
108 void init();
109
110#define KCHART_IMPL_DERIVED_DIAGRAM( CLASS, PARENT, PLANE ) \
111inline CLASS::CLASS( Private * p ) \
112 : PARENT( p ) { init(); } \
113inline CLASS::CLASS( \
114 Private * p, QWidget* parent, PLANE * plane ) \
115 : PARENT( p, parent, plane ) { init(); } \
116inline CLASS::Private * CLASS::d_func() \
117 { return static_cast<Private *>( PARENT::d_func() ); } \
118inline 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 ) \
123inline CLASS::CLASS( Private * p, Chart* parent ) \
124 : BASEPLANE( p, parent ) { init(); } \
125inline CLASS::Private * CLASS::d_func() \
126 { return static_cast<Private *>( BASEPLANE::d_func() ); } \
127inline 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 ) \
135QT_BEGIN_NAMESPACE \
136 template <> inline void qSwap<X>( X & lhs, X & rhs ) \
137 { lhs.swap( rhs ); } \
138QT_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 ) \
145QT_BEGIN_NAMESPACE \
146 template <> inline void qSwap<X>( X & lhs, X & rhs ) \
147 { lhs.swap( rhs ); } \
148QT_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 ) \
155protected: \
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>
167template class Q_DECL_IMPORT QVector<QPointF>;
168#endif
169#endif
170
171#include <Qt>
172
173/**
174 \namespace KChart
175 \brief Global namespace
176 */
177namespace KChart {
178
179enum 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-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.