00001
00002
00003
00004
00005
00006
00007 #ifndef __REFCOUNT_BUFFER_H__
00008 #define __REFCOUNT_BUFFER_H__
00009
00010 #include "refcount.h"
00011
00012 class RefCountBufferImp : public RefCountObj {
00013 public:
00014 friend class RefCountBuffer;
00015
00016 private:
00017 RefCountBufferImp (unsigned int size, const char *buffer);
00018 ~RefCountBufferImp ();
00019
00020 private:
00021 char *_buf;
00022 unsigned int _size;
00023 };
00024
00025
00026 class RefCountBuffer {
00027 public:
00028
00029 RefCountBuffer (unsigned int size = 0, const char *buffer = NULL);
00030 virtual ~RefCountBuffer();
00031 RefCountBuffer (const RefCountBuffer &other);
00032
00033
00034 RefCountBuffer & operator = (const RefCountBuffer &other);
00035
00036
00037 char *get_data ()
00038 {
00039 return _imp -> _buf;
00040 }
00041
00042 const char *get_data () const
00043 {
00044 return _imp -> _buf;
00045 }
00046
00047 unsigned int get_size () const
00048 {
00049 return _imp -> _size;
00050 }
00051
00052 RefCountBuffer clone() const
00053 {
00054 return RefCountBuffer(_imp->_size, _imp->_buf);
00055 }
00056
00057 private:
00058 RefCountPtr <RefCountBufferImp> _imp;
00059 };
00060
00061 RefCountBuffer operator + (const RefCountBuffer &x, const RefCountBuffer &y);
00062
00063 #endif // __REFCOUNT_BUFFER_H__