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