/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
 * This file is part of the Collabora Office 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/.
 */

#include <sal/config.h>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/testuno/XStringFactory.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>

namespace com::sun::star::uno
{
class XComponentContext;
}

namespace
{
class SingletonTest
    : public cppu::WeakImplHelper<css::testuno::XStringFactory, css::lang::XServiceInfo>
{
public:
    OUString SAL_CALL getImplementationName() override
    {
        return u"com.sun.star.comp.testuno.Singleton"_ustr;
    }

    bool SAL_CALL supportsService(OUString const& ServiceName) override
    {
        return cppu::supportsService(this, ServiceName);
    }

    cpo::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
    {
        return { u"com.sun.star.testuno.Singleton"_ustr };
    }

    OUString SAL_CALL getString() override { return u"this is a string from XStringFactory"_ustr; }
};
}

extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
com_sun_star_comp_testuno_Singleton_get_implementation(css::uno::XComponentContext*,
                                                       cpo::uno::Sequence<cpo::uno::Any> const&)
{
    return cppu::acquire(new SingletonTest);
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
