File: type.h

package info (click to toggle)
libloki 0.1.5-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,888 kB
  • ctags: 5,535
  • sloc: cpp: 22,174; ansic: 1,955; makefile: 359; php: 316; perl: 108
file content (165 lines) | stat: -rwxr-xr-x 4,425 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
////////////////////////////////////////////////////////////////////////////////
// The Loki Library
// Copyright (c) 2006 Peter Kmmel
// Permission to use, copy, modify, distribute and sell this software for any 
//     purpose is hereby granted without fee, provided that the above copyright 
//     notice appear in all copies and that both that copyright notice and this 
//     permission notice appear in supporting documentation.
// The author makes no representations about the 
//     suitability of this software for any purpose. It is provided "as is" 
//     without express or implied warranty.
////////////////////////////////////////////////////////////////////////////////

// $Header:

#include <loki/Pimpl.h>


//#define TEST_WITH_BOOST
#ifdef TEST_WITH_BOOST
#include <boost/shared_ptr.hpp>
#endif

#include <loki/SmartPtr.h>
#include <loki/SmallObj.h>

using namespace Loki;

/////////////////////////////////////////
// class A declaration
/////////////////////////////////////////

class A
{
public:
    A();
    void foo();

private:
    PimplT<A>::Type d;
};


/////////////////////////////////////////
// class B declaration
/////////////////////////////////////////

class B : private PimplT<B>::Owner
{
public:
    B();
    void foo();
};


/////////////////////////////////////////
// class C declaration
/////////////////////////////////////////

class C
{
public:
    C();
    void foo();

private:
    PimplT<C>::Type p;
    RimplT<C>::Type d; 
};


/////////////////////////////////////////
// class D declaration
/////////////////////////////////////////

class D : private RimplT<D>::Owner
{
public:
    D();
    void foo();
};




////////////////////
// more test code
////////////////////

struct E;

typedef SmartPtr<ImplT<E> > LokiPtr;
typedef ConstPropPtr<ImplT<E> > CPropPtr;
typedef std::auto_ptr<ImplT<E> > StdAutoPtr;

#ifdef TEST_WITH_BOOST
    typedef boost::shared_ptr<ImplT<E> > BoostPtr;
#else
    typedef LokiPtr BoostPtr;
#endif



// Pimpl

typedef Pimpl<ImplT<E> >            Pimpl1;
typedef Pimpl<ImplT<E>, CPropPtr>    Pimpl2;
typedef Pimpl<ImplT<E>, LokiPtr>    Pimpl3;
typedef Pimpl<ImplT<E>, BoostPtr>    Pimpl4;
typedef Pimpl<ImplT<E>, StdAutoPtr>    Pimpl5;

struct P1 {Pimpl1 d;        P1();void f();void f()const;};
struct P2 {Pimpl2 d;        P2();void f();void f()const;};
struct P3 {Pimpl3 d;        P3();void f();void f()const;};
struct P4 {Pimpl4 d;        P4();void f();void f()const;};
struct P5 {Pimpl5 d;        P5();void f();void f()const;};


// PimplOwner

typedef PimplOwner<ImplT<E> >            PimplOwner1;
typedef PimplOwner<ImplT<E>, CPropPtr>    PimplOwner2;
typedef PimplOwner<ImplT<E>, LokiPtr>    PimplOwner3;
typedef PimplOwner<ImplT<E>, BoostPtr>    PimplOwner4;
typedef PimplOwner<ImplT<E>, StdAutoPtr>PimplOwner5;

struct PO1 : private PimplOwner1 {PO1();void f();void f()const;};
struct PO2 : private PimplOwner2 {PO2();void f();void f()const;};
struct PO3 : private PimplOwner3 {PO3();void f();void f()const;};
struct PO4 : private PimplOwner4 {PO4();void f();void f()const;};
struct PO5 : private PimplOwner5 {PO5();void f();void f()const;};



// Rimpl

typedef RimplT<ImplT<E>,Pimpl1> Rimpl1;
typedef RimplT<ImplT<E>,Pimpl2> Rimpl2;
typedef RimplT<ImplT<E>,Pimpl3> Rimpl3;
typedef RimplT<ImplT<E>,Pimpl4> Rimpl4;
typedef RimplT<ImplT<E>,Pimpl5> Rimpl5;

struct R1 {Pimpl1 p; Rimpl1::Type d; R1();void f();void f()const;};
struct R2 {Pimpl2 p; Rimpl2::Type d; R2();void f();void f()const;};
struct R3 {Pimpl3 p; Rimpl3::Type d; R3();void f();void f()const;};
struct R4 {Pimpl4 p; Rimpl4::Type d; R4();void f();void f()const;};
struct R5 {Pimpl5 p; Rimpl5::Type d; R5();void f();void f()const;};


// RimplOwner

typedef RimplT<ImplT<E>,Pimpl1>::Owner RimplO1;
typedef RimplT<ImplT<E>,Pimpl2>::Owner RimplO2;
typedef RimplT<ImplT<E>,Pimpl3>::Owner RimplO3;
typedef RimplT<ImplT<E>,Pimpl4>::Owner RimplO4;
typedef RimplT<ImplT<E>,Pimpl5>::Owner RimplO5;

struct RO1 : private RimplO1 {RO1();void f();void f()const;};
struct RO2 : private RimplO2 {RO2();void f();void f()const;};
struct RO3 : private RimplO3 {RO3();void f();void f()const;};
struct RO4 : private RimplO4 {RO4();void f();void f()const;};
struct RO5 : private RimplO5 {RO5();void f();void f()const;};