Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/dvi/dvilib/dl-refcounted.hh
blob: 068ac2e7dcf74443bbfa33883fed95c4644bfcbd (plain)
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
#ifndef DL_REFCOUNTED_HH
#define DL_REFCOUNTED_HH

using namespace std;

typedef unsigned int uint;
typedef unsigned char uchar;

namespace DviLib {
    
    class RefCounted
    {
	int refcount;

    public:

	RefCounted (void)
	{
	    refcount = 1;
	}

	RefCounted *ref (void)
	{
	    refcount++;
	    return this;
	}

	void unref (void)
	{
	    refcount--;
	    if (!refcount)
		delete this;
	}
    };
}

#endif // DL_REFCOUNTED_HH