diff options
author | Rüdiger Timm <rt@openoffice.org> | 2006-12-01 16:32:40 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2006-12-01 16:32:40 +0000 |
commit | e296956c673096c4565ab29d240e6c33863b5aec (patch) | |
tree | 7d6c4b5ef0b8317466b12cd01b7897e1d5708b08 | |
parent | 51e65d938f5166f5061625ce7ca459b9e29e442c (diff) |
INTEGRATION: CWS dba22a (1.4.34); FILE MERGED
2006/11/22 09:32:46 fs 1.4.34.1: allow construction from NamedValues
-rw-r--r-- | comphelper/source/misc/namedvaluecollection.cxx | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/comphelper/source/misc/namedvaluecollection.cxx b/comphelper/source/misc/namedvaluecollection.cxx index 87611c0e349d..6c7a0931ddce 100644 --- a/comphelper/source/misc/namedvaluecollection.cxx +++ b/comphelper/source/misc/namedvaluecollection.cxx @@ -4,9 +4,9 @@ * * $RCSfile: namedvaluecollection.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: obo $ $Date: 2006-09-17 17:12:43 $ + * last change: $Author: rt $ $Date: 2006-12-01 17:32:40 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -66,6 +66,7 @@ namespace comphelper using ::com::sun::star::uno::cpp_acquire; using ::com::sun::star::uno::cpp_release; using ::com::sun::star::uno::cpp_queryInterface; + using ::com::sun::star::beans::NamedValue; /** === end UNO using === **/ //==================================================================== @@ -102,6 +103,13 @@ namespace comphelper } //-------------------------------------------------------------------- + NamedValueCollection::NamedValueCollection( const Sequence< NamedValue >& _rArguments ) + :m_pImpl( new NamedValueCollection_Impl ) + { + impl_assign( _rArguments ); + } + + //-------------------------------------------------------------------- NamedValueCollection::~NamedValueCollection() { } @@ -126,7 +134,7 @@ namespace comphelper else if ( *pArgument >>= aNamedValue ) m_pImpl->aValues[ aNamedValue.Name ] = aNamedValue.Value; else - OSL_ENSURE( !pArgument->hasValue(), "NamedValueCollection::NamedValueCollection: encountered a value which I cannot handle!" ); + OSL_ENSURE( !pArgument->hasValue(), "NamedValueCollection::impl_assign: encountered a value which I cannot handle!" ); } } @@ -145,6 +153,20 @@ namespace comphelper } //-------------------------------------------------------------------- + void NamedValueCollection::impl_assign( const Sequence< NamedValue >& _rArguments ) + { + { + NamedValueRepository empty; + m_pImpl->aValues.swap( empty ); + } + + const NamedValue* pArgument = _rArguments.getConstArray(); + const NamedValue* pArgumentEnd = _rArguments.getConstArray() + _rArguments.getLength(); + for ( ; pArgument != pArgumentEnd; ++pArgument ) + m_pImpl->aValues[ pArgument->Name ] = pArgument->Value; + } + + //-------------------------------------------------------------------- bool NamedValueCollection::getIfExists_ensureType( const ::rtl::OUString& _rValueName, void* _pValueLocation, const Type& _rExpectedValueType ) const { NamedValueRepository::const_iterator pos = m_pImpl->aValues.find( _rValueName ); |