Line data Source code
1 : #ifndef INCLUDED_COM_SUN_STAR_CONTAINER_ENUMERABLEMAP_HPP
2 : #define INCLUDED_COM_SUN_STAR_CONTAINER_ENUMERABLEMAP_HPP
3 :
4 : #include "sal/config.h"
5 :
6 : #include <cassert>
7 :
8 : #include "com/sun/star/uno/RuntimeException.hpp"
9 : #include "com/sun/star/uno/Exception.hpp"
10 : #include "com/sun/star/uno/XComponentContext.hpp"
11 : #include "com/sun/star/lang/IllegalArgumentException.hpp"
12 : #include "com/sun/star/container/XEnumerableMap.hpp"
13 : #include "com/sun/star/beans/IllegalTypeException.hpp"
14 : #include "com/sun/star/uno/DeploymentException.hpp"
15 : #include "com/sun/star/beans/Pair.hpp"
16 : #include "com/sun/star/uno/Any.hxx"
17 : #include "com/sun/star/uno/Reference.hxx"
18 : #include "com/sun/star/uno/Sequence.hxx"
19 : #include "com/sun/star/uno/Type.hxx"
20 : #include "cppu/unotype.hxx"
21 : #include "rtl/ustring.h"
22 : #include "rtl/ustring.hxx"
23 :
24 : namespace com { namespace sun { namespace star { namespace container {
25 :
26 : class EnumerableMap {
27 : public:
28 0 : static ::com::sun::star::uno::Reference< css::container::XEnumerableMap > create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::com::sun::star::uno::Type& KeyType, const ::com::sun::star::uno::Type& ValueType) {
29 : assert(the_context.is());
30 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(2);
31 0 : the_arguments[0] <<= KeyType;
32 0 : the_arguments[1] <<= ValueType;
33 0 : ::com::sun::star::uno::Reference< css::container::XEnumerableMap > the_instance;
34 : try {
35 0 : the_instance = ::com::sun::star::uno::Reference< css::container::XEnumerableMap >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.container.EnumerableMap" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
36 0 : } catch (::com::sun::star::uno::RuntimeException &) {
37 0 : throw;
38 0 : } catch (css::beans::IllegalTypeException &) {
39 0 : throw;
40 0 : } catch (::com::sun::star::uno::Exception & the_exception) {
41 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.container.EnumerableMap of type com.sun.star.container.XEnumerableMap: " ) + the_exception.Message, the_context);
42 : }
43 0 : if (!the_instance.is()) {
44 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.container.EnumerableMap of type com.sun.star.container.XEnumerableMap" ), the_context);
45 : }
46 0 : return the_instance;
47 : }
48 :
49 : static ::com::sun::star::uno::Reference< css::container::XEnumerableMap > createImmutable(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::com::sun::star::uno::Type& KeyType, const ::com::sun::star::uno::Type& ValueType, const ::com::sun::star::uno::Sequence< css::beans::Pair< ::com::sun::star::uno::Any, ::com::sun::star::uno::Any > >& Values) {
50 : assert(the_context.is());
51 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(3);
52 : the_arguments[0] <<= KeyType;
53 : the_arguments[1] <<= ValueType;
54 : the_arguments[2] <<= Values;
55 : ::com::sun::star::uno::Reference< css::container::XEnumerableMap > the_instance;
56 : try {
57 : the_instance = ::com::sun::star::uno::Reference< css::container::XEnumerableMap >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.container.EnumerableMap" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
58 : } catch (::com::sun::star::uno::RuntimeException &) {
59 : throw;
60 : } catch (css::beans::IllegalTypeException &) {
61 : throw;
62 : } catch (::com::sun::star::uno::Exception & the_exception) {
63 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.container.EnumerableMap of type com.sun.star.container.XEnumerableMap: " ) + the_exception.Message, the_context);
64 : }
65 : if (!the_instance.is()) {
66 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.container.EnumerableMap of type com.sun.star.container.XEnumerableMap" ), the_context);
67 : }
68 : return the_instance;
69 : }
70 :
71 : private:
72 : EnumerableMap(); // not implemented
73 : EnumerableMap(EnumerableMap &); // not implemented
74 : ~EnumerableMap(); // not implemented
75 : void operator =(EnumerableMap); // not implemented
76 : };
77 :
78 : } } } }
79 :
80 : #endif // INCLUDED_COM_SUN_STAR_CONTAINER_ENUMERABLEMAP_HPP
|