[Libreoffice-commits] core.git: basic/source editeng/source oox/source scripting/source sc/source

ekuiitr jhaekansh80 at gmail.com
Wed Jan 10 14:21:16 UTC 2018


 basic/source/classes/sb.cxx                         |   15 +++++++--------
 basic/source/classes/sbunoobj.cxx                   |    4 +---
 editeng/source/editeng/editobj.cxx                  |   16 +++++++---------
 oox/source/ole/vbacontrol.cxx                       |    5 ++---
 sc/source/ui/vba/vbafiledialogitems.cxx             |   10 ++++------
 scripting/source/provider/BrowseNodeFactoryImpl.cxx |   13 +++++--------
 6 files changed, 26 insertions(+), 37 deletions(-)

New commits:
commit 728104b31c89c93c8211fcd78a2c7a38192268eb
Author: ekuiitr <jhaekansh80 at gmail.com>
Date:   Wed Dec 27 18:55:49 2017 +0800

    tdf#96099 Removed some trivial typedefs related to UnOrderedMap and size_t.
    
    Change-Id: I59d3d0b2c1097b5ca96505dc99a4a104b4f8ab48
    Reviewed-on: https://gerrit.libreoffice.org/47082
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 1dcd71704399..79e40d298660 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -173,14 +173,13 @@ void SAL_CALL DocBasicItem::disposing( const lang::EventObject& /*rEvent*/ )
 namespace {
 
 typedef ::rtl::Reference< DocBasicItem > DocBasicItemRef;
-typedef std::unordered_map< const StarBASIC *, DocBasicItemRef > DocBasicItemMap;
 
-class GaDocBasicItems : public rtl::Static<DocBasicItemMap,GaDocBasicItems> {};
+class GaDocBasicItems : public rtl::Static<std::unordered_map< const StarBASIC *, DocBasicItemRef >,GaDocBasicItems> {};
 
 const DocBasicItem* lclFindDocBasicItem( const StarBASIC* pDocBasic )
 {
-    DocBasicItemMap::iterator it = GaDocBasicItems::get().find( pDocBasic );
-    DocBasicItemMap::iterator end = GaDocBasicItems::get().end();
+    auto it = GaDocBasicItems::get().find( pDocBasic );
+    auto end = GaDocBasicItems::get().end();
     return (it != end) ? it->second.get() : nullptr;
 }
 
@@ -193,13 +192,13 @@ void lclInsertDocBasicItem( StarBASIC& rDocBasic )
 
 void lclRemoveDocBasicItem( StarBASIC& rDocBasic )
 {
-    DocBasicItemMap::iterator it = GaDocBasicItems::get().find( &rDocBasic );
+    auto it = GaDocBasicItems::get().find( &rDocBasic );
     if( it != GaDocBasicItems::get().end() )
     {
         it->second->stopListening();
         GaDocBasicItems::get().erase( it );
     }
-    DocBasicItemMap::iterator it_end = GaDocBasicItems::get().end();
+    auto it_end = GaDocBasicItems::get().end();
     for( it = GaDocBasicItems::get().begin(); it != it_end; ++it )
     {
         it->second->clearDependingVarsOnDelete( rDocBasic );
@@ -1936,8 +1935,8 @@ Reference< frame::XModel > StarBASIC::GetModelFromBasic( SbxObject* pBasic )
 
 void StarBASIC::DetachAllDocBasicItems()
 {
-    DocBasicItemMap& rItems = GaDocBasicItems::get();
-    DocBasicItemMap::iterator it = rItems.begin(), itEnd = rItems.end();
+    std::unordered_map< const StarBASIC *, DocBasicItemRef >& rItems = GaDocBasicItems::get();
+    auto it = rItems.begin(), itEnd = rItems.end();
     for (; it != itEnd; ++it)
     {
         DocBasicItemRef xItem = it->second;
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 829db9b695e4..8a67a697e5f0 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -3200,8 +3200,6 @@ Reference< XTypeDescriptionEnumeration > getTypeDescriptorEnumeration( const OUS
     return xEnum;
 }
 
-typedef std::unordered_map< OUString, Any > VBAConstantsHash;
-
 VBAConstantHelper&
 VBAConstantHelper::instance()
 {
@@ -3278,7 +3276,7 @@ VBAConstantHelper::getVBAConstant( const OUString& rName )
     SbxVariable* pConst = nullptr;
     init();
 
-    VBAConstantsHash::const_iterator it = aConstHash.find( rName.toAsciiLowerCase() );
+    auto it = aConstHash.find( rName.toAsciiLowerCase() );
 
     if ( it != aConstHash.end() )
     {
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 59f1c17fcd0a..b9a8fd82baff 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -878,15 +878,13 @@ public:
 
 void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs ) const
 {
-    typedef std::vector<size_t> SectionBordersType;
-    typedef std::vector<SectionBordersType> ParagraphsType;
-    ParagraphsType aParaBorders(aContents.size());
+    std::vector<std::vector<size_t>> aParaBorders(aContents.size());
 
     // First pass: determine section borders for each paragraph.
     for (size_t nPara = 0; nPara < aContents.size(); ++nPara)
     {
         const ContentInfo& rC = *aContents[nPara].get();
-        SectionBordersType& rBorders = aParaBorders[nPara];
+        std::vector<size_t>& rBorders = aParaBorders[nPara];
         rBorders.push_back(0);
         rBorders.push_back(rC.GetText().getLength());
         for (const auto & aAttrib : rC.maCharAttribs)
@@ -902,12 +900,12 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs )
     }
 
     // Sort and remove duplicates for each paragraph.
-    ParagraphsType::iterator it = aParaBorders.begin(), itEnd = aParaBorders.end();
+    std::vector<std::vector<size_t>>::iterator it = aParaBorders.begin(), itEnd = aParaBorders.end();
     for (; it != itEnd; ++it)
     {
-        SectionBordersType& rBorders = *it;
+        std::vector<size_t>& rBorders = *it;
         std::sort(rBorders.begin(), rBorders.end());
-        SectionBordersType::iterator itUniqueEnd = std::unique(rBorders.begin(), rBorders.end());
+        auto itUniqueEnd = std::unique(rBorders.begin(), rBorders.end());
         rBorders.erase(itUniqueEnd, rBorders.end());
     }
 
@@ -920,7 +918,7 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs )
     for (; it != itEnd; ++it)
     {
         size_t nPara = distance(aParaBorders.begin(), it);
-        const SectionBordersType& rBorders = *it;
+        const std::vector<size_t>& rBorders = *it;
         if (rBorders.size() == 1 && rBorders[0] == 0)
         {
             // Empty paragraph. Push an empty section.
@@ -928,7 +926,7 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs )
             continue;
         }
 
-        SectionBordersType::const_iterator itBorder = rBorders.begin(), itBorderEnd = rBorders.end();
+        auto itBorder = rBorders.begin(), itBorderEnd = rBorders.end();
         size_t nPrev = *itBorder;
         size_t nCur;
         for (++itBorder; itBorder != itBorderEnd; ++itBorder, nPrev = nCur)
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
index 77e056ca80ef..03ed0e49aa35 100644
--- a/oox/source/ole/vbacontrol.cxx
+++ b/oox/source/ole/vbacontrol.cxx
@@ -426,7 +426,6 @@ void VbaFormControl::importStorage( StorageBase& rStrg, const AxClassTable& rCla
                 IdToPageMap idToPage;
                 VbaFormControlVector::iterator it = maControls.begin();
                 VbaFormControlVector::iterator it_end = maControls.end();
-                typedef std::vector< sal_uInt32 > UInt32Array;
                 AxArrayString sCaptions;
 
                 for ( ; it != it_end; ++it )
@@ -446,8 +445,8 @@ void VbaFormControl::importStorage( StorageBase& rStrg, const AxClassTable& rCla
                     }
                 }
                 // apply caption/titles to pages
-                UInt32Array::iterator itCtrlId = pMultiPage->mnIDs.begin();
-                UInt32Array::iterator itCtrlId_end = pMultiPage->mnIDs.end();
+                auto itCtrlId = pMultiPage->mnIDs.begin();
+                auto itCtrlId_end = pMultiPage->mnIDs.end();
                 AxArrayString::iterator itCaption = sCaptions.begin();
 
                 maControls.clear();
diff --git a/sc/source/ui/vba/vbafiledialogitems.cxx b/sc/source/ui/vba/vbafiledialogitems.cxx
index 4e57a2e0d10a..bd78a4d77b66 100644
--- a/sc/source/ui/vba/vbafiledialogitems.cxx
+++ b/sc/source/ui/vba/vbafiledialogitems.cxx
@@ -23,14 +23,12 @@
 using namespace ::com::sun::star;
 using namespace ::ooo::vba;
 
-typedef std::vector< OUString > StringVector;
-
 class FileDialogItemEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration >
 {
-    StringVector m_sItems;
-    StringVector::iterator mIt;
+    std::vector< OUString > m_sItems;
+    std::vector< OUString >::iterator mIt;
 public:
-    explicit FileDialogItemEnumeration( const StringVector& rVector ) : m_sItems( rVector ), mIt( m_sItems.begin() ) {}
+    explicit FileDialogItemEnumeration( const std::vector< OUString >& rVector ) : m_sItems( rVector ), mIt( m_sItems.begin() ) {}
     virtual sal_Bool SAL_CALL hasMoreElements() override
     {
         return ( mIt != m_sItems.end() );
@@ -47,7 +45,7 @@ public:
 ScVbaFileDialogSelectedItems::ScVbaFileDialogSelectedItems(
         const css::uno::Reference< ov::XHelperInterface >& xParent
        ,const css::uno::Reference< css::uno::XComponentContext >& xContext
-       ,const StringVector& rItems)
+       ,const std::vector< OUString >& rItems)
     : FileDialogSelectedItems_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() )
     , m_sItems(rItems) {}
 
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index 90be10172ba7..94b35b6b82c1 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -150,9 +150,6 @@ public:
     }
 };
 
-typedef std::unordered_map< OUString, Reference< browse::XBrowseNode > >  BrowseNodeAggregatorHash;
-typedef std::vector< OUString > vString;
-
 struct alphaSort
 {
     bool operator()( const OUString& a, const OUString& b )
@@ -164,8 +161,8 @@ class LocationBrowseNode :
     public ::cppu::WeakImplHelper< browse::XBrowseNode >
 {
 private:
-    std::unique_ptr<BrowseNodeAggregatorHash> m_hBNA;
-    vString m_vStr;
+    std::unique_ptr<std::unordered_map< OUString, Reference< browse::XBrowseNode > >> m_hBNA;
+    std::vector< OUString > m_vStr;
     OUString m_sNodeName;
     Reference< browse::XBrowseNode > m_origNode;
 
@@ -197,7 +194,7 @@ public:
         Sequence<  Reference< browse::XBrowseNode > > children( m_hBNA->size() );
         sal_Int32 index = 0;
 
-        vString::const_iterator it = m_vStr.begin();
+        auto it = m_vStr.begin();
 
         for ( ; it != m_vStr.end(); ++it, index++ )
         {
@@ -221,7 +218,7 @@ private:
 
     void loadChildNodes()
     {
-        m_hBNA.reset( new BrowseNodeAggregatorHash );
+        m_hBNA.reset( new std::unordered_map< OUString, Reference< browse::XBrowseNode > > );
 
         Sequence< Reference< browse::XBrowseNode > > langNodes =
             m_origNode->getChildNodes();
@@ -245,7 +242,7 @@ private:
             {
                 Reference< browse::XBrowseNode > grandchild(grandchildren[j]);
 
-                BrowseNodeAggregatorHash::iterator h_it =
+                auto h_it =
                     m_hBNA->find( grandchild->getName() );
 
                 if ( h_it != m_hBNA->end() )


More information about the Libreoffice-commits mailing list