diff options
author | Matúš Kukan <matus.kukan@gmail.com> | 2015-12-28 20:29:40 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2015-12-28 20:35:43 +0100 |
commit | e65709245cb844205f47ab1ccc79f718fbf2d025 (patch) | |
tree | 685d8785656414cee60ad67f7c8998c0034a62f2 /extensions/source/logging | |
parent | 42ab260e502c29034d4deb0c4a5a29d7a34c7b96 (diff) |
tdf#74608: Ctor function for logging::PlainTextFormatter
Change-Id: Ibaf362c811564cab1855fd5c863b59d90256d047
Diffstat (limited to 'extensions/source/logging')
-rw-r--r-- | extensions/source/logging/log.component | 5 | ||||
-rw-r--r-- | extensions/source/logging/log_services.cxx | 43 | ||||
-rw-r--r-- | extensions/source/logging/log_services.hxx | 33 | ||||
-rw-r--r-- | extensions/source/logging/plaintextformatter.cxx | 65 |
4 files changed, 18 insertions, 128 deletions
diff --git a/extensions/source/logging/log.component b/extensions/source/logging/log.component index 3f9ad05e073d..2bd7f651a622 100644 --- a/extensions/source/logging/log.component +++ b/extensions/source/logging/log.component @@ -18,7 +18,7 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="log" xmlns="http://openoffice.org/2010/uno-components"> + xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.extensions.ConsoleHandler" constructor="com_sun_star_comp_extensions_ConsoleHandler"> <service name="com.sun.star.logging.ConsoleHandler"/> @@ -35,7 +35,8 @@ constructor="com_sun_star_comp_extensions_LoggerPool"> <singleton name="com.sun.star.logging.LoggerPool"/> </implementation> - <implementation name="com.sun.star.comp.extensions.PlainTextFormatter"> + <implementation name="com.sun.star.comp.extensions.PlainTextFormatter" + constructor="com_sun_star_comp_extensions_PlainTextFormatter"> <service name="com.sun.star.logging.PlainTextFormatter"/> </implementation> </component> diff --git a/extensions/source/logging/log_services.cxx b/extensions/source/logging/log_services.cxx deleted file mode 100644 index 09df0db2539d..000000000000 --- a/extensions/source/logging/log_services.cxx +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "log_module.hxx" -#include "log_services.hxx" - -namespace logging -{ - static void initializeModule() - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - createRegistryInfo_PlainTextFormatter(); - } - - -} // namespace logging - - -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL log_component_getFactory( - const sal_Char* pImplementationName, SAL_UNUSED_PARAMETER void*, - SAL_UNUSED_PARAMETER void* ) -{ - ::logging::initializeModule(); - return ::logging::LogModule::getInstance().getComponentFactory( pImplementationName ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/log_services.hxx b/extensions/source/logging/log_services.hxx deleted file mode 100644 index 47d6a6c08e88..000000000000 --- a/extensions/source/logging/log_services.hxx +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOG_SERVICES_HXX -#define INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOG_SERVICES_HXX - -#include <sal/config.h> - -namespace logging { - -void createRegistryInfo_PlainTextFormatter(); - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/plaintextformatter.cxx b/extensions/source/logging/plaintextformatter.cxx index 585b5e864ff3..7712f54ea6be 100644 --- a/extensions/source/logging/plaintextformatter.cxx +++ b/extensions/source/logging/plaintextformatter.cxx @@ -17,11 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#include "log_module.hxx" -#include "log_services.hxx" - -#include <stdio.h> +#include <sal/config.h> #include <com/sun/star/logging/XLogFormatter.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -31,32 +27,26 @@ #include <cppuhelper/supportsservice.hxx> #include <rtl/ustrbuf.hxx> - #include <osl/thread.h> +#include <stdio.h> namespace logging { - - - using ::com::sun::star::logging::XLogFormatter; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; - using ::com::sun::star::lang::XServiceInfo; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::logging::LogRecord; using ::com::sun::star::uno::XInterface; - typedef ::cppu::WeakImplHelper < XLogFormatter - , XServiceInfo - > PlainTextFormatter_Base; - class PlainTextFormatter : public PlainTextFormatter_Base + class PlainTextFormatter : public cppu::WeakImplHelper<css::logging::XLogFormatter, css::lang::XServiceInfo> { - protected: + public: PlainTextFormatter(); virtual ~PlainTextFormatter(); + private: // XLogFormatter virtual OUString SAL_CALL getHead( ) throw (RuntimeException, std::exception) override; virtual OUString SAL_CALL format( const LogRecord& Record ) throw (RuntimeException, std::exception) override; @@ -66,12 +56,6 @@ namespace logging virtual OUString SAL_CALL getImplementationName() throw(RuntimeException, std::exception) override; virtual sal_Bool SAL_CALL supportsService( const OUString& _rServiceName ) throw(RuntimeException, std::exception) override; virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException, std::exception) override; - - public: - // XServiceInfo - static version - static OUString SAL_CALL getImplementationName_static(); - static Sequence< OUString > SAL_CALL getSupportedServiceNames_static(); - static Reference< XInterface > Create( const Reference< XComponentContext >& _rxContext ); }; PlainTextFormatter::PlainTextFormatter() @@ -153,42 +137,23 @@ namespace logging OUString SAL_CALL PlainTextFormatter::getImplementationName() throw(RuntimeException, std::exception) { - return getImplementationName_static(); + return OUString("com.sun.star.comp.extensions.PlainTextFormatter"); } - Sequence< OUString > SAL_CALL PlainTextFormatter::getSupportedServiceNames() throw(RuntimeException, std::exception) { - return getSupportedServiceNames_static(); - } - - - OUString SAL_CALL PlainTextFormatter::getImplementationName_static() - { - return OUString( "com.sun.star.comp.extensions.PlainTextFormatter" ); + return { "com.sun.star.logging.PlainTextFormatter" }; } - - Sequence< OUString > SAL_CALL PlainTextFormatter::getSupportedServiceNames_static() - { - Sequence< OUString > aServiceNames { "com.sun.star.logging.PlainTextFormatter" }; - return aServiceNames; - } - - - Reference< XInterface > PlainTextFormatter::Create( const Reference< XComponentContext >& ) - { - return *( new PlainTextFormatter ); - } - - - void createRegistryInfo_PlainTextFormatter() - { - static OAutoRegistration< PlainTextFormatter > aAutoRegistration; - } - - } // namespace logging +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_extensions_PlainTextFormatter( + css::uno::XComponentContext *, + css::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new logging::PlainTextFormatter()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |