summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-12-12 12:48:55 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-12-12 15:10:35 +0100
commitab9e014d6fc1050de8510dbec816535972569bab (patch)
tree7d35a3fd5f93f32bd65914ae953ab237bbd5cef5
parent3f3c755475728b2f73ac45be3229970b5d616496 (diff)
Some clean-up
Change-Id: I8ea3018efb01069b9a0555d9ac4ddfa89a990ba8
-rw-r--r--comphelper/source/property/ChainablePropertySetInfo.cxx31
-rw-r--r--comphelper/source/property/MasterPropertySetInfo.cxx38
-rw-r--r--include/comphelper/ChainablePropertySetInfo.hxx22
-rw-r--r--include/comphelper/MasterPropertySetInfo.hxx20
4 files changed, 37 insertions, 74 deletions
diff --git a/comphelper/source/property/ChainablePropertySetInfo.cxx b/comphelper/source/property/ChainablePropertySetInfo.cxx
index 97be665f5b65..5188331db2ad 100644
--- a/comphelper/source/property/ChainablePropertySetInfo.cxx
+++ b/comphelper/source/property/ChainablePropertySetInfo.cxx
@@ -32,9 +32,14 @@ using ::com::sun::star::beans::XPropertySetInfo;
using ::com::sun::star::beans::UnknownPropertyException;
ChainablePropertySetInfo::ChainablePropertySetInfo( PropertyInfo const * pMap )
- throw()
{
- add ( pMap );
+ for( ; !pMap->maName.isEmpty(); ++pMap )
+ {
+ SAL_WARN_IF(
+ maMap.find(pMap->maName) != maMap.end(),
+ "comphelper", "Duplicate property name \"" << pMap->maName << "\"");
+ maMap[pMap->maName] = pMap;
+ }
}
ChainablePropertySetInfo::~ChainablePropertySetInfo()
@@ -42,29 +47,7 @@ ChainablePropertySetInfo::~ChainablePropertySetInfo()
{
}
-void ChainablePropertySetInfo::add( PropertyInfo const * pMap, sal_Int32 nCount )
- throw()
-{
- // nCount < 0 => add all
- // nCount == 0 => add nothing
- // nCount > 0 => add at most nCount entries
- if( maProperties.getLength() )
- maProperties.realloc( 0 );
-
- while( !pMap->maName.isEmpty() && ( ( nCount < 0) || ( nCount-- > 0 ) ) )
- {
-#ifdef DBG_UTIL
- PropertyInfoHash::iterator aIter = maMap.find( pMap->maName );
- if( aIter != maMap.end() )
- OSL_FAIL( "Warning: PropertyInfo added twice, possible error!");
-#endif
- maMap[pMap->maName] = pMap;
- ++pMap;
- }
-}
-
void ChainablePropertySetInfo::remove( const OUString& aName )
- throw()
{
maMap.erase ( aName );
if ( maProperties.getLength() )
diff --git a/comphelper/source/property/MasterPropertySetInfo.cxx b/comphelper/source/property/MasterPropertySetInfo.cxx
index d6f1496dfb4b..5628e641e5bc 100644
--- a/comphelper/source/property/MasterPropertySetInfo.cxx
+++ b/comphelper/source/property/MasterPropertySetInfo.cxx
@@ -32,9 +32,14 @@ using ::com::sun::star::beans::XPropertySetInfo;
using ::com::sun::star::beans::UnknownPropertyException;
MasterPropertySetInfo::MasterPropertySetInfo( PropertyInfo const * pMap )
- throw()
{
- add ( pMap );
+ for ( ; !pMap->maName.isEmpty(); ++pMap )
+ {
+ SAL_WARN_IF(
+ maMap.find(pMap->maName) != maMap.end(),
+ "comphelper", "Duplicate property name \"" << pMap->maName << "\"");
+ maMap[pMap->maName] = new PropertyData ( 0, pMap );
+ }
}
MasterPropertySetInfo::~MasterPropertySetInfo()
@@ -48,28 +53,7 @@ MasterPropertySetInfo::~MasterPropertySetInfo()
}
}
-void MasterPropertySetInfo::add( PropertyInfo const * pMap, sal_Int32 nCount, sal_uInt8 nMapId )
- throw()
-{
- // nCount < 0 => add all
- // nCount == 0 => add nothing
- // nCount > 0 => add at most nCount entries
- if( maProperties.getLength() )
- maProperties.realloc( 0 );
-
- for ( ; !pMap->maName.isEmpty() && ( ( nCount < 0 ) || ( nCount > 0 ) ); --nCount, ++pMap )
- {
-#ifdef DBG_UTIL
- PropertyDataHash::iterator aIter = maMap.find( pMap->maName );
- if( aIter != maMap.end() )
- OSL_FAIL( "Warning: PropertyInfo added twice, possible error!");
-#endif
- maMap[pMap->maName] = new PropertyData ( nMapId, pMap );
- }
-}
-
void MasterPropertySetInfo::add( PropertyInfoHash &rHash, sal_uInt8 nMapId )
- throw()
{
if( maProperties.getLength() )
maProperties.realloc( 0 );
@@ -77,11 +61,9 @@ void MasterPropertySetInfo::add( PropertyInfoHash &rHash, sal_uInt8 nMapId )
while ( aIter != aEnd )
{
-#ifdef DBG_UTIL
- PropertyDataHash::iterator aDebugIter = maMap.find( (*aIter).first );
- if( aDebugIter != maMap.end() )
- OSL_FAIL( "Warning: PropertyInfo added twice, possible error!");
-#endif
+ SAL_WARN_IF(
+ maMap.find(aIter->first) != maMap.end(),
+ "comphelper", "Duplicate property name \"" << aIter->first << "\"");
maMap[(*aIter).first] = new PropertyData ( nMapId, (*aIter).second );
++aIter;
}
diff --git a/include/comphelper/ChainablePropertySetInfo.hxx b/include/comphelper/ChainablePropertySetInfo.hxx
index e5d731d429c6..5da0dc79032d 100644
--- a/include/comphelper/ChainablePropertySetInfo.hxx
+++ b/include/comphelper/ChainablePropertySetInfo.hxx
@@ -37,21 +37,13 @@ namespace comphelper
public ::cppu::WeakImplHelper1<
::com::sun::star::beans::XPropertySetInfo >
{
- friend class ChainablePropertySet;
- friend class MasterPropertySet;
- protected:
- PropertyInfoHash maMap;
- com::sun::star::uno::Sequence < com::sun::star::beans::Property > maProperties;
public:
- ChainablePropertySetInfo( PropertyInfo const * pMap )
- throw();
+ ChainablePropertySetInfo( PropertyInfo const * pMap );
- virtual ~ChainablePropertySetInfo()
- throw();
+ void remove( const OUString& aName );
- void add( PropertyInfo const * pMap, sal_Int32 nCount = -1 )
- throw();
- void remove( const OUString& aName )
+ private:
+ virtual ~ChainablePropertySetInfo()
throw();
// XPropertySetInfo
@@ -61,6 +53,12 @@ namespace comphelper
throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name )
throw(::com::sun::star::uno::RuntimeException);
+
+ PropertyInfoHash maMap;
+ com::sun::star::uno::Sequence < com::sun::star::beans::Property > maProperties;
+
+ friend class ChainablePropertySet;
+ friend class MasterPropertySet;
};
}
#endif
diff --git a/include/comphelper/MasterPropertySetInfo.hxx b/include/comphelper/MasterPropertySetInfo.hxx
index e3553a9a6fc9..f44f455a06e4 100644
--- a/include/comphelper/MasterPropertySetInfo.hxx
+++ b/include/comphelper/MasterPropertySetInfo.hxx
@@ -30,19 +30,14 @@ namespace comphelper
public ::cppu::WeakImplHelper1<
::com::sun::star::beans::XPropertySetInfo >
{
- friend class MasterPropertySet;
- protected:
- PropertyDataHash maMap;
- com::sun::star::uno::Sequence < com::sun::star::beans::Property > maProperties;
public:
- MasterPropertySetInfo( PropertyInfo const * pMap )
- throw();
+ MasterPropertySetInfo( PropertyInfo const * pMap );
+
+ private:
virtual ~MasterPropertySetInfo()
throw();
- void add( PropertyInfo const * pMap, sal_Int32 nCount = -1, sal_uInt8 nMapId = 0 )
- throw();
- void add( PropertyInfoHash &rHash, sal_uInt8 nMapId )
- throw();
+
+ void add( PropertyInfoHash &rHash, sal_uInt8 nMapId );
// XPropertySetInfo
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties()
@@ -51,6 +46,11 @@ namespace comphelper
throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name )
throw(::com::sun::star::uno::RuntimeException);
+
+ PropertyDataHash maMap;
+ com::sun::star::uno::Sequence < com::sun::star::beans::Property > maProperties;
+
+ friend class MasterPropertySet;
};
}
#endif