From 3a27454dca4a16d021a4d418f0725adccc5baabb Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 25 May 2019 20:34:29 -0700 Subject: Just about everything that Blob needs is in. --- src/unstable/blob.h | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'src/unstable/blob.h') diff --git a/src/unstable/blob.h b/src/unstable/blob.h index 6ce0c67..daee5f9 100644 --- a/src/unstable/blob.h +++ b/src/unstable/blob.h @@ -24,11 +24,17 @@ namespace Bu */ class Blob { + public: + class iterator; + class const_iterator; + public: Blob(); Blob( const Blob &rSrc ); Blob( const char *pSrc ); Blob( const void *pSrc, int32_t iSize ); + Blob( const const_iterator &iStart ); + Blob( const const_iterator &iStart, const const_iterator &iEnd ); virtual ~Blob(); int32_t getSize() const; @@ -58,13 +64,22 @@ namespace Bu bool operator>=( const Blob &rRhs ) const; bool operator>=( const char *rRhs ) const; - class const_iterator; + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + iterator rbegin(); + const_iterator rbegin() const; + iterator rend(); + const_iterator rend() const; + class iterator { friend class Blob; friend class const_iterator; private: iterator( Blob *pBlob, bool bForward ); + iterator( Blob *pBlob, int32_t iIndex, bool bForward ); public: iterator(); @@ -74,10 +89,12 @@ namespace Bu operator bool() const; char &operator *(); - iterator &operator++( int ); + iterator &operator++( int32_t ); iterator &operator++(); - iterator &operator--( int ); + iterator &operator--( int32_t ); iterator &operator--(); + iterator operator+( int32_t iDelta ) const; + iterator operator-( int32_t iDelta ) const; bool operator==( const iterator &rRhs ); bool operator==( const const_iterator &rRhs ); bool operator!=( const iterator &rRhs ); @@ -97,6 +114,7 @@ namespace Bu friend class iterator; private: const_iterator( const Blob *pBlob, bool bForward ); + const_iterator( const Blob *pBlob, int32_t iIndex, bool bForward ); public: const_iterator(); @@ -107,10 +125,12 @@ namespace Bu operator bool() const; char operator *() const; - const_iterator &operator++( int ); + const_iterator &operator++( int32_t ); const_iterator &operator++(); - const_iterator &operator--( int ); + const_iterator &operator--( int32_t ); const_iterator &operator--(); + const_iterator operator+( int32_t iDelta ) const; + const_iterator operator-( int32_t iDelta ) const; bool operator==( const iterator &rRhs ); bool operator==( const const_iterator &rRhs ); bool operator!=( const iterator &rRhs ); @@ -125,15 +145,6 @@ namespace Bu bool bForward; }; - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; - iterator rbegin(); - const_iterator rbegin() const; - iterator rend(); - const_iterator rend() const; - private: char *pData; int32_t iSize; -- cgit v1.2.3