Chester
 All Classes Files Functions Variables Macros Pages
dptr_base.h
Go to the documentation of this file.
1 //d-ptr header
2 //
3 // (c) Konrad Rosenbaum, 2010-2013
4 // Copying and distribution of this file, with or without modification,
5 // are permitted in any medium without royalty provided the copyright
6 // notice and this notice are preserved. This file is offered as-is,
7 // without any warranty.
8 
9 
10 #ifdef DPTR_CLASS_NAME
11 #undef DPTR_CLASS_NAME
12 #endif
13 
14 #ifdef DPTR_NAME
15 #undef DPTR_NAME
16 #endif
17 
18 #ifdef DPTR_WRAPPER_NAME
19 #undef DPTR_WRAPPER_NAME
20 #endif
21 
25 #define DPTR_CLASS_NAME(Class) Class::Private
26 
30 #define DPTR_NAME Private
31 
35 #define DPTR_WRAPPER_NAME DPrivate
36 
37 #ifdef DECLARE_DPTR
38 #undef DECLARE_DPTR
39 #endif
40 
64 #define DECLARE_DPTR(dp) DECLARE_DPTRX(dp,)
65 #define DECLARE_DPTRX(dp,export_spec) \
66  private:\
67  class Private; \
68  class export_spec DPrivate{\
69  public:DPrivate();DPrivate(const DPrivate&);~DPrivate();\
70  DPrivate&operator=(const DPrivate&);\
71  const Private*operator->()const{return d;}\
72  Private*operator->(){return d;}\
73  DPrivate clone()const;\
74  private:Private*d;\
75  }; \
76  DPrivate dp;
77 
78 #ifdef DECLARE_SHARED_DPTR
79 #undef DECLARE_SHARED_DPTR
80 #endif
81 
106 #define DECLARE_SHARED_DPTR(dp) DECLARE_SHARED_DPTRX(dp,)
107 #define DECLARE_SHARED_DPTRX(dp,export_spec) \
108  private:\
109  class Private; \
110  class export_spec DPrivate{\
111  public:DPrivate();DPrivate(const DPrivate&);~DPrivate();\
112  DPrivate&operator=(const DPrivate&);\
113  const Private*operator->()const{return d;}\
114  Private*operator->(){return d;}\
115  DPrivate clone()const;\
116  void decouple();\
117  private:Private*d;\
118  }; \
119  DPrivate dp;
120 
121 
122 #ifdef DECLARE_NONCOPY_DPTR
123 #undef DECLARE_NONCOPY_DPTR
124 #endif
125 
148 #define DECLARE_NONCOPY_DPTR(dp) DECLARE_NONCOPY_DPTRX(dp,)
149 #define DECLARE_NONCOPY_DPTRX(dp,export_spec) \
150  private:\
151  class Private; \
152  class export_spec DPrivate{\
153  public:DPrivate();~DPrivate();\
154  const Private*operator->()const{return d;}\
155  Private*operator->(){return d;}\
156  private:Private*d;\
157  DPrivate(const DPrivate&);DPrivate&operator=(const DPrivate&);\
158  }; \
159  DPrivate dp;