[Libreoffice-commits] core.git: basctl/source include/sfx2 sc/source sd/source sfx2/source starmath/source sw/source

Mark Page aptitude at btconnect.com
Mon Jul 4 07:09:09 UTC 2016


 basctl/source/basicide/basicmod.hxx |    2 +-
 include/sfx2/module.hxx             |    2 +-
 sc/source/ui/app/scmod.cxx          |    2 +-
 sd/source/ui/app/sdmod.cxx          |    3 +--
 sfx2/source/appl/module.cxx         |   13 ++++++-------
 starmath/source/smmod.cxx           |    2 +-
 sw/source/uibase/app/swmodule.cxx   |    3 +--
 7 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit 66576fc1f6cf34d658993fa5f92020bc29fe3f88
Author: Mark Page <aptitude at btconnect.com>
Date:   Fri Jul 1 12:37:24 2016 +0100

    SfxModule to use initializer_list instead of variadic arguments
    
    The compiler can perform type checking with initializer lists
    
    Change-Id: I1d26b56a3a2b67fe719f33d758ca9b0c95ebd4d1
    Reviewed-on: https://gerrit.libreoffice.org/26852
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/basctl/source/basicide/basicmod.hxx b/basctl/source/basicide/basicmod.hxx
index b52a1c7..3bed4f2 100644
--- a/basctl/source/basicide/basicmod.hxx
+++ b/basctl/source/basicide/basicmod.hxx
@@ -31,7 +31,7 @@ class Module : public SfxModule
     static Module* mpModule;
 public:
     Module ( ResMgr *pMgr, SfxObjectFactory *pObjFact) :
-        SfxModule( pMgr, pObjFact, nullptr )
+        SfxModule( pMgr, {pObjFact} )
     { }
 public:
     static Module*& Get () { return mpModule; }
diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
index 72f25f5..2761cce 100644
--- a/include/sfx2/module.hxx
+++ b/include/sfx2/module.hxx
@@ -69,7 +69,7 @@ private:
 
 public:
 
-                                SfxModule( ResMgr* pMgrP, SfxObjectFactory* pFactoryP, ... );
+                                SfxModule( ResMgr* pMgrP, std::initializer_list<SfxObjectFactory*> pFactoryList);
                                 virtual ~SfxModule();
 
     ResMgr*                     GetResMgr();
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index c45480f..c1dc616 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -130,7 +130,7 @@ void ScModule::InitInterface_Impl()
 }
 
 ScModule::ScModule( SfxObjectFactory* pFact ) :
-    SfxModule( ResMgr::CreateResMgr( "sc" ), pFact, nullptr ),
+    SfxModule( ResMgr::CreateResMgr( "sc" ), {pFact} ),
     aIdleTimer("sc ScModule IdleTimer"),
     aSpellIdle("sc ScModule SpellIdle"),
     mpDragData(new ScDragData),
diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
index 9b54068..1f821f0 100644
--- a/sd/source/ui/app/sdmod.cxx
+++ b/sd/source/ui/app/sdmod.cxx
@@ -67,8 +67,7 @@ void SdModule::InitInterface_Impl()
 
 // Ctor
 SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 )
-:   SfxModule( ResMgr::CreateResMgr("sd"),
-                  pFact1, pFact2, nullptr ),
+:   SfxModule( ResMgr::CreateResMgr("sd"), {pFact1, pFact2} ),
     pTransferClip(nullptr),
     pTransferDrag(nullptr),
     pTransferSelection(nullptr),
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index 3978723..7ea9e34 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -103,16 +103,15 @@ ResMgr* SfxModule::GetResMgr()
     return pResMgr;
 }
 
-SfxModule::SfxModule( ResMgr* pMgrP, SfxObjectFactory* pFactoryP, ... )
+SfxModule::SfxModule( ResMgr* pMgrP, std::initializer_list<SfxObjectFactory*> pFactoryList )
     : pResMgr( pMgrP ), pImpl(nullptr)
 {
     Construct_Impl();
-    va_list pVarArgs;
-    va_start( pVarArgs, pFactoryP );
-    for ( SfxObjectFactory *pArg = pFactoryP; pArg;
-         pArg = va_arg( pVarArgs, SfxObjectFactory* ) )
-        pArg->SetModule_Impl( this );
-    va_end(pVarArgs);
+    for (auto pFactory : pFactoryList)
+    {
+        if (pFactory)
+            pFactory->SetModule_Impl( this );
+    }
 }
 
 void SfxModule::Construct_Impl()
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index e394fe6..e4d5445 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -151,7 +151,7 @@ void SmModule::InitInterface_Impl()
 }
 
 SmModule::SmModule(SfxObjectFactory* pObjFact) :
-    SfxModule(ResMgr::CreateResMgr("sm"), pObjFact, nullptr)
+    SfxModule(ResMgr::CreateResMgr("sm"), {pObjFact})
 {
     SetName("StarMath");
 
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index c4bfa35..f436e09 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -141,8 +141,7 @@ using namespace ::com::sun::star::uno;
 SwModule::SwModule( SfxObjectFactory* pWebFact,
                     SfxObjectFactory* pFact,
                     SfxObjectFactory* pGlobalFact )
-    : SfxModule( ResMgr::CreateResMgr( "sw" ), pWebFact,
-                     pFact, pGlobalFact, nullptr ),
+    : SfxModule( ResMgr::CreateResMgr( "sw" ), {pWebFact, pFact, pGlobalFact} ),
     m_pModuleConfig(nullptr),
     m_pUsrPref(nullptr),
     m_pWebUsrPref(nullptr),


More information about the Libreoffice-commits mailing list