chxbody.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:1k
- /************************************************************************
- * chxbody.h
- * ------------
- *
- * Synopsis:
- * Simple ref counting class to derive from.
- *
- * Target:
- * Symbian OS
- *
- *
- * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
- *
- ************************************************************************/
- #ifndef _chxbody_h_
- #define _chxbody_h_
- typedef unsigned long CountType;
- class CHXBody {
- public:
- CountType ref();
- CountType unref();
- CountType refcount() const;
- static void ref(CHXBody*);
- static void unref(CHXBody*);
- protected:
- CHXBody();
- ~CHXBody();
- CHXBody(const CHXBody&);
- CHXBody& operator=(const CHXBody&);
- private:
- CountType refcount_;
- };
- inline
- CHXBody::CHXBody()
- : refcount_(0)
- {}
- inline
- CHXBody::CHXBody(const CHXBody&)
- : refcount_(0)
- {}
- inline
- CHXBody& CHXBody::operator=(const CHXBody&)
- {
- return *this;
- }
- inline
- CHXBody::~CHXBody()
- {}
- inline
- CountType CHXBody::ref()
- {
- return ++refcount_;
- }
- inline
- CountType CHXBody::unref()
- {
- return --refcount_;
- }
- inline
- void CHXBody::unref(CHXBody* b)
- {
- if (b) b->unref();
- }
- inline
- CountType CHXBody::refcount() const
- {
- return refcount_;
- }
- #endif // _chxbody_h_