summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-06-12 22:43:05 +0200
committerMichael Stahl <mstahl@redhat.com>2012-06-12 23:25:16 +0200
commita96d082bc03683e9920a53ede7becb048240fbd5 (patch)
treefa24a5187f601c25b072236e0c514e0bc7658604 /basic
parenta7a6f775826a7d1c365b5ca0725b61c7fedf0f0b (diff)
convert SbPropertyValueArr_Impl to boost::ptr_vector
Change-Id: Id3189a9abff5ee97b93bccefba8193ba36cb043a
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/propacc.cxx25
-rw-r--r--basic/source/inc/propacc.hxx5
2 files changed, 14 insertions, 16 deletions
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index 97280231be45..b4e351ac247f 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -62,13 +62,13 @@ int CDECL SbCompare_PropertyValues_Impl( const void *arg1, const void *arg2 )
struct SbCompare_UString_PropertyValue_Impl
{
- bool operator() ( const ::rtl::OUString& lhs, PropertyValue* const & rhs )
+ bool operator() (const ::rtl::OUString& lhs, PropertyValue const & rhs)
{
- return lhs.compareTo(rhs->Name) < 0;
+ return lhs.compareTo(rhs.Name) < 0;
}
- bool operator() ( PropertyValue* const & lhs, const ::rtl::OUString& rhs )
+ bool operator() (PropertyValue const & lhs, const ::rtl::OUString& rhs)
{
- return lhs->Name.compareTo(rhs) < 0;
+ return lhs.Name.compareTo(rhs) < 0;
}
};
@@ -95,9 +95,6 @@ SbPropertyValues::SbPropertyValues()
SbPropertyValues::~SbPropertyValues()
{
m_xInfo = Reference< XPropertySetInfo >();
-
- for ( sal_uInt16 n = 0; n < m_aPropVals.size(); ++n )
- delete m_aPropVals[ n ];
}
//----------------------------------------------------------------------------
@@ -141,8 +138,8 @@ void SbPropertyValues::setPropertyValue(
::com::sun::star::uno::RuntimeException)
{
size_t const nIndex = GetIndex_Impl( aPropertyName );
- PropertyValue *const pPropVal = m_aPropVals[nIndex];
- pPropVal->Value = aValue;
+ PropertyValue & rPropVal = m_aPropVals[nIndex];
+ rPropVal.Value = aValue;
}
//----------------------------------------------------------------------------
@@ -154,7 +151,7 @@ Any SbPropertyValues::getPropertyValue(
::com::sun::star::uno::RuntimeException)
{
size_t const nIndex = GetIndex_Impl( aPropertyName );
- return m_aPropVals[nIndex]->Value;
+ return m_aPropVals[nIndex].Value;
}
//----------------------------------------------------------------------------
@@ -202,8 +199,8 @@ void SbPropertyValues::removeVetoableChangeListener(
Sequence< PropertyValue > SbPropertyValues::getPropertyValues(void) throw (::com::sun::star::uno::RuntimeException)
{
Sequence<PropertyValue> aRet( m_aPropVals.size() );
- for ( sal_uInt16 n = 0; n < m_aPropVals.size(); ++n )
- aRet.getArray()[n] = *m_aPropVals[n];
+ for (size_t n = 0; n < m_aPropVals.size(); ++n)
+ aRet.getArray()[n] = m_aPropVals[n];
return aRet;
}
@@ -220,7 +217,7 @@ void SbPropertyValues::setPropertyValues(const Sequence< PropertyValue >& rPrope
throw PropertyExistException();
const PropertyValue *pPropVals = rPropertyValues.getConstArray();
- for ( sal_Int16 n = 0; n < rPropertyValues.getLength(); ++n )
+ for (sal_Int32 n = 0; n < rPropertyValues.getLength(); ++n)
{
PropertyValue *pPropVal = new PropertyValue(pPropVals[n]);
m_aPropVals.push_back( pPropVal );
@@ -272,7 +269,7 @@ SbPropertySetInfo::SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals )
for ( sal_uInt16 n = 0; n < rPropVals.size(); ++n )
{
Property &rProp = aImpl._aProps.getArray()[n];
- const PropertyValue &rPropVal = *rPropVals[n];
+ const PropertyValue &rPropVal = rPropVals[n];
rProp.Name = rPropVal.Name;
rProp.Handle = rPropVal.Handle;
rProp.Type = getCppuVoidType();
diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx
index 3afbd2288f2a..d14cf5157d04 100644
--- a/basic/source/inc/propacc.hxx
+++ b/basic/source/inc/propacc.hxx
@@ -35,9 +35,10 @@
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
-#include <vector>
+#include <boost/ptr_container/ptr_vector.hpp>
-typedef std::vector< ::com::sun::star::beans::PropertyValue* > SbPropertyValueArr_Impl;
+typedef ::boost::ptr_vector< ::com::sun::star::beans::PropertyValue >
+ SbPropertyValueArr_Impl;
typedef ::cppu::WeakImplHelper2< ::com::sun::star::beans::XPropertySet,
::com::sun::star::beans::XPropertyAccess > SbPropertyValuesHelper;