diff options
author | Frank Schönheit <fs@openoffice.org> | 2001-04-11 08:08:45 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2001-04-11 08:08:45 +0000 |
commit | 805e4fcdb666de4fd6690a3b4edb604bb253620a (patch) | |
tree | 60fad487da2b8117b99a85177b345734b1efec3e /comphelper | |
parent | 6995d0a48bcfab928ae8d9165ff2d8ea7b5c8b20 (diff) |
added a 'add' with an 'nCount' parameter
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/inc/comphelper/propertysetinfo.hxx | 15 | ||||
-rw-r--r-- | comphelper/source/property/propertysetinfo.cxx | 19 |
2 files changed, 26 insertions, 8 deletions
diff --git a/comphelper/inc/comphelper/propertysetinfo.hxx b/comphelper/inc/comphelper/propertysetinfo.hxx index 0a8797cc6c9a..2d0f66e70f12 100644 --- a/comphelper/inc/comphelper/propertysetinfo.hxx +++ b/comphelper/inc/comphelper/propertysetinfo.hxx @@ -2,9 +2,9 @@ * * $RCSfile: propertysetinfo.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: cl $ $Date: 2001-03-14 15:52:37 $ + * last change: $Author: fs $ $Date: 2001-04-11 09:08:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -115,10 +115,19 @@ public: const PropertyMap* getPropertyMap() const throw(); /** adds an array of PropertyMapEntry to this instance.<p> - The end is marked with a PropertyMapEntry where mpName equals NULL + The end is marked with a PropertyMapEntry where mpName equals NULL</p> */ void add( PropertyMapEntry* pMap ) throw(); + /** adds an array of PropertyMapEntry to this instance + + <p>At most the number of entries given will be added, if no terminating entry (<code>mpName == <NULL/></code>) is encountered.</p> + + <p>If <arg>nCount</arg> is less than 0, it is ignored and all entries (up to, but not including, the terminating + one) are added.</p> + */ + void add( PropertyMapEntry* pMap, sal_Int32 nCount ) throw(); + /** removes an already added PropertyMapEntry which string in mpName equals to aName */ void remove( const rtl::OUString& aName ) throw(); diff --git a/comphelper/source/property/propertysetinfo.cxx b/comphelper/source/property/propertysetinfo.cxx index 6e0ce2abec7a..f283a8ea453d 100644 --- a/comphelper/source/property/propertysetinfo.cxx +++ b/comphelper/source/property/propertysetinfo.cxx @@ -2,9 +2,9 @@ * * $RCSfile: propertysetinfo.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jl $ $Date: 2001-03-22 13:32:35 $ + * last change: $Author: fs $ $Date: 2001-04-11 09:08:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,7 +76,7 @@ public: PropertyMapImpl() throw(); virtual ~PropertyMapImpl() throw(); - void add( PropertyMapEntry* pMap ) throw(); + void add( PropertyMapEntry* pMap, sal_Int32 nCount = -1 ) throw(); void remove( const OUString& aName ) throw(); Sequence< Property > getProperties() throw(); @@ -100,9 +100,13 @@ PropertyMapImpl::~PropertyMapImpl() throw() { } -void PropertyMapImpl::add( PropertyMapEntry* pMap ) throw() +void PropertyMapImpl::add( PropertyMapEntry* pMap, sal_Int32 nCount ) throw() { - while( pMap->mpName ) + // nCount < 0 => add all + // nCount == 0 => add nothing + // nCount > 0 => add at most nCount entries + + while( pMap->mpName && ( ( nCount < 0) || ( nCount-- > 0 ) ) ) { OUString aName( pMap->mpName, pMap->mnNameLen, RTL_TEXTENCODING_ASCII_US ); @@ -210,6 +214,11 @@ void PropertySetInfo::add( PropertyMapEntry* pMap ) throw() mpMap->add( pMap ); } +void PropertySetInfo::add( PropertyMapEntry* pMap, sal_Int32 nCount ) throw() +{ + mpMap->add( pMap, nCount ); +} + void PropertySetInfo::remove( const rtl::OUString& aName ) throw() { mpMap->remove( aName ); |