diff options
author | Søren Sandmann <sandmann@redhat.com> | 2004-12-21 23:57:26 (GMT) |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@src.gnome.org> | 2004-12-21 23:57:26 (GMT) |
commit | 4296951e94a43c723e9522b588cab178eb66d144 (patch) | |
tree | 63ba229741d10df67fe87f24b6241903e16e9764 /dvi/dvilib/dl-refcounted.hh | |
parent | 3e73e947a3a8c03da8f35f52e2a42ba066e2be2a (diff) |
New directory with the beginning of a .dvi backend.
Tue Dec 21 18:55:06 2004 Søren Sandmann <sandmann@redhat.com>
* dvi/*: New directory with the beginning of a .dvi backend.
Diffstat (limited to 'dvi/dvilib/dl-refcounted.hh')
-rwxr-xr-x | dvi/dvilib/dl-refcounted.hh | 37 |
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 |