diff options
author | Noel Grandin <noel@peralex.com> | 2013-03-20 09:16:19 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-04-08 13:53:02 +0200 |
commit | 3cfecf8427c529c7c1d32be2b361934b63fa6933 (patch) | |
tree | 0eed4fbb77434a558dd48234a95b099a9ada534b /comphelper/source/property/opropertybag.cxx | |
parent | 002aab309055b7feeeeeb25c1835b6abe6646729 (diff) |
fdo#46808, Convert beans::PropertyBag to new style
Change-Id: Ibb2466af4c9289cba93b8330d10db033d296bfc1
Diffstat (limited to 'comphelper/source/property/opropertybag.cxx')
-rw-r--r-- | comphelper/source/property/opropertybag.cxx | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx index a3d3a64d501e..d54fdf3c2559 100644 --- a/comphelper/source/property/opropertybag.cxx +++ b/comphelper/source/property/opropertybag.cxx @@ -88,20 +88,36 @@ namespace comphelper //-------------------------------------------------------------------- void SAL_CALL OPropertyBag::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException) { - ::comphelper::NamedValueCollection aArguments( _rArguments ); - Sequence< Type > aTypes; - if ( aArguments.get_ensureType( "AllowedTypes", aTypes ) ) + bool AllowEmptyPropertyName(false); + bool AutomaticAddition(false); + + if (_rArguments.getLength() == 3 + && (_rArguments[0] >>= aTypes) + && (_rArguments[1] >>= AllowEmptyPropertyName) + && (_rArguments[2] >>= AutomaticAddition)) + { ::std::copy( aTypes.getConstArray(), aTypes.getConstArray() + aTypes.getLength(), ::std::insert_iterator< TypeBag >( m_aAllowedTypes, m_aAllowedTypes.begin() ) ); + m_bAutoAddProperties = AutomaticAddition; - aArguments.get_ensureType( "AutomaticAddition", m_bAutoAddProperties ); - bool AllowEmptyPropertyName(false); - aArguments.get_ensureType( "AllowEmptyPropertyName", - AllowEmptyPropertyName ); + } else { + ::comphelper::NamedValueCollection aArguments( _rArguments ); + + if ( aArguments.get_ensureType( "AllowedTypes", aTypes ) ) + ::std::copy( + aTypes.getConstArray(), + aTypes.getConstArray() + aTypes.getLength(), + ::std::insert_iterator< TypeBag >( m_aAllowedTypes, m_aAllowedTypes.begin() ) + ); + + aArguments.get_ensureType( "AutomaticAddition", m_bAutoAddProperties ); + aArguments.get_ensureType( "AllowEmptyPropertyName", + AllowEmptyPropertyName ); + } if (AllowEmptyPropertyName) { m_aDynamicProperties.setAllowEmptyPropertyName( AllowEmptyPropertyName); |