Avoid potential negative array index access to cached text.
[LibreOffice.git] / cppuhelper / source / typemanager.hxx
blobab1dc4fdbe71ae4beb509e33c5016d0123102294
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #pragma once
12 #include <sal/config.h>
14 #include <cstddef>
16 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
17 #include <com/sun/star/container/XSet.hpp>
18 #include <com/sun/star/lang/XServiceInfo.hpp>
19 #include <com/sun/star/reflection/TypeDescriptionSearchDepth.hpp>
20 #include <com/sun/star/reflection/XTypeDescriptionEnumerationAccess.hpp>
21 #include <com/sun/star/uno/Reference.hxx>
22 #include <com/sun/star/uno/Sequence.hxx>
23 #include <compbase2.hxx>
24 #include <rtl/ref.hxx>
25 #include <sal/types.h>
27 namespace com::sun::star {
28 namespace reflection { class XTypeDescription; }
30 namespace unoidl {
31 class ConstantGroupEntity;
32 class Entity;
33 class EnumTypeEntity;
34 class Manager;
37 namespace cppuhelper {
39 typedef WeakComponentImplHelper2<
40 css::lang::XServiceInfo, css::container::XHierarchicalNameAccess,
41 css::container::XSet, css::reflection::XTypeDescriptionEnumerationAccess >
42 TypeManager_Base;
44 class TypeManager: public TypeManager_Base {
45 public:
46 TypeManager();
48 using TypeManager_Base::acquire;
49 using TypeManager_Base::release;
51 void init(std::u16string_view rdbUris);
53 css::uno::Any find(OUString const & name);
55 css::uno::Reference< css::reflection::XTypeDescription > resolve(
56 OUString const & name);
58 private:
59 virtual ~TypeManager() noexcept override;
61 virtual OUString SAL_CALL getImplementationName() override;
63 virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
65 virtual css::uno::Sequence< OUString > SAL_CALL
66 getSupportedServiceNames() override;
68 virtual css::uno::Any SAL_CALL getByHierarchicalName(
69 OUString const & aName) override;
71 virtual sal_Bool SAL_CALL hasByHierarchicalName(OUString const & aName) override;
73 virtual css::uno::Type SAL_CALL getElementType() override;
75 virtual sal_Bool SAL_CALL hasElements() override;
77 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
78 createEnumeration() override;
80 virtual sal_Bool SAL_CALL has(css::uno::Any const & aElement) override;
82 virtual void SAL_CALL insert(css::uno::Any const & aElement) override;
84 virtual void SAL_CALL remove(css::uno::Any const & aElement) override;
86 virtual css::uno::Reference< css::reflection::XTypeDescriptionEnumeration >
87 SAL_CALL createTypeDescriptionEnumeration(
88 OUString const & moduleName,
89 css::uno::Sequence< css::uno::TypeClass > const & types,
90 css::reflection::TypeDescriptionSearchDepth depth) override;
92 void readRdbDirectory(std::u16string_view uri, bool optional);
94 void readRdbFile(std::u16string_view uri, bool optional);
96 css::uno::Any getSequenceType(OUString const & name);
98 css::uno::Any getInstantiatedStruct(
99 OUString const & name, sal_Int32 separator);
101 css::uno::Any getInterfaceMember(
102 std::u16string_view name, std::size_t separator);
104 css::uno::Any getNamed(
105 OUString const & name,
106 rtl::Reference< unoidl::Entity > const & entity);
108 static css::uno::Any getEnumMember(
109 rtl::Reference< unoidl::EnumTypeEntity > const & entity,
110 std::u16string_view member);
112 static css::uno::Any getConstant(
113 std::u16string_view constantGroupName,
114 rtl::Reference< unoidl::ConstantGroupEntity > const & entity,
115 std::u16string_view member);
117 rtl::Reference< unoidl::Entity > findEntity(OUString const & name);
119 rtl::Reference< unoidl::Manager > manager_;
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */