Kaydet (Commit) da40cdd0 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Remove com.sun.star.comp.stoc.RegistryTypeDescriptionProvider

...which had become unused with the new cppuhelper/source/typemanager.cxx.

Change-Id: Ic84d11cc9ecd1e7d73aa2757c14ffd46fa21e890
üst cc0dd9f8
...@@ -47,21 +47,6 @@ $(eval $(call gb_Library_add_exception_objects,bootstrap,\ ...@@ -47,21 +47,6 @@ $(eval $(call gb_Library_add_exception_objects,bootstrap,\
stoc/source/implementationregistration/implreg \ stoc/source/implementationregistration/implreg \
stoc/source/implementationregistration/mergekeys \ stoc/source/implementationregistration/mergekeys \
stoc/source/loader/dllcomponentloader \ stoc/source/loader/dllcomponentloader \
stoc/source/registry_tdprovider/functiondescription \
stoc/source/registry_tdprovider/methoddescription \
stoc/source/registry_tdprovider/rdbtdp_tdenumeration \
stoc/source/registry_tdprovider/structtypedescription \
stoc/source/registry_tdprovider/td \
stoc/source/registry_tdprovider/tdcomp \
stoc/source/registry_tdprovider/tdconsts \
stoc/source/registry_tdprovider/tdef \
stoc/source/registry_tdprovider/tdenum \
stoc/source/registry_tdprovider/tdiface \
stoc/source/registry_tdprovider/tdmodule \
stoc/source/registry_tdprovider/tdprop \
stoc/source/registry_tdprovider/tdprovider \
stoc/source/registry_tdprovider/tdservice \
stoc/source/registry_tdprovider/tdsingleton \
stoc/source/security/access_controller \ stoc/source/security/access_controller \
stoc/source/security/file_policy \ stoc/source/security/file_policy \
stoc/source/security/permissions \ stoc/source/security/permissions \
......
...@@ -84,13 +84,6 @@ namespace stoc_bootstrap ...@@ -84,13 +84,6 @@ namespace stoc_bootstrap
throw(::com::sun::star::uno::Exception); throw(::com::sun::star::uno::Exception);
::com::sun::star::uno::Sequence< OUString > loader_getSupportedServiceNames(); ::com::sun::star::uno::Sequence< OUString > loader_getSupportedServiceNames();
OUString loader_getImplementationName(); OUString loader_getImplementationName();
//registry_tdprovider
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ProviderImpl_create(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& )
throw(::com::sun::star::uno::Exception);
::com::sun::star::uno::Sequence< OUString > rdbtdp_getSupportedServiceNames();
OUString rdbtdp_getImplementationName();
} // namespace } // namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -88,12 +88,6 @@ static struct ImplementationEntry g_entries[] = ...@@ -88,12 +88,6 @@ static struct ImplementationEntry g_entries[] =
loader_getSupportedServiceNames, createSingleComponentFactory, loader_getSupportedServiceNames, createSingleComponentFactory,
0, 0 0, 0
}, },
//registry_tdprovider
{
ProviderImpl_create, rdbtdp_getImplementationName,
rdbtdp_getSupportedServiceNames, createSingleComponentFactory,
0, 0
},
//end //end
{ 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0 }
}; };
......
This diff is collapsed.
/* -*- 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 "functiondescription.hxx"
#include "com/sun/star/container/NoSuchElementException.hpp"
#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
#include "com/sun/star/reflection/XCompoundTypeDescription.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/TypeClass.hpp"
#include "com/sun/star/uno/XInterface.hpp"
#include "cppuhelper/implbase1.hxx"
#include "osl/diagnose.h"
#include "osl/mutex.hxx"
#include "registry/reader.hxx"
#include "registry/version.h"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
#include "sal/types.h"
using stoc::registry_tdprovider::FunctionDescription;
FunctionDescription::FunctionDescription(
css::uno::Reference< css::container::XHierarchicalNameAccess > const &
manager,
com::sun::star::uno::Sequence< sal_Int8 > const & bytes,
sal_uInt16 index):
m_manager(manager), m_bytes(bytes), m_index(index), m_exceptionsInit(false)
{}
FunctionDescription::~FunctionDescription() {}
css::uno::Sequence<
css::uno::Reference< css::reflection::XCompoundTypeDescription > >
FunctionDescription::getExceptions() const {
{
osl::MutexGuard guard(m_mutex);
if (m_exceptionsInit) {
return m_exceptions;
}
}
typereg::Reader reader(getReader());
sal_uInt16 n = reader.getMethodExceptionCount(m_index);
css::uno::Sequence<
css::uno::Reference< css::reflection::XCompoundTypeDescription > >
exceptions(n);
for (sal_uInt16 i = 0; i < n; ++i) {
OUString name(
reader.getMethodExceptionTypeName(m_index, i).replace('/', '.'));
css::uno::Any any;
try {
any = m_manager->getByHierarchicalName(name);
} catch (const css::container::NoSuchElementException & e) {
throw css::uno::RuntimeException(
(OUString(
"com.sun.star.container.NoSuchElementException: ")
+ e.Message),
css::uno::Reference< css::uno::XInterface >()); //TODO
}
if (!(any >>= exceptions[i])
|| exceptions[i]->getTypeClass() != css::uno::TypeClass_EXCEPTION)
{
throw css::uno::RuntimeException(
(OUString("not an exception type: ")
+ name),
css::uno::Reference< css::uno::XInterface >()); //TODO
}
OSL_ASSERT(exceptions[i].is());
}
osl::MutexGuard guard(m_mutex);
if (!m_exceptionsInit) {
m_exceptions = exceptions;
m_exceptionsInit = true;
}
return m_exceptions;
}
typereg::Reader FunctionDescription::getReader() const {
return typereg::Reader(
m_bytes.getConstArray(), m_bytes.getLength(), false, TYPEREG_VERSION_1);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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_stoc_source_registry_tdprovider_functiondescription_hxx
#define INCLUDED_stoc_source_registry_tdprovider_functiondescription_hxx
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/Sequence.hxx"
#include "osl/mutex.hxx"
#include "sal/types.h"
namespace com { namespace sun { namespace star {
namespace container {
class XHierarchicalNameAccess;
}
namespace reflection {
class XCompoundTypeDescription;
}
} } }
namespace typereg { class Reader; }
namespace stoc { namespace registry_tdprovider {
class FunctionDescription {
public:
FunctionDescription(
com::sun::star::uno::Reference<
com::sun::star::container::XHierarchicalNameAccess > const &
manager,
com::sun::star::uno::Sequence< sal_Int8 > const & bytes,
sal_uInt16 index);
~FunctionDescription();
com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
com::sun::star::reflection::XCompoundTypeDescription > >
getExceptions() const;
protected:
typereg::Reader getReader() const;
com::sun::star::uno::Reference<
com::sun::star::container::XHierarchicalNameAccess > m_manager;
com::sun::star::uno::Sequence< sal_Int8 > m_bytes;
sal_uInt16 m_index;
mutable osl::Mutex m_mutex;
mutable com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
com::sun::star::reflection::XCompoundTypeDescription > >
m_exceptions;
mutable bool m_exceptionsInit;
private:
FunctionDescription(FunctionDescription &); // not implemented
void operator =(FunctionDescription); // not implemented
};
} }
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 "methoddescription.hxx"
#include "com/sun/star/container/NoSuchElementException.hpp"
#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
#include "com/sun/star/reflection/XParameter.hpp"
#include "com/sun/star/reflection/XTypeDescription.hpp"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/weak.hxx"
#include "osl/mutex.hxx"
#include "registry/reader.hxx"
#include "registry/types.h"
#include "rtl/ustring.hxx"
#include "sal/types.h"
using stoc::registry_tdprovider::MethodDescription;
namespace {
class Parameter: public cppu::WeakImplHelper1< css::reflection::XParameter > {
public:
Parameter(
css::uno::Reference< css::container::XHierarchicalNameAccess > const &
manager,
OUString const & name, OUString const & typeName,
RTParamMode mode, sal_Int32 position):
m_manager(manager), m_name(name),
m_typeName(typeName.replace('/', '.')), m_mode(mode),
m_position(position) {}
virtual ~Parameter() {}
virtual OUString SAL_CALL getName() throw (css::uno::RuntimeException)
{ return m_name; }
virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
getType() throw (css::uno::RuntimeException);
virtual sal_Bool SAL_CALL isIn() throw (css::uno::RuntimeException)
{ return (m_mode & RT_PARAM_IN) != 0; }
virtual sal_Bool SAL_CALL isOut() throw (css::uno::RuntimeException)
{ return (m_mode & RT_PARAM_OUT) != 0; }
virtual sal_Int32 SAL_CALL getPosition() throw (css::uno::RuntimeException)
{ return m_position; }
virtual sal_Bool SAL_CALL isRestParameter()
throw (css::uno::RuntimeException)
{ return (m_mode & RT_PARAM_REST) != 0; }
private:
Parameter(Parameter &); // not implemented
void operator =(Parameter); // not implemented
css::uno::Reference< css::container::XHierarchicalNameAccess > m_manager;
OUString m_name;
OUString m_typeName;
RTParamMode m_mode;
sal_Int32 m_position;
};
css::uno::Reference< css::reflection::XTypeDescription > Parameter::getType()
throw (css::uno::RuntimeException)
{
try {
return css::uno::Reference< css::reflection::XTypeDescription >(
m_manager->getByHierarchicalName(m_typeName),
css::uno::UNO_QUERY_THROW);
} catch (const css::container::NoSuchElementException & e) {
throw css::uno::RuntimeException(
(OUString(
"com.sun.star.container.NoSuchElementException: ")
+ e.Message),
static_cast< cppu::OWeakObject * >(this));
}
}
}
MethodDescription::MethodDescription(
css::uno::Reference< css::container::XHierarchicalNameAccess > const &
manager,
OUString const & name,
com::sun::star::uno::Sequence< sal_Int8 > const & bytes,
sal_uInt16 index):
FunctionDescription(manager, bytes, index), m_name(name),
m_parametersInit(false)
{}
MethodDescription::~MethodDescription() {}
css::uno::Sequence< css::uno::Reference< css::reflection::XParameter > >
MethodDescription::getParameters() const {
osl::MutexGuard guard(m_mutex);
if (!m_parametersInit) {
typereg::Reader reader(getReader());
sal_uInt16 n = reader.getMethodParameterCount(m_index);
m_parameters.realloc(n);
for (sal_uInt16 i = 0; i < n; ++i) {
m_parameters[i] = new Parameter(
m_manager, reader.getMethodParameterName(m_index, i),
reader.getMethodParameterTypeName(m_index, i),
reader.getMethodParameterFlags(m_index, i), i);
}
m_parametersInit = true;
}
return m_parameters;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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_stoc_source_registry_tdprovider_methoddescription_hxx
#define INCLUDED_stoc_source_registry_tdprovider_methoddescription_hxx
#include "functiondescription.hxx"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/Sequence.hxx"
#include "rtl/ustring.hxx"
#include "sal/types.h"
namespace com { namespace sun { namespace star {
namespace container {
class XHierarchicalNameAccess;
}
namespace reflection {
class XParameter;
}
} } }
namespace typereg { class Reader; }
namespace stoc { namespace registry_tdprovider {
class MethodDescription: public FunctionDescription {
public:
MethodDescription(
com::sun::star::uno::Reference<
com::sun::star::container::XHierarchicalNameAccess > const &
manager,
OUString const & name,
com::sun::star::uno::Sequence< sal_Int8 > const & bytes,
sal_uInt16 index);
~MethodDescription();
OUString getName() const { return m_name; }
com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
com::sun::star::reflection::XParameter > >
getParameters() const;
private:
MethodDescription(MethodDescription &); // not implemented
void operator =(MethodDescription); // not implemented
OUString m_name;
mutable com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
com::sun::star::reflection::XParameter > > m_parameters;
mutable bool m_parametersInit;
};
} }
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 _STOC_RDBTDP_TDENUMERATION_HXX
#define _STOC_RDBTDP_TDENUMERATION_HXX
#include <list>
#include <osl/mutex.hxx>
#include <rtl/ref.hxx>
#include <registry/refltype.hxx>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/reflection/InvalidTypeNameException.hpp>
#include <com/sun/star/reflection/NoSuchTypeNameException.hpp>
#include <com/sun/star/reflection/TypeDescriptionSearchDepth.hpp>
#include <com/sun/star/reflection/XTypeDescriptionEnumeration.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/TypeClass.hpp>
#include <cppuhelper/implbase1.hxx>
#include "base.hxx"
namespace stoc_rdbtdp
{
typedef ::std::list< ::com::sun::star::uno::Reference<
::com::sun::star::reflection::XTypeDescription > > TypeDescriptionList;
class TypeDescriptionEnumerationImpl
: public cppu::WeakImplHelper1<
com::sun::star::reflection::XTypeDescriptionEnumeration >
{
public:
static rtl::Reference< TypeDescriptionEnumerationImpl > createInstance(
const ::com::sun::star::uno::Reference<
::com::sun::star::container::XHierarchicalNameAccess > & xTDMgr,
const OUString & rModuleName,
const ::com::sun::star::uno::Sequence<
::com::sun::star::uno::TypeClass > & rTypes,
::com::sun::star::reflection::TypeDescriptionSearchDepth eDepth,
const RegistryKeyList & rBaseKeys )
throw ( ::com::sun::star::reflection::NoSuchTypeNameException,
::com::sun::star::reflection::InvalidTypeNameException,
::com::sun::star::uno::RuntimeException );
virtual ~TypeDescriptionEnumerationImpl();
// XEnumeration (base of XTypeDescriptionEnumeration)
virtual sal_Bool SAL_CALL hasMoreElements()
throw ( ::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
// XTypeDescriptionEnumeration
virtual ::com::sun::star::uno::Reference<
::com::sun::star::reflection::XTypeDescription > SAL_CALL
nextTypeDescription()
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException );
private:
// Note: keys must be open (XRegistryKey->openKey(...)).
TypeDescriptionEnumerationImpl(
const ::com::sun::star::uno::Reference<
::com::sun::star::container::XHierarchicalNameAccess > & xTDMgr,
const RegistryKeyList & rModuleKeys,
const ::com::sun::star::uno::Sequence<
::com::sun::star::uno::TypeClass > & rTypes,
::com::sun::star::reflection::TypeDescriptionSearchDepth eDepth );
static bool match( ::RTTypeClass eType1,
::com::sun::star::uno::TypeClass eType2 );
bool queryMore();
::com::sun::star::uno::Reference<
::com::sun::star::reflection::XTypeDescription > queryNext();
// members
osl::Mutex m_aMutex;
RegistryKeyList m_aModuleKeys;
RegistryKeyList m_aCurrentModuleSubKeys;
TypeDescriptionList m_aTypeDescs;
::com::sun::star::uno::Sequence<
::com::sun::star::uno::TypeClass > m_aTypes;
::com::sun::star::reflection::TypeDescriptionSearchDepth m_eDepth;
::com::sun::star::uno::Reference<
::com::sun::star::container::XHierarchicalNameAccess > m_xTDMgr;
};
} // namespace stoc_rdbtdp
#endif /* _STOC_RDBTDP_TDENUMERATION_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 "structtypedescription.hxx"
#include "base.hxx"
#include "com/sun/star/reflection/XTypeDescription.hpp"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/TypeClass.hpp"
#include "cppuhelper/weak.hxx"
#include "osl/diagnose.h"
#include "registry/reader.hxx"
#include "registry/types.h"
#include "registry/version.h"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
#include <new>
using stoc::registry_tdprovider::StructTypeDescription;
StructTypeDescription::StructTypeDescription(
css::uno::Reference< css::container::XHierarchicalNameAccess > const &
manager,
OUString const & name, OUString const & baseTypeName,
css::uno::Sequence< sal_Int8 > const & data, bool published):
m_data(data),
m_base(
new stoc_rdbtdp::CompoundTypeDescriptionImpl(
manager, css::uno::TypeClass_STRUCT, name, baseTypeName, data,
published))
{}
StructTypeDescription::~StructTypeDescription()
{}
css::uno::TypeClass StructTypeDescription::getTypeClass()
throw (css::uno::RuntimeException)
{
return m_base->getTypeClass();
}
OUString StructTypeDescription::getName()
throw (css::uno::RuntimeException)
{
return m_base->getName();
}
css::uno::Reference< css::reflection::XTypeDescription >
StructTypeDescription::getBaseType() throw (css::uno::RuntimeException)
{
return m_base->getBaseType();
}
css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
StructTypeDescription::getMemberTypes() throw (css::uno::RuntimeException)
{
return m_base->getMemberTypes();
}
css::uno::Sequence< OUString > StructTypeDescription::getMemberNames()
throw (css::uno::RuntimeException)
{
return m_base->getMemberNames();
}
css::uno::Sequence< OUString > StructTypeDescription::getTypeParameters()
throw (css::uno::RuntimeException)
{
try {
typereg::Reader reader(
m_data.getConstArray(), m_data.getLength(), false,
TYPEREG_VERSION_1);
OSL_ASSERT(reader.isValid());
sal_uInt16 n = reader.getReferenceCount();
css::uno::Sequence< OUString > parameters(n);
for (sal_uInt16 i = 0; i < n; ++i) {
if (reader.getReferenceFlags(i) != RT_ACCESS_INVALID
|| reader.getReferenceSort(i) != RT_REF_TYPE_PARAMETER)
{
throw css::uno::RuntimeException(
OUString(
"type parameter of polymorphic struct type template"
" not RT_ACCESS_INVALID/RT_REF_TYPE_PARAMETER"),
static_cast< cppu::OWeakObject * >(this));
}
parameters[i] = reader.getReferenceTypeName(i);
}
return parameters;
} catch (std::bad_alloc &) {
throw css::uno::RuntimeException(
OUString("std::bad_alloc"),
static_cast< cppu::OWeakObject * >(this));
}
}
css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
StructTypeDescription::getTypeArguments() throw (css::uno::RuntimeException)
{
return css::uno::Sequence<
css::uno::Reference< css::reflection::XTypeDescription > >();
}
sal_Bool StructTypeDescription::isPublished() throw (css::uno::RuntimeException)
{
return m_base->isPublished();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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_stoc_source_registry_tdprovider_structtypedescription_hxx
#define INCLUDED_stoc_source_registry_tdprovider_structtypedescription_hxx
#include "com/sun/star/reflection/XPublished.hpp"
#include "com/sun/star/reflection/XStructTypeDescription.hpp"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/Sequence.hxx"
#include "cppuhelper/implbase2.hxx"
#include "rtl/ref.hxx"
#include "sal/types.h"
namespace com { namespace sun { namespace star {
namespace container { class XHierarchicalNameAccess; }
namespace reflection { class XCompoundTypeDescription; }
} } }
namespace stoc_rdbtdp { class CompoundTypeDescriptionImpl; }
namespace stoc { namespace registry_tdprovider {
class StructTypeDescription:
public cppu::WeakImplHelper2<
com::sun::star::reflection::XStructTypeDescription,
com::sun::star::reflection::XPublished >
{
public:
StructTypeDescription(
com::sun::star::uno::Reference<
com::sun::star::container::XHierarchicalNameAccess > const &
manager,
OUString const & name, OUString const & baseTypeName,
com::sun::star::uno::Sequence< sal_Int8 > const & data, bool published);
virtual ~StructTypeDescription();
virtual com::sun::star::uno::TypeClass SAL_CALL getTypeClass()
throw (com::sun::star::uno::RuntimeException);
virtual OUString SAL_CALL getName()
throw (com::sun::star::uno::RuntimeException);
virtual
com::sun::star::uno::Reference<
com::sun::star::reflection::XTypeDescription >
SAL_CALL getBaseType() throw (com::sun::star::uno::RuntimeException);
virtual
com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
com::sun::star::reflection::XTypeDescription > >
SAL_CALL getMemberTypes() throw (com::sun::star::uno::RuntimeException);
virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
getMemberNames() throw (com::sun::star::uno::RuntimeException);
virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
getTypeParameters() throw (com::sun::star::uno::RuntimeException);
virtual
com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
com::sun::star::reflection::XTypeDescription > >
SAL_CALL getTypeArguments() throw (com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL isPublished()
throw (com::sun::star::uno::RuntimeException);
private:
StructTypeDescription(StructTypeDescription &); // not implemented
void operator =(StructTypeDescription); // not implemented
com::sun::star::uno::Sequence< sal_Int8 > m_data;
rtl::Reference< stoc_rdbtdp::CompoundTypeDescriptionImpl > m_base;
};
} }
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 "osl/doublecheckedlocking.h"
#include "base.hxx"
namespace stoc_rdbtdp
{
//------------------------------------------------------------------------------
::osl::Mutex & getMutex()
{
static ::osl::Mutex * s_pmutex = 0;
if (s_pmutex == 0)
{
::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
if (s_pmutex == 0)
{
static ::osl::Mutex s_mutex;
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
s_pmutex = &s_mutex;
}
}
else
{
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
}
return *s_pmutex;
}
TypeDescriptionImpl::~TypeDescriptionImpl() {}
// XTypeDescription
//__________________________________________________________________________________________________
TypeClass TypeDescriptionImpl::getTypeClass()
throw(::com::sun::star::uno::RuntimeException)
{
return _eTypeClass;
}
//__________________________________________________________________________________________________
OUString TypeDescriptionImpl::getName()
throw(::com::sun::star::uno::RuntimeException)
{
return _aName;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 "base.hxx"
#include "registry/reader.hxx"
#include "registry/version.h"
namespace stoc_rdbtdp
{
//__________________________________________________________________________________________________
CompoundTypeDescriptionImpl::~CompoundTypeDescriptionImpl()
{
delete _pMembers;
delete _pMemberNames;
}
// XTypeDescription
//__________________________________________________________________________________________________
TypeClass CompoundTypeDescriptionImpl::getTypeClass()
throw(::com::sun::star::uno::RuntimeException)
{
return _eTypeClass;
}
//__________________________________________________________________________________________________
OUString CompoundTypeDescriptionImpl::getName()
throw(::com::sun::star::uno::RuntimeException)
{
return _aName;
}
// XCompoundTypeDescription
//__________________________________________________________________________________________________
Reference< XTypeDescription > CompoundTypeDescriptionImpl::getBaseType()
throw(::com::sun::star::uno::RuntimeException)
{
if (!_xBaseTD.is() && !_aBaseType.isEmpty())
{
try
{
Reference< XTypeDescription > xBaseTD;
if (_xTDMgr->getByHierarchicalName( _aBaseType ) >>= xBaseTD)
{
MutexGuard aGuard( getMutex() );
if (! _xBaseTD.is())
_xBaseTD = xBaseTD;
return _xBaseTD;
}
}
catch (NoSuchElementException &)
{
}
// never try again, if no base td was found
_aBaseType = OUString();
}
return _xBaseTD;
}
//__________________________________________________________________________________________________
namespace {
class TypeParameter: public WeakImplHelper1< XTypeDescription > {
public:
explicit TypeParameter(OUString const & name): m_name(name) {}
virtual TypeClass SAL_CALL getTypeClass() throw (RuntimeException)
{ return TypeClass_UNKNOWN; }
virtual OUString SAL_CALL getName() throw (RuntimeException)
{ return m_name; }
private:
OUString m_name;
};
}
Sequence< Reference< XTypeDescription > > CompoundTypeDescriptionImpl::getMemberTypes()
throw(::com::sun::star::uno::RuntimeException)
{
if (! _pMembers)
{
typereg::Reader aReader(
_aBytes.getConstArray(), _aBytes.getLength(), false,
TYPEREG_VERSION_1);
sal_uInt16 nFields = aReader.getFieldCount();
Sequence< Reference< XTypeDescription > > * pTempMembers =
new Sequence< Reference< XTypeDescription > >( nFields );
Reference< XTypeDescription > * pMembers = pTempMembers->getArray();
while (nFields--)
{
if ((aReader.getFieldFlags(nFields) & RT_ACCESS_PARAMETERIZED_TYPE)
!= 0)
{
pMembers[nFields] = new TypeParameter(
aReader.getFieldTypeName(nFields));
} else {
try {
_xTDMgr->getByHierarchicalName(
aReader.getFieldTypeName(nFields).replace('/', '.'))
>>= pMembers[nFields];
} catch (NoSuchElementException &) {}
OSL_ENSURE(
pMembers[nFields].is(), "### compound member unknown!");
}
}
ClearableMutexGuard aGuard( getMutex() );
if (_pMembers)
{
aGuard.clear();
delete pTempMembers;
}
else
{
_pMembers = pTempMembers;
}
}
return *_pMembers;
}
//__________________________________________________________________________________________________
Sequence< OUString > CompoundTypeDescriptionImpl::getMemberNames()
throw(::com::sun::star::uno::RuntimeException)
{
if (! _pMemberNames)
{
typereg::Reader aReader(
_aBytes.getConstArray(), _aBytes.getLength(), false,
TYPEREG_VERSION_1);
sal_uInt16 nFields = aReader.getFieldCount();
Sequence< OUString > * pTempMemberNames = new Sequence< OUString >( nFields );
OUString * pMemberNames = pTempMemberNames->getArray();
while (nFields--)
{
pMemberNames[nFields] = aReader.getFieldName( nFields );
}
ClearableMutexGuard aGuard( getMutex() );
if (_pMemberNames)
{
aGuard.clear();
delete pTempMemberNames;
}
else
{
_pMemberNames = pTempMemberNames;
}
}
return *_pMemberNames;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
#include "registry/reader.hxx"
#include "registry/version.h"
#include "base.hxx"
namespace stoc_rdbtdp
{
//__________________________________________________________________________________________________
// virtual
ConstantsTypeDescriptionImpl::~ConstantsTypeDescriptionImpl()
{
delete _pMembers;
}
// XTypeDescription
//__________________________________________________________________________________________________
// virtual
TypeClass ConstantsTypeDescriptionImpl::getTypeClass()
throw( RuntimeException )
{
return TypeClass_CONSTANTS;
}
//__________________________________________________________________________________________________
// virtual
OUString ConstantsTypeDescriptionImpl::getName()
throw( RuntimeException )
{
return _aName;
}
// XConstantsTypeDescription
//__________________________________________________________________________________________________
// virtual
Sequence< Reference< XConstantTypeDescription > > SAL_CALL
ConstantsTypeDescriptionImpl::getConstants()
throw ( RuntimeException )
{
if ( !_pMembers )
{
typereg::Reader aReader(
_aBytes.getConstArray(), _aBytes.getLength(), false,
TYPEREG_VERSION_1);
sal_uInt16 nFields = aReader.getFieldCount();
Sequence< Reference< XConstantTypeDescription > > * pTempConsts
= new Sequence< Reference< XConstantTypeDescription > >( nFields );
Reference< XConstantTypeDescription > * pConsts
= pTempConsts->getArray();
while ( nFields-- )
{
OUStringBuffer aName( _aName );
aName.appendAscii( "." );
aName.append( aReader.getFieldName( nFields ) );
Any aValue( getRTValue( aReader.getFieldValue( nFields ) ) );
pConsts[ nFields ]
= new ConstantTypeDescriptionImpl( aName.makeStringAndClear(),
aValue );
}
ClearableMutexGuard aGuard( getMutex() );
if ( _pMembers )
{
aGuard.clear();
delete pTempConsts;
}
else
{
_pMembers = pTempConsts;
}
}
return *_pMembers;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 "base.hxx"
namespace stoc_rdbtdp
{
TypedefTypeDescriptionImpl::~TypedefTypeDescriptionImpl() {}
// XTypeDescription
//__________________________________________________________________________________________________
TypeClass TypedefTypeDescriptionImpl::getTypeClass()
throw(::com::sun::star::uno::RuntimeException)
{
return TypeClass_TYPEDEF;
}
//__________________________________________________________________________________________________
OUString TypedefTypeDescriptionImpl::getName()
throw(::com::sun::star::uno::RuntimeException)
{
return _aName;
}
// XIndirectTypeDescription
//__________________________________________________________________________________________________
Reference< XTypeDescription > TypedefTypeDescriptionImpl::getReferencedType()
throw(::com::sun::star::uno::RuntimeException)
{
if (!_xRefTD.is() && !_aRefName.isEmpty())
{
try
{
Reference< XTypeDescription > xRefTD;
if (_xTDMgr->getByHierarchicalName( _aRefName ) >>= xRefTD)
{
MutexGuard aGuard( getMutex() );
if (! _xRefTD.is())
_xRefTD = xRefTD;
return _xRefTD;
}
}
catch (NoSuchElementException &)
{
}
// never try again, if no base td was found
_aRefName = OUString();
}
return _xRefTD;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 "base.hxx"
#include "registry/reader.hxx"
#include "registry/version.h"
namespace stoc_rdbtdp
{
//__________________________________________________________________________________________________
EnumTypeDescriptionImpl::~EnumTypeDescriptionImpl()
{
delete _pEnumNames;
delete _pEnumValues;
}
// XTypeDescription
//__________________________________________________________________________________________________
TypeClass EnumTypeDescriptionImpl::getTypeClass()
throw(::com::sun::star::uno::RuntimeException)
{
return TypeClass_ENUM;
}
//__________________________________________________________________________________________________
OUString EnumTypeDescriptionImpl::getName()
throw(::com::sun::star::uno::RuntimeException)
{
return _aName;
}
// XEnumTypeDescription
//__________________________________________________________________________________________________
sal_Int32 EnumTypeDescriptionImpl::getDefaultEnumValue()
throw(::com::sun::star::uno::RuntimeException)
{
return _nDefaultValue;
}
//__________________________________________________________________________________________________
Sequence< OUString > EnumTypeDescriptionImpl::getEnumNames()
throw(::com::sun::star::uno::RuntimeException)
{
if (! _pEnumNames)
{
typereg::Reader aReader(
_aBytes.getConstArray(), _aBytes.getLength(), false,
TYPEREG_VERSION_1);
sal_uInt16 nFields = aReader.getFieldCount();
Sequence< OUString > * pTempEnumNames = new Sequence< OUString >( nFields );
OUString * pEnumNames = pTempEnumNames->getArray();
while (nFields--)
{
pEnumNames[nFields] = aReader.getFieldName( nFields );
}
ClearableMutexGuard aGuard( getMutex() );
if (_pEnumNames)
{
aGuard.clear();
delete pTempEnumNames;
}
else
{
_pEnumNames = pTempEnumNames;
}
}
return *_pEnumNames;
}
//__________________________________________________________________________________________________
Sequence< sal_Int32 > EnumTypeDescriptionImpl::getEnumValues()
throw(::com::sun::star::uno::RuntimeException)
{
if (! _pEnumValues)
{
typereg::Reader aReader(
_aBytes.getConstArray(), _aBytes.getLength(), false,
TYPEREG_VERSION_1);
sal_uInt16 nFields = aReader.getFieldCount();
Sequence< sal_Int32 > * pTempEnumValues = new Sequence< sal_Int32 >( nFields );
sal_Int32 * pEnumValues = pTempEnumValues->getArray();
while (nFields--)
{
pEnumValues[nFields] = getRTValueAsInt32(
aReader.getFieldValue( nFields ) );
}
ClearableMutexGuard aGuard( getMutex() );
if (_pEnumValues)
{
aGuard.clear();
delete pTempEnumValues;
}
else
{
_pEnumValues = pTempEnumValues;
}
}
return *_pEnumValues;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 <vector>
#include <osl/diagnose.h>
#include "base.hxx"
namespace stoc_rdbtdp
{
//__________________________________________________________________________________________________
// virtual
ModuleTypeDescriptionImpl::~ModuleTypeDescriptionImpl()
{
delete _pMembers;
}
// XTypeDescription
//__________________________________________________________________________________________________
// virtual
TypeClass ModuleTypeDescriptionImpl::getTypeClass()
throw( RuntimeException )
{
return TypeClass_MODULE;
}
//__________________________________________________________________________________________________
// virtual
OUString ModuleTypeDescriptionImpl::getName()
throw( RuntimeException )
{
return _aName;
}
// XModuleTypeDescription
//__________________________________________________________________________________________________
// virtual
Sequence< Reference< XTypeDescription > > SAL_CALL
ModuleTypeDescriptionImpl::getMembers()
throw ( RuntimeException )
{
if ( !_pMembers )
{
Reference< XTypeDescriptionEnumeration > xEnum;
try
{
xEnum = _xTDMgr->createTypeDescriptionEnumeration(
_aName,
Sequence< TypeClass >(),
TypeDescriptionSearchDepth_ONE );
}
catch ( NoSuchTypeNameException const & )
{
}
catch ( InvalidTypeNameException const & )
{
}
OSL_ENSURE( xEnum.is(),
"ModuleTypeDescriptionImpl::getMembers - No enumeration!" );
std::vector< Reference< XTypeDescription > > aTDs;
while ( xEnum->hasMoreElements() )
{
try
{
Reference< XTypeDescription > xTD(
xEnum->nextTypeDescription() );
aTDs.push_back( xTD );
}
catch ( NoSuchElementException const & )
{
OSL_FAIL( "ModuleTypeDescriptionImpl::getMembers - "
" Caught NoSuchElementException!" );
}
}
Sequence< Reference< XTypeDescription > > * pMembers
= new Sequence< Reference< XTypeDescription > >( aTDs.size() );
for ( sal_Int32 n = 0; n < pMembers->getLength(); n++ )
(*pMembers)[ n ] = aTDs[ n ];
ClearableMutexGuard aGuard( getMutex() );
if ( _pMembers )
{
aGuard.clear();
delete pMembers;
}
else
{
_pMembers = pMembers;
}
}
return *_pMembers;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 <osl/diagnose.h>
#include "base.hxx"
namespace stoc_rdbtdp
{
//__________________________________________________________________________________________________
// virtual
ConstantTypeDescriptionImpl::~ConstantTypeDescriptionImpl() {}
// XTypeDescription
//__________________________________________________________________________________________________
// virtual
TypeClass ConstantTypeDescriptionImpl::getTypeClass()
throw( RuntimeException )
{
return TypeClass_CONSTANT;
}
//__________________________________________________________________________________________________
// virtual
OUString ConstantTypeDescriptionImpl::getName()
throw( RuntimeException )
{
return _aName;
}
// XConstantTypeDescription
//__________________________________________________________________________________________________
// virtual
Any SAL_CALL ConstantTypeDescriptionImpl::getConstantValue()
throw( RuntimeException )
{
return _aValue;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 <osl/diagnose.h>
#include "base.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
using namespace com::sun::star;
namespace stoc_rdbtdp
{
void SingletonTypeDescriptionImpl::init() {
{
MutexGuard guard(getMutex());
if (_xInterfaceTD.is() || _xServiceTD.is()) {
return;
}
}
Reference< XTypeDescription > base;
try {
base = Reference< XTypeDescription >(
_xTDMgr->getByHierarchicalName(_aBaseName), UNO_QUERY_THROW);
} catch (NoSuchElementException const & e) {
throw RuntimeException(
(OUString(
"com.sun.star.container.NoSuchElementException: ")
+ e.Message),
static_cast< OWeakObject * >(this));
}
MutexGuard guard(getMutex());
if (!_xInterfaceTD.is() && !_xServiceTD.is()) {
if (resolveTypedefs(base)->getTypeClass() == TypeClass_INTERFACE) {
_xInterfaceTD = base;
} else if (base->getTypeClass() == TypeClass_SERVICE) {
_xServiceTD = Reference< XServiceTypeDescription >(
base, UNO_QUERY_THROW);
} else {
throw RuntimeException(
OUString(
"Singleton is based on neither interface nor service"),
static_cast< OWeakObject * >(this));
}
}
OSL_ASSERT(_xInterfaceTD.is() ^ _xServiceTD.is());
}
//__________________________________________________________________________________________________
// virtual
SingletonTypeDescriptionImpl::~SingletonTypeDescriptionImpl() {}
// XTypeDescription
//__________________________________________________________________________________________________
// virtual
TypeClass SingletonTypeDescriptionImpl::getTypeClass()
throw(::com::sun::star::uno::RuntimeException)
{
return TypeClass_SINGLETON;
}
//__________________________________________________________________________________________________
// virtual
OUString SingletonTypeDescriptionImpl::getName()
throw(::com::sun::star::uno::RuntimeException)
{
return _aName;
}
// XSingletonTypeDescription
//__________________________________________________________________________________________________
// virtual
Reference< XServiceTypeDescription > SAL_CALL
SingletonTypeDescriptionImpl::getService()
throw(::com::sun::star::uno::RuntimeException)
{
init();
return _xServiceTD;
}
// XSingletonTypeDescription2
//______________________________________________________________________________
// virtual
sal_Bool SAL_CALL
SingletonTypeDescriptionImpl::isInterfaceBased()
throw(::com::sun::star::uno::RuntimeException)
{
init();
return _xInterfaceTD.is();
}
//______________________________________________________________________________
// virtual
Reference< XTypeDescription > SAL_CALL
SingletonTypeDescriptionImpl::getInterface()
throw(::com::sun::star::uno::RuntimeException)
{
init();
return _xInterfaceTD;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
<service name="com.sun.star.lang.ServiceManager"/> <service name="com.sun.star.lang.ServiceManager"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.stoc.OServiceManagerWrapper"/> <implementation name="com.sun.star.comp.stoc.OServiceManagerWrapper"/>
<implementation
name="com.sun.star.comp.stoc.RegistryTypeDescriptionProvider"/>
<implementation name="com.sun.star.comp.stoc.SimpleRegistry"> <implementation name="com.sun.star.comp.stoc.SimpleRegistry">
<service name="com.sun.star.registry.SimpleRegistry"/> <service name="com.sun.star.registry.SimpleRegistry"/>
</implementation> </implementation>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment