Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/dvi/dvilib/dl-refcounted.hh
diff options
context:
space:
mode:
Diffstat (limited to 'dvi/dvilib/dl-refcounted.hh')
-rwxr-xr-xdvi/dvilib/dl-refcounted.hh37
1 files changed, 37 insertions, 0 deletions
diff --git a/dvi/dvilib/dl-refcounted.hh b/dvi/dvilib/dl-refcounted.hh
new file mode 100755
index 0000000..068ac2e
--- /dev/null
+++ b/dvi/dvilib/dl-refcounted.hh
@@ -0,0 +1,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