Branch data Line data Source code
1 : : #ifndef INCLUDED_COM_SUN_STAR_RDF_URI_HPP
2 : : #define INCLUDED_COM_SUN_STAR_RDF_URI_HPP
3 : :
4 : : #include "sal/config.h"
5 : :
6 : : #include "com/sun/star/uno/RuntimeException.hpp"
7 : : #include "com/sun/star/uno/Exception.hpp"
8 : : #include "com/sun/star/uno/DeploymentException.hpp"
9 : : #include "com/sun/star/uno/XComponentContext.hpp"
10 : : #include "com/sun/star/rdf/XURI.hpp"
11 : : #include "com/sun/star/lang/XMultiComponentFactory.hpp"
12 : : #include "com/sun/star/lang/IllegalArgumentException.hpp"
13 : : #include "com/sun/star/uno/Any.hxx"
14 : : #include "com/sun/star/uno/Reference.hxx"
15 : : #include "com/sun/star/uno/Sequence.hxx"
16 : : #include "cppu/unotype.hxx"
17 : : #include "rtl/ustring.h"
18 : : #include "rtl/ustring.hxx"
19 : : #include "sal/types.h"
20 : :
21 : : namespace com { namespace sun { namespace star { namespace rdf {
22 : :
23 : : class URI {
24 : : public:
25 : 2347 : static ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI > create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::rtl::OUString& Value) {
26 [ + - ][ + - ]: 2347 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
27 [ - + ]: 2347 : if (!the_factory.is()) {
28 [ # # ][ # # ]: 0 : throw com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service manager")), the_context);
29 : : }
30 [ + - ]: 2347 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(1);
31 [ + - ][ + - ]: 2347 : the_arguments[0] <<= Value;
32 : 2347 : ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI > the_instance;
33 : : try {
34 [ + - ][ + - ]: 2347 : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.rdf.URI")), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
[ + - ][ + - ]
[ + - ]
35 : 0 : } catch (::com::sun::star::uno::RuntimeException &) {
36 : 0 : throw;
37 : 0 : } catch (::com::sun::star::lang::IllegalArgumentException &) {
38 : 0 : throw;
39 [ # # # # ]: 0 : } catch (::com::sun::star::uno::Exception & the_exception) {
40 [ # # # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.rdf.URI of type com.sun.star.rdf.XURI: ")) + the_exception.Message, the_context);
41 : : }
42 [ + + ]: 2347 : if (!the_instance.is()) {
43 [ + - ][ + - ]: 33 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.rdf.URI of type com.sun.star.rdf.XURI")), the_context);
44 : : }
45 [ + - ]: 2347 : return the_instance;
46 : : }
47 : :
48 : 180 : static ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI > createNS(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::rtl::OUString& Namespace, const ::rtl::OUString& LocalName) {
49 [ + - ][ + - ]: 180 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
50 [ - + ]: 180 : if (!the_factory.is()) {
51 [ # # ][ # # ]: 0 : throw com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service manager")), the_context);
52 : : }
53 [ + - ]: 180 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(2);
54 [ + - ][ + - ]: 180 : the_arguments[0] <<= Namespace;
55 [ + - ][ + - ]: 180 : the_arguments[1] <<= LocalName;
56 : 180 : ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI > the_instance;
57 : : try {
58 [ + - ][ + - ]: 180 : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.rdf.URI")), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
[ + - ][ + - ]
[ + - ]
59 : 0 : } catch (::com::sun::star::uno::RuntimeException &) {
60 : 0 : throw;
61 : 0 : } catch (::com::sun::star::lang::IllegalArgumentException &) {
62 : 0 : throw;
63 [ # # # # ]: 0 : } catch (::com::sun::star::uno::Exception & the_exception) {
64 [ # # # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.rdf.URI of type com.sun.star.rdf.XURI: ")) + the_exception.Message, the_context);
65 : : }
66 [ - + ]: 180 : if (!the_instance.is()) {
67 [ # # ][ # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.rdf.URI of type com.sun.star.rdf.XURI")), the_context);
68 : : }
69 [ + - ]: 180 : return the_instance;
70 : : }
71 : :
72 : 110 : static ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI > createKnown(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, ::sal_Int16 Id) {
73 [ + - ][ + - ]: 110 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
74 [ - + ]: 110 : if (!the_factory.is()) {
75 [ # # ][ # # ]: 0 : throw com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service manager")), the_context);
76 : : }
77 [ + - ]: 110 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(1);
78 [ + - ][ + - ]: 110 : the_arguments[0] <<= Id;
79 : 110 : ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI > the_instance;
80 : : try {
81 [ + - ][ + - ]: 110 : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.rdf.URI")), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
[ + - ][ + - ]
[ + - ]
82 : 0 : } catch (::com::sun::star::uno::RuntimeException &) {
83 : 0 : throw;
84 : 0 : } catch (::com::sun::star::lang::IllegalArgumentException &) {
85 : 0 : throw;
86 [ # # # # ]: 0 : } catch (::com::sun::star::uno::Exception & the_exception) {
87 [ # # # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.rdf.URI of type com.sun.star.rdf.XURI: ")) + the_exception.Message, the_context);
88 : : }
89 [ - + ]: 110 : if (!the_instance.is()) {
90 [ # # ][ # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.rdf.URI of type com.sun.star.rdf.XURI")), the_context);
91 : : }
92 [ + - ]: 110 : return the_instance;
93 : : }
94 : :
95 : : private:
96 : : URI(); // not implemented
97 : : URI(URI &); // not implemented
98 : : ~URI(); // not implemented
99 : : void operator =(URI); // not implemented
100 : : };
101 : :
102 : : } } } }
103 : :
104 : : #endif // INCLUDED_COM_SUN_STAR_RDF_URI_HPP
|