chxbody.h

来自「symbian 下的helix player源代码」· C头文件 代码 · 共 87 行

H
87
字号
/************************************************************************
 * 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_


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?