diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-12-11 15:37:26 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-12-11 15:38:30 +0100 |
commit | 123e2c3e9350463fde38fbcbb522e3d6d8340ee6 (patch) | |
tree | c0f9350733d93f6a906cfe2f19b5dac66a655283 /comphelper | |
parent | Don't hold css::uno::Type instances by pointer (diff) | |
download | core-123e2c3e9350463fde38fbcbb522e3d6d8340ee6.tar.gz core-123e2c3e9350463fde38fbcbb522e3d6d8340ee6.zip |
Revert "Don't hold css::uno::Type instances by pointer"
This reverts commit 90f91088d238469b4a2262c91de3117ba40f5bde for now:
Ach, old GCC doesn't like plain string literals to initialize members
of OUString type...
Change-Id: I50563a00406259bb5d41831e2a2796762450d097
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/property/genericpropertyset.cxx | 10 | ||||
-rw-r--r-- | comphelper/source/property/propertysethelper.cxx | 20 | ||||
-rw-r--r-- | comphelper/source/property/propertysetinfo.cxx | 31 |
3 files changed, 35 insertions, 26 deletions
diff --git a/comphelper/source/property/genericpropertyset.cxx b/comphelper/source/property/genericpropertyset.cxx index e5d52a7546d0..feb803ef1dad 100644 --- a/comphelper/source/property/genericpropertyset.cxx +++ b/comphelper/source/property/genericpropertyset.cxx @@ -157,14 +157,15 @@ void GenericPropertySet::_setPropertyValues( const PropertyMapEntry** ppEntries, while( *ppEntries ) { - OInterfaceContainerHelper * pHelper = m_aListener.getContainer((*ppEntries)->maName); + const OUString aPropertyName( (*ppEntries)->mpName, (*ppEntries)->mnNameLen, RTL_TEXTENCODING_ASCII_US ); + OInterfaceContainerHelper * pHelper = m_aListener.getContainer(aPropertyName); - maAnyMap[ (*ppEntries)->maName ] = *pValues; + maAnyMap[ aPropertyName ] = *pValues; if ( pHelper ) { PropertyChangeEvent aEvt; - aEvt.PropertyName = (*ppEntries)->maName; + aEvt.PropertyName = aPropertyName; aEvt.NewValue = *pValues; aGuard.clear(); pHelper->notifyEach( &XPropertyChangeListener::propertyChange, aEvt ); @@ -183,7 +184,8 @@ void GenericPropertySet::_getPropertyValues( const comphelper::PropertyMapEntry* while( *ppEntries ) { - *pValue = maAnyMap[ (*ppEntries)->maName ]; + const OUString aPropertyName( (*ppEntries)->mpName, (*ppEntries)->mnNameLen, RTL_TEXTENCODING_ASCII_US ); + *pValue = maAnyMap[ aPropertyName ]; ppEntries++; pValue++; diff --git a/comphelper/source/property/propertysethelper.cxx b/comphelper/source/property/propertysethelper.cxx index 21cea0cc30bf..e1422cf21f3f 100644 --- a/comphelper/source/property/propertysethelper.cxx +++ b/comphelper/source/property/propertysethelper.cxx @@ -35,13 +35,13 @@ namespace comphelper class PropertySetHelperImpl { public: - PropertyMapEntry const * find( const OUString& aName ) const throw(); + PropertyMapEntry* find( const OUString& aName ) const throw(); PropertySetInfo* mpInfo; }; } -PropertyMapEntry const * PropertySetHelperImpl::find( const OUString& aName ) const throw() +PropertyMapEntry* PropertySetHelperImpl::find( const OUString& aName ) const throw() { PropertyMap::const_iterator aIter = mpInfo->getPropertyMap()->find( aName ); @@ -84,7 +84,7 @@ Reference< XPropertySetInfo > SAL_CALL PropertySetHelper::getPropertySetInfo( ) void SAL_CALL PropertySetHelper::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { - PropertyMapEntry const * aEntries[2]; + PropertyMapEntry* aEntries[2]; aEntries[0] = mp->find( aPropertyName ); if( NULL == aEntries[0] ) @@ -97,7 +97,7 @@ void SAL_CALL PropertySetHelper::setPropertyValue( const OUString& aPropertyName Any SAL_CALL PropertySetHelper::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { - PropertyMapEntry const * aEntries[2]; + PropertyMapEntry* aEntries[2]; aEntries[0] = mp->find( PropertyName ); if( NULL == aEntries[0] ) @@ -141,7 +141,7 @@ void SAL_CALL PropertySetHelper::setPropertyValues( const Sequence< OUString >& if( nCount ) { - PropertyMapEntry const ** pEntries = new PropertyMapEntry const *[nCount+1]; + PropertyMapEntry** pEntries = new PropertyMapEntry*[nCount+1]; pEntries[nCount] = NULL; const OUString* pNames = aPropertyNames.getConstArray(); @@ -170,7 +170,7 @@ Sequence< Any > SAL_CALL PropertySetHelper::getPropertyValues( const Sequence< O Sequence< Any > aValues; if( nCount ) { - PropertyMapEntry const ** pEntries = new PropertyMapEntry const *[nCount+1]; + PropertyMapEntry** pEntries = new PropertyMapEntry*[nCount+1]; pEntries[nCount] = NULL; const OUString* pNames = aPropertyNames.getConstArray(); @@ -215,7 +215,7 @@ void SAL_CALL PropertySetHelper::firePropertiesChangeEvent( const Sequence< OUSt // XPropertyState PropertyState SAL_CALL PropertySetHelper::getPropertyState( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException) { - PropertyMapEntry const * aEntries[2]; + PropertyMapEntry* aEntries[2]; aEntries[0] = mp->find( PropertyName ); if( aEntries[0] == NULL ) @@ -241,7 +241,7 @@ Sequence< PropertyState > SAL_CALL PropertySetHelper::getPropertyStates( const S sal_Bool bUnknown = sal_False; - PropertyMapEntry const ** pEntries = new PropertyMapEntry const *[nCount+1]; + PropertyMapEntry** pEntries = new PropertyMapEntry*[nCount+1]; sal_Int32 n; for( n = 0; !bUnknown && (n < nCount); n++, pNames++ ) @@ -266,7 +266,7 @@ Sequence< PropertyState > SAL_CALL PropertySetHelper::getPropertyStates( const S void SAL_CALL PropertySetHelper::setPropertyToDefault( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException) { - PropertyMapEntry const *pEntry = mp->find( PropertyName ); + PropertyMapEntry *pEntry = mp->find( PropertyName ); if( NULL == pEntry ) throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) ); @@ -275,7 +275,7 @@ void SAL_CALL PropertySetHelper::setPropertyToDefault( const OUString& PropertyN Any SAL_CALL PropertySetHelper::getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { - PropertyMapEntry const * pEntry = mp->find( aPropertyName ); + PropertyMapEntry* pEntry = mp->find( aPropertyName ); if( NULL == pEntry ) throw UnknownPropertyException( aPropertyName, static_cast< XPropertySet* >( this ) ); diff --git a/comphelper/source/property/propertysetinfo.cxx b/comphelper/source/property/propertysetinfo.cxx index cc4984122054..2567a0630109 100644 --- a/comphelper/source/property/propertysetinfo.cxx +++ b/comphelper/source/property/propertysetinfo.cxx @@ -35,7 +35,7 @@ public: PropertyMapImpl() throw(); virtual ~PropertyMapImpl() throw(); - void add( PropertyMapEntry const * pMap, sal_Int32 nCount = -1 ) throw(); + void add( PropertyMapEntry* pMap, sal_Int32 nCount = -1 ) throw(); void remove( const OUString& aName ) throw(); Sequence< Property > getProperties() throw(); @@ -59,23 +59,30 @@ PropertyMapImpl::~PropertyMapImpl() throw() { } -void PropertyMapImpl::add( PropertyMapEntry const * pMap, sal_Int32 nCount ) throw() +void PropertyMapImpl::add( PropertyMapEntry* pMap, sal_Int32 nCount ) throw() { // nCount < 0 => add all // nCount == 0 => add nothing // nCount > 0 => add at most nCount entries - while( !pMap->maName.isEmpty() && ( ( nCount < 0) || ( nCount-- > 0 ) ) ) + while( pMap->mpName && ( ( nCount < 0) || ( nCount-- > 0 ) ) ) { + OUString aName( pMap->mpName, pMap->mnNameLen, RTL_TEXTENCODING_ASCII_US ); + #ifdef DBG_UTIL - PropertyMap::iterator aIter = maPropertyMap.find( pMap->maName ); + PropertyMap::iterator aIter = maPropertyMap.find( aName ); if( aIter != maPropertyMap.end() ) { OSL_FAIL( "Warning: PropertyMapEntry added twice, possible error!"); } #endif + if( NULL == pMap->mpType ) + { + OSL_FAIL( "No type in PropertyMapEntry!"); + pMap->mpType = &::getCppuType((const sal_Int32*)0); + } - maPropertyMap[pMap->maName] = pMap; + maPropertyMap[aName] = pMap; if( maProperties.getLength() ) maProperties.realloc( 0 ); @@ -106,11 +113,11 @@ Sequence< Property > PropertyMapImpl::getProperties() throw() const PropertyMap::iterator aEnd = maPropertyMap.end(); while( aIter != aEnd ) { - PropertyMapEntry const * pEntry = (*aIter).second; + PropertyMapEntry* pEntry = (*aIter).second; - pProperties->Name = pEntry->maName; + pProperties->Name = OUString( pEntry->mpName, pEntry->mnNameLen, RTL_TEXTENCODING_ASCII_US ); pProperties->Handle = pEntry->mnHandle; - pProperties->Type = pEntry->maType; + pProperties->Type = *pEntry->mpType; pProperties->Attributes = pEntry->mnAttributes; ++pProperties; @@ -133,9 +140,9 @@ Property PropertyMapImpl::getPropertyByName( const OUString& aName ) throw( Unkn if( maPropertyMap.end() == aIter ) throw UnknownPropertyException( aName, NULL ); - PropertyMapEntry const * pEntry = (*aIter).second; + PropertyMapEntry* pEntry = (*aIter).second; - return Property( aName, pEntry->mnHandle, pEntry->maType, pEntry->mnAttributes ); + return Property( aName, pEntry->mnHandle, *pEntry->mpType, pEntry->mnAttributes ); } sal_Bool PropertyMapImpl::hasPropertyByName( const OUString& aName ) throw() @@ -150,7 +157,7 @@ PropertySetInfo::PropertySetInfo() throw() mpMap = new PropertyMapImpl(); } -PropertySetInfo::PropertySetInfo( PropertyMapEntry const * pMap ) throw() +PropertySetInfo::PropertySetInfo( PropertyMapEntry* pMap ) throw() { mpMap = new PropertyMapImpl(); mpMap->add( pMap ); @@ -161,7 +168,7 @@ PropertySetInfo::~PropertySetInfo() throw() delete mpMap; } -void PropertySetInfo::add( PropertyMapEntry const * pMap ) throw() +void PropertySetInfo::add( PropertyMapEntry* pMap ) throw() { mpMap->add( pMap ); } |