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

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

Generated by: LCOV version 1.10