diff options
Diffstat (limited to 'comphelper/source/container/enumerablemap.cxx')
-rw-r--r-- | comphelper/source/container/enumerablemap.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx index 55c2b9e28077..ae78223a20fe 100644 --- a/comphelper/source/container/enumerablemap.cxx +++ b/comphelper/source/container/enumerablemap.cxx @@ -18,7 +18,6 @@ */ -#include <comphelper_module.hxx> #include <comphelper/anytostring.hxx> #include <comphelper/anycompare.hxx> #include <comphelper/componentbase.hxx> @@ -30,15 +29,17 @@ #include <com/sun/star/beans/IllegalTypeException.hpp> #include <com/sun/star/beans/Pair.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> -#include <cppuhelper/compbase3.hxx> +#include <cppuhelper/compbase.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> -#include <rtl/math.hxx> #include <typelib/typedescription.hxx> +#include <cmath> #include <map> #include <memory> +#include <optional> #include <utility> namespace comphelper @@ -89,7 +90,7 @@ namespace comphelper { Type m_aKeyType; Type m_aValueType; - std::unique_ptr< KeyedValues > m_pValues; + std::optional< KeyedValues > m_pValues; std::shared_ptr< IKeyPredicateLess > m_pKeyCompare; bool m_bMutable; std::vector< MapEnumerator* > m_aModListeners; @@ -102,11 +103,10 @@ namespace comphelper MapData( const MapData& _source ) :m_aKeyType( _source.m_aKeyType ) ,m_aValueType( _source.m_aValueType ) - ,m_pValues( new KeyedValues( *_source.m_pValues ) ) ,m_pKeyCompare( _source.m_pKeyCompare ) ,m_bMutable( false ) - ,m_aModListeners() { + m_pValues.emplace( *_source.m_pValues ); } private: MapData& operator=( const MapData& _source ) = delete; @@ -143,7 +143,7 @@ namespace comphelper // EnumerableMap - typedef ::cppu::WeakAggComponentImplHelper3 < XInitialization + typedef ::cppu::WeakComponentImplHelper < XInitialization , XEnumerableMap , XServiceInfo > Map_IFace; @@ -326,7 +326,7 @@ namespace comphelper sal_Int32 nArgumentCount = _arguments.getLength(); if ( ( nArgumentCount != 2 ) && ( nArgumentCount != 3 ) ) - throw IllegalArgumentException(); + throw IllegalArgumentException("wrong number of args", static_cast<cppu::OWeakObject*>(this), 1); Type aKeyType, aValueType; if ( !( _arguments[0] >>= aKeyType ) ) @@ -356,7 +356,7 @@ namespace comphelper m_aData.m_aKeyType = aKeyType; m_aData.m_aValueType = aValueType; m_aData.m_pKeyCompare = std::move(pComparator); - m_aData.m_pValues.reset( new KeyedValues( *m_aData.m_pKeyCompare ) ); + m_aData.m_pValues.emplace( *m_aData.m_pKeyCompare ); m_aData.m_bMutable = bMutable; if ( aInitialValues.hasElements() ) |