Kaydet (Commit) a96d082b authored tarafından Michael Stahl's avatar Michael Stahl

convert SbPropertyValueArr_Impl to boost::ptr_vector

Change-Id: Id3189a9abff5ee97b93bccefba8193ba36cb043a
üst a7a6f775
...@@ -62,13 +62,13 @@ int CDECL SbCompare_PropertyValues_Impl( const void *arg1, const void *arg2 ) ...@@ -62,13 +62,13 @@ int CDECL SbCompare_PropertyValues_Impl( const void *arg1, const void *arg2 )
struct SbCompare_UString_PropertyValue_Impl 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() ...@@ -95,9 +95,6 @@ SbPropertyValues::SbPropertyValues()
SbPropertyValues::~SbPropertyValues() SbPropertyValues::~SbPropertyValues()
{ {
m_xInfo = Reference< XPropertySetInfo >(); 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( ...@@ -141,8 +138,8 @@ void SbPropertyValues::setPropertyValue(
::com::sun::star::uno::RuntimeException) ::com::sun::star::uno::RuntimeException)
{ {
size_t const nIndex = GetIndex_Impl( aPropertyName ); size_t const nIndex = GetIndex_Impl( aPropertyName );
PropertyValue *const pPropVal = m_aPropVals[nIndex]; PropertyValue & rPropVal = m_aPropVals[nIndex];
pPropVal->Value = aValue; rPropVal.Value = aValue;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -154,7 +151,7 @@ Any SbPropertyValues::getPropertyValue( ...@@ -154,7 +151,7 @@ Any SbPropertyValues::getPropertyValue(
::com::sun::star::uno::RuntimeException) ::com::sun::star::uno::RuntimeException)
{ {
size_t const nIndex = GetIndex_Impl( aPropertyName ); size_t const nIndex = GetIndex_Impl( aPropertyName );
return m_aPropVals[nIndex]->Value; return m_aPropVals[nIndex].Value;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -202,8 +199,8 @@ void SbPropertyValues::removeVetoableChangeListener( ...@@ -202,8 +199,8 @@ void SbPropertyValues::removeVetoableChangeListener(
Sequence< PropertyValue > SbPropertyValues::getPropertyValues(void) throw (::com::sun::star::uno::RuntimeException) Sequence< PropertyValue > SbPropertyValues::getPropertyValues(void) throw (::com::sun::star::uno::RuntimeException)
{ {
Sequence<PropertyValue> aRet( m_aPropVals.size() ); Sequence<PropertyValue> aRet( m_aPropVals.size() );
for ( sal_uInt16 n = 0; n < m_aPropVals.size(); ++n ) for (size_t n = 0; n < m_aPropVals.size(); ++n)
aRet.getArray()[n] = *m_aPropVals[n]; aRet.getArray()[n] = m_aPropVals[n];
return aRet; return aRet;
} }
...@@ -220,7 +217,7 @@ void SbPropertyValues::setPropertyValues(const Sequence< PropertyValue >& rPrope ...@@ -220,7 +217,7 @@ void SbPropertyValues::setPropertyValues(const Sequence< PropertyValue >& rPrope
throw PropertyExistException(); throw PropertyExistException();
const PropertyValue *pPropVals = rPropertyValues.getConstArray(); 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]); PropertyValue *pPropVal = new PropertyValue(pPropVals[n]);
m_aPropVals.push_back( pPropVal ); m_aPropVals.push_back( pPropVal );
...@@ -272,7 +269,7 @@ SbPropertySetInfo::SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals ) ...@@ -272,7 +269,7 @@ SbPropertySetInfo::SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals )
for ( sal_uInt16 n = 0; n < rPropVals.size(); ++n ) for ( sal_uInt16 n = 0; n < rPropVals.size(); ++n )
{ {
Property &rProp = aImpl._aProps.getArray()[n]; Property &rProp = aImpl._aProps.getArray()[n];
const PropertyValue &rPropVal = *rPropVals[n]; const PropertyValue &rPropVal = rPropVals[n];
rProp.Name = rPropVal.Name; rProp.Name = rPropVal.Name;
rProp.Handle = rPropVal.Handle; rProp.Handle = rPropVal.Handle;
rProp.Type = getCppuVoidType(); rProp.Type = getCppuVoidType();
......
...@@ -35,9 +35,10 @@ ...@@ -35,9 +35,10 @@
#include <com/sun/star/beans/XPropertyContainer.hpp> #include <com/sun/star/beans/XPropertyContainer.hpp>
#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.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, typedef ::cppu::WeakImplHelper2< ::com::sun::star::beans::XPropertySet,
::com::sun::star::beans::XPropertyAccess > SbPropertyValuesHelper; ::com::sun::star::beans::XPropertyAccess > SbPropertyValuesHelper;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment