From dda94f3b53e02e117e6eb5758afa1410e1664c9f Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 15 May 2007 05:25:19 +0000 Subject: SPtr is now Bu::ified, and the List class now acts the way we think const lists should act, you can't change anything in there. I'm still debating changing the const_iterator to a constIterator, or something else that's more Bu::worthy. Heh, the namespaces are funny...ok...I'm really tired. --- src/old/sptr.cpp | 1 - src/old/sptr.h | 99 -------------------------------------------------------- 2 files changed, 100 deletions(-) delete mode 100644 src/old/sptr.cpp delete mode 100644 src/old/sptr.h (limited to 'src/old') diff --git a/src/old/sptr.cpp b/src/old/sptr.cpp deleted file mode 100644 index 7f5e894..0000000 --- a/src/old/sptr.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "sptr.h" diff --git a/src/old/sptr.h b/src/old/sptr.h deleted file mode 100644 index deae94d..0000000 --- a/src/old/sptr.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef SPTR_H -#define SPTR_H - -#include -#include - -template -class SPtr -{ -public: - SPtr() : - pRefCnt( NULL ), - pData( NULL ) - { - } - - ~SPtr() - { - decCount(); - } - - SPtr( const SPtr &src ) : - pRefCnt( src.pRefCnt ), - pData( src.pData ) - { - if( pRefCnt ) - (*pRefCnt) += 1; - } - - SPtr( T *pSrc ) : - pRefCnt( NULL ), - pData( pSrc ) - { - pRefCnt = new int32_t; - (*pRefCnt) = 1; - } - - int32_t count() - { - return *pRefCnt; - } - - T *operator->() const - { - return pData; - } - - T *operator*() const - { - return pData; - } - - SPtr operator=( const SPtr &src ) - { - decCount(); - pRefCnt = src.pRefCnt; - pData = src.pData; - (*pRefCnt) += 1; - - return *this; - } - - bool operator==( const SPtr &src ) - { - return pData == src.pData; - } - - operator bool() - { - return pRefCnt != NULL; - } - - bool isSet() - { - return pRefCnt != NULL; - } - -private: - void decCount() - { - if( pRefCnt ) - { - (*pRefCnt) -= 1; - //printf("Decrementing ref-count to %d\n", *pRefCnt ); - if( (*pRefCnt) == 0 ) - { - delete pRefCnt; - delete pData; - pRefCnt = NULL; - pData = NULL; - } - } - } - - int32_t *pRefCnt; - T *pData; -}; - -#endif -- cgit v1.2.3