28#include <osl/mutex.hxx>
29#include <com/sun/star/container/XNameContainer.hpp>
38 class NameContainer :
public ::cppu::WeakImplHelper< css::container::XNameContainer >
44 virtual void SAL_CALL insertByName(
const OUString&
aName,
const css::uno::Any& aElement )
override;
45 virtual void SAL_CALL removeByName(
const OUString&
Name )
override;
48 virtual void SAL_CALL replaceByName(
const OUString&
aName,
const css::uno::Any& aElement )
override;
51 virtual css::uno::Any SAL_CALL getByName(
const OUString&
aName )
override;
52 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( )
override;
53 virtual sal_Bool SAL_CALL hasByName(
const OUString&
aName )
override;
56 virtual sal_Bool SAL_CALL hasElements( )
override;
57 virtual css::uno::Type SAL_CALL getElementType( )
override;
83 std::scoped_lock aGuard(
maMutex );
86 throw ElementExistException();
88 if( aElement.getValueType() !=
maType )
89 throw IllegalArgumentException(
"element is wrong type",
static_cast<cppu::OWeakObject*
>(
this), 2);
96 std::scoped_lock aGuard(
maMutex );
98 SvGenericNameContainerMapImpl::iterator aIter =
maProperties.find( Name );
100 throw NoSuchElementException();
109 std::scoped_lock aGuard(
maMutex );
111 SvGenericNameContainerMapImpl::iterator aIter(
maProperties.find( aName ) );
113 throw NoSuchElementException();
115 if( aElement.getValueType() !=
maType )
116 throw IllegalArgumentException(
"element is wrong type",
static_cast<cppu::OWeakObject*
>(
this), 2);
118 (*aIter).second = aElement;
125 std::scoped_lock aGuard(
maMutex );
127 SvGenericNameContainerMapImpl::iterator aIter =
maProperties.find( aName );
129 throw NoSuchElementException();
131 return (*aIter).second;
136 std::scoped_lock aGuard(
maMutex );
143 std::scoped_lock aGuard(
maMutex );
145 SvGenericNameContainerMapImpl::iterator aIter =
maProperties.find( aName );
151 std::scoped_lock aGuard(
maMutex );
virtual void SAL_CALL insertByName(const OUString &rName, const css::uno::Any &aElement) override
virtual void SAL_CALL replaceByName(const OUString &rName, const css::uno::Any &aElement) override
virtual css::uno::Any SAL_CALL getByName(const OUString &rName) override
virtual css::uno::Type SAL_CALL getElementType() override
virtual sal_Bool SAL_CALL hasElements() override
virtual void SAL_CALL removeByName(const OUString &rName) override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual sal_Bool SAL_CALL hasByName(const OUString &rName) override
const css::uno::Type maType
SvGenericNameContainerMapImpl maProperties
std::map< OUString, css::uno::Any > SvGenericNameContainerMapImpl
css::uno::Sequence< typename M::key_type > mapKeysToSequence(M const &map)
Copy (keys or values) from an associate container into a Sequence.
COMPHELPER_DLLPUBLIC css::uno::Reference< css::container::XNameContainer > NameContainer_createInstance(const css::uno::Type &aType)