From 0e5fe45f133198380caab831038d518998025b9f Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Sun, 19 Aug 2007 19:59:09 +0000 Subject: [PATCH] Removed unused DataBuffer class git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22012 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/shared/DataBuffer.h | 77 ------------- src/kits/support/DataBuffer.cpp | 172 ---------------------------- src/kits/support/Jamfile | 2 - 3 files changed, 251 deletions(-) delete mode 100644 headers/private/shared/DataBuffer.h delete mode 100644 src/kits/support/DataBuffer.cpp diff --git a/headers/private/shared/DataBuffer.h b/headers/private/shared/DataBuffer.h deleted file mode 100644 index 4f7ec14b5e..0000000000 --- a/headers/private/shared/DataBuffer.h +++ /dev/null @@ -1,77 +0,0 @@ -//------------------------------------------------------------------------------ -// DataBuffer.h -// -//------------------------------------------------------------------------------ - -#ifndef DATABUFFER_H -#define DATABUFFER_H - -// Standard Includes ----------------------------------------------------------- - -// System Includes ------------------------------------------------------------- -#include - -// Project Includes ------------------------------------------------------------ - -// Local Includes -------------------------------------------------------------- - -// Local Defines --------------------------------------------------------------- - -// Globals --------------------------------------------------------------------- - -namespace BPrivate { - -class BDataBuffer -{ - public: - BDataBuffer(size_t len); - BDataBuffer(const void* data, size_t len, bool copy = false); - BDataBuffer(const BDataBuffer& rhs, bool copy = false); - ~BDataBuffer(); - - BDataBuffer& operator=(const BDataBuffer& rhs); - - size_t BufferSize() const; - const void* Buffer() const; - - private: - class BDataReference - { - public: - void Acquire(BDataReference*& ref); - void Release(BDataReference*& ref); - - char* Data() { return fData; } - size_t Size() const { return fSize; } - int32 Count() { return fCount; } - - static void Create(const void* data, size_t len, - BDataReference*& ref, bool copy = false); - static void Create(size_t len, BDataReference*& ref); - - private: - BDataReference(const void* data, size_t len, bool copy = false); - BDataReference(size_t len); - ~BDataReference(); - - char* fData; - size_t fSize; - int32 fCount; - }; - - BDataBuffer(); // No default construction allowed! - - BDataReference* fDataRef; -}; - -} // namespace BPrivate - -#endif // DATABUFFER_H - -/* - * $Log $ - * - * $Id $ - * - */ - diff --git a/src/kits/support/DataBuffer.cpp b/src/kits/support/DataBuffer.cpp deleted file mode 100644 index 342d0bb1c5..0000000000 --- a/src/kits/support/DataBuffer.cpp +++ /dev/null @@ -1,172 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: DataBuffer.cpp -// Author(s): Erik Jaesler -// -// Description: Provides the backing store for BMessages -// -// -//------------------------------------------------------------------------------ - -// Standard Includes ----------------------------------------------------------- -#include - -// System Includes ------------------------------------------------------------- - -// Project Includes ------------------------------------------------------------ -#include - -// Local Includes -------------------------------------------------------------- - -// Local Defines --------------------------------------------------------------- - -// Globals --------------------------------------------------------------------- - -namespace BPrivate { - -//------------------------------------------------------------------------------ -BDataBuffer::BDataBuffer(size_t len) -{ - BDataReference::Create(len, fDataRef); -} -//------------------------------------------------------------------------------ -BDataBuffer::BDataBuffer(const void* data, size_t len, bool copy) -{ - BDataReference::Create(data, len, fDataRef, copy); -} -//------------------------------------------------------------------------------ -BDataBuffer::BDataBuffer(const BDataBuffer& rhs, bool copy) -{ - if (this != &rhs) - { - if (copy) - { - BDataReference::Create(rhs.Buffer(), rhs.BufferSize(), - fDataRef, copy); - } - else - { - rhs.fDataRef->Acquire(fDataRef); - } - } -} -//------------------------------------------------------------------------------ -BDataBuffer::~BDataBuffer() -{ - if (fDataRef) - { - fDataRef->Release(fDataRef); - } -} -//------------------------------------------------------------------------------ -BDataBuffer& BDataBuffer::operator=(const BDataBuffer& rhs) -{ - if (this != &rhs) - { - rhs.fDataRef->Acquire(fDataRef); - } - - return *this; -} -//------------------------------------------------------------------------------ -size_t BDataBuffer::BufferSize() const -{ - return fDataRef->Size(); -} -//------------------------------------------------------------------------------ -const void* BDataBuffer::Buffer() const -{ - return (const void*)fDataRef->Data(); -} -//------------------------------------------------------------------------------ - - -//------------------------------------------------------------------------------ -void BDataBuffer::BDataReference::Create(const void* data, size_t len, - BDataReference*& ref, bool copy) -{ - BDataReference* temp = new BDataReference(data, len, copy); - temp->Acquire(ref); -} -//------------------------------------------------------------------------------ -void BDataBuffer::BDataReference::Create(size_t len, BDataReference*& ref) -{ - BDataReference* temp = new BDataReference(len); - temp->Acquire(ref); -} -//------------------------------------------------------------------------------ -void BDataBuffer::BDataReference::Acquire(BDataReference*& ref) -{ - ref = this; - ++fCount; -} -//------------------------------------------------------------------------------ -void BDataBuffer::BDataReference::Release(BDataReference*& ref) -{ - ref = NULL; - --fCount; - if (fCount <= 0) - { - delete this; - } -} -//------------------------------------------------------------------------------ -BDataBuffer::BDataReference::BDataReference(const void* data, size_t len, - bool copy) - : fData(NULL), fSize(len), fCount(0) -{ - if (copy) - { - fData = new char[fSize]; - memcpy((void*)fData, data, fSize); - } - else - { - fData = (char*)data; - } -} -//------------------------------------------------------------------------------ -BDataBuffer::BDataReference::BDataReference(size_t len) - : fData(NULL), fSize(len), fCount(0) -{ - fData = new char[fSize]; -} -//------------------------------------------------------------------------------ -BDataBuffer::BDataReference::~BDataReference() -{ - if (fData) - { - delete[] fData; - fData = NULL; - } -} -//------------------------------------------------------------------------------ - -} // namespace BPrivate - -/* - * $Log $ - * - * $Id $ - * - */ - diff --git a/src/kits/support/Jamfile b/src/kits/support/Jamfile index 004a4e26ca..31126dde36 100644 --- a/src/kits/support/Jamfile +++ b/src/kits/support/Jamfile @@ -9,7 +9,6 @@ MergeObject support_kit.o : Beep.cpp BlockCache.cpp ByteOrder.cpp - DataBuffer.cpp DataIO.cpp BufferIO.cpp Flattenable.cpp @@ -19,5 +18,4 @@ MergeObject support_kit.o : Referenceable.cpp StopWatch.cpp String.cpp -# StreamIO.cpp ;