16
|
1 |
/**
|
|
2 |
This file is part of CWRT package **
|
|
3 |
|
|
4 |
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
|
|
5 |
|
|
6 |
This program is free software: you can redistribute it and/or modify
|
|
7 |
it under the terms of the GNU (Lesser) General Public License as
|
|
8 |
published by the Free Software Foundation, version 2.1 of the License.
|
|
9 |
This program is distributed in the hope that it will be useful, but
|
|
10 |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
12 |
(Lesser) General Public License for more details. You should have
|
|
13 |
received a copy of the GNU (Lesser) General Public License along
|
|
14 |
with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15 |
*/
|
|
16 |
|
|
17 |
#ifndef DOWNLOADMGRPIMPL_H
|
|
18 |
#define DOWNLOADMGRPIMPL_H
|
|
19 |
|
|
20 |
#define DM_DECLARE_PRIVATE(Class) \
|
|
21 |
private: \
|
|
22 |
inline Class##Private* priv_func() { return reinterpret_cast<Class##Private *>(priv_ptr); } \
|
|
23 |
inline const Class##Private* priv_func() const { return reinterpret_cast<const Class##Private *>(priv_ptr); } \
|
|
24 |
friend class Class##Private; \
|
|
25 |
void* priv_ptr;
|
|
26 |
|
|
27 |
#define DM_DECLARE_PUBLIC(Class) \
|
|
28 |
public: \
|
|
29 |
inline Class* pub_func() { return static_cast<Class *>(pub_ptr); } \
|
|
30 |
inline const Class* pub_func() const { return static_cast<const Class *>(pub_ptr); } \
|
|
31 |
private: \
|
|
32 |
friend class Class; \
|
|
33 |
void* pub_ptr;
|
|
34 |
|
|
35 |
#define DM_PRIVATE(Class) Class##Private * const priv = priv_func()
|
|
36 |
#define DM_PUBLIC(Class) Class * const pub = pub_func()
|
|
37 |
|
|
38 |
#define DM_INITIALIZE(Class) \
|
|
39 |
priv_ptr = new Class##Private(); \
|
|
40 |
DM_PRIVATE(Class); \
|
|
41 |
priv->pub_ptr = this;
|
|
42 |
|
|
43 |
#define DM_UNINITIALIZE(Class) \
|
|
44 |
DM_PRIVATE(Class); \
|
|
45 |
delete priv;
|
|
46 |
|
|
47 |
#endif // DOWNLOADMGRPIMPL_H
|
|
48 |
|