Kaydet (Commit) ab9e014d authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Some clean-up

Change-Id: I8ea3018efb01069b9a0555d9ac4ddfa89a990ba8
üst 3f3c7554
...@@ -32,9 +32,14 @@ using ::com::sun::star::beans::XPropertySetInfo; ...@@ -32,9 +32,14 @@ using ::com::sun::star::beans::XPropertySetInfo;
using ::com::sun::star::beans::UnknownPropertyException; using ::com::sun::star::beans::UnknownPropertyException;
ChainablePropertySetInfo::ChainablePropertySetInfo( PropertyInfo const * pMap ) 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() ChainablePropertySetInfo::~ChainablePropertySetInfo()
...@@ -42,29 +47,7 @@ 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 ) void ChainablePropertySetInfo::remove( const OUString& aName )
throw()
{ {
maMap.erase ( aName ); maMap.erase ( aName );
if ( maProperties.getLength() ) if ( maProperties.getLength() )
......
...@@ -32,9 +32,14 @@ using ::com::sun::star::beans::XPropertySetInfo; ...@@ -32,9 +32,14 @@ using ::com::sun::star::beans::XPropertySetInfo;
using ::com::sun::star::beans::UnknownPropertyException; using ::com::sun::star::beans::UnknownPropertyException;
MasterPropertySetInfo::MasterPropertySetInfo( PropertyInfo const * pMap ) 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() MasterPropertySetInfo::~MasterPropertySetInfo()
...@@ -48,28 +53,7 @@ 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 ) void MasterPropertySetInfo::add( PropertyInfoHash &rHash, sal_uInt8 nMapId )
throw()
{ {
if( maProperties.getLength() ) if( maProperties.getLength() )
maProperties.realloc( 0 ); maProperties.realloc( 0 );
...@@ -77,11 +61,9 @@ void MasterPropertySetInfo::add( PropertyInfoHash &rHash, sal_uInt8 nMapId ) ...@@ -77,11 +61,9 @@ void MasterPropertySetInfo::add( PropertyInfoHash &rHash, sal_uInt8 nMapId )
while ( aIter != aEnd ) while ( aIter != aEnd )
{ {
#ifdef DBG_UTIL SAL_WARN_IF(
PropertyDataHash::iterator aDebugIter = maMap.find( (*aIter).first ); maMap.find(aIter->first) != maMap.end(),
if( aDebugIter != maMap.end() ) "comphelper", "Duplicate property name \"" << aIter->first << "\"");
OSL_FAIL( "Warning: PropertyInfo added twice, possible error!");
#endif
maMap[(*aIter).first] = new PropertyData ( nMapId, (*aIter).second ); maMap[(*aIter).first] = new PropertyData ( nMapId, (*aIter).second );
++aIter; ++aIter;
} }
......
...@@ -37,21 +37,13 @@ namespace comphelper ...@@ -37,21 +37,13 @@ namespace comphelper
public ::cppu::WeakImplHelper1< public ::cppu::WeakImplHelper1<
::com::sun::star::beans::XPropertySetInfo > ::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: public:
ChainablePropertySetInfo( PropertyInfo const * pMap ) ChainablePropertySetInfo( PropertyInfo const * pMap );
throw();
virtual ~ChainablePropertySetInfo() void remove( const OUString& aName );
throw();
void add( PropertyInfo const * pMap, sal_Int32 nCount = -1 ) private:
throw(); virtual ~ChainablePropertySetInfo()
void remove( const OUString& aName )
throw(); throw();
// XPropertySetInfo // XPropertySetInfo
...@@ -61,6 +53,12 @@ namespace comphelper ...@@ -61,6 +53,12 @@ namespace comphelper
throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name )
throw(::com::sun::star::uno::RuntimeException); 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 #endif
......
...@@ -30,19 +30,14 @@ namespace comphelper ...@@ -30,19 +30,14 @@ namespace comphelper
public ::cppu::WeakImplHelper1< public ::cppu::WeakImplHelper1<
::com::sun::star::beans::XPropertySetInfo > ::com::sun::star::beans::XPropertySetInfo >
{ {
friend class MasterPropertySet;
protected:
PropertyDataHash maMap;
com::sun::star::uno::Sequence < com::sun::star::beans::Property > maProperties;
public: public:
MasterPropertySetInfo( PropertyInfo const * pMap ) MasterPropertySetInfo( PropertyInfo const * pMap );
throw();
private:
virtual ~MasterPropertySetInfo() virtual ~MasterPropertySetInfo()
throw(); throw();
void add( PropertyInfo const * pMap, sal_Int32 nCount = -1, sal_uInt8 nMapId = 0 )
throw(); void add( PropertyInfoHash &rHash, sal_uInt8 nMapId );
void add( PropertyInfoHash &rHash, sal_uInt8 nMapId )
throw();
// XPropertySetInfo // XPropertySetInfo
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties() virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties()
...@@ -51,6 +46,11 @@ namespace comphelper ...@@ -51,6 +46,11 @@ namespace comphelper
throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name )
throw(::com::sun::star::uno::RuntimeException); throw(::com::sun::star::uno::RuntimeException);
PropertyDataHash maMap;
com::sun::star::uno::Sequence < com::sun::star::beans::Property > maProperties;
friend class MasterPropertySet;
}; };
} }
#endif #endif
......
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