diff options
author | Matúš Kukan <matus.kukan@gmail.com> | 2015-12-28 20:23:48 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2015-12-28 20:35:41 +0100 |
commit | 42ab260e502c29034d4deb0c4a5a29d7a34c7b96 (patch) | |
tree | 39a61e5ab6d845eab1ba8167e48809f59a62c092 /extensions/source | |
parent | cc6ccaf922bc8cefec714b9110a7d36ae113817c (diff) |
tdf#74608: Ctor function for logging::CsvFormatter
Change-Id: I3383e02a7162cc8dbce3ba0b04fac6dec3492d94
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/logging/csvformatter.cxx | 69 | ||||
-rw-r--r-- | extensions/source/logging/log.component | 3 | ||||
-rw-r--r-- | extensions/source/logging/log_services.cxx | 1 | ||||
-rw-r--r-- | extensions/source/logging/log_services.hxx | 1 |
4 files changed, 19 insertions, 55 deletions
diff --git a/extensions/source/logging/csvformatter.cxx b/extensions/source/logging/csvformatter.cxx index 708dfbc71726..3b358d3d7ab6 100644 --- a/extensions/source/logging/csvformatter.cxx +++ b/extensions/source/logging/csvformatter.cxx @@ -17,12 +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 <string> +#include <sal/config.h> #include <com/sun/star/logging/XCsvLogFormatter.hpp> #include <com/sun/star/logging/XLogFormatter.hpp> @@ -33,40 +28,28 @@ #include <cppuhelper/supportsservice.hxx> #include <rtl/ustrbuf.hxx> - #include <osl/thread.h> +#include <stdio.h> +#include <string> + namespace logging { - - using ::com::sun::star::logging::XCsvLogFormatter; - 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; // formats for csv files as defined by RFC4180 - typedef ::cppu::WeakImplHelper < XCsvLogFormatter - , XServiceInfo - > CsvFormatter_Base; - class CsvFormatter : public CsvFormatter_Base + class CsvFormatter : public cppu::WeakImplHelper<css::logging::XCsvLogFormatter, css::lang::XServiceInfo> { public: virtual OUString SAL_CALL formatMultiColumn(const Sequence< OUString>& column_data) throw (RuntimeException, std::exception) override; - // XServiceInfo - static version - static OUString SAL_CALL getImplementationName_static(); - static Sequence< OUString > SAL_CALL getSupportedServiceNames_static(); - static Reference< XInterface > Create( const Reference< XComponentContext >& context ); - - protected: CsvFormatter(); virtual ~CsvFormatter(); + private: // XCsvLogFormatter virtual sal_Bool SAL_CALL getLogEventNo() throw (RuntimeException, std::exception) override; virtual sal_Bool SAL_CALL getLogThread() throw (RuntimeException, std::exception) override; @@ -142,12 +125,6 @@ namespace else buf.append(str); }; - - css::uno::Sequence< OUString> initialColumns() - { - css::uno::Sequence< OUString> result { "message" }; - return result; - }; } namespace logging @@ -158,7 +135,7 @@ namespace logging m_LogTimestamp(true), m_LogSource(false), m_MultiColumn(false), - m_Columnnames(initialColumns()) + m_Columnnames({ "message" }) { } CsvFormatter::~CsvFormatter() @@ -317,34 +294,22 @@ namespace logging OUString SAL_CALL CsvFormatter::getImplementationName() throw(RuntimeException, std::exception) { - return getImplementationName_static(); + return OUString("com.sun.star.comp.extensions.CsvFormatter"); } Sequence< OUString > SAL_CALL CsvFormatter::getSupportedServiceNames() throw(RuntimeException, std::exception) { - return getSupportedServiceNames_static(); + return { "com.sun.star.logging.CsvFormatter" }; } - OUString SAL_CALL CsvFormatter::getImplementationName_static() - { - return OUString( "com.sun.star.comp.extensions.CsvFormatter" ); - } - - Sequence< OUString > SAL_CALL CsvFormatter::getSupportedServiceNames_static() - { - Sequence< OUString > aServiceNames { "com.sun.star.logging.CsvFormatter" }; - return aServiceNames; - } - - Reference< XInterface > CsvFormatter::Create( const Reference< XComponentContext >& ) - { - return *( new CsvFormatter ); - } - - void createRegistryInfo_CsvFormatter() - { - static OAutoRegistration< CsvFormatter > aAutoRegistration; - } } // namespace logging +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_extensions_CsvFormatter( + css::uno::XComponentContext *, + css::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new logging::CsvFormatter()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/log.component b/extensions/source/logging/log.component index 4cd5a553be2d..3f9ad05e073d 100644 --- a/extensions/source/logging/log.component +++ b/extensions/source/logging/log.component @@ -23,7 +23,8 @@ constructor="com_sun_star_comp_extensions_ConsoleHandler"> <service name="com.sun.star.logging.ConsoleHandler"/> </implementation> - <implementation name="com.sun.star.comp.extensions.CsvFormatter"> + <implementation name="com.sun.star.comp.extensions.CsvFormatter" + constructor="com_sun_star_comp_extensions_CsvFormatter"> <service name="com.sun.star.logging.CsvFormatter"/> </implementation> <implementation name="com.sun.star.comp.extensions.FileHandler" diff --git a/extensions/source/logging/log_services.cxx b/extensions/source/logging/log_services.cxx index d2599a0c0dad..09df0db2539d 100644 --- a/extensions/source/logging/log_services.cxx +++ b/extensions/source/logging/log_services.cxx @@ -26,7 +26,6 @@ namespace logging { ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); createRegistryInfo_PlainTextFormatter(); - createRegistryInfo_CsvFormatter(); } diff --git a/extensions/source/logging/log_services.hxx b/extensions/source/logging/log_services.hxx index 17c5ec984722..47d6a6c08e88 100644 --- a/extensions/source/logging/log_services.hxx +++ b/extensions/source/logging/log_services.hxx @@ -25,7 +25,6 @@ namespace logging { void createRegistryInfo_PlainTextFormatter(); -void createRegistryInfo_CsvFormatter(); } |