xref: /AOO41X/main/comphelper/source/misc/namedvaluecollection.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_comphelper.hxx"
30*cdf0e10cSrcweir #include <comphelper/namedvaluecollection.hxx>
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir /** === begin UNO includes === **/
33*cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/lang/IllegalArgumentException.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyState.hpp>
36*cdf0e10cSrcweir /** === end UNO includes === **/
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
39*cdf0e10cSrcweir #include <rtl/strbuf.hxx>
40*cdf0e10cSrcweir #include <osl/diagnose.h>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include <hash_map>
43*cdf0e10cSrcweir #include <functional>
44*cdf0e10cSrcweir #include <algorithm>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir //........................................................................
47*cdf0e10cSrcweir namespace comphelper
48*cdf0e10cSrcweir {
49*cdf0e10cSrcweir //........................................................................
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir     /** === begin UNO using === **/
52*cdf0e10cSrcweir     using ::com::sun::star::uno::Any;
53*cdf0e10cSrcweir     using ::com::sun::star::uno::Sequence;
54*cdf0e10cSrcweir     using ::com::sun::star::beans::PropertyValue;
55*cdf0e10cSrcweir     using ::com::sun::star::beans::NamedValue;
56*cdf0e10cSrcweir     using ::com::sun::star::uno::Type;
57*cdf0e10cSrcweir     using ::com::sun::star::uno::cpp_acquire;
58*cdf0e10cSrcweir     using ::com::sun::star::uno::cpp_release;
59*cdf0e10cSrcweir     using ::com::sun::star::uno::cpp_queryInterface;
60*cdf0e10cSrcweir     using ::com::sun::star::lang::IllegalArgumentException;
61*cdf0e10cSrcweir     using ::com::sun::star::beans::NamedValue;
62*cdf0e10cSrcweir     using ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
63*cdf0e10cSrcweir     /** === end UNO using === **/
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir     //====================================================================
66*cdf0e10cSrcweir 	//= NamedValueCollection_Impl
67*cdf0e10cSrcweir 	//====================================================================
68*cdf0e10cSrcweir     typedef ::std::hash_map< ::rtl::OUString, Any, ::rtl::OUStringHash >    NamedValueRepository;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir     struct NamedValueCollection_Impl
71*cdf0e10cSrcweir     {
72*cdf0e10cSrcweir         NamedValueRepository    aValues;
73*cdf0e10cSrcweir     };
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir     //====================================================================
76*cdf0e10cSrcweir 	//= NamedValueCollection
77*cdf0e10cSrcweir 	//====================================================================
78*cdf0e10cSrcweir 	//--------------------------------------------------------------------
79*cdf0e10cSrcweir     NamedValueCollection::NamedValueCollection()
80*cdf0e10cSrcweir         :m_pImpl( new NamedValueCollection_Impl )
81*cdf0e10cSrcweir     {
82*cdf0e10cSrcweir     }
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir 	//--------------------------------------------------------------------
85*cdf0e10cSrcweir     NamedValueCollection::NamedValueCollection( const NamedValueCollection& _rCopySource )
86*cdf0e10cSrcweir         :m_pImpl( new NamedValueCollection_Impl )
87*cdf0e10cSrcweir     {
88*cdf0e10cSrcweir         *this = _rCopySource;
89*cdf0e10cSrcweir     }
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir 	//--------------------------------------------------------------------
92*cdf0e10cSrcweir     NamedValueCollection& NamedValueCollection::operator=( const NamedValueCollection& i_rCopySource )
93*cdf0e10cSrcweir     {
94*cdf0e10cSrcweir         m_pImpl->aValues = i_rCopySource.m_pImpl->aValues;
95*cdf0e10cSrcweir         return *this;
96*cdf0e10cSrcweir     }
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir 	//--------------------------------------------------------------------
99*cdf0e10cSrcweir     NamedValueCollection::NamedValueCollection( const Any& _rElements )
100*cdf0e10cSrcweir         :m_pImpl( new NamedValueCollection_Impl )
101*cdf0e10cSrcweir     {
102*cdf0e10cSrcweir         impl_assign( _rElements );
103*cdf0e10cSrcweir     }
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 	//--------------------------------------------------------------------
106*cdf0e10cSrcweir     NamedValueCollection::NamedValueCollection( const Sequence< Any >& _rArguments )
107*cdf0e10cSrcweir         :m_pImpl( new NamedValueCollection_Impl )
108*cdf0e10cSrcweir     {
109*cdf0e10cSrcweir         impl_assign( _rArguments );
110*cdf0e10cSrcweir     }
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	//--------------------------------------------------------------------
113*cdf0e10cSrcweir     NamedValueCollection::NamedValueCollection( const Sequence< PropertyValue >& _rArguments )
114*cdf0e10cSrcweir         :m_pImpl( new NamedValueCollection_Impl )
115*cdf0e10cSrcweir     {
116*cdf0e10cSrcweir         impl_assign( _rArguments );
117*cdf0e10cSrcweir     }
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir 	//--------------------------------------------------------------------
120*cdf0e10cSrcweir     NamedValueCollection::NamedValueCollection( const Sequence< NamedValue >& _rArguments )
121*cdf0e10cSrcweir         :m_pImpl( new NamedValueCollection_Impl )
122*cdf0e10cSrcweir     {
123*cdf0e10cSrcweir         impl_assign( _rArguments );
124*cdf0e10cSrcweir     }
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 	//--------------------------------------------------------------------
127*cdf0e10cSrcweir     NamedValueCollection::~NamedValueCollection()
128*cdf0e10cSrcweir     {
129*cdf0e10cSrcweir     }
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir 	//--------------------------------------------------------------------
132*cdf0e10cSrcweir     NamedValueCollection& NamedValueCollection::merge( const NamedValueCollection& _rAdditionalValues, bool _bOverwriteExisting )
133*cdf0e10cSrcweir     {
134*cdf0e10cSrcweir         for (   NamedValueRepository::const_iterator namedValue = _rAdditionalValues.m_pImpl->aValues.begin();
135*cdf0e10cSrcweir                 namedValue != _rAdditionalValues.m_pImpl->aValues.end();
136*cdf0e10cSrcweir                 ++namedValue
137*cdf0e10cSrcweir             )
138*cdf0e10cSrcweir         {
139*cdf0e10cSrcweir             if ( _bOverwriteExisting || !impl_has( namedValue->first ) )
140*cdf0e10cSrcweir                 impl_put( namedValue->first, namedValue->second );
141*cdf0e10cSrcweir         }
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir         return *this;
144*cdf0e10cSrcweir     }
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 	//--------------------------------------------------------------------
147*cdf0e10cSrcweir     size_t NamedValueCollection::size() const
148*cdf0e10cSrcweir     {
149*cdf0e10cSrcweir         return m_pImpl->aValues.size();
150*cdf0e10cSrcweir     }
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 	//--------------------------------------------------------------------
153*cdf0e10cSrcweir     bool NamedValueCollection::empty() const
154*cdf0e10cSrcweir     {
155*cdf0e10cSrcweir         return m_pImpl->aValues.empty();
156*cdf0e10cSrcweir     }
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 	//--------------------------------------------------------------------
159*cdf0e10cSrcweir     ::std::vector< ::rtl::OUString > NamedValueCollection::getNames() const
160*cdf0e10cSrcweir     {
161*cdf0e10cSrcweir         ::std::vector< ::rtl::OUString > aNames( m_pImpl->aValues.size() );
162*cdf0e10cSrcweir         ::std::transform(
163*cdf0e10cSrcweir             m_pImpl->aValues.begin(),
164*cdf0e10cSrcweir             m_pImpl->aValues.end(),
165*cdf0e10cSrcweir             aNames.begin(),
166*cdf0e10cSrcweir             ::std::select1st< NamedValueRepository::value_type >()
167*cdf0e10cSrcweir         );
168*cdf0e10cSrcweir         return aNames;
169*cdf0e10cSrcweir     }
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 	//--------------------------------------------------------------------
172*cdf0e10cSrcweir     void NamedValueCollection::impl_assign( const Any& i_rWrappedElements )
173*cdf0e10cSrcweir     {
174*cdf0e10cSrcweir         Sequence< NamedValue > aNamedValues;
175*cdf0e10cSrcweir         Sequence< PropertyValue > aPropertyValues;
176*cdf0e10cSrcweir         NamedValue aNamedValue;
177*cdf0e10cSrcweir         PropertyValue aPropertyValue;
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir         if ( i_rWrappedElements >>= aNamedValues )
180*cdf0e10cSrcweir             impl_assign( aNamedValues );
181*cdf0e10cSrcweir         else if ( i_rWrappedElements >>= aPropertyValues )
182*cdf0e10cSrcweir             impl_assign( aPropertyValues );
183*cdf0e10cSrcweir         else if ( i_rWrappedElements >>= aNamedValue )
184*cdf0e10cSrcweir             impl_assign( Sequence< NamedValue >( &aNamedValue, 1 ) );
185*cdf0e10cSrcweir         else if ( i_rWrappedElements >>= aPropertyValue )
186*cdf0e10cSrcweir             impl_assign( Sequence< PropertyValue >( &aPropertyValue, 1 ) );
187*cdf0e10cSrcweir         else
188*cdf0e10cSrcweir             OSL_ENSURE( !i_rWrappedElements.hasValue(), "NamedValueCollection::impl_assign(Any): unsupported type!" );
189*cdf0e10cSrcweir     }
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir 	//--------------------------------------------------------------------
192*cdf0e10cSrcweir     void NamedValueCollection::impl_assign( const Sequence< Any >& _rArguments )
193*cdf0e10cSrcweir     {
194*cdf0e10cSrcweir         {
195*cdf0e10cSrcweir             NamedValueRepository aEmpty;
196*cdf0e10cSrcweir             m_pImpl->aValues.swap( aEmpty );
197*cdf0e10cSrcweir         }
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir         PropertyValue aPropertyValue;
200*cdf0e10cSrcweir         NamedValue aNamedValue;
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir         const Any* pArgument = _rArguments.getConstArray();
203*cdf0e10cSrcweir         const Any* pArgumentEnd = _rArguments.getConstArray() + _rArguments.getLength();
204*cdf0e10cSrcweir         for ( ; pArgument != pArgumentEnd; ++pArgument )
205*cdf0e10cSrcweir         {
206*cdf0e10cSrcweir             if ( *pArgument >>= aPropertyValue )
207*cdf0e10cSrcweir                 m_pImpl->aValues[ aPropertyValue.Name ] = aPropertyValue.Value;
208*cdf0e10cSrcweir             else if ( *pArgument >>= aNamedValue )
209*cdf0e10cSrcweir                 m_pImpl->aValues[ aNamedValue.Name ] = aNamedValue.Value;
210*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
211*cdf0e10cSrcweir             else if ( pArgument->hasValue() )
212*cdf0e10cSrcweir             {
213*cdf0e10cSrcweir                 ::rtl::OStringBuffer message;
214*cdf0e10cSrcweir                 message.append( "NamedValueCollection::impl_assign: encountered a value type which I cannot handle:\n" );
215*cdf0e10cSrcweir                 message.append( ::rtl::OUStringToOString( pArgument->getValueTypeName(), RTL_TEXTENCODING_ASCII_US ) );
216*cdf0e10cSrcweir                 OSL_ENSURE( false, message.makeStringAndClear() );
217*cdf0e10cSrcweir             }
218*cdf0e10cSrcweir #endif
219*cdf0e10cSrcweir         }
220*cdf0e10cSrcweir     }
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 	//--------------------------------------------------------------------
223*cdf0e10cSrcweir     void NamedValueCollection::impl_assign( const Sequence< PropertyValue >& _rArguments )
224*cdf0e10cSrcweir     {
225*cdf0e10cSrcweir         {
226*cdf0e10cSrcweir             NamedValueRepository aEmpty;
227*cdf0e10cSrcweir             m_pImpl->aValues.swap( aEmpty );
228*cdf0e10cSrcweir         }
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir         const PropertyValue* pArgument = _rArguments.getConstArray();
231*cdf0e10cSrcweir         const PropertyValue* pArgumentEnd = _rArguments.getConstArray() + _rArguments.getLength();
232*cdf0e10cSrcweir         for ( ; pArgument != pArgumentEnd; ++pArgument )
233*cdf0e10cSrcweir             m_pImpl->aValues[ pArgument->Name ] = pArgument->Value;
234*cdf0e10cSrcweir     }
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 	//--------------------------------------------------------------------
237*cdf0e10cSrcweir     void NamedValueCollection::impl_assign( const Sequence< NamedValue >& _rArguments )
238*cdf0e10cSrcweir     {
239*cdf0e10cSrcweir         {
240*cdf0e10cSrcweir             NamedValueRepository aEmpty;
241*cdf0e10cSrcweir             m_pImpl->aValues.swap( aEmpty );
242*cdf0e10cSrcweir         }
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir         const NamedValue* pArgument = _rArguments.getConstArray();
245*cdf0e10cSrcweir         const NamedValue* pArgumentEnd = _rArguments.getConstArray() + _rArguments.getLength();
246*cdf0e10cSrcweir         for ( ; pArgument != pArgumentEnd; ++pArgument )
247*cdf0e10cSrcweir             m_pImpl->aValues[ pArgument->Name ] = pArgument->Value;
248*cdf0e10cSrcweir     }
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 	//--------------------------------------------------------------------
251*cdf0e10cSrcweir     bool NamedValueCollection::get_ensureType( const ::rtl::OUString& _rValueName, void* _pValueLocation, const Type& _rExpectedValueType ) const
252*cdf0e10cSrcweir     {
253*cdf0e10cSrcweir         NamedValueRepository::const_iterator pos = m_pImpl->aValues.find( _rValueName );
254*cdf0e10cSrcweir         if ( pos != m_pImpl->aValues.end() )
255*cdf0e10cSrcweir         {
256*cdf0e10cSrcweir 		    if ( uno_type_assignData(
257*cdf0e10cSrcweir 			        _pValueLocation, _rExpectedValueType.getTypeLibType(),
258*cdf0e10cSrcweir 				    const_cast< void* >( pos->second.getValue() ), pos->second.getValueType().getTypeLibType(),
259*cdf0e10cSrcweir 			    	reinterpret_cast< uno_QueryInterfaceFunc >( cpp_queryInterface ),
260*cdf0e10cSrcweir                     reinterpret_cast< uno_AcquireFunc >( cpp_acquire ),
261*cdf0e10cSrcweir                     reinterpret_cast< uno_ReleaseFunc >( cpp_release )
262*cdf0e10cSrcweir                 ) )
263*cdf0e10cSrcweir                 // argument exists, and could be extracted
264*cdf0e10cSrcweir                 return true;
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir             // argument exists, but is of wrong type
267*cdf0e10cSrcweir             ::rtl::OUStringBuffer aBuffer;
268*cdf0e10cSrcweir             aBuffer.appendAscii( "Invalid value type for '" );
269*cdf0e10cSrcweir             aBuffer.append     ( _rValueName );
270*cdf0e10cSrcweir             aBuffer.appendAscii( "'.\nExpected: " );
271*cdf0e10cSrcweir             aBuffer.append     ( _rExpectedValueType.getTypeName() );
272*cdf0e10cSrcweir             aBuffer.appendAscii( "\nFound: " );
273*cdf0e10cSrcweir             aBuffer.append     ( pos->second.getValueType().getTypeName() );
274*cdf0e10cSrcweir             throw IllegalArgumentException( aBuffer.makeStringAndClear(), NULL, 0 );
275*cdf0e10cSrcweir         }
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir         // argument does not exist
278*cdf0e10cSrcweir         return false;
279*cdf0e10cSrcweir     }
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir     //--------------------------------------------------------------------
282*cdf0e10cSrcweir     const Any& NamedValueCollection::impl_get( const ::rtl::OUString& _rValueName ) const
283*cdf0e10cSrcweir     {
284*cdf0e10cSrcweir         NamedValueRepository::const_iterator pos = m_pImpl->aValues.find( _rValueName );
285*cdf0e10cSrcweir         if ( pos != m_pImpl->aValues.end() )
286*cdf0e10cSrcweir             return pos->second;
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir         static Any aEmptyDefault;
289*cdf0e10cSrcweir         return aEmptyDefault;
290*cdf0e10cSrcweir     }
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir     //--------------------------------------------------------------------
293*cdf0e10cSrcweir     bool NamedValueCollection::impl_has( const ::rtl::OUString& _rValueName ) const
294*cdf0e10cSrcweir     {
295*cdf0e10cSrcweir         NamedValueRepository::const_iterator pos = m_pImpl->aValues.find( _rValueName );
296*cdf0e10cSrcweir         return ( pos != m_pImpl->aValues.end() );
297*cdf0e10cSrcweir     }
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir     //--------------------------------------------------------------------
300*cdf0e10cSrcweir     bool NamedValueCollection::impl_put( const ::rtl::OUString& _rValueName, const Any& _rValue )
301*cdf0e10cSrcweir     {
302*cdf0e10cSrcweir         bool bHas = impl_has( _rValueName );
303*cdf0e10cSrcweir         m_pImpl->aValues[ _rValueName ] = _rValue;
304*cdf0e10cSrcweir         return bHas;
305*cdf0e10cSrcweir     }
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir     //--------------------------------------------------------------------
308*cdf0e10cSrcweir     bool NamedValueCollection::impl_remove( const ::rtl::OUString& _rValueName )
309*cdf0e10cSrcweir     {
310*cdf0e10cSrcweir         NamedValueRepository::iterator pos = m_pImpl->aValues.find( _rValueName );
311*cdf0e10cSrcweir         if ( pos == m_pImpl->aValues.end() )
312*cdf0e10cSrcweir             return false;
313*cdf0e10cSrcweir         m_pImpl->aValues.erase( pos );
314*cdf0e10cSrcweir         return true;
315*cdf0e10cSrcweir     }
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir     //--------------------------------------------------------------------
318*cdf0e10cSrcweir     namespace
319*cdf0e10cSrcweir     {
320*cdf0e10cSrcweir         struct Value2PropertyValue : public ::std::unary_function< NamedValueRepository::value_type, PropertyValue >
321*cdf0e10cSrcweir         {
322*cdf0e10cSrcweir             PropertyValue operator()( const NamedValueRepository::value_type& _rValue )
323*cdf0e10cSrcweir             {
324*cdf0e10cSrcweir                 return PropertyValue(
325*cdf0e10cSrcweir                     _rValue.first, 0, _rValue.second, PropertyState_DIRECT_VALUE );
326*cdf0e10cSrcweir             }
327*cdf0e10cSrcweir         };
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir         struct Value2NamedValue : public ::std::unary_function< NamedValueRepository::value_type, NamedValue >
330*cdf0e10cSrcweir         {
331*cdf0e10cSrcweir             NamedValue operator()( const NamedValueRepository::value_type& _rValue )
332*cdf0e10cSrcweir             {
333*cdf0e10cSrcweir                 return NamedValue( _rValue.first, _rValue.second );
334*cdf0e10cSrcweir             }
335*cdf0e10cSrcweir         };
336*cdf0e10cSrcweir     }
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir     //--------------------------------------------------------------------
339*cdf0e10cSrcweir     sal_Int32 NamedValueCollection::operator >>= ( Sequence< PropertyValue >& _out_rValues ) const
340*cdf0e10cSrcweir     {
341*cdf0e10cSrcweir         _out_rValues.realloc( m_pImpl->aValues.size() );
342*cdf0e10cSrcweir         ::std::transform( m_pImpl->aValues.begin(), m_pImpl->aValues.end(), _out_rValues.getArray(), Value2PropertyValue() );
343*cdf0e10cSrcweir         return _out_rValues.getLength();
344*cdf0e10cSrcweir     }
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir     //--------------------------------------------------------------------
347*cdf0e10cSrcweir     sal_Int32 NamedValueCollection::operator >>= ( Sequence< NamedValue >& _out_rValues ) const
348*cdf0e10cSrcweir     {
349*cdf0e10cSrcweir         _out_rValues.realloc( m_pImpl->aValues.size() );
350*cdf0e10cSrcweir         ::std::transform( m_pImpl->aValues.begin(), m_pImpl->aValues.end(), _out_rValues.getArray(), Value2NamedValue() );
351*cdf0e10cSrcweir         return _out_rValues.getLength();
352*cdf0e10cSrcweir     }
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir //........................................................................
355*cdf0e10cSrcweir } // namespace comphelper
356*cdf0e10cSrcweir //........................................................................
357*cdf0e10cSrcweir 
358