[Libreoffice-commits] core.git: compilerplugins/clang dbaccess/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Oct 5 06:44:54 UTC 2016


 compilerplugins/clang/mergeclasses.results         |    1 -
 dbaccess/source/core/recovery/storagestream.cxx    |   15 ---------------
 dbaccess/source/core/recovery/storagestream.hxx    |   20 --------------------
 dbaccess/source/core/recovery/storagexmlstream.cxx |   17 +++++++++++------
 dbaccess/source/core/recovery/storagexmlstream.hxx |   11 +++++------
 5 files changed, 16 insertions(+), 48 deletions(-)

New commits:
commit c1e18e05a53c1d55afe36a887ca25f74f3f1d32d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Oct 4 09:57:11 2016 +0200

    merge dbaccess::StorageInputStream with dbaccess::StorageXMLInputStream
    
    Change-Id: I05b54b8a2fe4ff0c8b9f89e3d29e864e8665b7b8
    Reviewed-on: https://gerrit.libreoffice.org/29519
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results
index 29b47df..d0c51a5 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -227,7 +227,6 @@ merge cppu::PropertySetMixinImpl with cppu::PropertySetMixin
 merge dbaccess::IPropertyContainer with dbaccess::OColumn
 merge dbaccess::IRefreshListener with dbaccess::OConnection
 merge dbaccess::OColumnWrapper with dbaccess::OTableColumnDescriptorWrapper
-merge dbaccess::StorageInputStream with dbaccess::StorageXMLInputStream
 merge dbaui::IEntryFilter with dbaui::(anonymous namespace)::FilterByEntryDataId
 merge dbaui::IUpdateHelper with dbaui::OParameterUpdateHelper
 merge dbaui::OSplitterView with dbaui::OApplicationDetailView
diff --git a/dbaccess/source/core/recovery/storagestream.cxx b/dbaccess/source/core/recovery/storagestream.cxx
index cba882c..6f23cba 100644
--- a/dbaccess/source/core/recovery/storagestream.cxx
+++ b/dbaccess/source/core/recovery/storagestream.cxx
@@ -60,21 +60,6 @@ namespace dbaccess
         // (legitimately) do not call this method here.
     }
 
-    // StorageInputStream
-    StorageInputStream::StorageInputStream( const Reference< XStorage >& i_rParentStorage,
-                                            const OUString& i_rStreamName
-                                          )
-    {
-        ENSURE_OR_THROW( i_rParentStorage.is(), "illegal stream" );
-
-        const Reference< XStream > xStream(
-            i_rParentStorage->openStreamElement( i_rStreamName, ElementModes::READ ), UNO_QUERY_THROW );
-        m_xInputStream.set( xStream->getInputStream(), UNO_SET_THROW );
-    }
-
-    StorageInputStream::~StorageInputStream()
-    {
-    }
 
 } // namespace dbaccess
 
diff --git a/dbaccess/source/core/recovery/storagestream.hxx b/dbaccess/source/core/recovery/storagestream.hxx
index 3fe4e28..6ed2b93 100644
--- a/dbaccess/source/core/recovery/storagestream.hxx
+++ b/dbaccess/source/core/recovery/storagestream.hxx
@@ -53,26 +53,6 @@ namespace dbaccess
                                                 m_xOutputStream;
     };
 
-    // StorageInputStream
-    /** convenience wrapper around a stream living in a storage
-    */
-    class StorageInputStream
-    {
-    public:
-        StorageInputStream(
-            const css::uno::Reference< css::embed::XStorage >& i_rParentStorage,
-            const OUString& i_rStreamName
-        );
-        virtual ~StorageInputStream();
-
-    protected:
-        const css::uno::Reference< css::io::XInputStream >&
-                                                getInputStream() const { return m_xInputStream; }
-
-    private:
-              css::uno::Reference< css::io::XInputStream >
-                                                m_xInputStream;
-    };
 
 } // namespace dbaccess
 
diff --git a/dbaccess/source/core/recovery/storagexmlstream.cxx b/dbaccess/source/core/recovery/storagexmlstream.cxx
index 3919598..e47db02 100644
--- a/dbaccess/source/core/recovery/storagexmlstream.cxx
+++ b/dbaccess/source/core/recovery/storagexmlstream.cxx
@@ -19,6 +19,7 @@
 
 #include "storagexmlstream.hxx"
 
+#include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/Writer.hpp>
@@ -128,10 +129,14 @@ namespace dbaccess
     StorageXMLInputStream::StorageXMLInputStream( const Reference<XComponentContext>& i_rContext,
                                                   const Reference< XStorage >& i_rParentStorage,
                                                   const OUString& i_rStreamName )
-        :StorageInputStream( i_rParentStorage, i_rStreamName )
-        ,m_pData( new StorageXMLInputStream_Data )
     {
-        m_pData->xParser.set( Parser::create(i_rContext) );
+        ENSURE_OR_THROW( i_rParentStorage.is(), "illegal stream" );
+
+        const Reference< css::io::XStream > xStream(
+            i_rParentStorage->openStreamElement( i_rStreamName, css::embed::ElementModes::READ ), UNO_QUERY_THROW );
+        m_xInputStream.set( xStream->getInputStream(), css::uno::UNO_SET_THROW );
+
+        m_xParser.set( Parser::create(i_rContext) );
     }
 
     void StorageXMLInputStream::import( const Reference< XDocumentHandler >& i_rHandler )
@@ -139,10 +144,10 @@ namespace dbaccess
         ENSURE_OR_THROW( i_rHandler.is(), "illegal document handler (NULL)" );
 
         InputSource aInputSource;
-        aInputSource.aInputStream = getInputStream();
+        aInputSource.aInputStream = m_xInputStream;
 
-        m_pData->xParser->setDocumentHandler( i_rHandler );
-        m_pData->xParser->parseStream( aInputSource );
+        m_xParser->setDocumentHandler( i_rHandler );
+        m_xParser->parseStream( aInputSource );
     }
 
     StorageXMLInputStream::~StorageXMLInputStream()
diff --git a/dbaccess/source/core/recovery/storagexmlstream.hxx b/dbaccess/source/core/recovery/storagexmlstream.hxx
index ba174c8..6f4876a 100644
--- a/dbaccess/source/core/recovery/storagexmlstream.hxx
+++ b/dbaccess/source/core/recovery/storagexmlstream.hxx
@@ -22,6 +22,7 @@
 
 #include "storagestream.hxx"
 
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/embed/XStorage.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 
@@ -61,9 +62,7 @@ namespace dbaccess
         ::std::unique_ptr< StorageXMLOutputStream_Data >   m_pData;
     };
 
-    // StorageXMLInputStream
-    struct StorageXMLInputStream_Data;
-    class StorageXMLInputStream : public StorageInputStream
+    class StorageXMLInputStream
     {
     public:
         StorageXMLInputStream(
@@ -71,18 +70,18 @@ namespace dbaccess
             const css::uno::Reference< css::embed::XStorage >& i_rParentStorage,
             const OUString& i_rStreamName
         );
-        virtual ~StorageXMLInputStream() override;
+        ~StorageXMLInputStream();
 
         void    import(
                     const css::uno::Reference< css::xml::sax::XDocumentHandler >& i_rHandler
                 );
 
-    private:
         StorageXMLInputStream( const StorageXMLInputStream& ) = delete;
         StorageXMLInputStream& operator=( const StorageXMLInputStream& ) = delete;
 
     private:
-        ::std::unique_ptr< StorageXMLInputStream_Data >   m_pData;
+        css::uno::Reference< css::xml::sax::XParser >     m_xParser;
+        css::uno::Reference< css::io::XInputStream >      m_xInputStream;
     };
 
 } // namespace dbaccess


More information about the Libreoffice-commits mailing list