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

Stephan Bergmann sbergman at redhat.com
Wed Dec 3 06:50:01 PST 2014


 basctl/source/basicide/bastype2.cxx |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

New commits:
commit 2dfcbfbdde1ab25bf395bf8f4533965f7d99d9e3
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Oct 9 12:32:14 2014 +0200

    Use std::initializer_list
    
    Change-Id: I726fc6429a2eb7827d09d04584fd0b725e78f650

diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 05894ad..9a4d75e 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -41,6 +41,7 @@
 #include <sfx2/dispatch.hxx>
 
 #include <cassert>
+#include <initializer_list>
 #include <memory>
 
 #include <com/sun/star/script/ModuleType.hpp>
@@ -424,18 +425,15 @@ void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const
 
 void TreeListBox::ImpCreateLibSubEntriesInVBAMode( SvTreeListEntry* pLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName )
 {
-
-    std::vector<std::pair<EntryType, OUString> > aEntries;
-    aEntries.push_back( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, IDE_RESSTR(RID_STR_DOCUMENT_OBJECTS) ) );
-    aEntries.push_back( ::std::make_pair( OBJ_TYPE_USERFORMS, IDE_RESSTR(RID_STR_USERFORMS) ) );
-    aEntries.push_back( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, IDE_RESSTR(RID_STR_NORMAL_MODULES) ) );
-    aEntries.push_back( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, IDE_RESSTR(RID_STR_CLASS_MODULES) ) );
-
-    std::vector<std::pair<EntryType, OUString> >::iterator iter;
-    for( iter = aEntries.begin(); iter != aEntries.end(); ++iter )
+    auto const aEntries = {
+        std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, IDE_RESSTR(RID_STR_DOCUMENT_OBJECTS) ),
+        std::make_pair( OBJ_TYPE_USERFORMS, IDE_RESSTR(RID_STR_USERFORMS) ),
+        std::make_pair( OBJ_TYPE_NORMAL_MODULES, IDE_RESSTR(RID_STR_NORMAL_MODULES) ),
+        std::make_pair( OBJ_TYPE_CLASS_MODULES, IDE_RESSTR(RID_STR_CLASS_MODULES) ) };
+    for( auto const & iter: aEntries )
     {
-        EntryType eType = iter->first;
-        OUString aEntryName = iter->second;
+        EntryType eType = iter.first;
+        OUString const & aEntryName = iter.second;
         SvTreeListEntry* pLibSubRootEntry = FindEntry( pLibRootEntry, aEntryName, eType );
         if( pLibSubRootEntry )
         {


More information about the Libreoffice-commits mailing list