LibreOffice Module comphelper (master)  1
enumerablemap.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 
21 #include <comphelper_module.hxx>
22 #include <comphelper_services.hxx>
26 
27 #include <com/sun/star/container/XEnumerableMap.hpp>
28 #include <com/sun/star/lang/NoSupportException.hpp>
29 #include <com/sun/star/lang/XInitialization.hpp>
30 #include <com/sun/star/ucb/AlreadyInitializedException.hpp>
31 #include <com/sun/star/beans/IllegalTypeException.hpp>
32 #include <com/sun/star/beans/Pair.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 
35 #include <cppuhelper/compbase3.hxx>
36 #include <cppuhelper/implbase.hxx>
38 #include <rtl/math.hxx>
39 #include <typelib/typedescription.hxx>
40 
41 #include <map>
42 #include <memory>
43 #include <utility>
44 
45 namespace comphelper
46 {
47 
48 
49  using ::com::sun::star::uno::Reference;
50  using ::com::sun::star::uno::XInterface;
51  using ::com::sun::star::uno::UNO_QUERY;
52  using ::com::sun::star::uno::RuntimeException;
53  using ::com::sun::star::uno::Any;
54  using ::com::sun::star::uno::Sequence;
55  using ::com::sun::star::uno::Type;
56  using ::com::sun::star::container::XEnumerableMap;
57  using ::com::sun::star::lang::NoSupportException;
58  using ::com::sun::star::beans::IllegalTypeException;
59  using ::com::sun::star::container::NoSuchElementException;
60  using ::com::sun::star::lang::IllegalArgumentException;
61  using ::com::sun::star::lang::XInitialization;
62  using ::com::sun::star::ucb::AlreadyInitializedException;
63  using ::com::sun::star::beans::Pair;
64  using ::com::sun::star::uno::TypeClass;
65  using ::com::sun::star::uno::TypeClass_VOID;
66  using ::com::sun::star::uno::TypeClass_UNKNOWN;
67  using ::com::sun::star::uno::TypeClass_ANY;
68  using ::com::sun::star::uno::TypeClass_EXCEPTION;
69  using ::com::sun::star::uno::TypeClass_STRUCT;
70  using ::com::sun::star::uno::TypeClass_FLOAT;
71  using ::com::sun::star::uno::TypeClass_DOUBLE;
72  using ::com::sun::star::uno::TypeClass_INTERFACE;
73  using ::com::sun::star::lang::XServiceInfo;
74  using ::com::sun::star::uno::XComponentContext;
75  using ::com::sun::star::container::XEnumeration;
76  using ::com::sun::star::uno::TypeDescription;
77  using ::com::sun::star::lang::DisposedException;
78 
80 
81  typedef std::map< Any, Any, LessPredicateAdapter > KeyedValues;
82  struct MapData
83  {
86  std::unique_ptr< KeyedValues > m_pValues;
87  std::shared_ptr< IKeyPredicateLess > m_pKeyCompare;
88  bool m_bMutable;
89  std::vector< MapEnumerator* > m_aModListeners;
90 
92  :m_bMutable( true )
93  {
94  }
95 
96  MapData( const MapData& _source )
97  :m_aKeyType( _source.m_aKeyType )
98  ,m_aValueType( _source.m_aValueType )
99  ,m_pValues( new KeyedValues( *_source.m_pValues ) )
100  ,m_pKeyCompare( _source.m_pKeyCompare )
101  ,m_bMutable( false )
102  ,m_aModListeners()
103  {
104  }
105  private:
106  MapData& operator=( const MapData& _source ) = delete;
107  };
108 
109 
110  static void lcl_registerMapModificationListener( MapData& _mapData, MapEnumerator& _listener )
111  {
112  #if OSL_DEBUG_LEVEL > 0
113  for ( const MapEnumerator* lookup : _mapData.m_aModListeners )
114  {
115  OSL_ENSURE( lookup != &_listener, "lcl_registerMapModificationListener: this listener is already registered!" );
116  }
117  #endif
118  _mapData.m_aModListeners.push_back( &_listener );
119  }
120 
121 
122  static void lcl_revokeMapModificationListener( MapData& _mapData, MapEnumerator& _listener )
123  {
124  auto lookup = std::find(_mapData.m_aModListeners.begin(), _mapData.m_aModListeners.end(), &_listener);
125  if (lookup != _mapData.m_aModListeners.end())
126  {
127  _mapData.m_aModListeners.erase( lookup );
128  return;
129  }
130  OSL_FAIL( "lcl_revokeMapModificationListener: the listener is not registered!" );
131  }
132 
133 
134  static void lcl_notifyMapDataListeners_nothrow( const MapData& _mapData );
135 
136 
137  // EnumerableMap
138 
139  typedef ::cppu::WeakAggComponentImplHelper3 < XInitialization
140  , XEnumerableMap
141  , XServiceInfo
143 
144  class EnumerableMap: public Map_IFace, public ComponentBase
145  {
146  protected:
147  EnumerableMap();
148  virtual ~EnumerableMap() override;
149 
150  // XInitialization
151  virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) override;
152 
153  // XEnumerableMap
154  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createKeyEnumeration( sal_Bool Isolated ) override;
155  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createValueEnumeration( sal_Bool Isolated ) override;
156  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createElementEnumeration( sal_Bool Isolated ) override;
157 
158  // XMap
159  virtual Type SAL_CALL getKeyType() override;
160  virtual Type SAL_CALL getValueType() override;
161  virtual void SAL_CALL clear( ) override;
162  virtual sal_Bool SAL_CALL containsKey( const Any& _key ) override;
163  virtual sal_Bool SAL_CALL containsValue( const Any& _value ) override;
164  virtual Any SAL_CALL get( const Any& _key ) override;
165  virtual Any SAL_CALL put( const Any& _key, const Any& _value ) override;
166  virtual Any SAL_CALL remove( const Any& _key ) override;
167 
168  // XElementAccess (base of XMap)
169  virtual Type SAL_CALL getElementType() override;
170  virtual sal_Bool SAL_CALL hasElements() override;
171 
172  // XServiceInfo
173  virtual OUString SAL_CALL getImplementationName( ) override;
174  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
175  virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
176 
177  public:
178  // XServiceInfo, static version (used for component registration)
179  static OUString getImplementationName_static( );
182 
183  private:
184  void impl_initValues_throw( const Sequence< Pair< Any, Any > >& _initialValues );
185 
187  void impl_checkValue_throw( const Any& _value ) const;
188  void impl_checkKey_throw( const Any& _key ) const;
189  void impl_checkNaN_throw( const Any& _keyOrValue, const Type& _keyOrValueType ) const;
190  void impl_checkMutable_throw() const;
191 
192  private:
193  ::osl::Mutex m_aMutex;
195  };
196 
197 
199  {
201  };
202 
203 
204  class MapEnumerator final
205  {
206  public:
207  MapEnumerator( ::cppu::OWeakObject& _rParent, MapData& _mapData, const EnumerationType _type )
208  :m_rParent( _rParent )
209  ,m_rMapData( _mapData )
210  ,m_eType( _type )
211  ,m_mapPos( _mapData.m_pValues->begin() )
212  ,m_disposed( false )
213  {
215  }
216 
218  {
219  dispose();
220  }
221 
222  void dispose()
223  {
224  if ( !m_disposed )
225  {
227  m_disposed = true;
228  }
229  }
230 
231  // noncopyable
232  MapEnumerator(const MapEnumerator&) = delete;
233  const MapEnumerator& operator=(const MapEnumerator&) = delete;
234 
235  // XEnumeration equivalents
236  bool hasMoreElements();
237  Any nextElement();
238 
240  void mapModified();
241 
242  private:
246  KeyedValues::const_iterator m_mapPos;
248  };
249 
250  static void lcl_notifyMapDataListeners_nothrow( const MapData& _mapData )
251  {
252  for ( MapEnumerator* loop : _mapData.m_aModListeners )
253  {
254  loop->mapModified();
255  }
256  }
257 
258  typedef ::cppu::WeakImplHelper < XEnumeration
261  ,public MapEnumeration_Base
262  {
263  public:
264  MapEnumeration( ::cppu::OWeakObject& _parentMap, MapData& _mapData, ::cppu::OBroadcastHelper& _rBHelper,
265  const EnumerationType _type, const bool _isolated )
267  ,m_xKeepMapAlive( _parentMap )
268  ,m_pMapDataCopy( _isolated ? new MapData( _mapData ) : nullptr )
269  ,m_aEnumerator( *this, _isolated ? *m_pMapDataCopy : _mapData, _type )
270  {
271  }
272 
273  // XEnumeration
274  virtual sal_Bool SAL_CALL hasMoreElements( ) override;
275  virtual Any SAL_CALL nextElement( ) override;
276 
277  protected:
278  virtual ~MapEnumeration() override
279  {
280  acquire();
281  {
282  ::osl::MutexGuard aGuard( getMutex() );
284  m_pMapDataCopy.reset();
285  }
286  }
287 
288  private:
289  // since we share our mutex with the main map, we need to keep it alive as long as we live
291  std::unique_ptr< MapData > m_pMapDataCopy;
293  };
294 
295 
297  :Map_IFace( m_aMutex )
298  ,ComponentBase( Map_IFace::rBHelper )
299  {
300  }
301 
302 
304  {
305  if ( !impl_isDisposed() )
306  {
307  acquire();
308  dispose();
309  }
310  }
311 
312 
313  void SAL_CALL EnumerableMap::initialize( const Sequence< Any >& _arguments )
314  {
317  throw AlreadyInitializedException();
318 
319  sal_Int32 nArgumentCount = _arguments.getLength();
320  if ( ( nArgumentCount != 2 ) && ( nArgumentCount != 3 ) )
321  throw IllegalArgumentException();
322 
323  Type aKeyType, aValueType;
324  if ( !( _arguments[0] >>= aKeyType ) )
325  throw IllegalArgumentException("com.sun.star.uno.Type expected.", *this, 1 );
326  if ( !( _arguments[1] >>= aValueType ) )
327  throw IllegalArgumentException("com.sun.star.uno.Type expected.", *this, 2 );
328 
329  Sequence< Pair< Any, Any > > aInitialValues;
330  bool bMutable = true;
331  if ( nArgumentCount == 3 )
332  {
333  if ( !( _arguments[2] >>= aInitialValues ) )
334  throw IllegalArgumentException("[]com.sun.star.beans.Pair<any,any> expected.", *this, 2 );
335  bMutable = false;
336  }
337 
338  // for the value, anything is allowed, except VOID
339  if ( ( aValueType.getTypeClass() == TypeClass_VOID ) || ( aValueType.getTypeClass() == TypeClass_UNKNOWN ) )
340  throw IllegalTypeException("Unsupported value type.", *this );
341 
342  // create the comparator for the KeyType, and throw if the type is not supported
343  std::unique_ptr< IKeyPredicateLess > pComparator( getStandardLessPredicate( aKeyType, nullptr ) );
344  if (!pComparator)
345  throw IllegalTypeException("Unsupported key type.", *this );
346 
347  // init members
348  m_aData.m_aKeyType = aKeyType;
349  m_aData.m_aValueType = aValueType;
350  m_aData.m_pKeyCompare = std::move(pComparator);
352  m_aData.m_bMutable = bMutable;
353 
354  if ( aInitialValues.hasElements() )
355  impl_initValues_throw( aInitialValues );
356 
357  setInitialized();
358  }
359 
360 
361  void EnumerableMap::impl_initValues_throw( const Sequence< Pair< Any, Any > >& _initialValues )
362  {
363  OSL_PRECOND( m_aData.m_pValues.get() && m_aData.m_pValues->empty(), "EnumerableMap::impl_initValues_throw: illegal call!" );
364  if (!m_aData.m_pValues || !m_aData.m_pValues->empty())
365  throw RuntimeException();
366 
367  const Pair< Any, Any >* mapping = _initialValues.getConstArray();
368  const Pair< Any, Any >* mappingEnd = mapping + _initialValues.getLength();
369  for ( ; mapping != mappingEnd; ++mapping )
370  {
371  impl_checkValue_throw( mapping->Second );
372  (*m_aData.m_pValues)[ mapping->First ] = mapping->Second;
373  }
374  }
375 
376 
377  void EnumerableMap::impl_checkValue_throw( const Any& _value ) const
378  {
379  if ( !_value.hasValue() )
380  // nothing to do, NULL values are always allowed, regardless of the ValueType
381  return;
382 
383  TypeClass eAllowedTypeClass = m_aData.m_aValueType.getTypeClass();
384  bool bValid = false;
385 
386  switch ( eAllowedTypeClass )
387  {
388  default:
389  bValid = ( _value.getValueTypeClass() == eAllowedTypeClass );
390  break;
391  case TypeClass_ANY:
392  bValid = true;
393  break;
394  case TypeClass_INTERFACE:
395  {
396  // special treatment: _value might contain the proper type, but the interface
397  // might actually be NULL. Which is still valid ...
398  if ( m_aData.m_aValueType.isAssignableFrom( _value.getValueType() ) )
399  // this also catches the special case where XFoo is our value type,
400  // and _value contains a NULL-reference to XFoo, or a derived type
401  bValid = true;
402  else
403  {
404  Reference< XInterface > xValue( _value, UNO_QUERY );
405  if ( xValue.is() )
406  // XInterface is not-NULL, but is X(ValueType) not-NULL, too?
407  xValue.set( xValue->queryInterface( m_aData.m_aValueType ), UNO_QUERY );
408  bValid = xValue.is();
409  }
410  }
411  break;
412  case TypeClass_EXCEPTION:
413  case TypeClass_STRUCT:
414  {
415  // values are accepted if and only if their type equals, or is derived from, our value type
416 
417  if ( _value.getValueTypeClass() != eAllowedTypeClass )
418  bValid = false;
419  else
420  {
421  const TypeDescription aValueTypeDesc( _value.getValueType() );
422  const TypeDescription aRequiredTypeDesc( m_aData.m_aValueType );
423 
424  const _typelib_CompoundTypeDescription* pValueCompoundTypeDesc =
425  reinterpret_cast< const _typelib_CompoundTypeDescription* >( aValueTypeDesc.get() );
426 
427  while ( pValueCompoundTypeDesc )
428  {
429  if ( typelib_typedescription_equals( &pValueCompoundTypeDesc->aBase, aRequiredTypeDesc.get() ) )
430  break;
431  pValueCompoundTypeDesc = pValueCompoundTypeDesc->pBaseTypeDescription;
432  }
433  bValid = ( pValueCompoundTypeDesc != nullptr );
434  }
435  }
436  break;
437  }
438 
439  if ( !bValid )
440  {
441  throw IllegalTypeException(
442  "Incompatible value type. Found '" + _value.getValueTypeName()
443  + "', where '" + m_aData.m_aValueType.getTypeName()
444  + "' (or compatible type) is expected.",
445  *const_cast< EnumerableMap* >( this ) );
446  }
447 
449  }
450 
451 
452  void EnumerableMap::impl_checkNaN_throw( const Any& _keyOrValue, const Type& _keyOrValueType ) const
453  {
454  if ( ( _keyOrValueType.getTypeClass() == TypeClass_DOUBLE )
455  || ( _keyOrValueType.getTypeClass() == TypeClass_FLOAT )
456  )
457  {
458  double nValue(0);
459  if ( _keyOrValue >>= nValue )
460  if ( ::rtl::math::isNan( nValue ) )
461  throw IllegalArgumentException(
462  "NaN (not-a-number) not supported by this implementation.",
463  *const_cast< EnumerableMap* >( this ), 0 );
464  // (note that the case of _key not containing a float/double value is handled in the
465  // respective IKeyPredicateLess implementation, so there's no need to handle this here.)
466  }
467  }
468 
469 
470  void EnumerableMap::impl_checkKey_throw( const Any& _key ) const
471  {
472  if ( !_key.hasValue() )
473  throw IllegalArgumentException(
474  "NULL keys not supported by this implementation.",
475  *const_cast< EnumerableMap* >( this ), 0 );
476 
478  }
479 
480 
482  {
483  if ( !m_aData.m_bMutable )
484  throw NoSupportException(
485  "The map is immutable.",
486  *const_cast< EnumerableMap* >( this ) );
487  }
488 
489 
490  Reference< XEnumeration > SAL_CALL EnumerableMap::createKeyEnumeration( sal_Bool Isolated )
491  {
492  ComponentMethodGuard aGuard( *this );
493  return new MapEnumeration( *this, m_aData, getBroadcastHelper(), eKeys, Isolated );
494  }
495 
496 
497  Reference< XEnumeration > SAL_CALL EnumerableMap::createValueEnumeration( sal_Bool Isolated )
498  {
499  ComponentMethodGuard aGuard( *this );
500  return new MapEnumeration( *this, m_aData, getBroadcastHelper(), eValues, Isolated );
501  }
502 
503 
504  Reference< XEnumeration > SAL_CALL EnumerableMap::createElementEnumeration( sal_Bool Isolated )
505  {
506  ComponentMethodGuard aGuard( *this );
507  return new MapEnumeration( *this, m_aData, getBroadcastHelper(), eBoth, Isolated );
508  }
509 
510 
512  {
513  ComponentMethodGuard aGuard( *this );
514  return m_aData.m_aKeyType;
515  }
516 
517 
519  {
520  ComponentMethodGuard aGuard( *this );
521  return m_aData.m_aValueType;
522  }
523 
524 
525  void SAL_CALL EnumerableMap::clear( )
526  {
527  ComponentMethodGuard aGuard( *this );
529 
530  m_aData.m_pValues->clear();
531 
533  }
534 
535 
536  sal_Bool SAL_CALL EnumerableMap::containsKey( const Any& _key )
537  {
538  ComponentMethodGuard aGuard( *this );
539  impl_checkKey_throw( _key );
540 
541  KeyedValues::const_iterator pos = m_aData.m_pValues->find( _key );
542  return ( pos != m_aData.m_pValues->end() );
543  }
544 
545 
546  sal_Bool SAL_CALL EnumerableMap::containsValue( const Any& _value )
547  {
548  ComponentMethodGuard aGuard( *this );
549  impl_checkValue_throw( _value );
550  for (auto const& value : *m_aData.m_pValues)
551  {
552  if ( value.second == _value )
553  return true;
554  }
555  return false;
556  }
557 
558 
559  Any SAL_CALL EnumerableMap::get( const Any& _key )
560  {
561  ComponentMethodGuard aGuard( *this );
562  impl_checkKey_throw( _key );
563 
564  KeyedValues::const_iterator pos = m_aData.m_pValues->find( _key );
565  if ( pos == m_aData.m_pValues->end() )
566  throw NoSuchElementException( anyToString( _key ), *this );
567 
568  return pos->second;
569  }
570 
571 
572  Any SAL_CALL EnumerableMap::put( const Any& _key, const Any& _value )
573  {
574  ComponentMethodGuard aGuard( *this );
576  impl_checkKey_throw( _key );
577  impl_checkValue_throw( _value );
578 
579  Any previousValue;
580 
581  KeyedValues::iterator pos = m_aData.m_pValues->find( _key );
582  if ( pos != m_aData.m_pValues->end() )
583  {
584  previousValue = pos->second;
585  pos->second = _value;
586  }
587  else
588  {
589  (*m_aData.m_pValues)[ _key ] = _value;
590  }
591 
593 
594  return previousValue;
595  }
596 
597 
598  Any SAL_CALL EnumerableMap::remove( const Any& _key )
599  {
600  ComponentMethodGuard aGuard( *this );
602  impl_checkKey_throw( _key );
603 
604  Any previousValue;
605 
606  KeyedValues::iterator pos = m_aData.m_pValues->find( _key );
607  if ( pos != m_aData.m_pValues->end() )
608  {
609  previousValue = pos->second;
610  m_aData.m_pValues->erase( pos );
611  }
612 
614 
615  return previousValue;
616  }
617 
618 
620  {
621  return ::cppu::UnoType< Pair< Any, Any > >::get();
622  }
623 
624 
626  {
627  ComponentMethodGuard aGuard( *this );
628  return m_aData.m_pValues->empty();
629  }
630 
631 
633  {
635  }
636 
637  sal_Bool SAL_CALL EnumerableMap::supportsService( const OUString& _serviceName )
638  {
639  return cppu::supportsService(this, _serviceName);
640  }
641 
642 
644  {
646  }
647 
648 
650  {
651  return "org.openoffice.comp.comphelper.EnumerableMap";
652  }
653 
654 
656  {
657  Sequence< OUString > aServiceNames { "com.sun.star.container.EnumerableMap" };
658  return aServiceNames;
659  }
660 
661 
663  {
664  return *new EnumerableMap;
665  }
666 
667 
669  {
670  if ( m_disposed )
671  throw DisposedException( OUString(), m_rParent );
672  return m_mapPos != m_rMapData.m_pValues->end();
673  }
674 
675 
677  {
678  if ( m_disposed )
679  throw DisposedException( OUString(), m_rParent );
680  if ( m_mapPos == m_rMapData.m_pValues->end() )
681  throw NoSuchElementException("No more elements.", m_rParent );
682 
683  Any aNextElement;
684  switch ( m_eType )
685  {
686  case eKeys: aNextElement = m_mapPos->first; break;
687  case eValues: aNextElement = m_mapPos->second; break;
688  case eBoth: aNextElement <<= Pair< Any, Any >( m_mapPos->first, m_mapPos->second ); break;
689  }
690  ++m_mapPos;
691  return aNextElement;
692  }
693 
694 
696  {
697  m_disposed = true;
698  }
699 
700 
702  {
703  ComponentMethodGuard aGuard( *this );
705  }
706 
707 
709  {
710  ComponentMethodGuard aGuard( *this );
711  return m_aEnumerator.nextElement();
712  }
713 
714 
715 } // namespace comphelper
716 
717 
719 {
721 }
722 
723 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Type
virtual void SAL_CALL acquire() SAL_OVERRIDE
::osl::Mutex m_aMutex
::cppu::OBroadcastHelper & getBroadcastHelper()
retrieves the component's broadcast helper
KeyedValues::const_iterator m_mapPos
IJScriptValueObject VARIANT value
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createKeyEnumeration(sal_Bool Isolated) override
const MapEnumerator & operator=(const MapEnumerator &)=delete
virtual Any SAL_CALL put(const Any &_key, const Any &_value) override
MapEnumeration(::cppu::OWeakObject &_parentMap, MapData &_mapData,::cppu::OBroadcastHelper &_rBHelper, const EnumerationType _type, const bool _isolated)
const EnumerationType m_eType
virtual Type SAL_CALL getValueType() override
std::map< Any, Any, LessPredicateAdapter > KeyedValues
Reference< XInterface > m_xKeepMapAlive
void impl_checkMutable_throw() const
static void lcl_notifyMapDataListeners_nothrow(const MapData &_mapData)
MapData(const MapData &_source)
MapEnumerator(::cppu::OWeakObject &_rParent, MapData &_mapData, const EnumerationType _type)
bool impl_isDisposed() const
determines whether the instance is already disposed
std::shared_ptr< IKeyPredicateLess > m_pKeyCompare
enumrange< T >::Iterator begin(enumrange< T >)
allow the method to be called without being initialized
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
::cppu::OWeakObject & m_rParent
void impl_checkNaN_throw(const Any &_keyOrValue, const Type &_keyOrValueType) const
virtual sal_Bool SAL_CALL hasElements() override
sal_Bool SAL_CALL typelib_typedescription_equals(const typelib_TypeDescription *p1, const typelib_TypeDescription *p2) SAL_THROW_EXTERN_C()
std::unique_ptr< MapData > m_pMapDataCopy
::cppu::WeakImplHelper< XEnumeration > MapEnumeration_Base
void impl_checkValue_throw(const Any &_value) const
throws an IllegalTypeException if the given value is not compatible with our ValueType ...
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
void setInitialized()
marks the instance as initialized
virtual ~MapEnumeration() override
void impl_initValues_throw(const Sequence< Pair< Any, Any > > &_initialValues)
virtual Any SAL_CALL nextElement() override
unsigned char sal_Bool
virtual ~EnumerableMap() override
::cppu::WeakAggComponentImplHelper3< XInitialization, XEnumerableMap, XServiceInfo > Map_IFace
virtual Type SAL_CALL getElementType() override
void createRegistryInfo_Map()
virtual sal_Bool SAL_CALL hasMoreElements() override
virtual void SAL_CALL clear() override
virtual sal_Bool SAL_CALL containsValue(const Any &_value) override
::osl::Mutex & getMutex()
retrieves the component's mutex
std::unique_ptr< KeyedValues > m_pValues
static Sequence< OUString > getSupportedServiceNames_static()
virtual sal_Bool SAL_CALL containsKey(const Any &_key) override
virtual void SAL_CALL initialize(const Sequence< Any > &aArguments) override
virtual Any SAL_CALL get(const Any &_key) override
virtual Any SAL_CALL remove(const Any &_key) override
std::unique_ptr< IKeyPredicateLess > getStandardLessPredicate(Type const &i_type, Reference< XCollator > const &i_collator)
Definition: anycompare.cxx:162
virtual OUString SAL_CALL getImplementationName() override
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createElementEnumeration(sal_Bool Isolated) override
virtual Type SAL_CALL getKeyType() override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createValueEnumeration(sal_Bool Isolated) override
void dispose()
void mapModified()
called when the map was modified
static void lcl_revokeMapModificationListener(MapData &_mapData, MapEnumerator &_listener)
static void lcl_registerMapModificationListener(MapData &_mapData, MapEnumerator &_listener)
static Reference< XInterface > Create(const Reference< XComponentContext > &)
bool impl_isInitialized_nothrow() const
determines whether the component is already initialized
static OUString getImplementationName_static()
void impl_checkKey_throw(const Any &_key) const
std::vector< MapEnumerator * > m_aModListeners
OUString anyToString(uno::Any const &value)
MapData & operator=(const MapData &_source)=delete