merge dbaccess::StorageInputStream with dbaccess::StorageXMLInputStream

Change-Id: I05b54b8a2fe4ff0c8b9f89e3d29e864e8665b7b8
Reviewed-on: https://gerrit.libreoffice.org/29519
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2016-10-04 09:57:11 +02:00
parent 106ea87205
commit c1e18e05a5
5 changed files with 16 additions and 48 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -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