diff options
-rw-r--r-- | package/inc/HashMaps.hxx | 8 | ||||
-rw-r--r-- | package/inc/ZipPackageFolder.hxx | 3 | ||||
-rw-r--r-- | package/source/zippackage/ContentInfo.hxx | 13 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageFolder.cxx | 18 |
4 files changed, 21 insertions, 21 deletions
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 <rtl/ref.hxx> #include <unordered_map> +#include <memory> + 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<ZipContentInfo>, 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 <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) { |