diff options
author | Noel Grandin <noel@peralex.com> | 2015-10-09 12:42:31 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-10-12 09:13:34 +0200 |
commit | 1d8806120f03e76574d5181fef0f0e81a3273caa (patch) | |
tree | 24c79232cc31ac1f384d61db3ea3b44798594181 /io/source | |
parent | 6b34ac24194ae56d2762fcb67ad1e5dcf1bf3a82 (diff) |
loplugin:mergeclasses
Change-Id: I31fe981dac14bd732ee68ee1a2e475dd1b0498a2
Diffstat (limited to 'io/source')
-rw-r--r-- | io/source/stm/omark.cxx | 4 | ||||
-rw-r--r-- | io/source/stm/streamhelper.hxx | 70 |
2 files changed, 28 insertions, 46 deletions
diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx index fd2db9894726..a0902285bdf7 100644 --- a/io/source/stm/omark.cxx +++ b/io/source/stm/omark.cxx @@ -138,7 +138,7 @@ private: Reference< XOutputStream > m_output; bool m_bValidStream; - IRingBuffer *m_pBuffer; + MemRingBuffer *m_pBuffer; map<sal_Int32,sal_Int32,less< sal_Int32 > > m_mapMarks; sal_Int32 m_nCurrentPos; sal_Int32 m_nCurrentMark; @@ -553,7 +553,7 @@ private: Reference< XInputStream > m_input; bool m_bValidStream; - IRingBuffer *m_pBuffer; + MemRingBuffer *m_pBuffer; map<sal_Int32,sal_Int32,less< sal_Int32 > > m_mapMarks; sal_Int32 m_nCurrentPos; sal_Int32 m_nCurrentMark; diff --git a/io/source/stm/streamhelper.hxx b/io/source/stm/streamhelper.hxx index 1fa232b00001..84501384ab64 100644 --- a/io/source/stm/streamhelper.hxx +++ b/io/source/stm/streamhelper.hxx @@ -34,14 +34,15 @@ #define Max( a, b ) (((a)>(b)) ? (a) : (b) ) #define Min( a, b ) (((a)<(b)) ? (a) : (b) ) -namespace io_stm { +namespace io_stm +{ class I_FIFO_OutOfBoundsException : - public Exception + public Exception {}; class I_FIFO_OutOfMemoryException : - public Exception + public Exception {}; class I_FIFO @@ -50,12 +51,12 @@ public: virtual void write( const Sequence<sal_Int8> &) throw( I_FIFO_OutOfMemoryException, - I_FIFO_OutOfBoundsException )=0; + I_FIFO_OutOfBoundsException )=0; virtual void read( Sequence<sal_Int8> & , sal_Int32 nBytesToRead ) - throw( I_FIFO_OutOfBoundsException )=0; + throw( I_FIFO_OutOfBoundsException )=0; virtual void skip( sal_Int32 nBytesToSkip ) - throw( I_FIFO_OutOfBoundsException )=0; + throw( I_FIFO_OutOfBoundsException )=0; virtual sal_Int32 getSize() const throw( ) =0; virtual ~I_FIFO() {}; @@ -63,56 +64,37 @@ public: class IRingBuffer_OutOfBoundsException : - public Exception + public Exception {}; class IRingBuffer_OutOfMemoryException : - public Exception + public Exception {}; -class IRingBuffer +class MemRingBuffer { public: + MemRingBuffer(); + virtual ~MemRingBuffer(); + /*** * overwrites data at given position. Size is automatically extended, when * data is written beyond end. - * ***/ + void writeAt( sal_Int32 nPos, const Sequence<sal_Int8> &) + throw( IRingBuffer_OutOfMemoryException, + IRingBuffer_OutOfBoundsException ); + void readAt( sal_Int32 nPos, Sequence<sal_Int8> & , sal_Int32 nBytesToRead ) const + throw( IRingBuffer_OutOfBoundsException ); + sal_Int32 getSize() const throw(); + void forgetFromStart( sal_Int32 nBytesToForget ) throw(IRingBuffer_OutOfBoundsException); - virtual void writeAt( sal_Int32 nPos, const Sequence<sal_Int8> &) - throw( IRingBuffer_OutOfMemoryException, - IRingBuffer_OutOfBoundsException )=0; - virtual void readAt( sal_Int32 nPos, Sequence<sal_Int8> & , sal_Int32 nBytesToRead ) const - throw( IRingBuffer_OutOfBoundsException )=0; - virtual sal_Int32 getSize() const throw( ) =0; - virtual void forgetFromStart( sal_Int32 nBytesToForget ) throw(IRingBuffer_OutOfBoundsException)=0; - virtual void shrink() throw() = 0; - virtual ~IRingBuffer() {}; -}; - - -class MemRingBuffer : - public IRingBuffer -{ -public: - MemRingBuffer(); - virtual ~MemRingBuffer(); - - virtual void writeAt( sal_Int32 nPos, const Sequence<sal_Int8> &) - throw( IRingBuffer_OutOfMemoryException, - IRingBuffer_OutOfBoundsException ) SAL_OVERRIDE; - virtual void readAt( sal_Int32 nPos, Sequence<sal_Int8> & , sal_Int32 nBytesToRead ) const - throw( IRingBuffer_OutOfBoundsException ) SAL_OVERRIDE; - virtual sal_Int32 getSize() const throw( ) SAL_OVERRIDE; - virtual void forgetFromStart( sal_Int32 nBytesToForget ) throw(IRingBuffer_OutOfBoundsException) SAL_OVERRIDE; - - virtual void shrink() throw() SAL_OVERRIDE; + virtual void shrink() throw(); private: void resizeBuffer( sal_Int32 nMinSize ) throw( IRingBuffer_OutOfMemoryException ); - inline void checkInvariants() - { + inline void checkInvariants() { assert( m_nBufferLen >= 0 ); assert( m_nOccupiedBuffer >= 0 ); assert( m_nOccupiedBuffer <= m_nBufferLen ); @@ -134,14 +116,14 @@ class MemFIFO : { public: virtual void write( const Sequence<sal_Int8> &) throw( I_FIFO_OutOfMemoryException, - I_FIFO_OutOfBoundsException ) SAL_OVERRIDE; + I_FIFO_OutOfBoundsException ) SAL_OVERRIDE; virtual void read( Sequence<sal_Int8> & , sal_Int32 nBytesToRead ) - throw( I_FIFO_OutOfBoundsException ) SAL_OVERRIDE; + throw( I_FIFO_OutOfBoundsException ) SAL_OVERRIDE; virtual void skip( sal_Int32 nBytesToSkip ) throw( I_FIFO_OutOfBoundsException ) SAL_OVERRIDE; virtual sal_Int32 getSize() const throw( ) SAL_OVERRIDE - { return MemRingBuffer::getSize(); } + { return MemRingBuffer::getSize(); } virtual void shrink() throw() SAL_OVERRIDE - { MemRingBuffer::shrink(); } + { MemRingBuffer::shrink(); } }; |