]> www.fi.muni.cz Git - evince.git/blob - dvi/dvilib/dl-refcounted.hh
068ac2e7dcf74443bbfa33883fed95c4644bfcbd
[evince.git] / dvi / dvilib / dl-refcounted.hh
1 #ifndef DL_REFCOUNTED_HH
2 #define DL_REFCOUNTED_HH
3
4 using namespace std;
5
6 typedef unsigned int uint;
7 typedef unsigned char uchar;
8
9 namespace DviLib {
10     
11     class RefCounted
12     {
13         int refcount;
14
15     public:
16
17         RefCounted (void)
18         {
19             refcount = 1;
20         }
21
22         RefCounted *ref (void)
23         {
24             refcount++;
25             return this;
26         }
27
28         void unref (void)
29         {
30             refcount--;
31             if (!refcount)
32                 delete this;
33         }
34     };
35 }
36
37 #endif // DL_REFCOUNTED_HH