From e1115a28535663cfe404791ede5bb7ca70399053 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 24 Apr 2023 09:16:32 -0700 Subject: Additions to blob/utfstring for json. --- src/unstable/blob.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'src/unstable/blob.cpp') diff --git a/src/unstable/blob.cpp b/src/unstable/blob.cpp index e72e265..23987f3 100644 --- a/src/unstable/blob.cpp +++ b/src/unstable/blob.cpp @@ -499,6 +499,26 @@ Bu::Blob::iterator &Bu::Blob::iterator::operator--() return *this; } +Bu::Blob::iterator &Bu::Blob::iterator::operator+=( int32_t iDelta ) +{ + if( bForward ) + iIndex += iDelta; + else + iIndex -= iDelta; + + return *this; +} + +Bu::Blob::iterator &Bu::Blob::iterator::operator-=( int32_t iDelta ) +{ + if( bForward ) + iIndex -= iDelta; + else + iIndex += iDelta; + + return *this; +} + Bu::Blob::iterator Bu::Blob::iterator::operator+( int32_t iDelta ) const { return iterator( pBlob, iIndex + iDelta, bForward ); @@ -541,7 +561,8 @@ bool Bu::Blob::iterator::operator!=( const Bu::Blob::const_iterator &rRhs ) return pBlob != rRhs.pBlob || iIndex != rRhs.iIndex; } -Bu::Blob::iterator &Bu::Blob::iterator::operator=( Bu::Blob::iterator &rRhs ) +Bu::Blob::iterator &Bu::Blob::iterator::operator=( + const Bu::Blob::iterator &rRhs ) { pBlob = rRhs.pBlob; iIndex = rRhs.iIndex; @@ -651,6 +672,26 @@ Bu::Blob::const_iterator &Bu::Blob::const_iterator::operator--() return *this; } +Bu::Blob::const_iterator &Bu::Blob::const_iterator::operator+=( int32_t iDelta ) +{ + if( bForward ) + iIndex += iDelta; + else + iIndex -= iDelta; + + return *this; +} + +Bu::Blob::const_iterator &Bu::Blob::const_iterator::operator-=( int32_t iDelta ) +{ + if( bForward ) + iIndex -= iDelta; + else + iIndex += iDelta; + + return *this; +} + Bu::Blob::const_iterator Bu::Blob::const_iterator::operator+( int32_t iDelta ) const { @@ -698,7 +739,7 @@ bool Bu::Blob::const_iterator::operator!=( } Bu::Blob::const_iterator &Bu::Blob::const_iterator::operator=( - Bu::Blob::iterator &rRhs ) + const Bu::Blob::iterator &rRhs ) { pBlob = rRhs.pBlob; iIndex = rRhs.iIndex; @@ -708,7 +749,7 @@ Bu::Blob::const_iterator &Bu::Blob::const_iterator::operator=( } Bu::Blob::const_iterator &Bu::Blob::const_iterator::operator=( - Bu::Blob::const_iterator &rRhs ) + const Bu::Blob::const_iterator &rRhs ) { pBlob = rRhs.pBlob; iIndex = rRhs.iIndex; -- cgit v1.2.3