From 1d8806120f03e76574d5181fef0f0e81a3273caa Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 9 Oct 2015 12:42:31 +0200 Subject: loplugin:mergeclasses Change-Id: I31fe981dac14bd732ee68ee1a2e475dd1b0498a2 --- compilerplugins/clang/mergeclasses.results | 1 - io/source/stm/omark.cxx | 4 +- io/source/stm/streamhelper.hxx | 70 +++++++++++------------------- 3 files changed, 28 insertions(+), 47 deletions(-) diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index cd855bacaf28..d32812475a16 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -130,7 +130,6 @@ merge frm::ITextSelectionListener with frm::ORichTextPeer merge ftp::CurlInput with InsertData merge ftp::ResultSetFactory with ResultSetFactoryI merge i_xml_parser_event_handler with (anonymous namespace)::recently_used_file_filter -merge io_stm::IRingBuffer with io_stm::MemRingBuffer merge io_stm::I_FIFO with io_stm::MemFIFO merge oglcanvas::CanvasHelper with oglcanvas::BitmapCanvasHelper merge oglcanvas::IBufferContext with oglcanvas::(anonymous namespace)::BufferContextImpl 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 > 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 > 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 &) throw( I_FIFO_OutOfMemoryException, - I_FIFO_OutOfBoundsException )=0; + I_FIFO_OutOfBoundsException )=0; virtual void read( Sequence & , 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 &) + throw( IRingBuffer_OutOfMemoryException, + IRingBuffer_OutOfBoundsException ); + void readAt( sal_Int32 nPos, Sequence & , 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 &) - throw( IRingBuffer_OutOfMemoryException, - IRingBuffer_OutOfBoundsException )=0; - virtual void readAt( sal_Int32 nPos, Sequence & , 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 &) - throw( IRingBuffer_OutOfMemoryException, - IRingBuffer_OutOfBoundsException ) SAL_OVERRIDE; - virtual void readAt( sal_Int32 nPos, Sequence & , 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 &) throw( I_FIFO_OutOfMemoryException, - I_FIFO_OutOfBoundsException ) SAL_OVERRIDE; + I_FIFO_OutOfBoundsException ) SAL_OVERRIDE; virtual void read( Sequence & , 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(); } }; -- cgit