From 4f24613db3fb36d9d7c97026b93819d457754d46 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Sat, 7 Jan 2017 19:40:36 -0500 Subject: 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 Reviewed-by: Kohei Yoshida --- package/inc/HashMaps.hxx | 8 ++++---- package/inc/ZipPackageFolder.hxx | 3 +-- package/source/zippackage/ContentInfo.hxx | 13 ++++++------- package/source/zippackage/ZipPackageFolder.cxx | 18 ++++++++++-------- 4 files changed, 21 insertions(+), 21 deletions(-) (limited to 'package') diff --git a/package/inc/HashMaps.hxx b/package/inc/HashMaps.hxx index f3d0c65a6bb7..e83a9483524f 100644 --- a/package/inc/HashMaps.hxx +++ b/package/inc/HashMaps.hxx @@ -23,6 +23,8 @@ #include #include +#include + struct eqFunc { bool operator()( const OUString &r1, @@ -33,9 +35,7 @@ struct eqFunc }; class ZipPackageFolder; -namespace com { namespace sun { namespace star { namespace packages { -class ContentInfo; -} } } } +struct ZipContentInfo; typedef std::unordered_map < OUString, ZipPackageFolder *, @@ -43,7 +43,7 @@ typedef std::unordered_map < OUString, eqFunc > FolderHash; typedef std::unordered_map < OUString, - rtl::Reference < css::packages::ContentInfo >, + std::unique_ptr, OUStringHash, eqFunc > ContentHash; diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx index 916c82477d9d..1b0cee329853 100644 --- a/package/inc/ZipPackageFolder.hxx +++ b/package/inc/ZipPackageFolder.hxx @@ -59,8 +59,7 @@ public: void doInsertByName ( ZipPackageEntry *pEntry, bool bSetParent ) throw(css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, css::uno::RuntimeException); - css::packages::ContentInfo & doGetByName( const OUString& aName ) - throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException); + ZipContentInfo& doGetByName( const OUString& aName ); static void copyZipEntry( ZipEntry &rDest, const ZipEntry &rSource); static css::uno::Sequence < sal_Int8 > static_getImplementationId(); 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 #include -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 #include +#include + 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(static_cast(pEntry)); else - maContents[pEntry->getName()] = new ContentInfo ( static_cast < ZipPackageStream *> ( pEntry ) ); + maContents[pEntry->getName()] = o3tl::make_unique(static_cast(pEntry)); } catch(const uno::Exception& rEx) { -- cgit v1.2.3