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