add ignore pattern for git
[web/konrad/chester.git] / tests / dptrpriv.cpp
1
2 #include "dptrtest.h"
3
4 #include <DPtr>
5 #include <SharedDPtr>
6 #include <NonCopyDPtr>
7
8 #include <QtCore>
9
10 class DPTR_CLASS_NAME(ClassWithDptr):public DPtr
11 {
12         public:
13                 int num;
14                 Private(){num=0;}
15 };
16 DEFINE_DPTR(ClassWithDptr)
17
18
19 QString ClassWithDptr::toString()const
20 {
21         return QString("class with dptr %1").arg(d->num);
22 }
23 int ClassWithDptr::num()const{return d->num;}
24 void ClassWithDptr::setNum(int n){d->num=n;}
25
26 class DPTR_CLASS_NAME(ClassWithSDptr):public SharedDPtr
27 {
28         public:
29                 int num;
30                 Private(){num=0;}
31 };
32 DEFINE_SHARED_DPTR(ClassWithSDptr)
33
34 QString ClassWithSDptr::toString()const
35 {
36         return QString("class with shared dptr %1").arg(d->num);
37 }
38 int ClassWithSDptr::num()const{return d->num;}
39 void ClassWithSDptr::setNum(int n){d->num=n;}
40 ClassWithSDptr ClassWithSDptr::clone()const
41 {
42         ClassWithSDptr ret;
43         ret.d=d.clone();
44         return ret;
45 }
46
47 class DPTR_CLASS_NAME(ClassWithNDptr):public NonCopyDPtr
48 {
49         public:
50                 QObject object;
51 };
52 DEFINE_NONCOPY_DPTR(ClassWithNDptr)
53
54 QString ClassWithNDptr::toString()const
55 {
56         return d->object.metaObject()->className();
57 }