summaryrefslogtreecommitdiff
path: root/scaddins
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-01-10 10:42:12 +0200
committerNoel Grandin <noel@peralex.com>2014-01-20 13:14:21 +0200
commit9ed624752f2a3648ab109e57680e285683387d64 (patch)
tree9e17e4aac3aa24c4f6b4daa0aa66987420b54038 /scaddins
parenta08633b07a4370d16cdba43427ddb57a7feb7552 (diff)
Convert custom list implementation ComplexList to use std::vector
Change-Id: Ifd02215e2b86fb9c527db0d4011781c4959c29bf
Diffstat (limited to 'scaddins')
-rw-r--r--scaddins/source/analysis/analysis.cxx22
-rw-r--r--scaddins/source/analysis/analysishelper.cxx4
-rw-r--r--scaddins/source/analysis/analysishelper.hxx28
3 files changed, 19 insertions, 35 deletions
diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx
index bec4960e32be..f2fa49feacb5 100644
--- a/scaddins/source/analysis/analysis.cxx
+++ b/scaddins/source/analysis/analysis.cxx
@@ -1120,15 +1120,12 @@ OUString SAL_CALL AnalysisAddIn::getImproduct( const uno::Reference< beans::XPro
z_list.Append( aNum1, AH_IgnoreEmpty );
z_list.Append( aNL, AH_IgnoreEmpty );
- const Complex* p = z_list.First();
-
- if( !p )
+ if( z_list.empty() )
return Complex( 0 ).GetString();
- Complex z( *p );
-
- for( p = z_list.Next() ; p ; p = z_list.Next() )
- z.Mult( *p );
+ Complex z( *(z_list.Get(0)) );
+ for( sal_uInt32 i = 1; i < z_list.Count(); ++i )
+ z.Mult( *(z_list.Get(i)) );
return z.GetString();
}
@@ -1168,15 +1165,12 @@ OUString SAL_CALL AnalysisAddIn::getImsum( const uno::Reference< beans::XPropert
z_list.Append( aNum1, AH_IgnoreEmpty );
z_list.Append( aFollowingPars, AH_IgnoreEmpty );
- const Complex* p = z_list.First();
-
- if( !p )
+ if( z_list.empty() )
return Complex( 0 ).GetString();
- Complex z( *p );
-
- for( p = z_list.Next() ; p ; p = z_list.Next() )
- z.Add( *p );
+ Complex z( *(z_list.Get(0)) );
+ for( sal_uInt32 i = 1; i < z_list.Count(); ++i )
+ z.Add( *(z_list.Get(i)) );
return z.GetString();
}
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index 11c4eb57bced..c60bc08fcb20 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -2195,8 +2195,8 @@ void Complex::Csch(void) throw( uno::RuntimeException, lang::IllegalArgumentExce
ComplexList::~ComplexList()
{
- for( Complex* p = ( Complex* ) First() ; p ; p = ( Complex* ) Next() )
- delete p;
+ for( sal_uInt32 i = 0; i < maVector.size(); ++i )
+ delete maVector[i];
}
diff --git a/scaddins/source/analysis/analysishelper.hxx b/scaddins/source/analysis/analysishelper.hxx
index 510c6bdaafe2..81a48ebb8a2e 100644
--- a/scaddins/source/analysis/analysishelper.hxx
+++ b/scaddins/source/analysis/analysishelper.hxx
@@ -466,18 +466,20 @@ enum ComplListAppendHandl
};
-class ComplexList : protected MyList
+class ComplexList
{
+private:
+ std::vector<Complex*> maVector;
public:
virtual ~ComplexList();
inline const Complex* Get( sal_uInt32 nIndex ) const;
- inline const Complex* First( void );
- inline const Complex* Next( void );
- using MyList::Count;
+ inline bool empty( void ) const
+ { return maVector.empty(); }
+ inline sal_uInt32 Count( void ) const
+ { return maVector.size(); }
- using MyList::Append;
inline void Append( Complex* pNew );
void Append( const css::uno::Sequence< css::uno::Sequence< OUString > >& rComplexNumList, ComplListAppendHandl eAH = AH_EmpyAs0 ) throw( css::uno::RuntimeException, css::lang::IllegalArgumentException );
void Append( const css::uno::Sequence< css::uno::Any >& aMultPars,ComplListAppendHandl eAH = AH_EmpyAs0 ) throw( css::uno::RuntimeException, css::lang::IllegalArgumentException );
@@ -791,25 +793,13 @@ inline void Complex::Add( const Complex& rAdd )
inline const Complex* ComplexList::Get( sal_uInt32 n ) const
{
- return ( const Complex* ) MyList::GetObject( n );
-}
-
-
-inline const Complex* ComplexList::First( void )
-{
- return ( const Complex* ) MyList::First();
-}
-
-
-inline const Complex* ComplexList::Next( void )
-{
- return ( const Complex* ) MyList::Next();
+ return maVector[n];
}
inline void ComplexList::Append( Complex* p )
{
- MyList::Append( p );
+ maVector.push_back(p);
}