Line data Source code
1 : #ifndef INCLUDED_COM_SUN_STAR_LOGGING_LOGGERPOOL_HPP
2 : #define INCLUDED_COM_SUN_STAR_LOGGING_LOGGERPOOL_HPP
3 :
4 : #include "sal/config.h"
5 :
6 : #include <cassert>
7 :
8 : #include "com/sun/star/logging/XLoggerPool.hpp"
9 : #include "com/sun/star/uno/DeploymentException.hpp"
10 : #include "com/sun/star/uno/XComponentContext.hpp"
11 : #include "com/sun/star/uno/Any.hxx"
12 : #include "com/sun/star/uno/Reference.hxx"
13 : #include "cppu/unotype.hxx"
14 : #include "rtl/ustring.h"
15 : #include "rtl/ustring.hxx"
16 :
17 : namespace com { namespace sun { namespace star { namespace logging {
18 :
19 : class LoggerPool {
20 : public:
21 5 : static ::com::sun::star::uno::Reference< css::logging::XLoggerPool > get(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context) {
22 : assert(the_context.is());
23 5 : ::com::sun::star::uno::Reference< css::logging::XLoggerPool > instance;
24 5 : if (!(the_context->getValueByName(::rtl::OUString( "/singletons/com.sun.star.logging.LoggerPool" )) >>= instance) || !instance.is()) {
25 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton com.sun.star.logging.LoggerPool of type com.sun.star.logging.XLoggerPool" ), the_context);
26 : }
27 5 : return instance;
28 : }
29 :
30 : private:
31 : LoggerPool(); // not implemented
32 : LoggerPool(LoggerPool &); // not implemented
33 : ~LoggerPool(); // not implemented
34 : void operator =(LoggerPool); // not implemented
35 : };
36 :
37 : } } } }
38 :
39 : #endif // INCLUDED_COM_SUN_STAR_LOGGING_LOGGERPOOL_HPP
|