summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorMichael Stahl <mst@apache.org>2011-09-17 21:41:28 +0000
committerMichael Stahl <mst@apache.org>2011-09-17 21:41:28 +0000
commit0e146fc26f44e44bcbc427016c47e4e23605a391 (patch)
tree165b121d3a66c19dadabf1826355675fd3ec0734 /comphelper
parent8851d704aea1525436ed9e0fa5b6395aca7e0901 (diff)
fs34c: #i117625# when assigning events, only throw if there is an invalid type given, *not* if the type is correct, but the sequence is merely empty
# HG changeset patch # User Frank Schoenheit [fs] <frank.schoenheit@oracle.com> # Date 1301640073 -7200 # Node ID e4014e6b2cb422bb8dca7dad4ba34f28d42cb86d # Parent a25f2ab3257e6b811ccb2436661f74d0c65719cd
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/inc/comphelper/namedvaluecollection.hxx8
-rw-r--r--comphelper/source/misc/namedvaluecollection.cxx13
2 files changed, 21 insertions, 0 deletions
diff --git a/comphelper/inc/comphelper/namedvaluecollection.hxx b/comphelper/inc/comphelper/namedvaluecollection.hxx
index e13059361b0a..341215351f2f 100644
--- a/comphelper/inc/comphelper/namedvaluecollection.hxx
+++ b/comphelper/inc/comphelper/namedvaluecollection.hxx
@@ -117,6 +117,14 @@ namespace comphelper
impl_assign( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >() );
}
+ /** determines whether or not named values can be extracted from the given value
+
+ @return
+ <TRUE/> if and only if the given <code>Any</code> contains a <code>NamedValue</code>, a
+ <code>PropertyValue</code>, or a sequence thereof.
+ */
+ static bool canExtractFrom( ::com::sun::star::uno::Any const & i_value );
+
/// returns the number of elements in the collection
size_t size() const;
diff --git a/comphelper/source/misc/namedvaluecollection.cxx b/comphelper/source/misc/namedvaluecollection.cxx
index 566e5526019c..4958fae8912e 100644
--- a/comphelper/source/misc/namedvaluecollection.cxx
+++ b/comphelper/source/misc/namedvaluecollection.cxx
@@ -129,6 +129,19 @@ namespace comphelper
}
//--------------------------------------------------------------------
+ bool NamedValueCollection::canExtractFrom( ::com::sun::star::uno::Any const & i_value )
+ {
+ Type const & aValueType = i_value.getValueType();
+ if ( aValueType.equals( ::cppu::UnoType< PropertyValue >::get() )
+ || aValueType.equals( ::cppu::UnoType< NamedValue >::get() )
+ || aValueType.equals( ::cppu::UnoType< Sequence< PropertyValue > >::get() )
+ || aValueType.equals( ::cppu::UnoType< Sequence< NamedValue > >::get() )
+ )
+ return true;
+ return false;
+ }
+
+ //--------------------------------------------------------------------
NamedValueCollection& NamedValueCollection::merge( const NamedValueCollection& _rAdditionalValues, bool _bOverwriteExisting )
{
for ( NamedValueRepository::const_iterator namedValue = _rAdditionalValues.m_pImpl->aValues.begin();