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

Ian ian.gilham at gmail.com
Fri Aug 7 00:04:05 PDT 2015


 scaddins/source/datefunc/datefunc.cxx |   14 +++-------
 scaddins/source/datefunc/datefunc.hxx |   44 ++--------------------------------
 2 files changed, 7 insertions(+), 51 deletions(-)

New commits:
commit 09a9234c021ad98c5adeb493b5814e97b92ee912
Author: Ian <ian.gilham at gmail.com>
Date:   Thu Aug 6 16:24:50 2015 +0100

    tdf#90222: Removed ScaStringList and replaced all uses with std::vector
    
    Change-Id: Icd12e4a1557b39fd387173ce261118c27200dd2b
    Reviewed-on: https://gerrit.libreoffice.org/17543
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx
index 64679ff..f3fe9a8 100644
--- a/scaddins/source/datefunc/datefunc.cxx
+++ b/scaddins/source/datefunc/datefunc.cxx
@@ -62,12 +62,6 @@ void ScaList::_Grow()
     pData = pNewData;
 }
 
-ScaStringList::~ScaStringList()
-{
-    for( OUString* pStr = First(); pStr; pStr = Next() )
-        delete pStr;
-}
-
 ScaResId::ScaResId( sal_uInt16 nId, ResMgr& rResMgr ) :
     ResId( nId, rResMgr )
 {
@@ -109,7 +103,7 @@ ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rResMgr ) :
     const ResStringArray& rArr = aArrLoader.GetStringArray();
 
     for( sal_uInt32 nIndex = 0; nIndex < rArr.Count(); nIndex++ )
-        aCompList.Append( rArr.GetString( nIndex ) );
+        aCompList.push_back( rArr.GetString( nIndex ) );
 }
 
 ScaFuncData::~ScaFuncData()
@@ -445,14 +439,14 @@ uno::Sequence< sheet::LocalizedName > SAL_CALL ScaDateAddIn::getCompatibilityNam
     if( !pFData )
         return uno::Sequence< sheet::LocalizedName >( 0 );
 
-    const ScaStringList& rStrList = pFData->GetCompNameList();
-    sal_uInt32 nCount = rStrList.Count();
+    const std::vector<OUString>& rStrList = pFData->GetCompNameList();
+    sal_uInt32 nCount = rStrList.size();
 
     uno::Sequence< sheet::LocalizedName > aRet( nCount );
     sheet::LocalizedName* pArray = aRet.getArray();
 
     for( sal_uInt32 nIndex = 0; nIndex < nCount; nIndex++ )
-        pArray[ nIndex ] = sheet::LocalizedName( GetLocale( nIndex ), *rStrList.Get( nIndex ) );
+        pArray[ nIndex ] = sheet::LocalizedName( GetLocale( nIndex ), rStrList.at( nIndex ) );
 
     return aRet;
 }
diff --git a/scaddins/source/datefunc/datefunc.hxx b/scaddins/source/datefunc/datefunc.hxx
index 9922bdf..db6e8f1 100644
--- a/scaddins/source/datefunc/datefunc.hxx
+++ b/scaddins/source/datefunc/datefunc.hxx
@@ -23,6 +23,7 @@
 #define INCLUDED_SCADDINS_SOURCE_DATEFUNC_DATEFUNC_HXX
 
 #include <string.h>
+#include <vector>
 #include <com/sun/star/lang/XServiceName.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -78,45 +79,6 @@ inline void ScaList::Append( void* pNew )
 }
 
 
-class ScaStringList : protected ScaList
-{
-public:
-    inline                      ScaStringList() : ScaList() {};
-    virtual                     ~ScaStringList();
-
-                                using ScaList::Count;
-
-    inline const OUString* Get( sal_uInt32 nIndex ) const;
-
-    inline OUString*     First();
-    inline OUString*     Next();
-
-    using ScaList::Append;
-    inline void                 Append( const OUString& rNew );
-};
-
-
-inline const OUString* ScaStringList::Get( sal_uInt32 nIndex ) const
-{
-    return static_cast< const OUString* >( ScaList::GetObject( nIndex ) );
-}
-
-inline OUString* ScaStringList::First()
-{
-    return static_cast< OUString* >( ScaList::First() );
-}
-
-inline OUString* ScaStringList::Next()
-{
-    return static_cast< OUString* >( ScaList::Next() );
-}
-
-inline void ScaStringList::Append( const OUString& rNew )
-{
-    ScaList::Append( new OUString( rNew ) );
-}
-
-
 class ScaResId : public ResId
 {
 public:
@@ -214,7 +176,7 @@ private:
     sal_uInt16                  nDescrID;           // leads also to parameter descriptions!
     sal_uInt16                  nCompListID;        // resource ID to list of valid names
     sal_uInt16                  nParamCount;        // num of parameters
-    ScaStringList               aCompList;          // list of all valid names
+    std::vector<OUString>       aCompList;          // list of all valid names
     ScaCategory                 eCat;               // function category
     bool                    bDouble;            // name already exist in Calc
     bool                    bWithOpt;           // first parameter is internal
@@ -232,7 +194,7 @@ public:
     inline bool                 Is( const OUString& rCompare ) const
                                                     { return aIntName == rCompare; }
 
-    inline const ScaStringList& GetCompNameList() const { return aCompList; }
+    inline const std::vector<OUString>& GetCompNameList() const { return aCompList; }
 };
 
 


More information about the Libreoffice-commits mailing list