diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-12-12 12:31:38 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-12-12 15:10:35 +0100 |
commit | 45c0a6174d452b9eb0ab2b5f8d9743922049338c (patch) | |
tree | 7c50153534956008c382b5a60f6388674941e9f6 /comphelper | |
parent | dbbcdd877b1644d9a7b1bb013460681428a00855 (diff) |
Simplify comphelper::PropertyInfo
...as its sole two uses (in sw) are already fine with initializing arrays of
it dynamically, there is no harm in changing it and thereby getting rid of the
last use of comphelper/TypeGeneration.hxx.
Change-Id: I11931dbbec48dac5a694a59cf6425206c806fbfb
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/property/ChainablePropertySetInfo.cxx | 31 | ||||
-rw-r--r-- | comphelper/source/property/MasterPropertySetInfo.cxx | 30 |
2 files changed, 23 insertions, 38 deletions
diff --git a/comphelper/source/property/ChainablePropertySetInfo.cxx b/comphelper/source/property/ChainablePropertySetInfo.cxx index c645af7c1c15..97be665f5b65 100644 --- a/comphelper/source/property/ChainablePropertySetInfo.cxx +++ b/comphelper/source/property/ChainablePropertySetInfo.cxx @@ -18,10 +18,8 @@ */ #include <comphelper/ChainablePropertySetInfo.hxx> -#include <comphelper/TypeGeneration.hxx> using ::comphelper::PropertyInfo; -using ::comphelper::GenerateCppuType; using ::comphelper::ChainablePropertySetInfo; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Type; @@ -33,7 +31,7 @@ using ::com::sun::star::beans::Property; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::beans::UnknownPropertyException; -ChainablePropertySetInfo::ChainablePropertySetInfo( PropertyInfo* pMap ) +ChainablePropertySetInfo::ChainablePropertySetInfo( PropertyInfo const * pMap ) throw() { add ( pMap ); @@ -44,7 +42,7 @@ ChainablePropertySetInfo::~ChainablePropertySetInfo() { } -void ChainablePropertySetInfo::add( PropertyInfo* pMap, sal_Int32 nCount ) +void ChainablePropertySetInfo::add( PropertyInfo const * pMap, sal_Int32 nCount ) throw() { // nCount < 0 => add all @@ -53,16 +51,15 @@ void ChainablePropertySetInfo::add( PropertyInfo* pMap, sal_Int32 nCount ) if( maProperties.getLength() ) maProperties.realloc( 0 ); - while( pMap->mpName && ( ( nCount < 0) || ( nCount-- > 0 ) ) ) + while( !pMap->maName.isEmpty() && ( ( nCount < 0) || ( nCount-- > 0 ) ) ) { - OUString aName( pMap->mpName, pMap->mnNameLen, RTL_TEXTENCODING_ASCII_US ); - #ifdef DBG_UTIL - PropertyInfoHash::iterator aIter = maMap.find( aName ); + PropertyInfoHash::iterator aIter = maMap.find( pMap->maName ); if( aIter != maMap.end() ) OSL_FAIL( "Warning: PropertyInfo added twice, possible error!"); #endif - maMap[aName] = pMap++; + maMap[pMap->maName] = pMap; + ++pMap; } } @@ -85,13 +82,11 @@ Sequence< ::Property > SAL_CALL ChainablePropertySetInfo::getProperties() for (PropertyInfoHash::const_iterator aIter(maMap.begin()), aEnd(maMap.end()); aIter != aEnd; ++aIter, ++pProperties) { - PropertyInfo* pInfo = (*aIter).second; + PropertyInfo const * pInfo = (*aIter).second; - pProperties->Name = OUString( pInfo->mpName, pInfo->mnNameLen, RTL_TEXTENCODING_ASCII_US ); + pProperties->Name = pInfo->maName; pProperties->Handle = pInfo->mnHandle; - const Type* pType; - GenerateCppuType ( pInfo->meCppuType, pType); - pProperties->Type = *pType; + pProperties->Type = pInfo->maType; pProperties->Attributes = pInfo->mnAttributes; } } @@ -106,13 +101,11 @@ Property SAL_CALL ChainablePropertySetInfo::getPropertyByName( const OUString& r if ( maMap.end() == aIter ) throw UnknownPropertyException( rName, *this ); - PropertyInfo *pInfo = (*aIter).second; + PropertyInfo const *pInfo = (*aIter).second; Property aProperty; - aProperty.Name = OUString( pInfo->mpName, pInfo->mnNameLen, RTL_TEXTENCODING_ASCII_US ); + aProperty.Name = pInfo->maName; aProperty.Handle = pInfo->mnHandle; - const Type* pType = &aProperty.Type; - GenerateCppuType ( pInfo->meCppuType, pType ); - aProperty.Type = *pType; + aProperty.Type = pInfo->maType; aProperty.Attributes = pInfo->mnAttributes; return aProperty; } diff --git a/comphelper/source/property/MasterPropertySetInfo.cxx b/comphelper/source/property/MasterPropertySetInfo.cxx index e85d7402eb3a..d6f1496dfb4b 100644 --- a/comphelper/source/property/MasterPropertySetInfo.cxx +++ b/comphelper/source/property/MasterPropertySetInfo.cxx @@ -18,10 +18,8 @@ */ #include <comphelper/MasterPropertySetInfo.hxx> -#include <comphelper/TypeGeneration.hxx> using ::comphelper::PropertyInfo; -using ::comphelper::GenerateCppuType; using ::comphelper::MasterPropertySetInfo; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Type; @@ -33,7 +31,7 @@ using ::com::sun::star::beans::Property; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::beans::UnknownPropertyException; -MasterPropertySetInfo::MasterPropertySetInfo( PropertyInfo* pMap ) +MasterPropertySetInfo::MasterPropertySetInfo( PropertyInfo const * pMap ) throw() { add ( pMap ); @@ -50,7 +48,7 @@ MasterPropertySetInfo::~MasterPropertySetInfo() } } -void MasterPropertySetInfo::add( PropertyInfo* pMap, sal_Int32 nCount, sal_uInt8 nMapId ) +void MasterPropertySetInfo::add( PropertyInfo const * pMap, sal_Int32 nCount, sal_uInt8 nMapId ) throw() { // nCount < 0 => add all @@ -59,16 +57,14 @@ void MasterPropertySetInfo::add( PropertyInfo* pMap, sal_Int32 nCount, sal_uInt8 if( maProperties.getLength() ) maProperties.realloc( 0 ); - for ( ; pMap->mpName && ( ( nCount < 0 ) || ( nCount > 0 ) ); --nCount, ++pMap ) + for ( ; !pMap->maName.isEmpty() && ( ( nCount < 0 ) || ( nCount > 0 ) ); --nCount, ++pMap ) { - OUString aName( pMap->mpName, pMap->mnNameLen, RTL_TEXTENCODING_ASCII_US ); - #ifdef DBG_UTIL - PropertyDataHash::iterator aIter = maMap.find( aName ); + PropertyDataHash::iterator aIter = maMap.find( pMap->maName ); if( aIter != maMap.end() ) OSL_FAIL( "Warning: PropertyInfo added twice, possible error!"); #endif - maMap[aName] = new PropertyData ( nMapId, pMap ); + maMap[pMap->maName] = new PropertyData ( nMapId, pMap ); } } @@ -102,13 +98,11 @@ Sequence< ::Property > SAL_CALL MasterPropertySetInfo::getProperties() for (PropertyDataHash::const_iterator aIter(maMap.begin()), aEnd(maMap.end()) ; aIter != aEnd; ++aIter, ++pProperties) { - PropertyInfo* pInfo = (*aIter).second->mpInfo; + PropertyInfo const * pInfo = (*aIter).second->mpInfo; - pProperties->Name = OUString( pInfo->mpName, pInfo->mnNameLen, RTL_TEXTENCODING_ASCII_US ); + pProperties->Name = pInfo->maName; pProperties->Handle = pInfo->mnHandle; - const Type* pType; - GenerateCppuType ( pInfo->meCppuType, pType); - pProperties->Type = *pType; + pProperties->Type = pInfo->maType; pProperties->Attributes = pInfo->mnAttributes; } } @@ -123,13 +117,11 @@ Property SAL_CALL MasterPropertySetInfo::getPropertyByName( const OUString& rNam if ( maMap.end() == aIter ) throw UnknownPropertyException( rName, *this ); - PropertyInfo *pInfo = (*aIter).second->mpInfo; + PropertyInfo const *pInfo = (*aIter).second->mpInfo; Property aProperty; - aProperty.Name = OUString( pInfo->mpName, pInfo->mnNameLen, RTL_TEXTENCODING_ASCII_US ); + aProperty.Name = pInfo->maName; aProperty.Handle = pInfo->mnHandle; - const Type* pType; - GenerateCppuType ( pInfo->meCppuType, pType ); - aProperty.Type = *pType; + aProperty.Type = pInfo->maType; aProperty.Attributes = pInfo->mnAttributes; return aProperty; |