[Libreoffice-commits] core.git: xmlhelp/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Dec 1 07:38:25 UTC 2019


 xmlhelp/source/cxxhelp/inc/tvread.hxx |   19 +++----------------
 xmlhelp/source/treeview/tvread.cxx    |   27 +++++++++++----------------
 2 files changed, 14 insertions(+), 32 deletions(-)

New commits:
commit 3e8a8806df33b8ffeac6f89c10d8d56baf9a2b89
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Nov 29 15:08:19 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Dec 1 08:37:44 2019 +0100

    loplugin:mergeclasses treeview::TreeFileIterator
    
    Change-Id: I9312806870b005e076fea3688f30ca86e93aeb4a
    Reviewed-on: https://gerrit.libreoffice.org/84108
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/xmlhelp/source/cxxhelp/inc/tvread.hxx b/xmlhelp/source/cxxhelp/inc/tvread.hxx
index 5f87ca5cf542..4753b9859930 100644
--- a/xmlhelp/source/cxxhelp/inc/tvread.hxx
+++ b/xmlhelp/source/cxxhelp/inc/tvread.hxx
@@ -239,18 +239,17 @@ namespace treeview {
         EndReached
     };
 
-    class ExtensionIteratorBase
+    class TreeFileIterator
     {
     public:
-        ExtensionIteratorBase( const OUString& aLanguage );
-        void init();
+        TreeFileIterator( const OUString& aLanguage );
+        OUString nextTreeFile( sal_Int32& rnFileSize );
 
     private:
         static css::uno::Reference< css::deployment::XPackage > implGetHelpPackageFromPackage
             ( const css::uno::Reference< css::deployment::XPackage >& xPackage,
               css::uno::Reference< css::deployment::XPackage >& o_xParentPackageBundle );
 
-    protected:
         css::uno::Reference< css::deployment::XPackage > implGetNextUserHelpPackage
             ( css::uno::Reference< css::deployment::XPackage >& o_xParentPackageBundle );
         css::uno::Reference< css::deployment::XPackage > implGetNextSharedHelpPackage
@@ -284,18 +283,6 @@ namespace treeview {
         int                                                                         m_iSharedPackage;
         int                                                                         m_iBundledPackage;
 
-    }; // end class ExtensionIteratorBase
-
-    class TreeFileIterator : public ExtensionIteratorBase
-    {
-    public:
-        TreeFileIterator( const OUString& aLanguage )
-            : ExtensionIteratorBase( aLanguage )
-        {}
-
-        OUString nextTreeFile( sal_Int32& rnFileSize );
-
-    private:
         OUString expandURL( const OUString& aURL );
         OUString implGetTreeFileFromPackage( sal_Int32& rnFileSize,
             const css::uno::Reference< css::deployment::XPackage >& xPackage );
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index a01dd66a51ef..922a418d401f 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -825,23 +825,18 @@ void TVChildTarget::subst( OUString& instpath )
     instpath = aOptions.SubstituteVariable( instpath );
 }
 
-// class ExtensionIteratorBase
+// class TreeFileIterator
 
 static const char aHelpMediaType[] = "application/vnd.sun.star.help";
 
-ExtensionIteratorBase::ExtensionIteratorBase( const OUString& aLanguage )
+TreeFileIterator::TreeFileIterator( const OUString& aLanguage )
         : m_eState( IteratorState::UserExtensions )
         , m_aLanguage( aLanguage )
 {
-    init();
-}
-
-void ExtensionIteratorBase::init()
-{
     m_xContext = ::comphelper::getProcessComponentContext();
     if( !m_xContext.is() )
     {
-        throw RuntimeException( "ExtensionIteratorBase::init(), no XComponentContext" );
+        throw RuntimeException( "TreeFileIterator::TreeFileIterator(), no XComponentContext" );
     }
 
     m_xSFA = ucb::SimpleFileAccess::create(m_xContext);
@@ -854,7 +849,7 @@ void ExtensionIteratorBase::init()
     m_iBundledPackage = 0;
 }
 
-Reference< deployment::XPackage > ExtensionIteratorBase::implGetHelpPackageFromPackage
+Reference< deployment::XPackage > TreeFileIterator::implGetHelpPackageFromPackage
     ( const Reference< deployment::XPackage >& xPackage, Reference< deployment::XPackage >& o_xParentPackageBundle )
 {
     o_xParentPackageBundle.clear();
@@ -903,7 +898,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetHelpPackageFromP
     return xHelpPackage;
 }
 
-Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextUserHelpPackage
+Reference< deployment::XPackage > TreeFileIterator::implGetNextUserHelpPackage
     ( Reference< deployment::XPackage >& o_xParentPackageBundle )
 {
     Reference< deployment::XPackage > xHelpPackage;
@@ -926,14 +921,14 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextUserHelpPack
     {
         const Reference< deployment::XPackage >* pUserPackages = m_aUserPackagesSeq.getConstArray();
         Reference< deployment::XPackage > xPackage = pUserPackages[ m_iUserPackage++ ];
-        OSL_ENSURE( xPackage.is(), "ExtensionIteratorBase::implGetNextUserHelpPackage(): Invalid package" );
+        OSL_ENSURE( xPackage.is(), "TreeFileIterator::implGetNextUserHelpPackage(): Invalid package" );
         xHelpPackage = implGetHelpPackageFromPackage( xPackage, o_xParentPackageBundle );
     }
 
     return xHelpPackage;
 }
 
-Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPackage
+Reference< deployment::XPackage > TreeFileIterator::implGetNextSharedHelpPackage
     ( Reference< deployment::XPackage >& o_xParentPackageBundle )
 {
     Reference< deployment::XPackage > xHelpPackage;
@@ -956,14 +951,14 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa
     {
         const Reference< deployment::XPackage >* pSharedPackages = m_aSharedPackagesSeq.getConstArray();
         Reference< deployment::XPackage > xPackage = pSharedPackages[ m_iSharedPackage++ ];
-        OSL_ENSURE( xPackage.is(), "ExtensionIteratorBase::implGetNextSharedHelpPackage(): Invalid package" );
+        OSL_ENSURE( xPackage.is(), "TreeFileIterator::implGetNextSharedHelpPackage(): Invalid package" );
         xHelpPackage = implGetHelpPackageFromPackage( xPackage, o_xParentPackageBundle );
     }
 
     return xHelpPackage;
 }
 
-Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextBundledHelpPackage
+Reference< deployment::XPackage > TreeFileIterator::implGetNextBundledHelpPackage
     ( Reference< deployment::XPackage >& o_xParentPackageBundle )
 {
     Reference< deployment::XPackage > xHelpPackage;
@@ -986,7 +981,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextBundledHelpP
     {
         const Reference< deployment::XPackage >* pBundledPackages = m_aBundledPackagesSeq.getConstArray();
         Reference< deployment::XPackage > xPackage = pBundledPackages[ m_iBundledPackage++ ];
-        OSL_ENSURE( xPackage.is(), "ExtensionIteratorBase::implGetNextBundledHelpPackage(): Invalid package" );
+        OSL_ENSURE( xPackage.is(), "TreeFileIterator::implGetNextBundledHelpPackage(): Invalid package" );
         xHelpPackage = implGetHelpPackageFromPackage( xPackage, o_xParentPackageBundle );
     }
 
@@ -998,7 +993,7 @@ static bool isLetter( sal_Unicode c )
     return rtl::isAsciiAlpha(c);
 }
 
-void ExtensionIteratorBase::implGetLanguageVectorFromPackage( ::std::vector< OUString > &rv,
+void TreeFileIterator::implGetLanguageVectorFromPackage( ::std::vector< OUString > &rv,
     const css::uno::Reference< css::deployment::XPackage >& xPackage )
 {
     rv.clear();


More information about the Libreoffice-commits mailing list