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

Generated by: LCOV version 1.11