diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2017-01-07 19:40:36 -0500 |
---|---|---|
committer | Kohei Yoshida <libreoffice@kohei.us> | 2017-01-08 01:48:35 +0000 |
commit | 4f24613db3fb36d9d7c97026b93819d457754d46 (patch) | |
tree | b67b387348ce45c2615f365199e955f6a8a5d9df /package/source | |
parent | 7c117c508c1eaa5c930481fb82c21fee6d71af0c (diff) |
Rename css::packages::ContentInfo to just ZipContentInfo.
And use std::unique_ptr not rtl::Reference. This is not a UNO object
anyway...
Change-Id: If43da4f7e0f478b9ad8d62e5f43f04f035c31717
Reviewed-on: https://gerrit.libreoffice.org/32828
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'package/source')
-rw-r--r-- | package/source/zippackage/ContentInfo.hxx | 13 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageFolder.cxx | 18 |
2 files changed, 16 insertions, 15 deletions
diff --git a/package/source/zippackage/ContentInfo.hxx b/package/source/zippackage/ContentInfo.hxx index 890368744bbe..a3e34de1434d 100644 --- a/package/source/zippackage/ContentInfo.hxx +++ b/package/source/zippackage/ContentInfo.hxx @@ -24,10 +24,8 @@ #include <ZipPackageFolder.hxx> #include <ZipPackageStream.hxx> -namespace com { namespace sun { namespace star { namespace packages { -class ContentInfo : public cppu::OWeakObject +struct ZipContentInfo { -public: css::uno::Reference < css::lang::XUnoTunnel > xTunnel; bool bFolder; union @@ -35,19 +33,20 @@ public: ZipPackageFolder *pFolder; ZipPackageStream *pStream; }; - ContentInfo ( ZipPackageStream * pNewStream ) + ZipContentInfo ( ZipPackageStream * pNewStream ) : xTunnel ( pNewStream ) , bFolder ( false ) , pStream ( pNewStream ) { } - ContentInfo ( ZipPackageFolder * pNewFolder ) + ZipContentInfo ( ZipPackageFolder * pNewFolder ) : xTunnel ( pNewFolder ) , bFolder ( true ) , pFolder ( pNewFolder ) { } - virtual ~ContentInfo () override + + ~ZipContentInfo() { if ( bFolder ) pFolder->clearParent(); @@ -55,7 +54,7 @@ public: pStream->clearParent(); } }; -} } } } + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index 992f82bfe2f4..22d18ce42839 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -37,6 +37,8 @@ #include <EncryptedDataHeader.hxx> #include <rtl/instance.hxx> +#include <o3tl/make_unique.hxx> + using namespace com::sun::star; using namespace com::sun::star::packages::zip::ZipConstants; using namespace com::sun::star::packages::zip; @@ -86,7 +88,7 @@ bool ZipPackageFolder::LookForUnexpectedODF12Streams( const OUString& aPath ) ++aCI) { const OUString &rShortName = (*aCI).first; - const ContentInfo &rInfo = *(*aCI).second; + const ZipContentInfo &rInfo = *(*aCI).second; if ( rInfo.bFolder ) { @@ -143,7 +145,7 @@ void ZipPackageFolder::setChildStreamsTypeByExtension( const beans::StringPair& ++aCI) { const OUString &rShortName = (*aCI).first; - const ContentInfo &rInfo = *(*aCI).second; + const ZipContentInfo &rInfo = *(*aCI).second; if ( rInfo.bFolder ) rInfo.pFolder->setChildStreamsTypeByExtension( aPair ); @@ -238,14 +240,14 @@ sal_Bool SAL_CALL ZipPackageFolder::hasElements( ) return maContents.size() > 0; } // XNameAccess -ContentInfo& ZipPackageFolder::doGetByName( const OUString& aName ) - throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException) +ZipContentInfo& ZipPackageFolder::doGetByName( const OUString& aName ) { ContentHash::iterator aIter = maContents.find ( aName ); if ( aIter == maContents.end()) throw NoSuchElementException(THROW_WHERE ); - return *(*aIter).second; + return *aIter->second; } + uno::Any SAL_CALL ZipPackageFolder::getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException, std::exception) { @@ -369,7 +371,7 @@ void ZipPackageFolder::saveContents( ++aCI) { const OUString &rShortName = (*aCI).first; - const ContentInfo &rInfo = *(*aCI).second; + const ZipContentInfo &rInfo = *(*aCI).second; if ( !bMimeTypeStreamStored || !rShortName.equals( aMimeTypeStreamName ) ) { @@ -442,9 +444,9 @@ void ZipPackageFolder::doInsertByName ( ZipPackageEntry *pEntry, bool bSetParent try { if ( pEntry->IsFolder() ) - maContents[pEntry->getName()] = new ContentInfo ( static_cast < ZipPackageFolder *> ( pEntry ) ); + maContents[pEntry->getName()] = o3tl::make_unique<ZipContentInfo>(static_cast<ZipPackageFolder*>(pEntry)); else - maContents[pEntry->getName()] = new ContentInfo ( static_cast < ZipPackageStream *> ( pEntry ) ); + maContents[pEntry->getName()] = o3tl::make_unique<ZipContentInfo>(static_cast<ZipPackageStream*>(pEntry)); } catch(const uno::Exception& rEx) { |