Chester
 All Classes Files Functions Variables Macros Pages
dptr.h
Go to the documentation of this file.
1 //d-ptr header
2 //
3 // (c) Konrad Rosenbaum, 2010-2011
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 #include "dptr_base.h"
10 
11 
12 #ifndef DPTR_CLASS_0_1_H
13 #define DPTR_CLASS_0_1_H
14 
15 //hide the namespace
17 namespace Chester_0_1{
19 
23 class DPtr
24 {
25  public:
27  DPtr(){}
29  virtual ~DPtr(){}
30 };
31 
32 //hide the namespace
34 };
35 using namespace Chester_0_1;
37 #endif
38 
39 #ifdef DEFINE_DPTR
40 #undef DEFINE_DPTR
41 #endif
42 
50 #define DEFINE_DPTR(Class) \
51  Class::DPrivate::DPrivate(){d=new Class::Private;}\
52  Class::DPrivate::DPrivate(const Class::DPrivate&dp){d=new Class::Private(*(dp.d));}\
53  Class::DPrivate::~DPrivate(){delete d;}\
54  Class::DPrivate Class::DPrivate::clone()const{DPrivate r;*(r.d)=*d;return r;}\
55  Class::DPrivate& Class::DPrivate::operator=(const Class::DPrivate&dp)\
56  {if(d!=dp.d)*d=*(dp.d);return *this;}
57 
virtual ~DPtr()
deletes a non-shared d-pointer
Definition: dptr.h:29
Base class of non-shared d-pointers.
Definition: dptr.h:23
DPtr()
instantiates a non-shared d-pointer
Definition: dptr.h:27