LCOV - code coverage report
Current view: top level - cppuhelper/source - typemanager.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 570 855 66.7 %
Date: 2014-11-03 Functions: 170 244 69.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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             :  */
       9             : 
      10             : #include <sal/config.h>
      11             : 
      12             : #include <cassert>
      13             : #include <cstddef>
      14             : #include <cstdlib>
      15             : #include <cstring>
      16             : #include <set>
      17             : #include <stack>
      18             : #include <vector>
      19             : 
      20             : #include <boost/noncopyable.hpp>
      21             : #include <com/sun/star/container/ElementExistException.hpp>
      22             : #include <com/sun/star/container/NoSuchElementException.hpp>
      23             : #include <com/sun/star/lang/IllegalArgumentException.hpp>
      24             : #include <com/sun/star/reflection/InvalidTypeNameException.hpp>
      25             : #include <com/sun/star/reflection/NoSuchTypeNameException.hpp>
      26             : #include <com/sun/star/reflection/TypeDescriptionSearchDepth.hpp>
      27             : #include <com/sun/star/reflection/XConstantTypeDescription.hpp>
      28             : #include <com/sun/star/reflection/XConstantsTypeDescription.hpp>
      29             : #include <com/sun/star/reflection/XEnumTypeDescription.hpp>
      30             : #include <com/sun/star/reflection/XIndirectTypeDescription.hpp>
      31             : #include <com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp>
      32             : #include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
      33             : #include <com/sun/star/reflection/XInterfaceTypeDescription2.hpp>
      34             : #include <com/sun/star/reflection/XModuleTypeDescription.hpp>
      35             : #include <com/sun/star/reflection/XPublished.hpp>
      36             : #include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
      37             : #include <com/sun/star/reflection/XSingletonTypeDescription2.hpp>
      38             : #include <com/sun/star/reflection/XStructTypeDescription.hpp>
      39             : #include <com/sun/star/reflection/XTypeDescription.hpp>
      40             : #include <com/sun/star/uno/Any.hxx>
      41             : #include <com/sun/star/uno/DeploymentException.hpp>
      42             : #include <com/sun/star/uno/Reference.hxx>
      43             : #include <com/sun/star/uno/RuntimeException.hpp>
      44             : #include <com/sun/star/uno/Sequence.hxx>
      45             : #include <com/sun/star/uno/Type.hxx>
      46             : #include <com/sun/star/uno/TypeClass.hpp>
      47             : #include <cppu/unotype.hxx>
      48             : #include <cppuhelper/implbase1.hxx>
      49             : #include <cppuhelper/supportsservice.hxx>
      50             : #include <osl/file.hxx>
      51             : #include <osl/mutex.hxx>
      52             : #include <rtl/ref.hxx>
      53             : #include <rtl/string.h>
      54             : #include <rtl/ustring.hxx>
      55             : #include <sal/macros.h>
      56             : #include <sal/types.h>
      57             : 
      58             : using rtl::OUString;
      59             : 
      60             : #include <unoidl/unoidl.hxx>
      61             : 
      62             : #include "paths.hxx"
      63             : #include "typemanager.hxx"
      64             : 
      65             : namespace {
      66             : 
      67       33990 : rtl::OUString makePrefix(rtl::OUString const & name) {
      68       33990 :     return name.isEmpty() ? name : name + ".";
      69             : }
      70             : 
      71      598408 : css::uno::Any resolveTypedefs(css::uno::Any const & type) {
      72      598408 :     for (css::uno::Any t(type);;) {
      73             :         css::uno::Reference< css::reflection::XIndirectTypeDescription > ind(
      74      598408 :             type, css::uno::UNO_QUERY);
      75      598408 :         if (!ind.is() || ind->getTypeClass() != css::uno::TypeClass_TYPEDEF) {
      76     1196816 :             return t;
      77             :         }
      78           0 :         t = css::uno::makeAny(ind->getReferencedType());
      79           0 :     }
      80             : }
      81             : 
      82             : class SimpleTypeDescription:
      83             :     public cppu::WeakImplHelper1< css::reflection::XTypeDescription >
      84             : {
      85             : public:
      86      124584 :     SimpleTypeDescription(
      87             :         css::uno::TypeClass typeClass, rtl::OUString const & name):
      88      124584 :         typeClass_(typeClass), name_(name)
      89      124584 :     {}
      90             : 
      91             : private:
      92      249168 :     virtual ~SimpleTypeDescription() {}
      93             : 
      94      177842 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
      95             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      96      177842 :     { return typeClass_; }
      97             : 
      98      283372 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      99      283372 :     { return name_; }
     100             : 
     101             :     css::uno::TypeClass typeClass_;
     102             :     rtl::OUString name_;
     103             : };
     104             : 
     105             : class SequenceTypeDescription:
     106             :     public cppu::WeakImplHelper1< css::reflection::XIndirectTypeDescription >
     107             : {
     108             : public:
     109        8824 :     SequenceTypeDescription(
     110             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
     111             :         rtl::OUString const & name, rtl::OUString const & componentType):
     112        8824 :         manager_(manager), name_(name), componentType_(componentType)
     113        8824 :     { assert(manager.is()); }
     114             : 
     115             : private:
     116       17648 :     virtual ~SequenceTypeDescription() {}
     117             : 
     118        9172 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
     119             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     120        9172 :     { return css::uno::TypeClass_SEQUENCE; }
     121             : 
     122        8890 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     123        8890 :     { return name_; }
     124             : 
     125             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
     126         326 :     getReferencedType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     127         326 :     { return manager_->resolve(componentType_); }
     128             : 
     129             :     rtl::Reference< cppuhelper::TypeManager > manager_;
     130             :     rtl::OUString name_;
     131             :     rtl::OUString componentType_;
     132             : };
     133             : 
     134             : class PublishableDescription:
     135             :     public cppu::WeakImplHelper1< css::reflection::XPublished >
     136             : {
     137             : protected:
     138      889770 :     PublishableDescription(bool published): published_(published) {}
     139             : 
     140      889770 :     virtual ~PublishableDescription() {}
     141             : 
     142             : private:
     143           0 :     virtual sal_Bool SAL_CALL isPublished() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     144           0 :     { return published_; }
     145             : 
     146             :     bool published_;
     147             : };
     148             : 
     149             : class ModuleDescription:
     150             :     public cppu::WeakImplHelper1< css::reflection::XModuleTypeDescription >
     151             : {
     152             : public:
     153          56 :     ModuleDescription(
     154             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
     155             :         rtl::OUString const & name,
     156             :         rtl::Reference< unoidl::ModuleEntity > const & entity):
     157          56 :         manager_(manager), name_(name), entity_(entity)
     158          56 :     { assert(manager.is()); assert(entity.is()); }
     159             : 
     160             : private:
     161         112 :     virtual ~ModuleDescription() {}
     162             : 
     163          28 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
     164             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     165          28 :     { return css::uno::TypeClass_MODULE; }
     166             : 
     167           0 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     168           0 :     { return name_; }
     169             : 
     170             :     virtual
     171             :     css::uno::Sequence<
     172             :         css::uno::Reference< css::reflection::XTypeDescription > >
     173             :     SAL_CALL getMembers() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     174             : 
     175             :     rtl::Reference< cppuhelper::TypeManager > manager_;
     176             :     rtl::OUString name_;
     177             :     rtl::Reference< unoidl::ModuleEntity > entity_;
     178             : };
     179             : 
     180             : css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
     181           0 : ModuleDescription::getMembers() throw (css::uno::RuntimeException, std::exception) {
     182             :     try {
     183           0 :         std::vector< rtl::OUString > names(entity_->getMemberNames());
     184             :         assert(names.size() <= SAL_MAX_INT32);
     185           0 :         sal_Int32 n = static_cast< sal_Int32 >(names.size());
     186             :         css::uno::Sequence<
     187           0 :             css::uno::Reference< css::reflection::XTypeDescription > > s(n);
     188           0 :         for (sal_Int32 i = 0; i != n; ++i) {
     189           0 :             s[i] = manager_->resolve(makePrefix(name_) + names[i]);
     190             :         }
     191           0 :         return s;
     192           0 :     } catch (unoidl::FileFormatException & e) {
     193             :         throw css::uno::DeploymentException(
     194           0 :             e.getUri() + ": " + e.getDetail(),
     195           0 :             static_cast< cppu::OWeakObject * >(this));
     196             :     }
     197             : }
     198             : 
     199             : typedef cppu::ImplInheritanceHelper1<
     200             :     PublishableDescription, css::reflection::XEnumTypeDescription >
     201             : EnumTypeDescription_Base;
     202             : 
     203             : class EnumTypeDescription: public EnumTypeDescription_Base {
     204             : public:
     205        3319 :     EnumTypeDescription(
     206             :         rtl::OUString const & name,
     207             :         rtl::Reference< unoidl::EnumTypeEntity > const & entity):
     208        3319 :         EnumTypeDescription_Base(entity->isPublished()), name_(name),
     209        3319 :         entity_(entity)
     210        3319 :     { assert(entity.is()); }
     211             : 
     212             : private:
     213        6638 :     virtual ~EnumTypeDescription() {}
     214             : 
     215        3369 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
     216             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     217        3369 :     { return css::uno::TypeClass_ENUM; }
     218             : 
     219        3469 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     220        3469 :     { return name_; }
     221             : 
     222        1468 :     virtual sal_Int32 SAL_CALL getDefaultEnumValue()
     223             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     224        1468 :     { return entity_->getMembers()[0].value; }
     225             : 
     226             :     virtual css::uno::Sequence< rtl::OUString > SAL_CALL getEnumNames()
     227             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     228             : 
     229             :     virtual css::uno::Sequence< sal_Int32 > SAL_CALL getEnumValues()
     230             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     231             : 
     232             :     rtl::OUString name_;
     233             :     rtl::Reference< unoidl::EnumTypeEntity > entity_;
     234             : };
     235             : 
     236        1468 : css::uno::Sequence< rtl::OUString > EnumTypeDescription::getEnumNames()
     237             :     throw (css::uno::RuntimeException, std::exception)
     238             : {
     239             :     assert(entity_->getMembers().size() <= SAL_MAX_INT32);
     240        1468 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getMembers().size());
     241        1468 :     css::uno::Sequence< rtl::OUString > s(n);
     242       17472 :     for (sal_Int32 i = 0; i != n; ++i) {
     243       16004 :         s[i] = entity_->getMembers()[i].name;
     244             :     }
     245        1468 :     return s;
     246             : }
     247             : 
     248        1468 : css::uno::Sequence< sal_Int32 > EnumTypeDescription::getEnumValues()
     249             :     throw (css::uno::RuntimeException, std::exception)
     250             : {
     251             :     assert(entity_->getMembers().size() <= SAL_MAX_INT32);
     252        1468 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getMembers().size());
     253        1468 :     css::uno::Sequence< sal_Int32 > s(n);
     254       17472 :     for (sal_Int32 i = 0; i != n; ++i) {
     255       16004 :         s[i] = entity_->getMembers()[i].value;
     256             :     }
     257        1468 :     return s;
     258             : }
     259             : 
     260             : typedef cppu::ImplInheritanceHelper1<
     261             :     PublishableDescription, css::reflection::XStructTypeDescription >
     262             : PlainStructTypeDescription_Base;
     263             : 
     264             : class PlainStructTypeDescription: public PlainStructTypeDescription_Base {
     265             : public:
     266       12880 :     PlainStructTypeDescription(
     267             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
     268             :         rtl::OUString const & name,
     269             :         rtl::Reference< unoidl::PlainStructTypeEntity > const & entity):
     270       12880 :         PlainStructTypeDescription_Base(entity->isPublished()),
     271       12880 :         manager_(manager), name_(name), entity_(entity)
     272       12880 :     { assert(manager.is()); assert(entity.is()); }
     273             : 
     274             : private:
     275       25760 :     virtual ~PlainStructTypeDescription() {}
     276             : 
     277       12940 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
     278             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     279       12940 :     { return css::uno::TypeClass_STRUCT; }
     280             : 
     281       13092 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     282       13092 :     { return name_; }
     283             : 
     284             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
     285        8184 :     getBaseType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE {
     286       16368 :         return entity_->getDirectBase().isEmpty()
     287             :             ? css::uno::Reference< css::reflection::XTypeDescription >()
     288       16368 :             : manager_->resolve(entity_->getDirectBase());
     289             :     }
     290             : 
     291             :     virtual
     292             :     css::uno::Sequence<
     293             :         css::uno::Reference< css::reflection::XTypeDescription > >
     294             :     SAL_CALL getMemberTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     295             : 
     296             :     virtual css::uno::Sequence< rtl::OUString > SAL_CALL getMemberNames()
     297             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     298             : 
     299        8184 :     virtual css::uno::Sequence< rtl::OUString > SAL_CALL getTypeParameters()
     300             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     301        8184 :     { return css::uno::Sequence< rtl::OUString >(); }
     302             : 
     303             :     virtual
     304             :     css::uno::Sequence<
     305             :         css::uno::Reference< css::reflection::XTypeDescription > >
     306           0 :     SAL_CALL getTypeArguments() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE {
     307             :         return css::uno::Sequence<
     308           0 :             css::uno::Reference< css::reflection::XTypeDescription > >();
     309             :     }
     310             : 
     311             :     rtl::Reference< cppuhelper::TypeManager > manager_;
     312             :     rtl::OUString name_;
     313             :     rtl::Reference< unoidl::PlainStructTypeEntity > entity_;
     314             : };
     315             : 
     316             : css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
     317        8184 : PlainStructTypeDescription::getMemberTypes() throw (css::uno::RuntimeException, std::exception)
     318             : {
     319             :     assert(entity_->getDirectMembers().size() <= SAL_MAX_INT32);
     320        8184 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getDirectMembers().size());
     321             :     css::uno::Sequence<
     322        8184 :         css::uno::Reference< css::reflection::XTypeDescription > > s(n);
     323       38255 :     for (sal_Int32 i = 0; i != n; ++i) {
     324       30071 :         s[i] = manager_->resolve(entity_->getDirectMembers()[i].type);
     325             :     }
     326        8184 :     return s;
     327             : }
     328             : 
     329        8184 : css::uno::Sequence< rtl::OUString > PlainStructTypeDescription::getMemberNames()
     330             :     throw (css::uno::RuntimeException, std::exception)
     331             : {
     332             :     assert(entity_->getDirectMembers().size() <= SAL_MAX_INT32);
     333        8184 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getDirectMembers().size());
     334        8184 :     css::uno::Sequence< rtl::OUString > s(n);
     335       38255 :     for (sal_Int32 i = 0; i != n; ++i) {
     336       30071 :         s[i] = entity_->getDirectMembers()[i].name;
     337             :     }
     338        8184 :     return s;
     339             : }
     340             : 
     341             : class ParameterizedMemberTypeDescription:
     342             :     public cppu::WeakImplHelper1< css::reflection::XTypeDescription >
     343             : {
     344             : public:
     345         408 :     explicit ParameterizedMemberTypeDescription(
     346             :         rtl::OUString const & typeParameterName):
     347         408 :         typeParameterName_(typeParameterName)
     348         408 :     {}
     349             : 
     350             : private:
     351         816 :     virtual ~ParameterizedMemberTypeDescription() {}
     352             : 
     353         408 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
     354             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     355         408 :     { return css::uno::TypeClass_UNKNOWN; }
     356             : 
     357           0 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     358           0 :     { return typeParameterName_; }
     359             : 
     360             :     rtl::OUString typeParameterName_;
     361             : };
     362             : 
     363             : typedef cppu::ImplInheritanceHelper1<
     364             :     PublishableDescription, css::reflection::XStructTypeDescription >
     365             : PolymorphicStructTypeTemplateDescription_Base;
     366             : 
     367             : class PolymorphicStructTypeTemplateDescription:
     368             :     public PolymorphicStructTypeTemplateDescription_Base
     369             : {
     370             : public:
     371         330 :     PolymorphicStructTypeTemplateDescription(
     372             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
     373             :         rtl::OUString const & name,
     374             :         rtl::Reference< unoidl::PolymorphicStructTypeTemplateEntity > const &
     375             :             entity):
     376         330 :         PolymorphicStructTypeTemplateDescription_Base(entity->isPublished()),
     377         330 :         manager_(manager), name_(name), entity_(entity)
     378         330 :     { assert(manager.is()); assert(entity.is()); }
     379             : 
     380             : private:
     381         660 :     virtual ~PolymorphicStructTypeTemplateDescription() {}
     382             : 
     383           0 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
     384             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     385           0 :     { return css::uno::TypeClass_STRUCT; }
     386             : 
     387           0 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     388           0 :     { return name_; }
     389             : 
     390             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
     391           0 :     getBaseType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     392           0 :     { return css::uno::Reference< css::reflection::XTypeDescription >(); }
     393             : 
     394             :     virtual
     395             :     css::uno::Sequence<
     396             :         css::uno::Reference< css::reflection::XTypeDescription > >
     397             :     SAL_CALL getMemberTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     398             : 
     399             :     virtual css::uno::Sequence< rtl::OUString > SAL_CALL getMemberNames()
     400             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     401             : 
     402             :     virtual css::uno::Sequence< rtl::OUString > SAL_CALL getTypeParameters()
     403             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     404             : 
     405             :     virtual
     406             :     css::uno::Sequence<
     407             :         css::uno::Reference< css::reflection::XTypeDescription > >
     408           0 :     SAL_CALL getTypeArguments() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE {
     409             :         return css::uno::Sequence<
     410           0 :             css::uno::Reference< css::reflection::XTypeDescription > >();
     411             :     }
     412             : 
     413             :     rtl::Reference< cppuhelper::TypeManager > manager_;
     414             :     rtl::OUString name_;
     415             :     rtl::Reference< unoidl::PolymorphicStructTypeTemplateEntity > entity_;
     416             : };
     417             : 
     418             : css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
     419         330 : PolymorphicStructTypeTemplateDescription::getMemberTypes()
     420             :     throw (css::uno::RuntimeException, std::exception)
     421             : {
     422             :     assert(entity_->getMembers().size() <= SAL_MAX_INT32);
     423         330 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getMembers().size());
     424             :     css::uno::Sequence<
     425         330 :         css::uno::Reference< css::reflection::XTypeDescription > > s(n);
     426         918 :     for (sal_Int32 i = 0; i != n; ++i) {
     427        1764 :         s[i] = entity_->getMembers()[i].parameterized
     428             :             ? new ParameterizedMemberTypeDescription(
     429         816 :                 entity_->getMembers()[i].type)
     430        1584 :             : manager_->resolve(entity_->getMembers()[i].type);
     431             :     }
     432         330 :     return s;
     433             : }
     434             : 
     435             : css::uno::Sequence< rtl::OUString >
     436           0 : PolymorphicStructTypeTemplateDescription::getMemberNames()
     437             :     throw (css::uno::RuntimeException, std::exception)
     438             : {
     439             :     assert(entity_->getMembers().size() <= SAL_MAX_INT32);
     440           0 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getMembers().size());
     441           0 :     css::uno::Sequence< rtl::OUString > s(n);
     442           0 :     for (sal_Int32 i = 0; i != n; ++i) {
     443           0 :         s[i] = entity_->getMembers()[i].name;
     444             :     }
     445           0 :     return s;
     446             : }
     447             : 
     448             : css::uno::Sequence< rtl::OUString >
     449           0 : PolymorphicStructTypeTemplateDescription::getTypeParameters()
     450             :     throw (css::uno::RuntimeException, std::exception)
     451             : {
     452             :     assert(entity_->getTypeParameters().size() <= SAL_MAX_INT32);
     453           0 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getTypeParameters().size());
     454           0 :     css::uno::Sequence< rtl::OUString > s(n);
     455           0 :     for (sal_Int32 i = 0; i != n; ++i) {
     456           0 :         s[i] = entity_->getTypeParameters()[i];
     457             :     }
     458           0 :     return s;
     459             : }
     460             : 
     461             : class InstantiatedPolymorphicStructTypeDescription:
     462             :     public cppu::WeakImplHelper1< css::reflection::XStructTypeDescription >
     463             : {
     464             : public:
     465         394 :     InstantiatedPolymorphicStructTypeDescription(
     466             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
     467             :         rtl::OUString const & name,
     468             :         rtl::Reference< unoidl::PolymorphicStructTypeTemplateEntity > const &
     469             :             entity,
     470             :         std::vector< rtl::OUString > const & arguments):
     471         394 :         manager_(manager), name_(name), entity_(entity), arguments_(arguments)
     472             :     {
     473             :         assert(manager.is());
     474             :         assert(entity.is());
     475             :         assert(arguments.size() == entity->getTypeParameters().size());
     476         394 :     }
     477             : 
     478             : private:
     479         788 :     virtual ~InstantiatedPolymorphicStructTypeDescription() {}
     480             : 
     481         394 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
     482             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     483         394 :     { return css::uno::TypeClass_STRUCT; }
     484             : 
     485         398 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     486         398 :     { return name_; }
     487             : 
     488             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
     489         330 :     getBaseType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     490         330 :     { return css::uno::Reference< css::reflection::XTypeDescription >(); }
     491             : 
     492             :     virtual
     493             :     css::uno::Sequence<
     494             :         css::uno::Reference< css::reflection::XTypeDescription > >
     495             :     SAL_CALL getMemberTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     496             : 
     497             :     virtual css::uno::Sequence< rtl::OUString > SAL_CALL getMemberNames()
     498             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     499             : 
     500         330 :     virtual css::uno::Sequence< rtl::OUString > SAL_CALL getTypeParameters()
     501             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     502         330 :     { return css::uno::Sequence< rtl::OUString >(); }
     503             : 
     504             :     virtual
     505             :     css::uno::Sequence<
     506             :         css::uno::Reference< css::reflection::XTypeDescription > >
     507             :     SAL_CALL getTypeArguments() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     508             : 
     509             :     rtl::Reference< cppuhelper::TypeManager > manager_;
     510             :     rtl::OUString name_;
     511             :     rtl::Reference< unoidl::PolymorphicStructTypeTemplateEntity > entity_;
     512             :     std::vector< rtl::OUString > arguments_;
     513             : };
     514             : 
     515             : css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
     516         330 : InstantiatedPolymorphicStructTypeDescription::getMemberTypes()
     517             :     throw (css::uno::RuntimeException, std::exception)
     518             : {
     519             :     assert(entity_->getMembers().size() <= SAL_MAX_INT32);
     520         330 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getMembers().size());
     521             :     css::uno::Sequence<
     522         330 :         css::uno::Reference< css::reflection::XTypeDescription > > s(n);
     523         918 :     for (sal_Int32 i = 0; i != n; ++i) {
     524         588 :         rtl::OUString type(entity_->getMembers()[i].type);
     525         588 :         if (entity_->getMembers()[i].parameterized) {
     526        1458 :             for (std::vector< rtl::OUString >::const_iterator j(
     527         408 :                      entity_->getTypeParameters().begin());
     528         972 :                  j != entity_->getTypeParameters().end(); ++j)
     529             :             {
     530         486 :                 if (*j == type) {
     531         408 :                     type = arguments_[j - entity_->getTypeParameters().begin()];
     532         408 :                     goto found;
     533             :                 }
     534             :             }
     535             :             assert(false); // this cannot happen                         //TODO!
     536             :         found:;
     537             :         }
     538         588 :         s[i] = manager_->resolve(type);
     539         588 :     }
     540         330 :     return s;
     541             : }
     542             : 
     543             : css::uno::Sequence< rtl::OUString >
     544         330 : InstantiatedPolymorphicStructTypeDescription::getMemberNames()
     545             :     throw (css::uno::RuntimeException, std::exception)
     546             : {
     547             :     assert(entity_->getMembers().size() <= SAL_MAX_INT32);
     548         330 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getMembers().size());
     549         330 :     css::uno::Sequence< rtl::OUString > s(n);
     550         918 :     for (sal_Int32 i = 0; i != n; ++i) {
     551         588 :         s[i] = entity_->getMembers()[i].name;
     552             :     }
     553         330 :     return s;
     554             : }
     555             : css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
     556           2 : InstantiatedPolymorphicStructTypeDescription::getTypeArguments()
     557             :     throw (css::uno::RuntimeException, std::exception)
     558             : {
     559             :     assert(arguments_.size() <= SAL_MAX_INT32);
     560           2 :     sal_Int32 n = static_cast< sal_Int32 >(arguments_.size());
     561             :     css::uno::Sequence<
     562           2 :         css::uno::Reference< css::reflection::XTypeDescription > > s(n);
     563           4 :     for (sal_Int32 i = 0; i != n; ++i) {
     564           2 :         s[i] = manager_->resolve(arguments_[i]);
     565             :     }
     566           2 :     return s;
     567             : }
     568             : 
     569             : typedef cppu::ImplInheritanceHelper1<
     570             :     PublishableDescription, css::reflection::XCompoundTypeDescription >
     571             : ExceptionTypeDescription_Base;
     572             : 
     573             : class ExceptionTypeDescription: public ExceptionTypeDescription_Base {
     574             : public:
     575       25047 :     ExceptionTypeDescription(
     576             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
     577             :         rtl::OUString const & name,
     578             :         rtl::Reference< unoidl::ExceptionTypeEntity > const & entity):
     579       25047 :         ExceptionTypeDescription_Base(entity->isPublished()), manager_(manager),
     580       25047 :         name_(name), entity_(entity)
     581       25047 :     { assert(manager.is()); assert(entity.is()); }
     582             : 
     583             : private:
     584       50094 :     virtual ~ExceptionTypeDescription() {}
     585             : 
     586        3246 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
     587             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     588        3246 :     { return css::uno::TypeClass_EXCEPTION; }
     589             : 
     590       25125 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     591       25125 :     { return name_; }
     592             : 
     593             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
     594        2437 :     getBaseType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE {
     595        4874 :         return entity_->getDirectBase().isEmpty()
     596             :             ? css::uno::Reference< css::reflection::XTypeDescription >()
     597        4874 :             : manager_->resolve(entity_->getDirectBase());
     598             :     }
     599             : 
     600             :     virtual
     601             :     css::uno::Sequence<
     602             :         css::uno::Reference< css::reflection::XTypeDescription > >
     603             :     SAL_CALL getMemberTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     604             : 
     605             :     virtual css::uno::Sequence< rtl::OUString > SAL_CALL getMemberNames()
     606             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     607             : 
     608             :     rtl::Reference< cppuhelper::TypeManager > manager_;
     609             :     rtl::OUString name_;
     610             :     rtl::Reference< unoidl::ExceptionTypeEntity > entity_;
     611             : };
     612             : 
     613             : css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
     614        2437 : ExceptionTypeDescription::getMemberTypes() throw (css::uno::RuntimeException, std::exception) {
     615             :     assert(entity_->getDirectMembers().size() <= SAL_MAX_INT32);
     616        2437 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getDirectMembers().size());
     617             :     css::uno::Sequence<
     618        2437 :         css::uno::Reference< css::reflection::XTypeDescription > > s(n);
     619        5497 :     for (sal_Int32 i = 0; i != n; ++i) {
     620        3060 :         s[i] = manager_->resolve(entity_->getDirectMembers()[i].type);
     621             :     }
     622        2437 :     return s;
     623             : }
     624             : 
     625        2437 : css::uno::Sequence< rtl::OUString > ExceptionTypeDescription::getMemberNames()
     626             :     throw (css::uno::RuntimeException, std::exception)
     627             : {
     628             :     assert(entity_->getDirectMembers().size() <= SAL_MAX_INT32);
     629        2437 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getDirectMembers().size());
     630        2437 :     css::uno::Sequence< rtl::OUString > s(n);
     631        5497 :     for (sal_Int32 i = 0; i != n; ++i) {
     632        3060 :         s[i] = entity_->getDirectMembers()[i].name;
     633             :     }
     634        2437 :     return s;
     635             : }
     636             : 
     637             : class AttributeDescription:
     638             :     public cppu::WeakImplHelper1<
     639             :         css::reflection::XInterfaceAttributeTypeDescription2 >
     640             : {
     641             : public:
     642      232620 :     AttributeDescription(
     643             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
     644             :         rtl::OUString const & name,
     645             :         unoidl::InterfaceTypeEntity::Attribute const & attribute,
     646             :         sal_Int32 position):
     647             :         manager_(manager), name_(name), attribute_(attribute),
     648      232620 :         position_(position)
     649      232620 :     { assert(manager.is()); }
     650             : 
     651             : private:
     652      465240 :     virtual ~AttributeDescription() {}
     653             : 
     654       81032 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
     655             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     656       81032 :     { return css::uno::TypeClass_INTERFACE_ATTRIBUTE; }
     657             : 
     658       27608 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     659       27608 :     { return name_; }
     660             : 
     661      128650 :     virtual rtl::OUString SAL_CALL getMemberName()
     662             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     663      128650 :     { return attribute_.name; }
     664             : 
     665        7540 :     virtual sal_Int32 SAL_CALL getPosition() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     666        7540 :     { return position_; }
     667             : 
     668       60964 :     virtual sal_Bool SAL_CALL isReadOnly() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     669       60964 :     { return attribute_.readOnly; }
     670             : 
     671             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
     672       60964 :     getType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     673       60964 :     { return manager_->resolve(attribute_.type); }
     674             : 
     675       53424 :     virtual sal_Bool SAL_CALL isBound() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     676       53424 :     { return attribute_.bound; }
     677             : 
     678             :     virtual
     679             :     css::uno::Sequence<
     680             :         css::uno::Reference< css::reflection::XCompoundTypeDescription > >
     681             :     SAL_CALL getGetExceptions() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     682             : 
     683             :     virtual
     684             :     css::uno::Sequence<
     685             :         css::uno::Reference< css::reflection::XCompoundTypeDescription > >
     686             :     SAL_CALL getSetExceptions() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     687             : 
     688             :     rtl::Reference< cppuhelper::TypeManager > manager_;
     689             :     rtl::OUString name_;
     690             :     unoidl::InterfaceTypeEntity::Attribute attribute_;
     691             :     sal_Int32 position_;
     692             : };
     693             : 
     694             : css::uno::Sequence<
     695             :     css::uno::Reference< css::reflection::XCompoundTypeDescription > >
     696       60964 : AttributeDescription::getGetExceptions() throw (css::uno::RuntimeException, std::exception) {
     697             :     assert(attribute_.getExceptions.size() <= SAL_MAX_INT32);
     698       60964 :     sal_Int32 n = static_cast< sal_Int32 >(attribute_.getExceptions.size());
     699             :     css::uno::Sequence<
     700       60964 :         css::uno::Reference< css::reflection::XCompoundTypeDescription > > s(n);
     701       61924 :     for (sal_Int32 i = 0; i != n; ++i) {
     702         960 :         s[i].set(
     703         960 :             manager_->resolve(attribute_.getExceptions[i]),
     704        1920 :             css::uno::UNO_QUERY_THROW);
     705             :     }
     706       60964 :     return s;
     707             : }
     708             : 
     709             : css::uno::Sequence<
     710             :     css::uno::Reference< css::reflection::XCompoundTypeDescription > >
     711       60964 : AttributeDescription::getSetExceptions() throw (css::uno::RuntimeException, std::exception) {
     712             :     assert(attribute_.setExceptions.size() <= SAL_MAX_INT32);
     713       60964 :     sal_Int32 n = static_cast< sal_Int32 >(attribute_.setExceptions.size());
     714             :     css::uno::Sequence<
     715       60964 :         css::uno::Reference< css::reflection::XCompoundTypeDescription > > s(n);
     716       62666 :     for (sal_Int32 i = 0; i != n; ++i) {
     717        1702 :         s[i].set(
     718        1702 :             manager_->resolve(attribute_.setExceptions[i]),
     719        3404 :             css::uno::UNO_QUERY_THROW);
     720             :     }
     721       60964 :     return s;
     722             : }
     723             : 
     724             : class MethodParameter:
     725             :     public cppu::WeakImplHelper1< css::reflection::XMethodParameter >
     726             : {
     727             : public:
     728       29717 :     MethodParameter(
     729             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
     730             :         unoidl::InterfaceTypeEntity::Method::Parameter const & parameter,
     731             :         sal_Int32 position):
     732       29717 :         manager_(manager), parameter_(parameter), position_(position)
     733       29717 :     { assert(manager.is()); }
     734             : 
     735             : private:
     736       59434 :     virtual ~MethodParameter() {}
     737             : 
     738       29717 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     739       29717 :     { return parameter_.name; }
     740             : 
     741             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
     742       29717 :     getType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     743       29717 :     { return manager_->resolve(parameter_.type); }
     744             : 
     745       29717 :     virtual sal_Bool SAL_CALL isIn() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE {
     746             :         return
     747             :             (parameter_.direction
     748       29717 :              == unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN)
     749       29977 :             || (parameter_.direction
     750         260 :                 == unoidl::InterfaceTypeEntity::Method::Parameter::
     751       29717 :                     DIRECTION_IN_OUT);
     752             :     }
     753             : 
     754       29717 :     virtual sal_Bool SAL_CALL isOut() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE {
     755             :         return
     756             :             (parameter_.direction
     757       29717 :              == unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_OUT)
     758       59274 :             || (parameter_.direction
     759       29557 :                 == unoidl::InterfaceTypeEntity::Method::Parameter::
     760       29717 :                     DIRECTION_IN_OUT);
     761             :     }
     762             : 
     763       29717 :     virtual sal_Int32 SAL_CALL getPosition() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     764       29717 :     { return position_; }
     765             : 
     766             :     rtl::Reference< cppuhelper::TypeManager > manager_;
     767             :     unoidl::InterfaceTypeEntity::Method::Parameter parameter_;
     768             :     sal_Int32 position_;
     769             : };
     770             : 
     771             : class MethodDescription:
     772             :     public cppu::WeakImplHelper1<
     773             :         css::reflection::XInterfaceMethodTypeDescription >
     774             : {
     775             : public:
     776     2409068 :     MethodDescription(
     777             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
     778             :         rtl::OUString const & name,
     779             :         unoidl::InterfaceTypeEntity::Method const & method, sal_Int32 position):
     780     2409068 :         manager_(manager), name_(name), method_(method), position_(position)
     781     2409068 :     { assert(manager.is()); }
     782             : 
     783             : private:
     784     4818136 :     virtual ~MethodDescription() {}
     785             : 
     786      593647 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
     787             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     788      593647 :     { return css::uno::TypeClass_INTERFACE_METHOD; }
     789             : 
     790      453267 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     791      453267 :     { return name_; }
     792             : 
     793      165518 :     virtual rtl::OUString SAL_CALL getMemberName()
     794             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     795      165518 :     { return method_.name; }
     796             : 
     797       35284 :     virtual sal_Int32 SAL_CALL getPosition() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     798       35284 :     { return position_; }
     799             : 
     800             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
     801       35284 :     getReturnType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     802       35284 :     { return manager_->resolve(method_.returnType); }
     803             : 
     804       35284 :     virtual sal_Bool SAL_CALL isOneway() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     805       35284 :     { return false; }
     806             : 
     807             :     virtual
     808             :     css::uno::Sequence<
     809             :         css::uno::Reference< css::reflection::XMethodParameter > >
     810             :     SAL_CALL getParameters() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     811             : 
     812             :     virtual
     813             :     css::uno::Sequence<
     814             :         css::uno::Reference< css::reflection::XTypeDescription > >
     815             :     SAL_CALL getExceptions() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     816             : 
     817             :     rtl::Reference< cppuhelper::TypeManager > manager_;
     818             :     rtl::OUString name_;
     819             :     unoidl::InterfaceTypeEntity::Method method_;
     820             :     sal_Int32 position_;
     821             : };
     822             : 
     823             : css::uno::Sequence< css::uno::Reference< css::reflection::XMethodParameter > >
     824       35284 : MethodDescription::getParameters() throw (css::uno::RuntimeException, std::exception) {
     825             :     assert(method_.parameters.size() <= SAL_MAX_INT32);
     826       35284 :     sal_Int32 n = static_cast< sal_Int32 >(method_.parameters.size());
     827             :     css::uno::Sequence<
     828       35284 :         css::uno::Reference< css::reflection::XMethodParameter > > s(n);
     829       65001 :     for (sal_Int32 i = 0; i != n; ++i) {
     830       29717 :         s[i] = new MethodParameter(manager_, method_.parameters[i], i);
     831             :     }
     832       35284 :     return s;
     833             : }
     834             : 
     835             : css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
     836       35284 : MethodDescription::getExceptions() throw (css::uno::RuntimeException, std::exception) {
     837             :     assert(method_.exceptions.size() <= SAL_MAX_INT32);
     838       35284 :     sal_Int32 n = static_cast< sal_Int32 >(method_.exceptions.size());
     839             :     css::uno::Sequence<
     840       35284 :         css::uno::Reference< css::reflection::XTypeDescription > > s(n);
     841       55232 :     for (sal_Int32 i = 0; i != n; ++i) {
     842       19948 :         s[i] = manager_->resolve(method_.exceptions[i]);
     843             :     }
     844       35284 :     return s;
     845             : }
     846             : 
     847      765741 : class BaseOffset: private boost::noncopyable {
     848             : public:
     849             :     BaseOffset(
     850             :         css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >
     851             :             const & description);
     852             : 
     853      765741 :     sal_Int32 get() const { return offset_; }
     854             : 
     855             : private:
     856             :     void calculateBases(
     857             :         css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >
     858             :             const & description);
     859             : 
     860             :     void calculate(
     861             :         css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >
     862             :             const & description);
     863             : 
     864             :     std::set< rtl::OUString > set_;
     865             :     sal_Int32 offset_;
     866             : };
     867             : 
     868      765741 : BaseOffset::BaseOffset(
     869             :     css::uno::Reference< css::reflection::XInterfaceTypeDescription2 > const &
     870             :         description):
     871      765741 :     offset_(0)
     872             : {
     873      765741 :     calculateBases(description);
     874      765741 : }
     875             : 
     876     1284323 : void BaseOffset::calculateBases(
     877             :     css::uno::Reference< css::reflection::XInterfaceTypeDescription2 > const &
     878             :         description)
     879             : {
     880             :     css::uno::Sequence<
     881             :         css::uno::Reference < css::reflection::XTypeDescription > > bases(
     882     1284323 :             description->getBaseTypes());
     883     1839907 :     for (sal_Int32 i = 0; i != bases.getLength(); ++i) {
     884             :         calculate(
     885             :             css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >(
     886      555584 :                 resolveTypedefs(css::uno::makeAny(bases[i])),
     887      555584 :                 css::uno::UNO_QUERY_THROW));
     888     1284323 :     }
     889     1284323 : }
     890             : 
     891      555584 : void BaseOffset::calculate(
     892             :     css::uno::Reference< css::reflection::XInterfaceTypeDescription2 > const &
     893             :         description)
     894             : {
     895      555584 :     if (set_.insert(description->getName()).second) {
     896      518582 :         calculateBases(description);
     897      518582 :         offset_ += description->getMembers().getLength();
     898             :     }
     899      555584 : }
     900             : 
     901             : typedef cppu::ImplInheritanceHelper1<
     902             :     PublishableDescription, css::reflection::XInterfaceTypeDescription2 >
     903             : InterfaceTypeDescription_Base;
     904             : 
     905             : class InterfaceTypeDescription: public InterfaceTypeDescription_Base {
     906             : public:
     907      840342 :     InterfaceTypeDescription(
     908             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
     909             :         rtl::OUString const & name,
     910             :         rtl::Reference< unoidl::InterfaceTypeEntity > const & entity):
     911      840342 :         InterfaceTypeDescription_Base(entity->isPublished()), manager_(manager),
     912      840342 :         name_(name), entity_(entity)
     913      840342 :     { assert(manager.is()); assert(entity.is()); }
     914             : 
     915             : private:
     916     1680684 :     virtual ~InterfaceTypeDescription() {}
     917             : 
     918      241952 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
     919             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     920      241952 :     { return css::uno::TypeClass_INTERFACE; }
     921             : 
     922      797572 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     923      797572 :     { return name_; }
     924             : 
     925             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
     926           0 :     getBaseType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE {
     927           0 :         return entity_->getDirectMandatoryBases().empty()
     928             :             ? css::uno::Reference< css::reflection::XTypeDescription >()
     929           0 :             : manager_->resolve(entity_->getDirectMandatoryBases()[0].name);
     930             :     }
     931             : 
     932           0 :     virtual css::uno::Uik SAL_CALL getUik() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     933           0 :     { return css::uno::Uik(); }
     934             : 
     935             :     virtual
     936             :     css::uno::Sequence<
     937             :         css::uno::Reference<
     938             :              css::reflection::XInterfaceMemberTypeDescription > >
     939             :     SAL_CALL getMembers() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     940             : 
     941             :     virtual
     942             :     css::uno::Sequence<
     943             :         css::uno::Reference< css::reflection::XTypeDescription > >
     944             :     SAL_CALL getBaseTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     945             : 
     946             :     virtual
     947             :     css::uno::Sequence<
     948             :         css::uno::Reference< css::reflection::XTypeDescription > >
     949             :     SAL_CALL getOptionalBaseTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     950             : 
     951             :     rtl::Reference< cppuhelper::TypeManager > manager_;
     952             :     rtl::OUString name_;
     953             :     rtl::Reference< unoidl::InterfaceTypeEntity > entity_;
     954             : };
     955             : 
     956             : css::uno::Sequence<
     957             :     css::uno::Reference< css::reflection::XInterfaceMemberTypeDescription > >
     958      765741 : InterfaceTypeDescription::getMembers() throw (css::uno::RuntimeException, std::exception) {
     959             :     assert(
     960             :         entity_->getDirectAttributes().size() <= SAL_MAX_INT32
     961             :         && (entity_->getDirectMethods().size()
     962             :             <= SAL_MAX_INT32 - entity_->getDirectAttributes().size()));
     963             :     sal_Int32 n1 = static_cast< sal_Int32 >(
     964      765741 :         entity_->getDirectAttributes().size());
     965      765741 :     sal_Int32 n2 = static_cast< sal_Int32 >(entity_->getDirectMethods().size());
     966             :     css::uno::Sequence<
     967             :         css::uno::Reference<
     968      765741 :             css::reflection::XInterfaceMemberTypeDescription > > s(n1 + n2);
     969      765741 :     sal_Int32 off = BaseOffset(this).get();
     970      998361 :     for (sal_Int32 i = 0; i != n1; ++i) {
     971      930480 :         s[i] = new AttributeDescription(
     972      465240 :             manager_, name_ + "::" + entity_->getDirectAttributes()[i].name,
     973      697860 :             entity_->getDirectAttributes()[i], off + i);
     974             :     }
     975     3174809 :     for (sal_Int32 i = 0; i != n2; ++i) {
     976     9636272 :         s[n1 + i] = new MethodDescription(
     977     4818136 :             manager_, name_ + "::" + entity_->getDirectMethods()[i].name,
     978     7227204 :             entity_->getDirectMethods()[i], off + n1 + i);
     979             :     }
     980      765741 :     return s;
     981             : }
     982             : 
     983             : css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
     984     1488658 : InterfaceTypeDescription::getBaseTypes() throw (css::uno::RuntimeException, std::exception) {
     985             :     assert(entity_->getDirectMandatoryBases().size() <= SAL_MAX_INT32);
     986             :     sal_Int32 n = static_cast< sal_Int32 >(
     987     1488658 :         entity_->getDirectMandatoryBases().size());
     988             :     css::uno::Sequence<
     989     1488658 :         css::uno::Reference< css::reflection::XTypeDescription > > s(n);
     990     2204326 :     for (sal_Int32 i = 0; i != n; ++i) {
     991      715668 :         s[i] = manager_->resolve(entity_->getDirectMandatoryBases()[i].name);
     992             :     }
     993     1488658 :     return s;
     994             : }
     995             : 
     996             : css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
     997           0 : InterfaceTypeDescription::getOptionalBaseTypes()
     998             :     throw (css::uno::RuntimeException, std::exception)
     999             : {
    1000             :     assert(entity_->getDirectOptionalBases().size() <= SAL_MAX_INT32);
    1001             :     sal_Int32 n = static_cast< sal_Int32 >(
    1002           0 :         entity_->getDirectOptionalBases().size());
    1003             :     css::uno::Sequence<
    1004           0 :         css::uno::Reference< css::reflection::XTypeDescription > > s(n);
    1005           0 :     for (sal_Int32 i = 0; i != n; ++i) {
    1006           0 :         s[i] = manager_->resolve(entity_->getDirectOptionalBases()[i].name);
    1007             :     }
    1008           0 :     return s;
    1009             : }
    1010             : 
    1011             : class ConstantDescription:
    1012             :     public cppu::WeakImplHelper1< css::reflection::XConstantTypeDescription >
    1013             : {
    1014             : public:
    1015             :     ConstantDescription(
    1016             :         rtl::OUString const & constantGroupName,
    1017             :         unoidl::ConstantGroupEntity::Member const & member);
    1018             : 
    1019             : private:
    1020       67900 :     virtual ~ConstantDescription() {}
    1021             : 
    1022          56 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
    1023             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1024          56 :     { return css::uno::TypeClass_CONSTANT; }
    1025             : 
    1026       33836 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1027       33836 :     { return name_; }
    1028             : 
    1029       33894 :     virtual css::uno::Any SAL_CALL getConstantValue()
    1030             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1031       33894 :     { return value_; }
    1032             : 
    1033             :     rtl::OUString name_;
    1034             :     css::uno::Any value_;
    1035             : };
    1036             : 
    1037       33950 : ConstantDescription::ConstantDescription(
    1038             :     rtl::OUString const & constantGroupName,
    1039             :     unoidl::ConstantGroupEntity::Member const & member):
    1040       33950 :     name_(makePrefix(constantGroupName) + member.name)
    1041             : {
    1042       33950 :     switch (member.value.type) {
    1043             :     case unoidl::ConstantValue::TYPE_BOOLEAN:
    1044           0 :         value_ <<= member.value.booleanValue;
    1045           0 :         break;
    1046             :     case unoidl::ConstantValue::TYPE_BYTE:
    1047           0 :         value_ <<= member.value.byteValue;
    1048           0 :         break;
    1049             :     case unoidl::ConstantValue::TYPE_SHORT:
    1050          96 :         value_ <<= member.value.shortValue;
    1051          96 :         break;
    1052             :     case unoidl::ConstantValue::TYPE_UNSIGNED_SHORT:
    1053           0 :         value_ <<= member.value.unsignedShortValue;
    1054           0 :         break;
    1055             :     case unoidl::ConstantValue::TYPE_LONG:
    1056       33854 :         value_ <<= member.value.longValue;
    1057       33854 :         break;
    1058             :     case unoidl::ConstantValue::TYPE_UNSIGNED_LONG:
    1059           0 :         value_ <<= member.value.unsignedLongValue;
    1060           0 :         break;
    1061             :     case unoidl::ConstantValue::TYPE_HYPER:
    1062           0 :         value_ <<= member.value.hyperValue;
    1063           0 :         break;
    1064             :     case unoidl::ConstantValue::TYPE_UNSIGNED_HYPER:
    1065           0 :         value_ <<= member.value.unsignedHyperValue;
    1066           0 :         break;
    1067             :     case unoidl::ConstantValue::TYPE_FLOAT:
    1068           0 :         value_ <<= member.value.floatValue;
    1069           0 :         break;
    1070             :     case unoidl::ConstantValue::TYPE_DOUBLE:
    1071           0 :         value_ <<= member.value.doubleValue;
    1072           0 :         break;
    1073             :     default:
    1074           0 :         for (;;) { std::abort(); } // this cannot happen
    1075             :     }
    1076       33950 : }
    1077             : 
    1078             : typedef cppu::ImplInheritanceHelper1<
    1079             :     PublishableDescription, css::reflection::XConstantsTypeDescription >
    1080             : ConstantGroupDescription_Base;
    1081             : 
    1082             : class ConstantGroupDescription: public ConstantGroupDescription_Base {
    1083             : public:
    1084        3392 :     ConstantGroupDescription(
    1085             :         rtl::OUString const & name,
    1086             :         rtl::Reference< unoidl::ConstantGroupEntity > const & entity):
    1087        3392 :         ConstantGroupDescription_Base(entity->isPublished()), name_(name),
    1088        3392 :         entity_(entity)
    1089        3392 :     { assert(entity.is()); }
    1090             : 
    1091             : private:
    1092        6784 :     virtual ~ConstantGroupDescription() {}
    1093             : 
    1094          60 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
    1095             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1096          60 :     { return css::uno::TypeClass_CONSTANTS; }
    1097             : 
    1098        3328 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1099        3328 :     { return name_; }
    1100             : 
    1101             :     virtual
    1102             :     css::uno::Sequence<
    1103             :         css::uno::Reference< css::reflection::XConstantTypeDescription > >
    1104             :     SAL_CALL getConstants() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1105             : 
    1106             :     rtl::OUString name_;
    1107             :     rtl::Reference< unoidl::ConstantGroupEntity > entity_;
    1108             : };
    1109             : 
    1110             : css::uno::Sequence<
    1111             :     css::uno::Reference< css::reflection::XConstantTypeDescription > >
    1112        3328 : ConstantGroupDescription::getConstants() throw (css::uno::RuntimeException, std::exception) {
    1113             :     assert(entity_->getMembers().size() <= SAL_MAX_INT32);
    1114        3328 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getMembers().size());
    1115             :     css::uno::Sequence<
    1116        3328 :         css::uno::Reference< css::reflection::XConstantTypeDescription > > s(n);
    1117       37164 :     for (sal_Int32 i = 0; i != n; ++i) {
    1118       33836 :         s[i] = new ConstantDescription(name_, entity_->getMembers()[i]);
    1119             :     }
    1120        3328 :     return s;
    1121             : }
    1122             : 
    1123             : typedef cppu::ImplInheritanceHelper1<
    1124             :     PublishableDescription, css::reflection::XIndirectTypeDescription >
    1125             : TypedefDescription_Base;
    1126             : 
    1127             : class TypedefDescription: public TypedefDescription_Base {
    1128             : public:
    1129        2140 :     TypedefDescription(
    1130             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
    1131             :         rtl::OUString const & name,
    1132             :         rtl::Reference< unoidl::TypedefEntity > const & entity):
    1133        2140 :         TypedefDescription_Base(entity->isPublished()), manager_(manager),
    1134        2140 :         name_(name), entity_(entity)
    1135        2140 :     { assert(manager.is()); assert(entity.is()); }
    1136             : 
    1137             : private:
    1138        4280 :     virtual ~TypedefDescription() {}
    1139             : 
    1140        2140 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
    1141             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1142        2140 :     { return css::uno::TypeClass_TYPEDEF; }
    1143             : 
    1144         974 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1145         974 :     { return name_; }
    1146             : 
    1147             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
    1148        1166 :     getReferencedType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1149        1166 :     { return manager_->resolve(entity_->getType()); }
    1150             : 
    1151             :     rtl::Reference< cppuhelper::TypeManager > manager_;
    1152             :     rtl::OUString name_;
    1153             :     rtl::Reference< unoidl::TypedefEntity > entity_;
    1154             : };
    1155             : 
    1156             : class ConstructorParameter:
    1157             :     public cppu::WeakImplHelper1< css::reflection::XParameter >
    1158             : {
    1159             : public:
    1160         362 :     ConstructorParameter(
    1161             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
    1162             :         unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter
    1163             :             const & parameter,
    1164             :         sal_Int32 position):
    1165         362 :         manager_(manager), parameter_(parameter), position_(position)
    1166         362 :     { assert(manager.is()); }
    1167             : 
    1168             : private:
    1169         724 :     virtual ~ConstructorParameter() {}
    1170             : 
    1171           0 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1172           0 :     { return parameter_.name; }
    1173             : 
    1174             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
    1175           0 :     getType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1176           0 :     { return manager_->resolve(parameter_.type); }
    1177             : 
    1178           0 :     virtual sal_Bool SAL_CALL isIn() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1179           0 :     { return true; }
    1180             : 
    1181           0 :     virtual sal_Bool SAL_CALL isOut() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1182           0 :     { return false; }
    1183             : 
    1184           0 :     virtual sal_Int32 SAL_CALL getPosition() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1185           0 :     { return position_; }
    1186             : 
    1187           0 :     virtual sal_Bool SAL_CALL isRestParameter()
    1188             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1189           0 :     { return parameter_.rest; }
    1190             : 
    1191             :     rtl::Reference< cppuhelper::TypeManager > manager_;
    1192             :     unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter
    1193             :         parameter_;
    1194             :     sal_Int32 position_;
    1195             : };
    1196             : 
    1197             : class ConstructorDescription:
    1198             :     public cppu::WeakImplHelper1<
    1199             :         css::reflection::XServiceConstructorDescription >
    1200             : {
    1201             : public:
    1202         680 :     ConstructorDescription(
    1203             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
    1204             :         unoidl::SingleInterfaceBasedServiceEntity::Constructor const &
    1205             :             constructor):
    1206         680 :         manager_(manager), constructor_(constructor)
    1207         680 :     { assert(manager.is()); }
    1208             : 
    1209             : private:
    1210        1360 :     virtual ~ConstructorDescription() {}
    1211             : 
    1212         476 :     virtual sal_Bool SAL_CALL isDefaultConstructor()
    1213             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1214         476 :     { return constructor_.defaultConstructor; }
    1215             : 
    1216           0 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1217           0 :     { return constructor_.name; }
    1218             : 
    1219             :     virtual
    1220             :     css::uno::Sequence<
    1221             :         css::uno::Reference< css::reflection::XParameter > >
    1222             :     SAL_CALL getParameters() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1223             : 
    1224             :     virtual
    1225             :     css::uno::Sequence<
    1226             :         css::uno::Reference< css::reflection::XCompoundTypeDescription > >
    1227             :     SAL_CALL getExceptions() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1228             : 
    1229             :     rtl::Reference< cppuhelper::TypeManager > manager_;
    1230             :     unoidl::SingleInterfaceBasedServiceEntity::Constructor constructor_;
    1231             : };
    1232             : 
    1233             : css::uno::Sequence< css::uno::Reference< css::reflection::XParameter > >
    1234         680 : ConstructorDescription::getParameters() throw (css::uno::RuntimeException, std::exception) {
    1235             :     assert(constructor_.parameters.size() <= SAL_MAX_INT32);
    1236         680 :     sal_Int32 n = static_cast< sal_Int32 >(constructor_.parameters.size());
    1237             :     css::uno::Sequence< css::uno::Reference< css::reflection::XParameter > > s(
    1238         680 :         n);
    1239        1042 :     for (sal_Int32 i = 0; i != n; ++i) {
    1240         724 :         s[i] = new ConstructorParameter(
    1241        1086 :             manager_, constructor_.parameters[i], i);
    1242             :     }
    1243         680 :     return s;
    1244             : }
    1245             : 
    1246             : css::uno::Sequence<
    1247             :     css::uno::Reference< css::reflection::XCompoundTypeDescription > >
    1248           0 : ConstructorDescription::getExceptions() throw (css::uno::RuntimeException, std::exception) {
    1249             :     assert(constructor_.exceptions.size() <= SAL_MAX_INT32);
    1250           0 :     sal_Int32 n = static_cast< sal_Int32 >(constructor_.exceptions.size());
    1251             :     css::uno::Sequence<
    1252           0 :         css::uno::Reference< css::reflection::XCompoundTypeDescription > > s(n);
    1253           0 :     for (sal_Int32 i = 0; i != n; ++i) {
    1254           0 :         s[i].set(
    1255           0 :             manager_->resolve(constructor_.exceptions[i]),
    1256           0 :             css::uno::UNO_QUERY_THROW);
    1257             :     }
    1258           0 :     return s;
    1259             : }
    1260             : 
    1261             : typedef cppu::ImplInheritanceHelper1<
    1262             :     PublishableDescription, css::reflection::XServiceTypeDescription2 >
    1263             : SingleInterfaceBasedServiceDescription_Base;
    1264             : 
    1265             : class SingleInterfaceBasedServiceDescription:
    1266             :     public SingleInterfaceBasedServiceDescription_Base
    1267             : {
    1268             : public:
    1269        1220 :     SingleInterfaceBasedServiceDescription(
    1270             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
    1271             :         rtl::OUString const & name,
    1272             :         rtl::Reference< unoidl::SingleInterfaceBasedServiceEntity > const &
    1273             :             entity):
    1274        1220 :         SingleInterfaceBasedServiceDescription_Base(entity->isPublished()),
    1275        1220 :         manager_(manager), name_(name), entity_(entity)
    1276        1220 :     { assert(manager.is()); assert(entity.is()); }
    1277             : 
    1278             : private:
    1279        2440 :     virtual ~SingleInterfaceBasedServiceDescription() {}
    1280             : 
    1281           0 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
    1282             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1283           0 :     { return css::uno::TypeClass_SERVICE; }
    1284             : 
    1285           0 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1286           0 :     { return name_; }
    1287             : 
    1288             :     virtual
    1289             :     css::uno::Sequence<
    1290             :         css::uno::Reference< css::reflection::XServiceTypeDescription > >
    1291           0 :     SAL_CALL getMandatoryServices() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1292             :     {
    1293             :         return css::uno::Sequence<
    1294           0 :             css::uno::Reference< css::reflection::XServiceTypeDescription > >();
    1295             :     }
    1296             : 
    1297             :     virtual
    1298             :     css::uno::Sequence<
    1299             :         css::uno::Reference< css::reflection::XServiceTypeDescription > >
    1300           0 :     SAL_CALL getOptionalServices() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1301             :     {
    1302             :         return css::uno::Sequence<
    1303           0 :             css::uno::Reference< css::reflection::XServiceTypeDescription > >();
    1304             :     }
    1305             : 
    1306             :     virtual
    1307             :     css::uno::Sequence<
    1308             :         css::uno::Reference< css::reflection::XInterfaceTypeDescription > >
    1309           0 :     SAL_CALL getMandatoryInterfaces() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1310             :     {
    1311             :         return css::uno::Sequence<
    1312             :             css::uno::Reference<
    1313           0 :                 css::reflection::XInterfaceTypeDescription > >();
    1314             :     }
    1315             : 
    1316             :     virtual
    1317             :     css::uno::Sequence<
    1318             :         css::uno::Reference< css::reflection::XInterfaceTypeDescription > >
    1319           0 :     SAL_CALL getOptionalInterfaces() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1320             :     {
    1321             :         return css::uno::Sequence<
    1322             :             css::uno::Reference<
    1323           0 :                 css::reflection::XInterfaceTypeDescription > >();
    1324             :     }
    1325             : 
    1326             :     virtual
    1327             :     css::uno::Sequence<
    1328             :         css::uno::Reference< css::reflection::XPropertyTypeDescription > >
    1329           0 :     SAL_CALL getProperties() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1330             :     {
    1331             :         return css::uno::Sequence<
    1332             :             css::uno::Reference<
    1333           0 :                 css::reflection::XPropertyTypeDescription > >();
    1334             :     }
    1335             : 
    1336           0 :     virtual sal_Bool SAL_CALL isSingleInterfaceBased()
    1337             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1338           0 :     { return true; }
    1339             : 
    1340             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
    1341           0 :     getInterface() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1342           0 :     { return manager_->resolve(entity_->getBase()); }
    1343             : 
    1344             :     virtual
    1345             :     css::uno::Sequence<
    1346             :         css::uno::Reference< css::reflection::XServiceConstructorDescription > >
    1347             :     SAL_CALL getConstructors() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1348             : 
    1349             :     rtl::Reference< cppuhelper::TypeManager > manager_;
    1350             :     rtl::OUString name_;
    1351             :     rtl::Reference< unoidl::SingleInterfaceBasedServiceEntity > entity_;
    1352             : };
    1353             : 
    1354             : css::uno::Sequence<
    1355             :     css::uno::Reference< css::reflection::XServiceConstructorDescription > >
    1356         610 : SingleInterfaceBasedServiceDescription::getConstructors()
    1357             :     throw (css::uno::RuntimeException, std::exception)
    1358             : {
    1359             :     assert(entity_->getConstructors().size() <= SAL_MAX_INT32);
    1360         610 :     sal_Int32 n = static_cast< sal_Int32 >(entity_->getConstructors().size());
    1361             :     css::uno::Sequence<
    1362             :         css::uno::Reference< css::reflection::XServiceConstructorDescription > >
    1363         610 :             s(n);
    1364        1290 :     for (sal_Int32 i = 0; i != n; ++i) {
    1365        1360 :         s[i] = new ConstructorDescription(
    1366        2040 :             manager_, entity_->getConstructors()[i]);
    1367             :     }
    1368         610 :     return s;
    1369             : }
    1370             : 
    1371             : class PropertyDescription:
    1372             :     public cppu::WeakImplHelper1< css::reflection::XPropertyTypeDescription >
    1373             : {
    1374             : public:
    1375           0 :     PropertyDescription(
    1376             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
    1377             :         unoidl::AccumulationBasedServiceEntity::Property const & property):
    1378           0 :         manager_(manager), property_(property)
    1379           0 :     { assert(manager.is()); }
    1380             : 
    1381             : private:
    1382           0 :     virtual ~PropertyDescription() {}
    1383             : 
    1384           0 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
    1385             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1386           0 :     { return css::uno::TypeClass_PROPERTY; }
    1387             : 
    1388           0 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1389           0 :     { return property_.name; }
    1390             : 
    1391           0 :     virtual sal_Int16 SAL_CALL getPropertyFlags()
    1392             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1393           0 :     { return property_.attributes; }
    1394             : 
    1395             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
    1396           0 :     getPropertyTypeDescription() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1397           0 :     { return manager_->resolve(property_.type); }
    1398             : 
    1399             :     rtl::Reference< cppuhelper::TypeManager > manager_;
    1400             :     unoidl::AccumulationBasedServiceEntity::Property property_;
    1401             : };
    1402             : 
    1403             : typedef cppu::ImplInheritanceHelper1<
    1404             :     PublishableDescription, css::reflection::XServiceTypeDescription2 >
    1405             : AccumulationBasedServiceDescription_Base;
    1406             : 
    1407             : class AccumulationBasedServiceDescription:
    1408             :     public AccumulationBasedServiceDescription_Base
    1409             : {
    1410             : public:
    1411        1100 :     AccumulationBasedServiceDescription(
    1412             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
    1413             :         rtl::OUString const & name,
    1414             :         rtl::Reference< unoidl::AccumulationBasedServiceEntity > const &
    1415             :             entity):
    1416        1100 :         AccumulationBasedServiceDescription_Base(entity->isPublished()),
    1417        1100 :         manager_(manager), name_(name), entity_(entity)
    1418        1100 :     { assert(manager.is()); assert(entity.is()); }
    1419             : 
    1420             : private:
    1421        2200 :     virtual ~AccumulationBasedServiceDescription() {}
    1422             : 
    1423           0 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
    1424             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1425           0 :     { return css::uno::TypeClass_SERVICE; }
    1426             : 
    1427           0 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1428           0 :     { return name_; }
    1429             : 
    1430             :     virtual
    1431             :     css::uno::Sequence<
    1432             :         css::uno::Reference< css::reflection::XServiceTypeDescription > >
    1433             :     SAL_CALL getMandatoryServices() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1434             : 
    1435             :     virtual
    1436             :     css::uno::Sequence<
    1437             :         css::uno::Reference< css::reflection::XServiceTypeDescription > >
    1438             :     SAL_CALL getOptionalServices() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1439             : 
    1440             :     virtual
    1441             :     css::uno::Sequence<
    1442             :         css::uno::Reference< css::reflection::XInterfaceTypeDescription > >
    1443             :     SAL_CALL getMandatoryInterfaces() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1444             : 
    1445             :     virtual
    1446             :     css::uno::Sequence<
    1447             :         css::uno::Reference< css::reflection::XInterfaceTypeDescription > >
    1448             :     SAL_CALL getOptionalInterfaces() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1449             : 
    1450             :     virtual
    1451             :     css::uno::Sequence<
    1452             :         css::uno::Reference< css::reflection::XPropertyTypeDescription > >
    1453             :     SAL_CALL getProperties() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1454             : 
    1455           0 :     virtual sal_Bool SAL_CALL isSingleInterfaceBased()
    1456             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1457           0 :     { return false; }
    1458             : 
    1459             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
    1460           0 :     getInterface() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1461           0 :     { return css::uno::Reference< css::reflection::XTypeDescription >(); }
    1462             : 
    1463             :     virtual
    1464             :     css::uno::Sequence<
    1465             :         css::uno::Reference< css::reflection::XServiceConstructorDescription > >
    1466         550 :     SAL_CALL getConstructors() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1467             :     {
    1468             :         return css::uno::Sequence<
    1469             :             css::uno::Reference<
    1470         550 :                 css::reflection::XServiceConstructorDescription > >();
    1471             :     }
    1472             : 
    1473             :     rtl::Reference< cppuhelper::TypeManager > manager_;
    1474             :     rtl::OUString name_;
    1475             :     rtl::Reference< unoidl::AccumulationBasedServiceEntity > entity_;
    1476             : };
    1477             : 
    1478             : css::uno::Sequence<
    1479             :     css::uno::Reference< css::reflection::XServiceTypeDescription > >
    1480           0 : AccumulationBasedServiceDescription::getMandatoryServices()
    1481             :     throw (css::uno::RuntimeException, std::exception)
    1482             : {
    1483             :     assert(entity_->getDirectMandatoryBaseServices().size() <= SAL_MAX_INT32);
    1484             :     sal_Int32 n = static_cast< sal_Int32 >(
    1485           0 :         entity_->getDirectMandatoryBaseServices().size());
    1486             :     css::uno::Sequence<
    1487           0 :         css::uno::Reference< css::reflection::XServiceTypeDescription > > s(n);
    1488           0 :     for (sal_Int32 i = 0; i != n; ++i) {
    1489           0 :         s[i].set(
    1490             :             manager_->resolve(
    1491           0 :                 entity_->getDirectMandatoryBaseServices()[i].name),
    1492           0 :             css::uno::UNO_QUERY_THROW);
    1493             :     }
    1494           0 :     return s;
    1495             : }
    1496             : 
    1497             : css::uno::Sequence<
    1498             :     css::uno::Reference< css::reflection::XServiceTypeDescription > >
    1499           0 : AccumulationBasedServiceDescription::getOptionalServices()
    1500             :     throw (css::uno::RuntimeException, std::exception)
    1501             : {
    1502             :     assert(entity_->getDirectOptionalBaseServices().size() <= SAL_MAX_INT32);
    1503             :     sal_Int32 n = static_cast< sal_Int32 >(
    1504           0 :         entity_->getDirectOptionalBaseServices().size());
    1505             :     css::uno::Sequence<
    1506           0 :         css::uno::Reference< css::reflection::XServiceTypeDescription > > s(n);
    1507           0 :     for (sal_Int32 i = 0; i != n; ++i) {
    1508           0 :         s[i].set(
    1509           0 :             manager_->resolve(entity_->getDirectOptionalBaseServices()[i].name),
    1510           0 :             css::uno::UNO_QUERY_THROW);
    1511             :     }
    1512           0 :     return s;
    1513             : }
    1514             : 
    1515             : css::uno::Sequence<
    1516             :     css::uno::Reference< css::reflection::XInterfaceTypeDescription > >
    1517           0 : AccumulationBasedServiceDescription::getMandatoryInterfaces()
    1518             :     throw (css::uno::RuntimeException, std::exception)
    1519             : {
    1520             :     assert(entity_->getDirectMandatoryBaseInterfaces().size() <= SAL_MAX_INT32);
    1521             :     sal_Int32 n = static_cast< sal_Int32 >(
    1522           0 :         entity_->getDirectMandatoryBaseInterfaces().size());
    1523             :     css::uno::Sequence<
    1524             :         css::uno::Reference< css::reflection::XInterfaceTypeDescription > > s(
    1525           0 :             n);
    1526           0 :     for (sal_Int32 i = 0; i != n; ++i) {
    1527           0 :         s[i].set(
    1528             :             resolveTypedefs(
    1529             :                 manager_->find(
    1530           0 :                     entity_->getDirectMandatoryBaseInterfaces()[i].name)),
    1531           0 :             css::uno::UNO_QUERY_THROW);
    1532             :     }
    1533           0 :     return s;
    1534             : }
    1535             : 
    1536             : css::uno::Sequence<
    1537             :     css::uno::Reference< css::reflection::XInterfaceTypeDescription > >
    1538           0 : AccumulationBasedServiceDescription::getOptionalInterfaces()
    1539             :     throw (css::uno::RuntimeException, std::exception)
    1540             : {
    1541             :     assert(entity_->getDirectOptionalBaseInterfaces().size() <= SAL_MAX_INT32);
    1542             :     sal_Int32 n = static_cast< sal_Int32 >(
    1543           0 :         entity_->getDirectOptionalBaseInterfaces().size());
    1544             :     css::uno::Sequence<
    1545             :         css::uno::Reference< css::reflection::XInterfaceTypeDescription > > s(
    1546           0 :             n);
    1547           0 :     for (sal_Int32 i = 0; i != n; ++i) {
    1548           0 :         s[i].set(
    1549             :             resolveTypedefs(
    1550             :                 manager_->find(
    1551           0 :                     entity_->getDirectOptionalBaseInterfaces()[i].name)),
    1552           0 :             css::uno::UNO_QUERY_THROW);
    1553             :     }
    1554           0 :     return s;
    1555             : }
    1556             : 
    1557             : css::uno::Sequence<
    1558             :     css::uno::Reference< css::reflection::XPropertyTypeDescription > >
    1559           0 : AccumulationBasedServiceDescription::getProperties()
    1560             :     throw (css::uno::RuntimeException, std::exception)
    1561             : {
    1562             :     assert(entity_->getDirectProperties().size() <= SAL_MAX_INT32);
    1563             :     sal_Int32 n = static_cast< sal_Int32 >(
    1564           0 :         entity_->getDirectProperties().size());
    1565             :     css::uno::Sequence<
    1566           0 :         css::uno::Reference< css::reflection::XPropertyTypeDescription > > s(n);
    1567           0 :     for (sal_Int32 i = 0; i != n; ++i) {
    1568           0 :         s[i] = new PropertyDescription(
    1569           0 :             manager_, entity_->getDirectProperties()[i]);
    1570             :     }
    1571           0 :     return s;
    1572             : }
    1573             : 
    1574             : typedef cppu::ImplInheritanceHelper1<
    1575             :     PublishableDescription, css::reflection::XSingletonTypeDescription2 >
    1576             : InterfaceBasedSingletonDescription_Base;
    1577             : 
    1578             : class InterfaceBasedSingletonDescription:
    1579             :     public InterfaceBasedSingletonDescription_Base
    1580             : {
    1581             : public:
    1582           0 :     InterfaceBasedSingletonDescription(
    1583             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
    1584             :         rtl::OUString const & name,
    1585             :         rtl::Reference< unoidl::InterfaceBasedSingletonEntity > const & entity):
    1586           0 :         InterfaceBasedSingletonDescription_Base(entity->isPublished()),
    1587           0 :         manager_(manager), name_(name), entity_(entity)
    1588           0 :     { assert(manager.is()); assert(entity.is()); }
    1589             : 
    1590             : private:
    1591           0 :     virtual ~InterfaceBasedSingletonDescription() {}
    1592             : 
    1593           0 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
    1594             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1595           0 :     { return css::uno::TypeClass_SINGLETON; }
    1596             : 
    1597           0 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1598           0 :     { return name_; }
    1599             : 
    1600             :     virtual css::uno::Reference< css::reflection::XServiceTypeDescription >
    1601           0 :     SAL_CALL getService() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1602             :     {
    1603             :         return
    1604           0 :             css::uno::Reference< css::reflection::XServiceTypeDescription >();
    1605             :     }
    1606             : 
    1607           0 :     virtual sal_Bool SAL_CALL isInterfaceBased()
    1608             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1609           0 :     { return true; }
    1610             : 
    1611             :     virtual css::uno::Reference< css::reflection::XTypeDescription >
    1612           0 :     SAL_CALL getInterface() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1613           0 :     { return manager_->resolve(entity_->getBase()); }
    1614             : 
    1615             :     rtl::Reference< cppuhelper::TypeManager > manager_;
    1616             :     rtl::OUString name_;
    1617             :     rtl::Reference< unoidl::InterfaceBasedSingletonEntity > entity_;
    1618             : };
    1619             : 
    1620             : typedef cppu::ImplInheritanceHelper1<
    1621             :     PublishableDescription, css::reflection::XSingletonTypeDescription2 >
    1622             : ServiceBasedSingletonDescription_Base;
    1623             : 
    1624             : class ServiceBasedSingletonDescription:
    1625             :     public ServiceBasedSingletonDescription_Base
    1626             : {
    1627             : public:
    1628           0 :     ServiceBasedSingletonDescription(
    1629             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
    1630             :         rtl::OUString const & name,
    1631             :         rtl::Reference< unoidl::ServiceBasedSingletonEntity > const & entity):
    1632           0 :         ServiceBasedSingletonDescription_Base(entity_->isPublished()),
    1633           0 :         manager_(manager), name_(name), entity_(entity)
    1634           0 :     { assert(manager.is()); assert(entity.is()); }
    1635             : 
    1636             : private:
    1637           0 :     virtual ~ServiceBasedSingletonDescription() {}
    1638             : 
    1639           0 :     virtual css::uno::TypeClass SAL_CALL getTypeClass()
    1640             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1641           0 :     { return css::uno::TypeClass_SINGLETON; }
    1642             : 
    1643           0 :     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1644           0 :     { return name_; }
    1645             : 
    1646             :     virtual css::uno::Reference< css::reflection::XServiceTypeDescription >
    1647           0 :     SAL_CALL getService() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1648             :     {
    1649             :         return css::uno::Reference< css::reflection::XServiceTypeDescription >(
    1650           0 :             manager_->resolve(entity_->getBase()), css::uno::UNO_QUERY_THROW);
    1651             :     }
    1652             : 
    1653           0 :     virtual sal_Bool SAL_CALL isInterfaceBased()
    1654             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1655           0 :     { return false; }
    1656             : 
    1657             :     virtual css::uno::Reference< css::reflection::XTypeDescription >
    1658           0 :     SAL_CALL getInterface() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1659           0 :     { return css::uno::Reference< css::reflection::XTypeDescription >(); }
    1660             : 
    1661             :     rtl::Reference< cppuhelper::TypeManager > manager_;
    1662             :     rtl::OUString name_;
    1663             :     rtl::Reference< unoidl::ServiceBasedSingletonEntity > entity_;
    1664             : };
    1665             : 
    1666             : class Enumeration:
    1667             :     public cppu::WeakImplHelper1< css::reflection::XTypeDescriptionEnumeration >
    1668             : {
    1669             : public:
    1670           4 :     Enumeration(
    1671             :         rtl::Reference< cppuhelper::TypeManager > const & manager,
    1672             :         rtl::OUString const & prefix,
    1673             :         rtl::Reference< unoidl::MapCursor > const & cursor,
    1674             :         css::uno::Sequence< css::uno::TypeClass > const & types, bool deep):
    1675           4 :         manager_(manager), types_(types), deep_(deep)
    1676             :     {
    1677             :         assert(manager.is());
    1678           4 :         positions_.push(Position(prefix, cursor));
    1679           4 :         findNextMatch();
    1680           4 :     }
    1681             : 
    1682             : private:
    1683           8 :     virtual ~Enumeration() {}
    1684             : 
    1685        3332 :     virtual sal_Bool SAL_CALL hasMoreElements()
    1686             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1687        3332 :     { return !positions_.empty(); }
    1688             : 
    1689        3328 :     virtual css::uno::Any SAL_CALL nextElement()
    1690             :         throw (
    1691             :             css::container::NoSuchElementException,
    1692             :             css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1693        3328 :     { return css::uno::makeAny(nextTypeDescription()); }
    1694             : 
    1695             :     virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
    1696             :     nextTypeDescription()
    1697             :         throw (
    1698             :             css::container::NoSuchElementException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1699             : 
    1700             :     bool matches(css::uno::TypeClass tc) const;
    1701             : 
    1702             :     void findNextMatch();
    1703             : 
    1704          80 :     struct Position {
    1705          40 :         Position(
    1706             :             rtl::OUString const & thePrefix,
    1707             :             rtl::Reference< unoidl::MapCursor > const & theCursor):
    1708          40 :             prefix(thePrefix), cursor(theCursor)
    1709          40 :         { assert(theCursor.is()); }
    1710             : 
    1711           0 :         Position(
    1712             :             rtl::OUString const & thePrefix,
    1713             :             rtl::Reference< unoidl::ConstantGroupEntity > const &
    1714             :                 theConstantGroup):
    1715             :             prefix(thePrefix), constantGroup(theConstantGroup),
    1716           0 :             constantGroupIndex(constantGroup->getMembers().begin())
    1717           0 :         { assert(theConstantGroup.is()); }
    1718             : 
    1719          40 :         Position(Position const & other):
    1720             :             prefix(other.prefix), cursor(other.cursor),
    1721          40 :             constantGroup(other.constantGroup)
    1722             :         {
    1723          40 :             if (constantGroup.is()) {
    1724           0 :                 constantGroupIndex = other.constantGroupIndex;
    1725             :             }
    1726          40 :         }
    1727             : 
    1728             :         rtl::OUString prefix;
    1729             :         rtl::Reference< unoidl::MapCursor > cursor;
    1730             :         rtl::Reference< unoidl::ConstantGroupEntity > constantGroup;
    1731             :         std::vector< unoidl::ConstantGroupEntity::Member >::const_iterator
    1732             :             constantGroupIndex;
    1733             :     };
    1734             : 
    1735             :     rtl::Reference< cppuhelper::TypeManager > manager_;
    1736             :     css::uno::Sequence< css::uno::TypeClass > types_;
    1737             :     bool deep_;
    1738             : 
    1739             :     osl::Mutex mutex_;
    1740             :     std::stack< Position > positions_;
    1741             :     rtl::OUString current_;
    1742             : };
    1743             : 
    1744             : css::uno::Reference< css::reflection::XTypeDescription >
    1745        3328 : Enumeration::nextTypeDescription()
    1746             :     throw (css::container::NoSuchElementException, css::uno::RuntimeException, std::exception)
    1747             : {
    1748        3328 :     rtl::OUString name;
    1749             :     {
    1750        3328 :         osl::MutexGuard g(mutex_);
    1751        3328 :         if (positions_.empty()) {
    1752             :             throw css::container::NoSuchElementException(
    1753             :                 "exhausted XTypeDescriptionEnumeration",
    1754           0 :                 static_cast< cppu::OWeakObject * >(this));
    1755             :         }
    1756        3328 :         name = current_;
    1757        3328 :         findNextMatch();
    1758             :     }
    1759        3328 :     return manager_->resolve(name);
    1760             : }
    1761             : 
    1762        7512 : bool Enumeration::matches(css::uno::TypeClass tc) const {
    1763        7512 :     if (types_.getLength() == 0) {
    1764           0 :         return true;
    1765             :     }
    1766       11696 :     for (sal_Int32 i = 0; i != types_.getLength(); ++i) {
    1767        7512 :         if (types_[i] == tc) {
    1768        3328 :             return true;
    1769             :         }
    1770             :     }
    1771        4184 :     return false;
    1772             : }
    1773             : 
    1774        4224 : void Enumeration::findNextMatch() {
    1775             :     try {
    1776             :         for (;;) {
    1777             :             assert(!positions_.empty());
    1778        4224 :             rtl::OUString name;
    1779        4224 :             if (positions_.top().cursor.is()) { // root or module
    1780             :                 rtl::Reference< unoidl::Entity > ent(
    1781        4224 :                     positions_.top().cursor->getNext(&name));
    1782        4224 :                 if (!ent.is()) {
    1783          40 :                     positions_.pop();
    1784          40 :                     if (positions_.empty()) {
    1785           4 :                         break;
    1786             :                     }
    1787          36 :                     continue;
    1788             :                 }
    1789        4184 :                 name = positions_.top().prefix + name;
    1790             :                 css::uno::TypeClass tc;
    1791        4184 :                 switch (ent->getSort()) {
    1792             :                 case unoidl::Entity::SORT_MODULE:
    1793          36 :                     tc = css::uno::TypeClass_MODULE;
    1794          36 :                     if (deep_) {
    1795             :                         positions_.push(
    1796             :                             Position(
    1797             :                                 makePrefix(name),
    1798             :                                 static_cast< unoidl::ModuleEntity * >(
    1799          36 :                                     ent.get())->createCursor()));
    1800             :                     }
    1801          36 :                     break;
    1802             :                 case unoidl::Entity::SORT_ENUM_TYPE:
    1803           0 :                     tc = css::uno::TypeClass_ENUM;
    1804           0 :                     break;
    1805             :                 case unoidl::Entity::SORT_PLAIN_STRUCT_TYPE:
    1806             :                 case unoidl::Entity::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE:
    1807           0 :                     tc = css::uno::TypeClass_STRUCT;
    1808           0 :                     break;
    1809             :                 case unoidl::Entity::SORT_EXCEPTION_TYPE:
    1810           0 :                     tc = css::uno::TypeClass_EXCEPTION;
    1811           0 :                     break;
    1812             :                 case unoidl::Entity::SORT_INTERFACE_TYPE:
    1813         780 :                     tc = css::uno::TypeClass_INTERFACE;
    1814         780 :                     break;
    1815             :                 case unoidl::Entity::SORT_TYPEDEF:
    1816           0 :                     tc = css::uno::TypeClass_TYPEDEF;
    1817           0 :                     break;
    1818             :                 case unoidl::Entity::SORT_CONSTANT_GROUP:
    1819        3328 :                     tc = css::uno::TypeClass_CONSTANTS;
    1820        3328 :                     if (deep_ && matches(css::uno::TypeClass_CONSTANT)) {
    1821             :                         positions_.push(
    1822             :                             Position(
    1823             :                                 makePrefix(name),
    1824             :                                 static_cast< unoidl::ConstantGroupEntity * >(
    1825           0 :                                     ent.get())));
    1826             :                     }
    1827        3328 :                     break;
    1828             :                 case unoidl::Entity::SORT_SINGLE_INTERFACE_BASED_SERVICE:
    1829             :                 case unoidl::Entity::SORT_ACCUMULATION_BASED_SERVICE:
    1830          40 :                     tc = css::uno::TypeClass_SERVICE;
    1831          40 :                     break;
    1832             :                 case unoidl::Entity::SORT_INTERFACE_BASED_SINGLETON:
    1833             :                 case unoidl::Entity::SORT_SERVICE_BASED_SINGLETON:
    1834           0 :                     tc = css::uno::TypeClass_SINGLETON;
    1835           0 :                     break;
    1836             :                 default:
    1837           0 :                     for (;;) { std::abort(); } // this cannot happen
    1838             :                 }
    1839        4184 :                 if (matches(tc)) {
    1840        3328 :                     current_ = name;
    1841        3328 :                     break;
    1842         856 :                 }
    1843             :             } else { // constant group
    1844           0 :                 if (positions_.top().constantGroupIndex
    1845           0 :                     == positions_.top().constantGroup->getMembers().end())
    1846             :                 {
    1847           0 :                     positions_.pop();
    1848           0 :                     if (positions_.empty()) {
    1849           0 :                         break;
    1850             :                     }
    1851           0 :                     continue;
    1852             :                 }
    1853           0 :                 current_ = positions_.top().prefix
    1854           0 :                     + positions_.top().constantGroupIndex++->name;
    1855           0 :                 break;
    1856             :             }
    1857        1748 :         }
    1858           0 :     } catch (unoidl::FileFormatException & e) {
    1859             :         throw css::uno::DeploymentException(
    1860           0 :             e.getUri() + ": " + e.getDetail(),
    1861           0 :             static_cast< cppu::OWeakObject * >(this));
    1862             :     }
    1863        3332 : }
    1864             : 
    1865             : }
    1866             : 
    1867         664 : cppuhelper::TypeManager::TypeManager():
    1868             :     TypeManager_Base(m_aMutex),
    1869         664 :     manager_(new unoidl::Manager)
    1870         664 : {}
    1871             : 
    1872         664 : void cppuhelper::TypeManager::init(rtl::OUString const & rdbUris) {
    1873         664 :     readRdbs(rdbUris);
    1874         664 : }
    1875             : 
    1876     1067616 : css::uno::Any cppuhelper::TypeManager::find(rtl::OUString const & name) {
    1877             :     //TODO: caching? (here or in unoidl::Manager?)
    1878             :     struct Simple {
    1879             :         char const * name; sal_Int32 length;
    1880             :         css::uno::TypeClass typeClass;
    1881             :     };
    1882             :     static Simple const simple[] = {
    1883             :         { RTL_CONSTASCII_STRINGPARAM("void"), css::uno::TypeClass_VOID },
    1884             :         { RTL_CONSTASCII_STRINGPARAM("boolean"), css::uno::TypeClass_BOOLEAN },
    1885             :         { RTL_CONSTASCII_STRINGPARAM("byte"), css::uno::TypeClass_BYTE },
    1886             :         { RTL_CONSTASCII_STRINGPARAM("short"), css::uno::TypeClass_SHORT },
    1887             :         { RTL_CONSTASCII_STRINGPARAM("unsigned short"),
    1888             :           css::uno::TypeClass_UNSIGNED_SHORT },
    1889             :         { RTL_CONSTASCII_STRINGPARAM("long"), css::uno::TypeClass_LONG },
    1890             :         { RTL_CONSTASCII_STRINGPARAM("unsigned long"),
    1891             :           css::uno::TypeClass_UNSIGNED_LONG },
    1892             :         { RTL_CONSTASCII_STRINGPARAM("hyper"), css::uno::TypeClass_HYPER },
    1893             :         { RTL_CONSTASCII_STRINGPARAM("unsigned hyper"),
    1894             :           css::uno::TypeClass_UNSIGNED_HYPER },
    1895             :         { RTL_CONSTASCII_STRINGPARAM("float"), css::uno::TypeClass_FLOAT },
    1896             :         { RTL_CONSTASCII_STRINGPARAM("double"), css::uno::TypeClass_DOUBLE },
    1897             :         { RTL_CONSTASCII_STRINGPARAM("char"), css::uno::TypeClass_CHAR },
    1898             :         { RTL_CONSTASCII_STRINGPARAM("string"), css::uno::TypeClass_STRING },
    1899             :         { RTL_CONSTASCII_STRINGPARAM("type"), css::uno::TypeClass_TYPE },
    1900             :         { RTL_CONSTASCII_STRINGPARAM("any"), css::uno::TypeClass_ANY } };
    1901    16088109 :     for (std::size_t i = 0; i != SAL_N_ELEMENTS(simple); ++i) {
    1902    15145077 :         if (name.equalsAsciiL(simple[i].name, simple[i].length)) {
    1903             :             return css::uno::makeAny<
    1904             :                 css::uno::Reference< css::reflection::XTypeDescription > >(
    1905      124584 :                     new SimpleTypeDescription(simple[i].typeClass, name));
    1906             :         }
    1907             :     }
    1908      943032 :     if (name.startsWith("[]")) {
    1909        8824 :         return getSequenceType(name);
    1910             :     }
    1911      934208 :     sal_Int32 i = name.indexOf('<');
    1912      934208 :     if (i != -1) {
    1913         394 :         return getInstantiatedStruct(name, i);
    1914             :     }
    1915      933814 :     i = name.indexOf("::");
    1916      933814 :     if (i != -1) {
    1917       42824 :         return getInterfaceMember(name, i);
    1918             :     }
    1919      890990 :     rtl::Reference< unoidl::Entity > ent(findEntity(name));
    1920      890990 :     if (ent.is()) {
    1921      889826 :         return getNamed(name, ent);
    1922             :     }
    1923        1164 :     i = name.lastIndexOf('.');
    1924        1164 :     if (i != -1) {
    1925         956 :         rtl::OUString parent(name.copy(0, i));
    1926         956 :         ent = findEntity(parent);
    1927         956 :         if (ent.is()) {
    1928         406 :             switch (ent->getSort()) {
    1929             :             case unoidl::Entity::SORT_ENUM_TYPE:
    1930             :                 return getEnumMember(
    1931          18 :                     static_cast< unoidl::EnumTypeEntity * >(ent.get()),
    1932          36 :                     name.copy(i + 1));
    1933             :             case unoidl::Entity::SORT_CONSTANT_GROUP:
    1934             :                 return getConstant(
    1935             :                     parent,
    1936         114 :                     static_cast< unoidl::ConstantGroupEntity * >(ent.get()),
    1937         228 :                     name.copy(i + 1));
    1938             :             default:
    1939         274 :                 break;
    1940             :             }
    1941         824 :         }
    1942             :     }
    1943        1032 :     return css::uno::Any();
    1944             : }
    1945             : 
    1946             : css::uno::Reference< css::reflection::XTypeDescription >
    1947      905654 : cppuhelper::TypeManager::resolve(rtl::OUString const & name) {
    1948             :     css::uno::Reference< css::reflection::XTypeDescription > desc(
    1949      905654 :         find(name), css::uno::UNO_QUERY);
    1950      905654 :     if (!desc.is()) {
    1951             :         throw css::uno::DeploymentException(
    1952           0 :             "cannot resolve type \"" + name + "\"",
    1953           0 :             static_cast< cppu::OWeakObject * >(this));
    1954             :     }
    1955      905654 :     return desc;
    1956             : }
    1957             : 
    1958        1206 : cppuhelper::TypeManager::~TypeManager() throw () {}
    1959             : 
    1960         658 : void cppuhelper::TypeManager::disposing() {} //TODO
    1961             : 
    1962           0 : rtl::OUString cppuhelper::TypeManager::getImplementationName()
    1963             :     throw (css::uno::RuntimeException, std::exception)
    1964             : {
    1965             :     return rtl::OUString(
    1966           0 :         "com.sun.star.comp.cppuhelper.bootstrap.TypeManager");
    1967             : }
    1968             : 
    1969           0 : sal_Bool cppuhelper::TypeManager::supportsService(
    1970             :     rtl::OUString const & ServiceName)
    1971             :     throw (css::uno::RuntimeException, std::exception)
    1972             : {
    1973           0 :     return cppu::supportsService(this, ServiceName);
    1974             : }
    1975             : 
    1976             : css::uno::Sequence< rtl::OUString >
    1977           0 : cppuhelper::TypeManager::getSupportedServiceNames()
    1978             :     throw (css::uno::RuntimeException, std::exception)
    1979             : {
    1980           0 :     css::uno::Sequence< rtl::OUString > names(1);
    1981           0 :     names[0] = "com.sun.star.reflection.TypeDescriptionManager"; //TODO
    1982           0 :     return names;
    1983             : }
    1984             : 
    1985      116934 : css::uno::Any cppuhelper::TypeManager::getByHierarchicalName(
    1986             :     rtl::OUString const & aName)
    1987             :     throw (css::container::NoSuchElementException, css::uno::RuntimeException, std::exception)
    1988             : {
    1989      116934 :     css::uno::Any desc(find(aName));
    1990      116934 :     if (!desc.hasValue()) {
    1991             :         throw css::container::NoSuchElementException(
    1992           6 :             aName, static_cast< cppu::OWeakObject * >(this));
    1993             :     }
    1994      116928 :     return desc;
    1995             : }
    1996             : 
    1997        2204 : sal_Bool cppuhelper::TypeManager::hasByHierarchicalName(
    1998             :     rtl::OUString const & aName)
    1999             :     throw (css::uno::RuntimeException, std::exception)
    2000             : {
    2001        2204 :     return find(aName).hasValue();
    2002             : }
    2003             : 
    2004           0 : css::uno::Type cppuhelper::TypeManager::getElementType()
    2005             :     throw (css::uno::RuntimeException, std::exception)
    2006             : {
    2007           0 :     return cppu::UnoType< rtl::OUString >::get();
    2008             : }
    2009             : 
    2010           0 : sal_Bool cppuhelper::TypeManager::hasElements()
    2011             :     throw (css::uno::RuntimeException, std::exception)
    2012             : {
    2013             :     throw css::uno::RuntimeException(
    2014             :         "TypeManager hasElements: method not supported",
    2015           0 :         static_cast< cppu::OWeakObject * >(this));
    2016             : }
    2017             : 
    2018             : css::uno::Reference< css::container::XEnumeration >
    2019           0 : cppuhelper::TypeManager::createEnumeration()
    2020             :     throw (css::uno::RuntimeException, std::exception)
    2021             : {
    2022             :     throw css::uno::RuntimeException(
    2023             :         "TypeManager createEnumeration: method not supported",
    2024           0 :         static_cast< cppu::OWeakObject * >(this));
    2025             : }
    2026             : 
    2027           0 : sal_Bool cppuhelper::TypeManager::has(css::uno::Any const &)
    2028             :     throw (css::uno::RuntimeException, std::exception)
    2029             : {
    2030             :     throw css::uno::RuntimeException(
    2031             :         "TypeManager has: method not supported",
    2032           0 :         static_cast< cppu::OWeakObject * >(this));
    2033             : }
    2034             : 
    2035           0 : void cppuhelper::TypeManager::insert(css::uno::Any const & aElement)
    2036             :     throw (
    2037             :         css::lang::IllegalArgumentException,
    2038             :         css::container::ElementExistException, css::uno::RuntimeException, std::exception)
    2039             : {
    2040           0 :     rtl::OUString uri;
    2041           0 :     if (!(aElement >>= uri)) {
    2042             :         throw css::lang::IllegalArgumentException(
    2043             :             ("css.uno.theTypeDescriptionManager.insert expects a string URI"
    2044             :              " argument"),
    2045           0 :             static_cast< cppu::OWeakObject * >(this), 0);
    2046             :     }
    2047             :     //TODO: check for ElementExistException
    2048             :     //TODO: check for consistency with existing data
    2049           0 :     readRdbFile(uri, false);
    2050           0 : }
    2051             : 
    2052           0 : void cppuhelper::TypeManager::remove(css::uno::Any const & aElement)
    2053             :     throw (
    2054             :         css::lang::IllegalArgumentException,
    2055             :         css::container::NoSuchElementException, css::uno::RuntimeException, std::exception)
    2056             : {
    2057           0 :     rtl::OUString uri;
    2058           0 :     if (!(aElement >>= uri)) {
    2059             :         throw css::lang::IllegalArgumentException(
    2060             :             ("css.uno.theTypeDescriptionManager.remove expects a string URI"
    2061             :              " argument"),
    2062           0 :             static_cast< cppu::OWeakObject * >(this), 0);
    2063           0 :     }
    2064             :     //TODO: remove requests are silently ignored for now
    2065           0 : }
    2066             : 
    2067             : css::uno::Reference< css::reflection::XTypeDescriptionEnumeration >
    2068           4 : cppuhelper::TypeManager::createTypeDescriptionEnumeration(
    2069             :     rtl::OUString const & moduleName,
    2070             :     css::uno::Sequence< css::uno::TypeClass > const & types,
    2071             :     css::reflection::TypeDescriptionSearchDepth depth)
    2072             :     throw (
    2073             :         css::reflection::NoSuchTypeNameException,
    2074             :         css::reflection::InvalidTypeNameException,
    2075             :         css::uno::RuntimeException, std::exception)
    2076             : {
    2077           4 :     rtl::Reference< unoidl::MapCursor > cursor;
    2078             :     try {
    2079           4 :         cursor = manager_->createCursor(moduleName);
    2080           0 :     } catch (unoidl::FileFormatException & e) {
    2081             :         throw css::uno::DeploymentException(
    2082           0 :             ("unoidl::FileFormatException for <" + e.getUri() + ">: "
    2083           0 :              + e.getDetail()),
    2084           0 :             static_cast< cppu::OWeakObject * >(this));
    2085             :     }
    2086           4 :     if (!cursor.is()) {
    2087             :         //TODO: css::reflection::InvalidTypeNameException if moduleName names a
    2088             :         // non-module
    2089             :         throw css::reflection::NoSuchTypeNameException(
    2090           0 :             moduleName, static_cast< cppu::OWeakObject * >(this));
    2091             :     }
    2092             :     return new Enumeration(
    2093             :         this, makePrefix(moduleName), cursor, types,
    2094           4 :         depth == css::reflection::TypeDescriptionSearchDepth_INFINITE);
    2095             : }
    2096             : 
    2097         664 : void cppuhelper::TypeManager::readRdbs(rtl::OUString const & uris) {
    2098        3202 :     for (sal_Int32 i = 0; i != -1;) {
    2099        1874 :         rtl::OUString uri(uris.getToken(0, ' ', i));
    2100        1874 :         if (uri.isEmpty()) {
    2101         763 :             continue;
    2102             :         }
    2103             :         bool optional;
    2104             :         bool directory;
    2105        1111 :         cppu::decodeRdbUri(&uri, &optional, &directory);
    2106        1111 :         if (directory) {
    2107         166 :             readRdbDirectory(uri, optional);
    2108             :         } else {
    2109         945 :             readRdbFile(uri, optional);
    2110             :         }
    2111        1111 :     }
    2112         664 : }
    2113             : 
    2114         166 : void cppuhelper::TypeManager::readRdbDirectory(
    2115             :     rtl::OUString const & uri, bool optional)
    2116             : {
    2117         166 :     osl::Directory dir(uri);
    2118         166 :     switch (dir.open()) {
    2119             :     case osl::FileBase::E_None:
    2120         166 :         break;
    2121             :     case osl::FileBase::E_NOENT:
    2122           0 :         if (optional) {
    2123             :             SAL_INFO("cppuhelper", "Ignored optional " << uri);
    2124         166 :             return;
    2125             :         }
    2126             :         // fall through
    2127             :     default:
    2128             :         throw css::uno::DeploymentException(
    2129           0 :             "Cannot open directory " + uri,
    2130           0 :             static_cast< cppu::OWeakObject * >(this));
    2131             :     }
    2132             :     for (;;) {
    2133         498 :         rtl::OUString url;
    2134         498 :         if (!cppu::nextDirectoryItem(dir, &url)) {
    2135         166 :             break;
    2136             :         }
    2137         332 :         readRdbFile(url, false);
    2138         332 :     }
    2139             : }
    2140             : 
    2141        1277 : void cppuhelper::TypeManager::readRdbFile(
    2142             :     rtl::OUString const & uri, bool optional)
    2143             : {
    2144             :     try {
    2145        1277 :         manager_->addProvider(uri);
    2146           0 :     } catch (unoidl::NoSuchFileException &) {
    2147           0 :         if (!optional) {
    2148             :             throw css::uno::DeploymentException(
    2149           0 :                 uri + ": no such file",
    2150           0 :                 static_cast< cppu::OWeakObject * >(this));
    2151             :         }
    2152             :         SAL_INFO("cppuhelper", "Ignored optional " << uri);
    2153           0 :     } catch (unoidl::FileFormatException & e) {
    2154             :             throw css::uno::DeploymentException(
    2155           0 :                 ("unoidl::FileFormatException for <" + e.getUri() + ">: "
    2156           0 :                  + e.getDetail()),
    2157           0 :                 static_cast< cppu::OWeakObject * >(this));
    2158             :     }
    2159        1277 : }
    2160             : 
    2161        8824 : css::uno::Any cppuhelper::TypeManager::getSequenceType(
    2162             :     rtl::OUString const & name)
    2163             : {
    2164             :     assert(name.startsWith("[]"));
    2165             :     return css::uno::makeAny<
    2166             :         css::uno::Reference< css::reflection::XTypeDescription > >(
    2167             :             new SequenceTypeDescription(
    2168        8824 :                 this, name, name.copy(std::strlen("[]"))));
    2169             : }
    2170             : 
    2171         394 : css::uno::Any cppuhelper::TypeManager::getInstantiatedStruct(
    2172             :     rtl::OUString const & name, sal_Int32 separator)
    2173             : {
    2174             :     assert(name.indexOf('<') == separator && separator != -1);
    2175         394 :     rtl::Reference< unoidl::Entity > ent(findEntity(name.copy(0, separator)));
    2176         788 :     if (!ent.is()
    2177         394 :         || (ent->getSort()
    2178             :             != unoidl::Entity::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE))
    2179             :     {
    2180           0 :         return css::uno::Any();
    2181             :     }
    2182             :     rtl::Reference< unoidl::PolymorphicStructTypeTemplateEntity > ent2(
    2183             :         static_cast< unoidl::PolymorphicStructTypeTemplateEntity * >(
    2184         788 :             ent.get()));
    2185         788 :     std::vector< rtl::OUString > args;
    2186         394 :     sal_Int32 i = separator;
    2187         492 :     do {
    2188         492 :         ++i; // skip '<' or ','
    2189         492 :         sal_Int32 j = i;
    2190        5112 :         for (sal_Int32 level = 0; j != name.getLength(); ++j) {
    2191        5112 :             sal_Unicode c = name[j];
    2192        5112 :             if (c == ',') {
    2193         116 :                 if (level == 0) {
    2194          98 :                     break;
    2195             :                 }
    2196        4996 :             } else if (c == '<') {
    2197          32 :                 ++level;
    2198        4964 :             } else if (c == '>') {
    2199         426 :                 if (level == 0) {
    2200         394 :                     break;
    2201             :                 }
    2202          32 :                 --level;
    2203             :             }
    2204             :         }
    2205         492 :         if (j != name.getLength()) {
    2206         492 :             args.push_back(name.copy(i, j - i));
    2207             :         }
    2208         492 :         i = j;
    2209         492 :     } while (i != name.getLength() && name[i] != '>');
    2210        1182 :     if (i != name.getLength() - 1 || name[i] != '>'
    2211         788 :         || args.size() != ent2->getTypeParameters().size())
    2212             :     {
    2213           0 :         return css::uno::Any();
    2214             :     }
    2215             :     return css::uno::makeAny<
    2216             :         css::uno::Reference< css::reflection::XTypeDescription > >(
    2217             :             new InstantiatedPolymorphicStructTypeDescription(
    2218         788 :                 this, name, ent2, args));
    2219             : }
    2220             : 
    2221       42824 : css::uno::Any cppuhelper::TypeManager::getInterfaceMember(
    2222             :     rtl::OUString const & name, sal_Int32 separator)
    2223             : {
    2224             :     assert(name.indexOf("::") == separator && separator != -1);
    2225             :     css::uno::Reference< css::reflection::XInterfaceTypeDescription2 > ifc(
    2226       42824 :         resolveTypedefs(find(name.copy(0, separator))), css::uno::UNO_QUERY);
    2227       42824 :     if (!ifc.is()) {
    2228           0 :         return css::uno::Any();
    2229             :     }
    2230       85648 :     rtl::OUString member(name.copy(separator + std::strlen("::")));
    2231             :     css::uno::Sequence<
    2232             :         css::uno::Reference<
    2233             :             css::reflection::XInterfaceMemberTypeDescription > > mems(
    2234       85648 :                 ifc->getMembers());
    2235      240744 :     for (sal_Int32 i = 0; i != mems.getLength(); ++i) {
    2236      240744 :         if (mems[i]->getMemberName() == member) {
    2237             :             return css::uno::makeAny<
    2238             :                 css::uno::Reference< css::reflection::XTypeDescription > >(
    2239       42824 :                     mems[i]);
    2240             :         }
    2241             :     }
    2242       42824 :     return css::uno::Any();
    2243             : }
    2244             : 
    2245      889826 : css::uno::Any cppuhelper::TypeManager::getNamed(
    2246             :     rtl::OUString const & name, rtl::Reference< unoidl::Entity > const & entity)
    2247             : {
    2248             :     assert(entity.is());
    2249      889826 :     switch (entity->getSort()) {
    2250             :     case unoidl::Entity::SORT_MODULE:
    2251             :         return css::uno::makeAny<
    2252             :             css::uno::Reference< css::reflection::XTypeDescription > >(
    2253             :                 new ModuleDescription(
    2254             :                     this, name,
    2255          56 :                     static_cast< unoidl::ModuleEntity * >(entity.get())));
    2256             :     case unoidl::Entity::SORT_ENUM_TYPE:
    2257             :         return css::uno::makeAny<
    2258             :             css::uno::Reference< css::reflection::XTypeDescription > >(
    2259             :                 new EnumTypeDescription(
    2260             :                     name,
    2261        3319 :                     static_cast< unoidl::EnumTypeEntity * >(entity.get())));
    2262             :     case unoidl::Entity::SORT_PLAIN_STRUCT_TYPE:
    2263             :         return css::uno::makeAny<
    2264             :             css::uno::Reference< css::reflection::XTypeDescription > >(
    2265             :                 new PlainStructTypeDescription(
    2266             :                     this, name,
    2267             :                     static_cast< unoidl::PlainStructTypeEntity * >(
    2268       12880 :                         entity.get())));
    2269             :     case unoidl::Entity::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE:
    2270             :         return css::uno::makeAny<
    2271             :             css::uno::Reference< css::reflection::XTypeDescription > >(
    2272             :                 new PolymorphicStructTypeTemplateDescription(
    2273             :                     this, name,
    2274             :                     static_cast<
    2275             :                         unoidl::PolymorphicStructTypeTemplateEntity * >(
    2276         330 :                             entity.get())));
    2277             :     case unoidl::Entity::SORT_EXCEPTION_TYPE:
    2278             :         return css::uno::makeAny<
    2279             :             css::uno::Reference< css::reflection::XTypeDescription > >(
    2280             :                 new ExceptionTypeDescription(
    2281             :                     this, name,
    2282             :                     static_cast< unoidl::ExceptionTypeEntity * >(
    2283       25047 :                         entity.get())));
    2284             :     case unoidl::Entity::SORT_INTERFACE_TYPE:
    2285             :         return css::uno::makeAny<
    2286             :             css::uno::Reference< css::reflection::XTypeDescription > >(
    2287             :                 new InterfaceTypeDescription(
    2288             :                     this, name,
    2289             :                     static_cast< unoidl::InterfaceTypeEntity * >(
    2290      840342 :                         entity.get())));
    2291             :     case unoidl::Entity::SORT_TYPEDEF:
    2292             :         return css::uno::makeAny<
    2293             :             css::uno::Reference< css::reflection::XTypeDescription > >(
    2294             :                 new TypedefDescription(
    2295             :                     this, name,
    2296        2140 :                     static_cast< unoidl::TypedefEntity * >(entity.get())));
    2297             :     case unoidl::Entity::SORT_CONSTANT_GROUP:
    2298             :         return css::uno::makeAny<
    2299             :             css::uno::Reference< css::reflection::XTypeDescription > >(
    2300             :                 new ConstantGroupDescription(
    2301             :                     name,
    2302             :                     static_cast< unoidl::ConstantGroupEntity * >(
    2303        3392 :                         entity.get())));
    2304             :     case unoidl::Entity::SORT_SINGLE_INTERFACE_BASED_SERVICE:
    2305             :         return css::uno::makeAny<
    2306             :             css::uno::Reference< css::reflection::XTypeDescription > >(
    2307             :                 new SingleInterfaceBasedServiceDescription(
    2308             :                     this, name,
    2309             :                     static_cast< unoidl::SingleInterfaceBasedServiceEntity * >(
    2310        1220 :                         entity.get())));
    2311             :     case unoidl::Entity::SORT_ACCUMULATION_BASED_SERVICE:
    2312             :         return css::uno::makeAny<
    2313             :             css::uno::Reference< css::reflection::XTypeDescription > >(
    2314             :                 new AccumulationBasedServiceDescription(
    2315             :                     this, name,
    2316             :                     static_cast< unoidl::AccumulationBasedServiceEntity * >(
    2317        1100 :                         entity.get())));
    2318             :     case unoidl::Entity::SORT_INTERFACE_BASED_SINGLETON:
    2319             :         return css::uno::makeAny<
    2320             :             css::uno::Reference< css::reflection::XTypeDescription > >(
    2321             :                 new InterfaceBasedSingletonDescription(
    2322             :                     this, name,
    2323             :                     static_cast< unoidl::InterfaceBasedSingletonEntity * >(
    2324           0 :                         entity.get())));
    2325             :     case unoidl::Entity::SORT_SERVICE_BASED_SINGLETON:
    2326             :         return css::uno::makeAny<
    2327             :             css::uno::Reference< css::reflection::XTypeDescription > >(
    2328             :                 new ServiceBasedSingletonDescription(
    2329             :                     this, name,
    2330             :                     static_cast< unoidl::ServiceBasedSingletonEntity * >(
    2331           0 :                         entity.get())));
    2332             :     default:
    2333           0 :         for (;;) { std::abort(); } // this cannot happen
    2334             :     }
    2335             : }
    2336             : 
    2337          18 : css::uno::Any cppuhelper::TypeManager::getEnumMember(
    2338             :     rtl::Reference< unoidl::EnumTypeEntity > const & entity,
    2339             :     rtl::OUString const & member)
    2340             : {
    2341         108 :     for (std::vector< unoidl::EnumTypeEntity::Member >::const_iterator i(
    2342          18 :              entity->getMembers().begin());
    2343          72 :          i != entity->getMembers().end(); ++i)
    2344             :     {
    2345          36 :         if (i->name == member) {
    2346          18 :             return css::uno::makeAny(i->value);
    2347             :         }
    2348             :     }
    2349           0 :     return css::uno::Any();
    2350             : }
    2351             : 
    2352         114 : css::uno::Any cppuhelper::TypeManager::getConstant(
    2353             :     rtl::OUString const & constantGroupName,
    2354             :     rtl::Reference< unoidl::ConstantGroupEntity > const & entity,
    2355             :     rtl::OUString const & member)
    2356             : {
    2357        1734 :     for (std::vector< unoidl::ConstantGroupEntity::Member >::const_iterator i(
    2358         114 :              entity->getMembers().begin());
    2359        1156 :          i != entity->getMembers().end(); ++i)
    2360             :     {
    2361         578 :         if (i->name == member) {
    2362             :             return css::uno::makeAny<
    2363             :                 css::uno::Reference< css::reflection::XTypeDescription > >(
    2364         114 :                     new ConstantDescription(constantGroupName, *i));
    2365             :         }
    2366             :     }
    2367           0 :     return css::uno::Any();
    2368             : }
    2369             : 
    2370      892340 : rtl::Reference< unoidl::Entity > cppuhelper::TypeManager::findEntity(
    2371             :     rtl::OUString const & name)
    2372             : {
    2373             :     try {
    2374      892340 :         return manager_->findEntity(name);
    2375           0 :     } catch (unoidl::FileFormatException & e) {
    2376             :         throw css::uno::DeploymentException(
    2377           0 :             ("unoidl::FileFormatException for <" + e.getUri() + ">: "
    2378           0 :              + e.getDetail()),
    2379           0 :             static_cast< cppu::OWeakObject * >(this));
    2380             :     }
    2381             : }
    2382             : 
    2383             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10