2003-03-19 10:58:17 +03:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// DataBuffer.h
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef DATABUFFER_H
|
|
|
|
#define DATABUFFER_H
|
|
|
|
|
|
|
|
// Standard Includes -----------------------------------------------------------
|
|
|
|
|
|
|
|
// System Includes -------------------------------------------------------------
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
|
|
// Project Includes ------------------------------------------------------------
|
|
|
|
|
|
|
|
// Local Includes --------------------------------------------------------------
|
|
|
|
|
|
|
|
// Local Defines ---------------------------------------------------------------
|
|
|
|
|
|
|
|
// Globals ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
|
|
|
|
class BDataBuffer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BDataBuffer(size_t len);
|
2004-09-08 03:00:30 +04:00
|
|
|
BDataBuffer(const void* data, size_t len, bool copy = false);
|
|
|
|
BDataBuffer(const BDataBuffer& rhs, bool copy = false);
|
2003-03-19 10:58:17 +03:00
|
|
|
~BDataBuffer();
|
|
|
|
|
|
|
|
BDataBuffer& operator=(const BDataBuffer& rhs);
|
|
|
|
|
|
|
|
size_t BufferSize() const;
|
2003-05-24 03:07:30 +04:00
|
|
|
const void* Buffer() const;
|
2003-03-19 10:58:17 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
class BDataReference
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void Acquire(BDataReference*& ref);
|
|
|
|
void Release(BDataReference*& ref);
|
|
|
|
|
2003-05-24 03:07:30 +04:00
|
|
|
char* Data() { return fData; }
|
|
|
|
size_t Size() const { return fSize; }
|
|
|
|
int32 Count() { return fCount; }
|
2003-03-19 10:58:17 +03:00
|
|
|
|
2004-09-08 03:00:30 +04:00
|
|
|
static void Create(const void* data, size_t len,
|
|
|
|
BDataReference*& ref, bool copy = false);
|
2003-03-19 10:58:17 +03:00
|
|
|
static void Create(size_t len, BDataReference*& ref);
|
|
|
|
|
|
|
|
private:
|
2004-09-08 03:00:30 +04:00
|
|
|
BDataReference(const void* data, size_t len, bool copy = false);
|
2003-03-19 10:58:17 +03:00
|
|
|
BDataReference(size_t len);
|
|
|
|
~BDataReference();
|
|
|
|
|
2003-05-24 03:07:30 +04:00
|
|
|
char* fData;
|
|
|
|
size_t fSize;
|
|
|
|
int32 fCount;
|
2003-03-19 10:58:17 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
BDataBuffer(); // No default construction allowed!
|
|
|
|
|
|
|
|
BDataReference* fDataRef;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
|
|
#endif // DATABUFFER_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* $Log $
|
|
|
|
*
|
|
|
|
* $Id $
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|